diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-03-08 22:39:16 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-03-09 10:13:26 +0200 |
commit | 170f3c0fe5def46c4d287a385e2354536fc5f693 (patch) | |
tree | 790bb4fc6b796894b1d1df3bf5d33f09d198bc1c /linker.ld | |
parent | Move multiboot header to its own section (diff) | |
download | kernel.cpp-170f3c0fe5def46c4d287a385e2354536fc5f693.tar.xz |
Map kernel to higher half
Diffstat (limited to 'linker.ld')
-rw-r--r-- | linker.ld | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -1,31 +1,36 @@ ENTRY(_start) OUTPUT_FORMAT(elf32-i386) +VADDR_BASE = 0xc0000000; + SECTIONS { - /* Begin putting sections at 1 MiB */ - . = 1M; - - /* First put the multiboot header, as it is required to be put very early + /* + * First put the multiboot header, as it is required to be put very early * early in the image or the bootloader won't recognize the file format. */ + . = 0; + _kernel_start = .; .multiboot : { *(.multiboot.header) *(.multiboot.text) } - .text : { + /* Begin putting sections at 1 MiB */ + . = VADDR_BASE + 1M; + + .text ALIGN(4K) : AT(ADDR(.text) - VADDR_BASE) { *(.text*) } /* Read-only data. */ - .rodata : { + .rodata ALIGN(4K) : AT(ADDR(.rodata) - VADDR_BASE) { *(.rodata*) } /* Read-write data (initialized) */ - .data : { - start_ctors = .; + .data ALIGN(4K) : AT(ADDR(.data) - VADDR_BASE) { + begin_ctors = .; KEEP(*(.init_array)); /* global constructors */ end_ctors = .; @@ -37,9 +42,10 @@ SECTIONS } /* Read-write data (uninitialized) and stack */ - .bss : { + .bss ALIGN(4K) : AT(ADDR(.bss) - VADDR_BASE) { + *(.pages) *(.bss) *(.stack) } - + _kernel_end = .; } |