Skip to content

Commit

Permalink
fix: revert to new linker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrgoblings committed Dec 31, 2024
1 parent 391cc52 commit f38d518
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
49 changes: 0 additions & 49 deletions anasos-kernel/linker copy.ld

This file was deleted.

17 changes: 17 additions & 0 deletions anasos-kernel/linker-old.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ENTRY(start_protected_mode)

SECTIONS
{
. = 1M;

.boot :
{
KEEP(*(.multiboot_header))
*(.boot)
}

.text :
{
*(.text)
}
}
52 changes: 42 additions & 10 deletions anasos-kernel/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,48 @@ ENTRY(start_protected_mode)

SECTIONS
{
. = 1M;

.boot :
{
KEEP(*(.multiboot_header))
. = 0x0;
.boot :
{
KEEP(*(.multiboot_header));
*(.boot)
}
}

/* Page table addresses already defined in boot.asm, but ensure alignment */
. = ALIGN(4096); /* Page size */
__page_table_start = .;
_p4 = PML4; /* Reference PML4 address from boot.asm */
_p3 = PDPT; /* Reference PDPT address from boot.asm */
_p2 = PD; /* Reference PD address from boot.asm */
_p1 = PT; /* Reference PT address from boot.asm */
__page_table_end = .;

/* Stack setup handled in boot.asm */
_stack_start = stack_bottom; /* Stack defined in boot.asm */
_stack_end = stack_top;

/* Memory map section for bootloader metadata */
__bootloader_start = .;
_memory_map = .; /* Memory map entry */
. += 4096; /* Reserve 4KB for memory map */

/* Kernel metadata section */
.kernel :
{
KEEP(*(.kernel))
}

/* Text section: contains code */
.text :
{
*(.text)
}

.text :
{
*(.text)
}
.bss ALIGN(4096):
{
__bss_start = .;
*(.bss)
*(COMMON)
__bss_end = .;
}
}

0 comments on commit f38d518

Please sign in to comment.