diff options
author | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-04-22 14:51:47 -0400 |
---|---|---|
committer | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-04-22 14:51:47 -0400 |
commit | 325e2ea9aef0723645b86bdc773f02293747c495 (patch) | |
tree | 2d844c3e30a27eaf463fed851620221f3ad7d540 /config | |
parent | try to find mcfg (diff) | |
parent | force rebuild on header change (diff) | |
download | comus-325e2ea9aef0723645b86bdc773f02293747c495.tar.gz comus-325e2ea9aef0723645b86bdc773f02293747c495.tar.bz2 comus-325e2ea9aef0723645b86bdc773f02293747c495.zip |
Merge branch 'main' into pciepcie
Diffstat (limited to 'config')
-rw-r--r-- | config/gdbinit | 32 | ||||
-rw-r--r-- | config/kernel.ld | 15 | ||||
-rw-r--r-- | config/user.ld | 65 |
3 files changed, 49 insertions, 63 deletions
diff --git a/config/gdbinit b/config/gdbinit index ca2c885..a5266e5 100644 --- a/config/gdbinit +++ b/config/gdbinit @@ -1,31 +1,3 @@ -# adapted from the xv6 .gdbinit.tmpl file -set $lastcs = -1 - -define hook-stop - # There doesn't seem to be a good way to detect if we're in 16- or - # 32-bit mode, but we always run with CS == 8 in 32-bit mode. - if $cs == 8 || $cs == 27 - if $lastcs != 8 && $lastcs != 27 - set architecture i386 - end - x/i $pc - else - if $lastcs == -1 || $lastcs == 8 || $lastcs == 27 - set architecture i8086 - end - # Translate the segment:offset into a physical address - printf "[%4x:%4x] ", $cs, $eip - x/i $cs*16+$eip - end - set $lastcs = $cs -end - -echo + target remote localhost:1337\n +set architecture i386:x86-64 target remote localhost:1337 - -# If this fails, it's probably because your GDB doesn't support ELF. -# Look at the tools page at -# http://pdos.csail.mit.edu/6.828/2009/tools.html -# for instructions on building GDB with ELF support. -echo + symbol-file build/kernel/kernel\n -symbol-file build/kernel/kernel +symbol-file bin/kernel.bin diff --git a/config/kernel.ld b/config/kernel.ld index bcacf61..8ac23e8 100644 --- a/config/kernel.ld +++ b/config/kernel.ld @@ -1,5 +1,12 @@ ENTRY(_start) +PHDRS +{ + text PT_LOAD; + rodata PT_LOAD; + data PT_LOAD; +} + SECTIONS { . = 1M; @@ -14,7 +21,7 @@ SECTIONS *(.text) *(.text.*) text_end = .; - } + } : text . = ALIGN(0x1000); @@ -23,7 +30,7 @@ SECTIONS *(.rodata) *(.rodata.*) rodata_end = .; - } + } : rodata . = ALIGN(0x1000); @@ -32,7 +39,7 @@ SECTIONS *(.data) *(.data.*) data_end = .; - } + } : data . = ALIGN(0x1000); @@ -42,7 +49,7 @@ SECTIONS *(.bss) *(.bss.*) bss_end = .; - } + } : data kernel_end = .; diff --git a/config/user.ld b/config/user.ld index 9e31dff..da1f8b5 100644 --- a/config/user.ld +++ b/config/user.ld @@ -1,51 +1,58 @@ -/* -** Simple linker script for user-level programs. -*/ - -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") -OUTPUT_ARCH(i386) ENTRY(_start) +PHDRS +{ + text PT_LOAD; + rodata PT_LOAD; + data PT_LOAD; +} + SECTIONS { - /* user text begins at the second page of the address space */ - . = 0x1000; + . = 1024M; + + user_start = .; .text : { - KEEP(*(.text .stub .text.* .gnu.linkonce.t.*)) - } + text_start = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + text_end = .; + } : text - /* define some standard symbols */ - PROVIDE(etext = .); - PROVIDE(_etext = .); + . = ALIGN(0x1000); - /* read-only data will go at the end of the text section */ .rodata : { - KEEP(*(.rodata .rodata.* .gnu.linkonce.r.*)) - } + rodata_start = .; + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + rodata_end = .; + } : rodata - /* Align the data segment at the next page boundary */ . = ALIGN(0x1000); .data : { - KEEP(*(.data)) - } + data_start = .; + *(.data) + *(.data.*) + data_end = .; + } : data - PROVIDE(edata = .); - PROVIDE(_edata = .); - - /* Page-align the BSS segment */ . = ALIGN(0x1000); - PROVIDE(__bss_start = .); - .bss : { - KEEP(*(.bss)) - } + bss_start = .; + *(COMMON) + *(.bss) + *(.bss.*) + bss_end = .; + } : data - PROVIDE(_end = .); + user_end = .; /DISCARD/ : { - *(.stab .stab_info .stabstr .eh_frame .note.GNU-stack .note.gnu.property .comment) + *(.eh_frame .note.GNU-stack .note.gnu.property .comment) } } |