Broke it :)

This commit is contained in:
2025-03-22 18:19:26 +01:00
parent c3f8d7d8f2
commit 4f543f3fd0
4 changed files with 56 additions and 35 deletions
+35 -4
View File
@@ -28,13 +28,28 @@ __kernel_stack_bottom:
__kernel_stack_top:
; Entry point
section .text
section .boot
global _start
extern kmain
_start:
_start:
; Temporary paging
mov edx, (init_pagedir - 0xC0000000)
mov cr3, edx
mov ecx, cr0
or ecx, 0x80000000
mov cr0, ecx
jmp $
jmp higher_half
section .text
higher_half:
mov esp, __kernel_stack_top
push eax
push ebx
add ebx, 0xC0000000 ; Make it a virtual address
push eax ; Magic
push ebx ; Multiboot info
call kmain ; Call kernel main
; Hang if kernel returns
@@ -42,3 +57,19 @@ _start:
.hlt: hlt
jmp .hlt
section .data
align 4096
global init_pagedir
init_pagedir:
dd 0b10000011 ; initial 4mb identity map, unmapped later
times 768-1 dd 0 ; padding
; hh kernel start, map 16 mb
dd (0 << 22) | 0b10000011 ; 0xC0000000
dd (1 << 22) | 0b10000011
dd (2 << 22) | 0b10000011
dd (3 << 22) | 0b10000011
times 256-4 dd 0 ; padding
; dd initial_page_dir | 11b