From fc4a2306b803ccfc27f1bdc4a831176a5278a9d5 Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Wed, 2 Apr 2025 09:57:54 +0000 Subject: fix interrupt handler and idt --- arch/x86_64/scripts/kernel.ld | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index cc07896..806adb5 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -90,6 +90,11 @@ SECTIONS *(.text*) } + .interrupt_text ALIGN(4K) : AT(ADDR (.interrupt_text)) + { + *(.interrupt_text) + } + .rodata ALIGN(4K) : AT (ADDR (.rodata)) { *(.rodata) -- cgit v1.2.3 From f83727a0c8913d19415c2ad482c70ee7373f6f3f Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Sun, 4 May 2025 11:26:29 +0000 Subject: add user_text linker section and temporarily add elf_sections.txt --- arch/x86_64/scripts/kernel.ld | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 806adb5..239d026 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -90,9 +90,9 @@ SECTIONS *(.text*) } - .interrupt_text ALIGN(4K) : AT(ADDR (.interrupt_text)) + .user_text ALIGN(4K) : AT(ADDR (.user_text)) { - *(.interrupt_text) + *(.user_text) } .rodata ALIGN(4K) : AT (ADDR (.rodata)) -- cgit v1.2.3 From d80ecf29baada6242c5181adaec0d1500707cad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Fri, 9 May 2025 12:00:23 +0000 Subject: Move necessary code into user text --- arch/x86_64/scripts/kernel.ld | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 239d026..88d90fe 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -128,6 +128,11 @@ SECTIONS *(.data*) } + .user_data ALIGN(4K) : AT (ADDR (.user_data)) + { + *(.user_data*) + } + /*************************************************************************** * In accordance with the symbol definitions at the start, we generate some * symbols to mark the end of our loaded image. -- cgit v1.2.3 From f3a976be198d97573b630242c0f833c290c62d81 Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Sat, 10 May 2025 10:33:26 +0000 Subject: experiment with globally available linker sections and page table entry flags --- arch/x86_64/scripts/kernel.ld | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 88d90fe..1856123 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -95,6 +95,11 @@ SECTIONS *(.user_text) } + .stl_text ALIGN(4K) : AT(ADDR (.stl_text)) + { + *(.stl_text) + } + .rodata ALIGN(4K) : AT (ADDR (.rodata)) { *(.rodata) -- cgit v1.2.3 From 06b6e20ba921a062b71c86df8859eaaea4b75cb2 Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Thu, 15 May 2025 12:20:19 +0000 Subject: add cpp standard library to .stl_text section (which is user accessible) --- arch/x86_64/scripts/kernel.ld | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 1856123..1925872 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -88,6 +88,7 @@ SECTIONS .text ALIGN(4K) : AT(ADDR (.text)) { *(.text*) + *(EXCLUDE_FILE (*libstdc++.a) .text .text.*) } .user_text ALIGN(4K) : AT(ADDR (.user_text)) @@ -98,6 +99,7 @@ SECTIONS .stl_text ALIGN(4K) : AT(ADDR (.stl_text)) { *(.stl_text) + *libstdc++.a:*(.text .text.*) } .rodata ALIGN(4K) : AT (ADDR (.rodata)) -- cgit v1.2.3 From d4cc546df6eba2dd287785f1a63fbcce4a1b9bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Fri, 16 May 2025 09:58:57 +0000 Subject: Attempt to move atomic into stl text as well --- arch/x86_64/scripts/kernel.ld | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 1925872..e5cbc73 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -85,21 +85,21 @@ SECTIONS KEEP(*crtn.s.o*(.fini)) } - .text ALIGN(4K) : AT(ADDR (.text)) + .stl_text ALIGN(4K) : AT(ADDR (.stl_text)) { - *(.text*) - *(EXCLUDE_FILE (*libstdc++.a) .text .text.*) + *(.stl_text) + KEEP(*libstdc++.a:*(.text .text.*)) + KEEP(*libatomic.a:*(.text .text.*)) /* Attempt to move atomic stl into stl_text as well, doesn't work */ } - .user_text ALIGN(4K) : AT(ADDR (.user_text)) + .text ALIGN(4K) : AT(ADDR (.text)) { - *(.user_text) + *(.text .text.*) } - .stl_text ALIGN(4K) : AT(ADDR (.stl_text)) + .user_text ALIGN(4K) : AT(ADDR (.user_text)) { - *(.stl_text) - *libstdc++.a:*(.text .text.*) + *(.user_text) } .rodata ALIGN(4K) : AT (ADDR (.rodata)) -- cgit v1.2.3 From 5c314eef566df2732973e8cb35974ec49748adba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Fri, 16 May 2025 13:27:16 +0000 Subject: Fix bug where level 4 to level 2 entries are not mapped user accesible. --- arch/x86_64/scripts/kernel.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index e5cbc73..23f9681 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -89,7 +89,7 @@ SECTIONS { *(.stl_text) KEEP(*libstdc++.a:*(.text .text.*)) - KEEP(*libatomic.a:*(.text .text.*)) /* Attempt to move atomic stl into stl_text as well, doesn't work */ + KEEP(*libatomic.a:*(.text .text.*)) /* TODO: Attempt to move atomic stl into stl_text as well, doesn't work */ } .text ALIGN(4K) : AT(ADDR (.text)) -- cgit v1.2.3 From 1b5a771a34743a2973a82de5ebdfd22da030b841 Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Sun, 18 May 2025 13:21:42 +0000 Subject: update linker file and improve section parsing --- arch/x86_64/scripts/kernel.ld | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 23f9681..3d9a7ae 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -87,9 +87,8 @@ SECTIONS .stl_text ALIGN(4K) : AT(ADDR (.stl_text)) { - *(.stl_text) + *(.stl_text .stl_text*) KEEP(*libstdc++.a:*(.text .text.*)) - KEEP(*libatomic.a:*(.text .text.*)) /* TODO: Attempt to move atomic stl into stl_text as well, doesn't work */ } .text ALIGN(4K) : AT(ADDR (.text)) @@ -99,7 +98,7 @@ SECTIONS .user_text ALIGN(4K) : AT(ADDR (.user_text)) { - *(.user_text) + *(.user_text .user_text.*) } .rodata ALIGN(4K) : AT (ADDR (.rodata)) @@ -137,7 +136,7 @@ SECTIONS .user_data ALIGN(4K) : AT (ADDR (.user_data)) { - *(.user_data*) + *(.user_data .user_data.*) } /*************************************************************************** -- cgit v1.2.3 From 8a6a9a3a159ce1b960721eb921b8e8d81b15b718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Tue, 20 May 2025 12:29:09 +0000 Subject: Improve syscalls and user heap allocator --- arch/x86_64/scripts/kernel.ld | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index 3d9a7ae..df9d7e7 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -89,6 +89,12 @@ SECTIONS { *(.stl_text .stl_text*) KEEP(*libstdc++.a:*(.text .text.*)) + KEEP(*libubsan.a:*(.text .text.*)) /* TODO: Include atomic_base into stl_text / Print where code lies: objdump -t build/bin/Debug/_kernel >> test.txt */ + KEEP(*liblsan.a:*(.text .text.*)) + KEEP(*libtsan.a:*(.text .text.*)) + KEEP(*libasan.a:*(.text .text.*)) + KEEP(*libgcc.a:*(.text .text.*)) + KEEP(*libatomic.a:*(.text .text.*)) } .text ALIGN(4K) : AT(ADDR (.text)) -- cgit v1.2.3 From 9f2e780030e2101d5f7f01f42df805db9a5fa809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Fri, 30 May 2025 12:48:57 +0000 Subject: Clean up files --- arch/x86_64/scripts/kernel.ld | 6 ------ 1 file changed, 6 deletions(-) (limited to 'arch/x86_64/scripts') diff --git a/arch/x86_64/scripts/kernel.ld b/arch/x86_64/scripts/kernel.ld index df9d7e7..3d9a7ae 100644 --- a/arch/x86_64/scripts/kernel.ld +++ b/arch/x86_64/scripts/kernel.ld @@ -89,12 +89,6 @@ SECTIONS { *(.stl_text .stl_text*) KEEP(*libstdc++.a:*(.text .text.*)) - KEEP(*libubsan.a:*(.text .text.*)) /* TODO: Include atomic_base into stl_text / Print where code lies: objdump -t build/bin/Debug/_kernel >> test.txt */ - KEEP(*liblsan.a:*(.text .text.*)) - KEEP(*libtsan.a:*(.text .text.*)) - KEEP(*libasan.a:*(.text .text.*)) - KEEP(*libgcc.a:*(.text .text.*)) - KEEP(*libatomic.a:*(.text .text.*)) } .text ALIGN(4K) : AT(ADDR (.text)) -- cgit v1.2.3