summaryrefslogtreecommitdiff
path: root/kernel/linker.ld
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-10-30 22:12:14 +0100
committerAnton Kling <anton@kling.gg>2023-10-31 00:18:38 +0100
commit8a9208612eec8ddae4c418485d848ecfa0613699 (patch)
tree2f4b29200c2f0c19ae52f45bdb9b38a41b356e30 /kernel/linker.ld
parentca76600acc8bf7a02346efa5bd8f17072210ec01 (diff)
Meta: Move kernel and userland to their own folders.
This is to allow both the kernel and the userland to share certain header files and to make the folder structure a bit more clear.
Diffstat (limited to 'kernel/linker.ld')
-rw-r--r--kernel/linker.ld41
1 files changed, 41 insertions, 0 deletions
diff --git a/kernel/linker.ld b/kernel/linker.ld
new file mode 100644
index 0000000..59b150d
--- /dev/null
+++ b/kernel/linker.ld
@@ -0,0 +1,41 @@
+ENTRY (_start)
+
+SECTIONS
+{
+ . = 0x00100000;
+ /* The kernel will live at 3GB + 1MB in the virtual address space, */
+ /* which will be mapped to 1MB in the physical address space. */
+ /* Note that we page-align the sections. */
+
+ _kernel_start = .;
+ .multiboot.data : {
+ *(.multiboot.data)
+ }
+
+ .multiboot.text : {
+ *(.multiboot.text)
+ }
+
+ . += 0xC0000000;
+ /* Add a symbol that indicates the start address of the kernel. */
+ .text ALIGN (4K) : AT (ADDR (.text) - 0xC0000000)
+ {
+ *(.text)
+ }
+ .rodata ALIGN (4K) : AT (ADDR (.rodata) - 0xC0000000)
+ {
+ *(.rodata)
+ }
+ .data ALIGN (4K) : AT (ADDR (.data) - 0xC0000000)
+ {
+ *(.data)
+ }
+ .bss ALIGN (4K) : AT (ADDR (.bss) - 0xC0000000)
+ {
+ *(COMMON)
+ *(.bss)
+ *(.bootstrap_stack)
+ }
+ /* Add a symbol that indicates the end address of the kernel. */
+ _kernel_end = .;
+}