diff options
Diffstat (limited to 'arch/x86_64/scripts')
| -rw-r--r-- | arch/x86_64/scripts/kernel.ld | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 943266c..cc07896 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -3,7 +3,6 @@ ENTRY(_start) /***************************************************************************** * Virtual and linear start addresses of the TeachOS kernel *****************************************************************************/ -TEACHOS_HIGH = -2048M; TEACHOS_LOW = 1M; PHDRS { @@ -31,44 +30,40 @@ SECTIONS * symbols at the beginning. ***************************************************************************/ _start_linear = .; - _start_virtual = . + TEACHOS_HIGH; + _start_virtual = .; /*************************************************************************** * The bootstrapping infratructure goes first. We first place the read-only * data, followed by our code, initialized mutable data, and finally our * uninitialized mutable data. ***************************************************************************/ - .boot_rodata : + .boot_rodata ALIGN(4K) : AT(ADDR (.boot_rodata)) { KEEP(*(.boot_mbh)) *(.boot_rodata) } :boot_rodata - .boot_text : + .boot_text ALIGN(4K) : AT(ADDR (.boot_text)) { *(.boot_text) } :boot_text - .boot_data : - { - *(.boot_data) - } :boot_data - - .boot_bss : + .boot_bss ALIGN(4K) : AT(ADDR (.boot_bss)) { *(.boot_bss) *(.boot_stack) } + .boot_data ALIGN(4K) : AT(ADDR (.boot_data)) + { + *(.boot_data) + } :boot_data + /*************************************************************************** - * Now it is time to load the 64-bit kernel code. We virtually load it into - * the upper 2GiB, while adjusting the linear load address appropriately. We - * also make sure to align the loaded data onto a page boundary. + * Now it is time to load the 64-bit kernel code. We + * make sure to align the loaded data onto a page boundary. ***************************************************************************/ - . = ALIGN(4K); - . += TEACHOS_HIGH; - - .init ALIGN(4K) : AT(ADDR (.init) - TEACHOS_HIGH) + .init ALIGN(4K) : AT(ADDR (.init)) { /* * Make sure that the crt code is wrapped around the compiler generated @@ -79,7 +74,7 @@ SECTIONS KEEP(*crtn.s.o*(.init)) } :text - .fini ALIGN(4K) : AT(ADDR (.fini) - TEACHOS_HIGH) + .fini ALIGN(4K) : AT(ADDR (.fini)) { /* * Make sure that the crt code is wrapped around the compiler generated @@ -90,18 +85,18 @@ SECTIONS KEEP(*crtn.s.o*(.fini)) } - .text ALIGN(4K) : AT(ADDR (.text) - TEACHOS_HIGH) + .text ALIGN(4K) : AT(ADDR (.text)) { *(.text*) } - .rodata ALIGN(4K) : AT (ADDR (.rodata) - TEACHOS_HIGH) + .rodata ALIGN(4K) : AT (ADDR (.rodata)) { *(.rodata) *(.rodata.*) } :rodata - .ctors ALIGN(4K) : AT (ADDR (.ctors) - TEACHOS_HIGH) + .ctors ALIGN(4K) : AT (ADDR (.ctors)) { KEEP(*crtbegin.o(.ctors)) KEEP(*(EXCLUDE_FILE (*crtend.o) .ctors)) @@ -109,7 +104,7 @@ SECTIONS KEEP(*crtend.o(.ctors)) } :data - .dtors ALIGN(4K) : AT (ADDR (.dtors) - TEACHOS_HIGH) + .dtors ALIGN(4K) : AT (ADDR (.dtors)) { KEEP(*crtbegin.o(.dtors)) KEEP(*(EXCLUDE_FILE (*crtend.o) .dtors)) @@ -117,15 +112,15 @@ SECTIONS KEEP(*crtend.o(.dtors)) } - .data ALIGN(4K) : AT (ADDR (.data) - TEACHOS_HIGH) + .bss ALIGN(4K) : AT (ADDR (.bss)) { - *(.data*) + *(COMMON) + *(.bss*) } - .bss ALIGN(4K) : AT (ADDR (.bss) - TEACHOS_HIGH) + .data ALIGN(4K) : AT (ADDR (.data)) { - *(COMMON) - *(.bss*) + *(.data*) } /*************************************************************************** @@ -133,7 +128,7 @@ SECTIONS * symbols to mark the end of our loaded image. ***************************************************************************/ _end_virtual = ADDR(.bss) + SIZEOF(.bss); - _end_linear = _end_virtual - TEACHOS_HIGH; + _end_linear = _end_virtual; /DISCARD/ : { *(.comment) } } |
