v2 initial commit

This commit is contained in:
Michael Shaw 2026-04-11 11:35:31 -04:00
commit d2ef885e8d
118 changed files with 2420 additions and 9320 deletions

View file

@ -1,12 +1,9 @@
/* Tell the linker that we want an x86_64 ELF64 output file */
/* SPDX-License-Identifier: GPL-2.0-only */
OUTPUT_FORMAT(elf64-x86-64)
OUTPUT_ARCH(i386:x86-64)
/* We want the symbol _start to be our entry point */
ENTRY(kmain)
/* Define the program headers we want so the bootloader gives us the right */
/* MMU permissions */
PHDRS
{
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
@ -16,24 +13,19 @@ PHDRS
SECTIONS
{
/* We wanna be placed in the topmost 2GiB of the address space, for optimisations */
/* and because that is what the Limine spec mandates. */
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
/* that is the beginning of the region. */
. = 0xffffffff80000000;
__kernel_start = .;
.text : {
*(.text .text.*)
} :text
/* Move to the next memory page for .rodata */
. += CONSTANT(MAXPAGESIZE);
.rodata ALIGN (0x1000) : {
*(.rodata .rodata.*)
} :rodata
/* Move to the next memory page for .data */
. += CONSTANT(MAXPAGESIZE);
.data ALIGN (0x1000) : {
@ -41,10 +33,6 @@ SECTIONS
__data_end = .;
} :data
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
/* unnecessary zeros will be written to the binary. */
/* If you need, for example, .init_array and .fini_array, those should be placed */
/* above this. */
.bss : {
__bss_start = .;
*(COMMON)
@ -52,7 +40,9 @@ SECTIONS
__bss_end = .;
} :data
/* Discard .note.* and .eh_frame since they may cause issues on some hosts. */
. = ALIGN(CONSTANT(MAXPAGESIZE));
__kernel_end = .;
/DISCARD/ : {
*(.eh_frame)
*(.note .note.*)