summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/entry.c2
-rw-r--r--kernel/kernel.ld25
2 files changed, 14 insertions, 13 deletions
diff --git a/kernel/entry.c b/kernel/entry.c
index 4dd2ee1..d288027 100644
--- a/kernel/entry.c
+++ b/kernel/entry.c
@@ -57,7 +57,7 @@ void entry_main(uint32_t mb_magic, multiboot_info* mb_info) {
entry_pagetable_low[i] = ((uint32_t)&addr_phys & 0xffc00000) | (i << 12) | 0x003;
// Map kernelspace.
- if((i << 12) < ((uint32_t)&addr_virt_end & 0x003ff000 )) {
+ if((i << 12) < ((uint32_t)&addr_virt_end & 0x003fffff)) {
entry_pagetable_high[i] = ((uint32_t)&addr_load_virt + (i << 12)) | 0x003;
} else {
entry_pagetable_high[i] = 0;
diff --git a/kernel/kernel.ld b/kernel/kernel.ld
index 2bcbcbc..ab294ee 100644
--- a/kernel/kernel.ld
+++ b/kernel/kernel.ld
@@ -1,3 +1,4 @@
+OUTPUT_ARCH("i386")
OUTPUT_FORMAT("elf32-i386")
ENTRY(entry)
@@ -5,8 +6,6 @@ addr_phys = 0x00100000;
addr_virt = 0xc0000000;
addr_virt_end = ADDR(.bss) + SIZEOF(.bss);
-
-addr_load_virt = LOADADDR(.text);
addr_load_virt_end = LOADADDR(.bss) + SIZEOF(.bss);
SECTIONS {
@@ -18,40 +17,42 @@ SECTIONS {
kernel/entry.o(.text)
kernel/entry.o(.rodata*)
- . = ALIGN(0x1000);
}
+ . = ALIGN(0x1000);
.data_low : {
kernel/entry.o(.data)
- . = ALIGN(0x1000);
}
+ . = ALIGN(0x1000);
.bss_low : {
- kernel/entry.o(.bss)
- . = ALIGN(0x1000);
entry_pagedir = .; . += 0x1000;
entry_pagetable_low = .; . += 0x1000;
entry_pagetable_high = .; . += 0x1000;
entry_stack = .; . += 0x1000; entry_stack_top = .;
+
+ kernel/entry.o(.bss)
}
- .text addr_virt : AT(LOADADDR(.bss_low) + SIZEOF(.bss_low)) {
+ addr_load_virt = ALIGN(0x1000);
+
+ .text addr_virt : AT(addr_load_virt) {
magic_text = .; LONG(0x0f00ba02);
*(.text)
*(.rodata*)
- . = ALIGN(0x1000);
}
- .data : AT(LOADADDR(.text) + SIZEOF(.text)) {
+ . = ALIGN(0x1000);
+ .data : {
magic_data = .; LONG(0x0f00ba03);
*(.data)
*(.ctors)
- . = ALIGN(0x1000);
}
- .bss : AT(LOADADDR(.data) + SIZEOF(.data)) {
+ . = ALIGN(0x1000);
+ .bss : {
*(.bss)
*(COMMON)
- . = ALIGN(0x1000);
}
+
}