mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-17 06:47:49 +00:00
Add and setup a P4 and a P3 table
This commit is contained in:
@@ -23,10 +23,23 @@ start:
|
|||||||
call check_cpuid
|
call check_cpuid
|
||||||
call check_long_mode
|
call check_long_mode
|
||||||
|
|
||||||
|
call setup_page_tables
|
||||||
|
|
||||||
; print `OK` to screen
|
; print `OK` to screen
|
||||||
mov dword [0xb8000], 0x2f4b2f4f
|
mov dword [0xb8000], 0x2f4b2f4f
|
||||||
hlt
|
hlt
|
||||||
|
|
||||||
|
setup_page_tables:
|
||||||
|
; map first P4 entry to P3 table
|
||||||
|
mov eax, p3_table
|
||||||
|
or eax, 0b11 ; present + writable
|
||||||
|
mov [p4_table], eax
|
||||||
|
|
||||||
|
; map first P3 entry to a huge page that starts at address 0
|
||||||
|
mov dword [p3_table], 0b10000011 ; present + writable + huge
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
; Prints `ERR: ` and the given error code to screen and hangs.
|
; Prints `ERR: ` and the given error code to screen and hangs.
|
||||||
; parameter: error code (in ascii) in al
|
; parameter: error code (in ascii) in al
|
||||||
error:
|
error:
|
||||||
@@ -80,6 +93,11 @@ check_long_mode:
|
|||||||
jmp error
|
jmp error
|
||||||
|
|
||||||
section .bss
|
section .bss
|
||||||
|
align 4096
|
||||||
|
p4_table:
|
||||||
|
resb 4096
|
||||||
|
p3_table:
|
||||||
|
resb 4096
|
||||||
stack_bottom:
|
stack_bottom:
|
||||||
resb 64
|
resb 64
|
||||||
stack_top:
|
stack_top:
|
||||||
|
|||||||
Reference in New Issue
Block a user