diff options
| author | Alejandro Sior <aho@sior.be> | 2022-05-13 20:50:39 +0200 |
|---|---|---|
| committer | Alejandro Sior <aho@sior.be> | 2022-05-13 20:50:39 +0200 |
| commit | e50cbe8eb763cf63fb44b047d5164f6fbf07eb39 (patch) | |
| tree | 8acb610a4f33462c843f54016861780ffadc010d /rt/hare.sc | |
boot: longmode to realmode stub
This is the initial commit to the repo. It adds all the code.
The last proper thing that I got working before committing is
calling real mode functions from long mode using a stub.
Next up, I would like to implement a disk reader abstraction over
the BIOS in order to read form partitions (most notably FAT32).
Diffstat (limited to 'rt/hare.sc')
| -rw-r--r-- | rt/hare.sc | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/rt/hare.sc b/rt/hare.sc new file mode 100644 index 0000000..0cb9c02 --- /dev/null +++ b/rt/hare.sc @@ -0,0 +1,74 @@ +OUTPUT_FORMAT(elf64-x86-64) +ENTRY(_stage0) + +PHDRS { + headers PT_PHDR PHDRS; + text PT_LOAD FILEHDR PHDRS; + data PT_LOAD; +} + +SECTIONS { + . = 0x0; + + . = 0x500; + . = ALIGN(4096); + _p4 = .; + . += 4096; + _p3 = .; + . += 4096; + _p2 = .; + . += 4096; + _p1 = .; + . += 4096; + + . = 0x7c00; + stack_top = .; + + boot_start = .; + + boot : { + boot_stage0_start = .; + *(boot.stage0) + boot_stage0_end = .; + + boot_stage1_start = .; + *(boot.stage1) + boot_stage1_end = .; + + . = ALIGN(512); + } + + .text : { + KEEP (*(.text)) + *(.text.*) + } :text + .data : { + KEEP (*(.data)) + *(.data.*) + . = ALIGN(16); + KEEP (*(.exception_array)) + } :data + .init_array : { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + } :data + .fini_array : { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + } :data + .test_array : { + PROVIDE_HIDDEN (__test_array_start = .); + KEEP (*(.test_array)) + PROVIDE_HIDDEN (__test_array_end = .); + } :data + + .bss : { + KEEP (*(.bss)) + *(.bss.*) + } :data + + + boot_end = .; +} |
