diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-27 23:40:14 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-27 23:40:54 +0200 |
commit | 7d642c99641ffc6960c8dd9ea88634bdaae80213 (patch) | |
tree | b4c8e3085b1ef3800c33006c7c6c50464a27dd83 /x86_64 | |
parent | 9acc5293e0386bfc0c505ac2efd287e610e7b662 (diff) | |
download | gnumach-7d642c99641ffc6960c8dd9ea88634bdaae80213.tar.gz gnumach-7d642c99641ffc6960c8dd9ea88634bdaae80213.tar.bz2 gnumach-7d642c99641ffc6960c8dd9ea88634bdaae80213.zip |
Fix building x86_64 xen platform
On Xen we do not have a separate boot section, we directly start at the
kernel map address. We thus do not have a map shift.
Diffstat (limited to 'x86_64')
-rw-r--r-- | x86_64/Makefrag.am | 51 | ||||
-rw-r--r-- | x86_64/boothdr.S | 15 | ||||
-rw-r--r-- | x86_64/ldscript | 18 |
3 files changed, 38 insertions, 46 deletions
diff --git a/x86_64/Makefrag.am b/x86_64/Makefrag.am index 0139940a..edf533fd 100644 --- a/x86_64/Makefrag.am +++ b/x86_64/Makefrag.am @@ -211,28 +211,6 @@ nodist_libkernel_a_SOURCES += \ # Architecture specialities. # -if PLATFORM_at -# This should probably be 0xffffffff80000000 for mcmodel=kernel, but let's try -# to stay in the first 8G first, otherwise we have to fix the pmap module to -# actually use the l4 page level -#KERNEL_MAP_BASE=0x100000000 -# but for nor try with < 4G, otherwise we have linker errors -KERNEL_MAP_BASE=0x40000000 -gnumach_LINKFLAGS += \ - --defsym _START_MAP=$(_START_MAP) \ - --defsym _START=_START_MAP \ - --defsym KERNEL_MAP_BASE=$(KERNEL_MAP_BASE) \ - -T '$(srcdir)'/x86_64/ldscript - -AM_CFLAGS += -D_START_MAP=$(_START_MAP) \ - -DKERNEL_MAP_BASE=$(KERNEL_MAP_BASE) -AM_CCASFLAGS += -D_START_MAP=$(_START_MAP) \ - -DKERNEL_MAP_BASE=$(KERNEL_MAP_BASE) - -AM_CCASFLAGS += \ - -Ii386 -endif - AM_CPPFLAGS += \ -I$(top_srcdir)/i386 \ -I$(top_srcdir)/i386/i386 \ @@ -273,7 +251,26 @@ include_mach_x86_64_HEADERS = \ # Platform specific parts. # +if PLATFORM_at +# This should probably be 0xffffffff80000000 for mcmodel=kernel, but let's try +# to stay in the first 8G first, otherwise we have to fix the pmap module to +# actually use the l4 page level +#KERNEL_MAP_BASE=0x100000000 +# but for nor try with < 4G, otherwise we have linker errors +KERNEL_MAP_BASE=0x40000000 +gnumach_LINKFLAGS += \ + --defsym _START_MAP=$(_START_MAP) \ + --defsym _START=$(_START_MAP) \ + --defsym KERNEL_MAP_SHIFT=$(KERNEL_MAP_BASE) \ + -T '$(srcdir)'/x86_64/ldscript + +AM_CCASFLAGS += \ + -Ii386 +endif + if PLATFORM_xen +KERNEL_MAP_BASE=0x40000000 + libkernel_a_SOURCES += \ x86_64/xen_locore.S \ x86_64/xen_boothdr.S \ @@ -281,9 +278,15 @@ libkernel_a_SOURCES += \ i386/i386/xen.h gnumach_LINKFLAGS += \ - --defsym _START=0x40000000 \ - --defsym _START_MAP=0x40000000 \ + --defsym _START_MAP=$(KERNEL_MAP_BASE) \ + --defsym _START=$(KERNEL_MAP_BASE) \ + --defsym KERNEL_MAP_SHIFT=0 \ -T '$(srcdir)'/x86_64/ldscript endif + +AM_CFLAGS += -D_START_MAP=$(_START_MAP) \ + -DKERNEL_MAP_BASE=$(KERNEL_MAP_BASE) +AM_CCASFLAGS += -D_START_MAP=$(_START_MAP) \ + -DKERNEL_MAP_BASE=$(KERNEL_MAP_BASE) endif # HOST_x86_64 diff --git a/x86_64/boothdr.S b/x86_64/boothdr.S index 5ea7834d..d81f9a78 100644 --- a/x86_64/boothdr.S +++ b/x86_64/boothdr.S @@ -26,8 +26,6 @@ */ .section .boot.text,"ax" /* We should never be entered this way. */ - .globl _start -_start: .globl boot_start boot_start: @@ -36,11 +34,7 @@ boot_start: /* MultiBoot header - see multiboot.h. */ #define MULTIBOOT_MAGIC 0x1BADB002 -#ifdef __ELF__ #define MULTIBOOT_FLAGS 0x00000003 -#else /* __ELF__ */ -#define MULTIBOOT_FLAGS 0x00010003 -#endif /* __ELF__ */ P2ALIGN(2) boot_hdr: .long MULTIBOOT_MAGIC @@ -50,14 +44,9 @@ boot_hdr: * XX this works OK until we need at least the 30th bit. */ .long - (MULTIBOOT_MAGIC+MULTIBOOT_FLAGS) -#ifndef __ELF__ /* a.out kludge */ - .long boot_hdr /* header_addr */ - .long _start /* load_addr */ - .long _edata /* load_end_addr */ - .long _end /* bss_end_addr */ - .long boot_entry /* entry */ -#endif /* __ELF__ */ + .global _start +_start: boot_entry: /* * Prepare minimal page mapping to jump to 64 bit and to C code. diff --git a/x86_64/ldscript b/x86_64/ldscript index de99795e..67703b4d 100644 --- a/x86_64/ldscript +++ b/x86_64/ldscript @@ -12,16 +12,16 @@ SECTIONS * `gnumach_LINKFLAGS' in `i386/Makefrag.am'. */ - . = _START_MAP; - .boot : + . = _START; + .boot : AT(_START_MAP) { *(.boot.text) *(.boot.data) } =0x90909090 - . += KERNEL_MAP_BASE; + . += KERNEL_MAP_SHIFT; _start = .; - .text : AT(((ADDR(.text)) - KERNEL_MAP_BASE)) + .text : AT(((ADDR(.text)) - KERNEL_MAP_SHIFT)) { *(.text*) *(.text .stub .text.* .gnu.linkonce.t.*) @@ -30,11 +30,11 @@ SECTIONS /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) } =0x90909090 - .init : AT(((ADDR(.init)) - KERNEL_MAP_BASE)) + .init : AT(((ADDR(.init)) - KERNEL_MAP_SHIFT)) { KEEP (*(.init)) } =0x90909090 - .fini : AT(((ADDR(.fini)) - KERNEL_MAP_BASE)) + .fini : AT(((ADDR(.fini)) - KERNEL_MAP_SHIFT)) { KEEP (*(.fini)) } =0x90909090 @@ -77,7 +77,7 @@ SECTIONS PROVIDE_HIDDEN (__rela_iplt_end = .); } .plt : { *(.plt) *(.iplt) } - .rodata : AT(((ADDR(.rodata)) - KERNEL_MAP_BASE)) { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata : AT(((ADDR(.rodata)) - KERNEL_MAP_SHIFT)) { *(.rodata .rodata.* .gnu.linkonce.r.*) } .rodata1 : { *(.rodata1) } .eh_frame_hdr : { *(.eh_frame_hdr) } .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } @@ -147,7 +147,7 @@ SECTIONS .got : { *(.got) *(.igot) } . = DATA_SEGMENT_RELRO_END (24, .); .got.plt : { *(.got.plt) *(.igot.plt) } - .data : AT(((ADDR(.data)) - KERNEL_MAP_BASE)) + .data : AT(((ADDR(.data)) - KERNEL_MAP_SHIFT)) { *(.data .data.* .gnu.linkonce.d.*) SORT(CONSTRUCTORS) @@ -155,7 +155,7 @@ SECTIONS .data1 : { *(.data1) } _edata = .; PROVIDE (edata = .); __bss_start = .; - .bss : AT(((ADDR(.bss)) - KERNEL_MAP_BASE)) + .bss : AT(((ADDR(.bss)) - KERNEL_MAP_SHIFT)) { *(.dynbss) *(.bss .bss.* .gnu.linkonce.b.*) |