Fixed it :(

This commit is contained in:
2025-03-22 18:39:54 +01:00
parent 4f543f3fd0
commit f73a6f9ccb
2 changed files with 16 additions and 19 deletions
+1 -1
View File
@@ -51,7 +51,7 @@
.baseLow = (uint16_t)(_base),\ .baseLow = (uint16_t)(_base),\
.baseMid = (uint8_t)((_base) >> 16),\ .baseMid = (uint8_t)((_base) >> 16),\
.access = (_acc),\ .access = (_acc),\
.flags = (_flag << 4) | (((_lim) >> 16) & 0x0f),\ .flags = ((_flag & 0x0f) << 4) | (((_lim) >> 16) & 0x0f),\
.baseHigh = (uint8_t)((_base) >> 24),\ .baseHigh = (uint8_t)((_base) >> 24),\
} }
+12 -15
View File
@@ -17,7 +17,6 @@ multiboot:
dd FLAGS dd FLAGS
dd CHECK dd CHECK
; Initialize stack ; Initialize stack
section .bss section .bss
align 16 align 16
@@ -30,21 +29,23 @@ __kernel_stack_top:
; Entry point ; Entry point
section .boot section .boot
global _start global _start
extern kmain
_start: _start:
; Temporary paging ; init temporary paging
mov edx, (init_pagedir - 0xC0000000) mov ecx, (init_pagedir - 0xC0000000)
mov cr3, edx mov cr3, ecx
mov ecx, cr4
or ecx, 0x10
mov cr4, ecx
mov ecx, cr0 mov ecx, cr0
or ecx, 0x80000000 or ecx, 0x80000000
mov cr0, ecx mov cr0, ecx
jmp $
jmp higher_half jmp higher_half
section .text section .text
extern kmain
higher_half: higher_half:
mov esp, __kernel_stack_top mov esp, __kernel_stack_top
add ebx, 0xC0000000 ; Make it a virtual address add ebx, 0xC0000000 ; Make it a virtual address
@@ -61,15 +62,11 @@ section .data
align 4096 align 4096
global init_pagedir global init_pagedir
init_pagedir: init_pagedir:
dd 0b10000011 ; initial 4mb identity map, unmapped later dd 0b10000011
times 768-1 dd 0
times 768-1 dd 0 ; padding dd (0 << 22) | 0b10000011
; hh kernel start, map 16 mb
dd (0 << 22) | 0b10000011 ; 0xC0000000
dd (1 << 22) | 0b10000011 dd (1 << 22) | 0b10000011
dd (2 << 22) | 0b10000011 dd (2 << 22) | 0b10000011
dd (3 << 22) | 0b10000011 dd (3 << 22) | 0b10000011
times 256-4 dd 0 ; padding times 256-4 dd 0
; dd initial_page_dir | 11b