BUILD: Fixed linker errors.
This commit is contained in:
parent
3b8c5cf935
commit
c28daeace7
|
@ -4,7 +4,8 @@
|
||||||
* Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
|
* Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
|
||||||
* Economic rights: Technische Universitaet Dresden (Germany)
|
* Economic rights: Technische Universitaet Dresden (Germany)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Udo Steinberg, Intel Corporation.
|
* Copyright (C) 2012-2013 Udo Steinberg, Intel Corporation.
|
||||||
|
* Copyright (C) 2019-2025 Udo Steinberg, BlueRock Security, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of the NOVA microhypervisor.
|
* This file is part of the NOVA microhypervisor.
|
||||||
*
|
*
|
||||||
|
@ -42,10 +43,7 @@ extern char OFFSET;
|
||||||
extern mword FIXUP_S;
|
extern mword FIXUP_S;
|
||||||
extern mword FIXUP_E;
|
extern mword FIXUP_E;
|
||||||
|
|
||||||
extern void (*CTORS_L)();
|
extern void (*CTORS_S[])(), (*CTORS_E[])(), (*CTORS_C[])(), (*CTORS_L[])();
|
||||||
extern void (*CTORS_C)();
|
|
||||||
extern void (*CTORS_G)();
|
|
||||||
extern void (*CTORS_E)();
|
|
||||||
|
|
||||||
extern char entry_sysenter;
|
extern char entry_sysenter;
|
||||||
extern char entry_vmx;
|
extern char entry_vmx;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
* Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
|
* Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
|
||||||
* Economic rights: Technische Universitaet Dresden (Germany)
|
* Economic rights: Technische Universitaet Dresden (Germany)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Udo Steinberg, Intel Corporation.
|
* Copyright (C) 2012-2013 Udo Steinberg, Intel Corporation.
|
||||||
|
* Copyright (C) 2019-2025 Udo Steinberg, BlueRock Security, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of the NOVA microhypervisor.
|
* This file is part of the NOVA microhypervisor.
|
||||||
*
|
*
|
||||||
|
@ -20,10 +21,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define AFTER(X) (X + 1)
|
// Lower numbers indicate a higher priority
|
||||||
|
#define AFTER(X) ((X) + 1)
|
||||||
|
|
||||||
#define PRIO_GLOBAL 100
|
#define PRIO_LIMIT 100
|
||||||
#define PRIO_BUDDY AFTER (PRIO_GLOBAL)
|
#define PRIO_BUDDY AFTER (PRIO_LIMIT)
|
||||||
#define PRIO_SLAB AFTER (PRIO_BUDDY)
|
#define PRIO_SLAB AFTER (PRIO_BUDDY)
|
||||||
#define PRIO_CONSOLE 0xfffd
|
#define PRIO_CONSOLE 65533
|
||||||
#define PRIO_LOCAL 0xfffe
|
#define PRIO_LOCAL 65534
|
||||||
|
|
|
@ -184,7 +184,7 @@ void Cpu::setup_pcid()
|
||||||
|
|
||||||
void Cpu::init()
|
void Cpu::init()
|
||||||
{
|
{
|
||||||
for (void (**func)() = &CTORS_L; func != &CTORS_C; (*func++)()) ;
|
for (auto func { CTORS_L }; func != CTORS_C; (*func++)()) ;
|
||||||
|
|
||||||
Gdt::build();
|
Gdt::build();
|
||||||
Tss::build();
|
Tss::build();
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
* Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
|
* Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
|
||||||
* Economic rights: Technische Universitaet Dresden (Germany)
|
* Economic rights: Technische Universitaet Dresden (Germany)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Udo Steinberg, Intel Corporation.
|
* Copyright (C) 2012-2013 Udo Steinberg, Intel Corporation.
|
||||||
|
* Copyright (C) 2019-2025 Udo Steinberg, BlueRock Security, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of the NOVA microhypervisor.
|
* This file is part of the NOVA microhypervisor.
|
||||||
*
|
*
|
||||||
|
@ -31,29 +32,31 @@ ENTRY(__start_bsp)
|
||||||
|
|
||||||
PHDRS
|
PHDRS
|
||||||
{
|
{
|
||||||
init PT_LOAD;
|
init PT_LOAD FLAGS (6);
|
||||||
kern PT_LOAD;
|
kern PT_LOAD FLAGS (6);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
.init LOAD_ADDR :
|
. = LOAD_ADDR;
|
||||||
|
|
||||||
|
.init :
|
||||||
{
|
{
|
||||||
*(.init)
|
*(.init)
|
||||||
*(.initdata)
|
*(.initdata)
|
||||||
} : init = 0x90909090
|
} : init
|
||||||
|
|
||||||
. = ALIGN(4K) + 4K; PROVIDE (STACK = .);
|
. = ALIGN(4K) + 4K; PROVIDE_HIDDEN (STACK = .);
|
||||||
|
|
||||||
PROVIDE (LOAD_E = .);
|
PROVIDE_HIDDEN (LOAD_E = .);
|
||||||
OFFSET = LINK_ADDR - ALIGN (4M);
|
OFFSET = LINK_ADDR - ALIGN (4M);
|
||||||
PROVIDE (LINK_P = LINK_ADDR - OFFSET);
|
PROVIDE_HIDDEN (LINK_P = LINK_ADDR - OFFSET);
|
||||||
|
|
||||||
.text LINK_ADDR : AT (ADDR (.text) - OFFSET)
|
.text LINK_ADDR : AT (ADDR (.text) - OFFSET)
|
||||||
{
|
{
|
||||||
*(.text.hot .text.hot.*)
|
*(.text.hot .text.hot.*)
|
||||||
*(.text .text.* .gnu.linkonce.t.*)
|
*(.text .text.* .gnu.linkonce.t.*)
|
||||||
} : kern = 0x90909090
|
} : kern
|
||||||
|
|
||||||
.rodata : AT (ADDR (.rodata) - OFFSET)
|
.rodata : AT (ADDR (.rodata) - OFFSET)
|
||||||
{
|
{
|
||||||
|
@ -62,21 +65,25 @@ SECTIONS
|
||||||
|
|
||||||
.fixup : AT (ADDR (.fixup) - OFFSET)
|
.fixup : AT (ADDR (.fixup) - OFFSET)
|
||||||
{
|
{
|
||||||
PROVIDE (FIXUP_S = .);
|
PROVIDE_HIDDEN (FIXUP_S = .);
|
||||||
KEEP (*(.fixup))
|
KEEP (*(.fixup))
|
||||||
PROVIDE (FIXUP_E = .);
|
PROVIDE_HIDDEN (FIXUP_E = .);
|
||||||
} : kern
|
} : kern
|
||||||
|
|
||||||
.init_array : AT (ADDR (.init_array) - OFFSET)
|
.init_array : AT (ADDR (.init_array) - OFFSET)
|
||||||
{
|
{
|
||||||
PROVIDE (CTORS_L = .);
|
/*
|
||||||
KEEP (SORT_BY_INIT_PRIORITY(*)(.init_array.65534 .ctors.00001))
|
* Portability note: Some compilers (e.g., on MacOS) still use
|
||||||
PROVIDE (CTORS_C = .);
|
* .ctors instead of .init_array, so we need to handle both.
|
||||||
KEEP (SORT_BY_INIT_PRIORITY(*)(.init_array.65533 .ctors.00002))
|
*/
|
||||||
PROVIDE (CTORS_G = .);
|
PROVIDE_HIDDEN (CTORS_L = .);
|
||||||
KEEP (SORT_BY_INIT_PRIORITY(*)(.init_array.* .ctors.*))
|
KEEP (*(SORT_BY_INIT_PRIORITY (.init_array.65534) SORT_BY_INIT_PRIORITY (.ctors.00001)))
|
||||||
|
PROVIDE_HIDDEN (CTORS_C = .);
|
||||||
|
KEEP (*(SORT_BY_INIT_PRIORITY (.init_array.65533) SORT_BY_INIT_PRIORITY (.ctors.00002)))
|
||||||
|
PROVIDE_HIDDEN (CTORS_S = .);
|
||||||
|
KEEP (*(SORT_BY_INIT_PRIORITY (.init_array.*) SORT_BY_INIT_PRIORITY (.ctors.*)))
|
||||||
KEEP (*(.init_array .ctors))
|
KEEP (*(.init_array .ctors))
|
||||||
PROVIDE (CTORS_E = .);
|
PROVIDE_HIDDEN (CTORS_E = .);
|
||||||
} : kern
|
} : kern
|
||||||
|
|
||||||
.data : AT (ADDR (.data) - OFFSET)
|
.data : AT (ADDR (.data) - OFFSET)
|
||||||
|
@ -89,38 +96,38 @@ SECTIONS
|
||||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||||
|
|
||||||
. = ALIGN(4K);
|
. = ALIGN(4K);
|
||||||
_mempool_l = .; PROVIDE (_mempool_p = _mempool_l - OFFSET);
|
_mempool_l = .; PROVIDE_HIDDEN (_mempool_p = _mempool_l - OFFSET);
|
||||||
|
|
||||||
PROVIDE (PAGE_0 = .); PROVIDE (FRAME_0 = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (PAGE_0 = .); PROVIDE_HIDDEN (FRAME_0 = . - OFFSET); . += 4K;
|
||||||
PROVIDE (PAGE_1 = .); PROVIDE (FRAME_1 = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (PAGE_1 = .); PROVIDE_HIDDEN (FRAME_1 = . - OFFSET); . += 4K;
|
||||||
PROVIDE (PAGE_H = .); PROVIDE (FRAME_H = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (PAGE_H = .); PROVIDE_HIDDEN (FRAME_H = . - OFFSET); . += 4K;
|
||||||
|
|
||||||
PROVIDE (PDBR = . - OFFSET);
|
PROVIDE_HIDDEN (PDBR = . - OFFSET);
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
PROVIDE (LVL2L = . - OFFSET);
|
PROVIDE_HIDDEN (LVL2L = . - OFFSET);
|
||||||
PROVIDE (LVL2H = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (LVL2H = . - OFFSET); . += 4K;
|
||||||
#else
|
#else
|
||||||
PROVIDE (LVL4 = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (LVL4 = . - OFFSET); . += 4K;
|
||||||
PROVIDE (LVL3L = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (LVL3L = . - OFFSET); . += 4K;
|
||||||
PROVIDE (LVL3H = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (LVL3H = . - OFFSET); . += 4K;
|
||||||
PROVIDE (LVL2L = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (LVL2L = . - OFFSET); . += 4K;
|
||||||
PROVIDE (LVL2H = . - OFFSET); . += 4K;
|
PROVIDE_HIDDEN (LVL2H = . - OFFSET); . += 4K;
|
||||||
#endif
|
#endif
|
||||||
_mempool_f = .;
|
_mempool_f = .;
|
||||||
|
|
||||||
. += 16M;
|
. += 16M;
|
||||||
. = ALIGN(4M);
|
. = ALIGN(4M);
|
||||||
|
|
||||||
PROVIDE (LINK_E = . - OFFSET);
|
PROVIDE_HIDDEN (LINK_E = . - OFFSET);
|
||||||
|
|
||||||
PROVIDE (_mempool_e = .);
|
PROVIDE_HIDDEN (_mempool_e = .);
|
||||||
|
|
||||||
} : kern
|
} : kern
|
||||||
|
|
||||||
.cpulocal CPU_LOCAL_DATA :
|
.cpulocal CPU_LOCAL_DATA :
|
||||||
{
|
{
|
||||||
SORT_BY_ALIGNMENT (*)(.cpulocal.hot)
|
*(SORT_BY_ALIGNMENT (.cpulocal.hot))
|
||||||
SORT_BY_ALIGNMENT (*)(.cpulocal)
|
*(SORT_BY_ALIGNMENT (.cpulocal))
|
||||||
}
|
}
|
||||||
|
|
||||||
/DISCARD/ :
|
/DISCARD/ :
|
||||||
|
|
|
@ -57,11 +57,11 @@ void init (mword mbi)
|
||||||
memset (reinterpret_cast<void *>(&PAGE_0), 0, PAGE_SIZE);
|
memset (reinterpret_cast<void *>(&PAGE_0), 0, PAGE_SIZE);
|
||||||
memset (reinterpret_cast<void *>(&PAGE_1), ~0u, PAGE_SIZE);
|
memset (reinterpret_cast<void *>(&PAGE_1), ~0u, PAGE_SIZE);
|
||||||
|
|
||||||
for (void (**func)() = &CTORS_G; func != &CTORS_E; (*func++)()) ;
|
for (auto func { CTORS_S }; func != CTORS_E; (*func++)()) ;
|
||||||
|
|
||||||
Hip::hip->build (mbi);
|
Hip::hip->build (mbi);
|
||||||
|
|
||||||
for (void (**func)() = &CTORS_C; func != &CTORS_G; (*func++)()) ;
|
for (auto func { CTORS_C }; func != CTORS_S; (*func++)()) ;
|
||||||
|
|
||||||
// Now we're ready to talk to the world
|
// Now we're ready to talk to the world
|
||||||
Console::print ("\fNOVA Microhypervisor v%d-%07lx (%s): %s %s [%s]\n", CFG_VER, reinterpret_cast<mword>(&GIT_VER), ARCH, __DATE__, __TIME__, COMPILER_STRING);
|
Console::print ("\fNOVA Microhypervisor v%d-%07lx (%s): %s %s [%s]\n", CFG_VER, reinterpret_cast<mword>(&GIT_VER), ARCH, __DATE__, __TIME__, COMPILER_STRING);
|
||||||
|
|
Loading…
Reference in New Issue