From: Amelia Coutard Date: Thu, 5 May 2022 17:11:06 +0000 (+0200) Subject: Moved the kernel to 1MiB (to avoid problems with low memory-mapped IO). X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=5c73cacd283b9c17fd5777f29707ae87f8150714;p=voyage-au-centre-des-fichiers.git Moved the kernel to 1MiB (to avoid problems with low memory-mapped IO). Also had to change the low mapping to 2GiB instead of 2MiB, because the stack finished after 2MiB. --- diff --git a/linker.ld b/linker.ld index 60de5eb..7c4e9f6 100644 --- a/linker.ld +++ b/linker.ld @@ -3,6 +3,8 @@ ENTRY(_start) KERNEL_VMA = 0xFFFFFFFF80000000; SECTIONS { + . = 1M; + .bootstrap ALIGN(4K) : { *(.multiboot_header) . = ALIGN(4K); diff --git a/src/boot.S b/src/boot.S index e745a0f..53a9162 100644 --- a/src/boot.S +++ b/src/boot.S @@ -77,16 +77,21 @@ TSS: TSS_END: .set TSS_SIZE, TSS_END - TSS .align 0x1000 +#TODO replace with actual RAM detection +.globl test_ram +test_ram: .quad 256 + .quad 0 + .skip 0x1000 * 256 - 16 # 1MiB RAM +PDPT_low: .quad 0x83 + .quad 0x83 + 1024 * 1024 * 1024 + .skip 0x1000 - 16 PDPT_high: .skip 0x1000 - 16 .quad 0x83 .quad 0x83 + 1024 * 1024 * 1024 .section .bss .align 0x1000 -PML4T: .skip 0x1000 -PDPT_low: .skip 0x1000 -PDT: .skip 0x1000 -PT: .skip 0x1000 +PML4T: .skip 0x1000 phys_mem_map: .skip 0x1000 * 128 - 8 .align 16 stack_bottom: @@ -152,21 +157,9 @@ _start: mov $PML4T - KERNEL_VMA, %eax mov %eax, %cr3 mov $PDPT_low - KERNEL_VMA + 3, %eax - mov %eax, PML4T - KERNEL_VMA + 0 * 8 + mov %eax, PML4T - KERNEL_VMA + 0 * 8 mov $PDPT_high - KERNEL_VMA + 3, %eax mov %eax, PML4T - KERNEL_VMA + 511 * 8 - mov $PDT - KERNEL_VMA + 3, %eax - mov %eax, PDPT_low - KERNEL_VMA + 0 * 8 - mov $PT - KERNEL_VMA + 3, %eax - mov %eax, PDT - KERNEL_VMA + 0 * 8 - - mov $PT - KERNEL_VMA, %edi - mov $0x0003, %ebx - mov $512, %ecx -1: mov %ebx, (%edi) - add $0x1000, %ebx - add $8, %edi - loop 1b # Enable PAE paging: mov %cr4, %eax