diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-27 19:02:17 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-27 19:02:17 +0200 |
| commit | f13b26eeb4f9afba3a1aed2516655b34139979aa (patch) | |
| tree | 9ec48586fa57749f2c1cb40d940863d2251bd401 /src/linker.ld | |
| parent | 9dc527b3be9d493dcf8cf1baf78477373eb5990d (diff) | |
Making kernel Higher-Half
Diffstat (limited to 'src/linker.ld')
| -rw-r--r-- | src/linker.ld | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/src/linker.ld b/src/linker.ld index 89e4909..7d7c3a6 100644 --- a/src/linker.ld +++ b/src/linker.ld @@ -1,30 +1,45 @@ -ENTRY(_start) OUTPUT_FORMAT(elf64-x86-64) +ENTRY(_start) -SECTIONS { +__kernel_vma = 0xFFFFFFFF80000000; +__boot_pma = 1M; +__stack_pma = 0x3FFFFF; +__stack_size = 4096; +__userspace_pma = 0x400000; - . = 1M; +PHDRS +{ + boot PT_LOAD; + kernel PT_LOAD; +} - .text : ALIGN(4) +SECTIONS { + . = __boot_pma; + .boot ALIGN(4096) : { *boot.o(.multiboot) *boot.o(.text) - *(.text) - } - .rodata : ALIGN(4) - { - *(.rodata) - } - .data : ALIGN(4) + *trampoline.o(.text .text.* .data .data.* .rodata .rodata.* .bss) + + } :boot + + . += __kernel_vma; + .text ALIGN(4096) : AT(ADDR(.text)-__kernel_vma) { - *(.data) - } - .bss : ALIGN(4) + *boot.o(.multiboot) + *boot.o(.text) + *(.text .text.*) + *(.rodata .rodata.*) + *(.data .data.*) + }:kernel + .bss ALIGN(4096) : AT(ADDR(.bss)-__kernel_vma) { - _bss_start = .; + __bss_start = .; *(.bss); - _bss_end = .; + __bss_end = .; *(COMMON); - } + ASSERT( (. - ABSOLUTE(__kernel_vma)) < (ABSOLUTE(__stack_pma)-ABSOLUTE(__stack_size)), "No room for stack !!"); + }:kernel + /DISCARD/ : { *(.eh_frame) *(.comment) *(.note*) } }
\ No newline at end of file |
