diff options
Diffstat (limited to 'src/kernel/boot.asm')
-rw-r--r-- | src/kernel/boot.asm | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/src/kernel/boot.asm b/src/kernel/boot.asm index 6aa5c1a..1e8d3ee 100644 --- a/src/kernel/boot.asm +++ b/src/kernel/boot.asm @@ -1,28 +1,17 @@ bits 32 -; Some variables -kernel_virt_base equ 0xC0000000 -kernel_page_number equ (kernel_virt_base >> 22) kernel_stack equ 0x4000 - -section .data - align 0x1000 - - boot_page_dir: - dd 0x00000083 - times (kernel_page_number - 1) dd 0 - dd 0x00000083 - times (1024 - kernel_page_number - 1) dd 0 +multiboot_magic equ 0xe85250d6 section .text align 4 multiboot: header_start: - dd 0xe85250d6 + dd multiboot_magic dd 0 dd header_end - header_start - dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start)) + dd 0x100000000 - (multiboot_magic + 0 + (header_end - header_start)) ; Information tag align 8 @@ -34,12 +23,6 @@ section .text dd 6 ; mmap dd 13 ; smbios - ; Page-align tag - align 8 - dw 6 - dw 0 - dd 8 - ; Empty tag align 8 dw 0 @@ -50,33 +33,17 @@ section .text global boot extern kernel_main boot: - mov ecx, (boot_page_dir - kernel_virt_base) - mov cr3, ecx - - mov ecx, cr4 - or ecx, 0x00000010 - mov cr4, ecx - - mov ecx, cr0 - or ecx, 0x80000000 - mov cr0, ecx - - lea ecx, [higher_half] - jmp ecx - - higher_half: - mov dword [boot_page_dir], 0 - invlpg [0] - - mov esp, stack + kernel_stack + mov esp, stack_top push esp push ebx push eax cli call kernel_main hlt + jmp $ section .bss align 32 - stack: - resb kernel_stack
\ No newline at end of file + stack_bottom: + resb kernel_stack + stack_top:
\ No newline at end of file |