2023-01-15 19:25:25 +00:00
|
|
|
[BITS 32]
|
|
|
|
|
2023-01-20 13:17:11 +00:00
|
|
|
PE_PRESENT equ 1 << 0
|
|
|
|
PE_WRITABLE equ 1 << 1
|
|
|
|
PE_USERMODE equ 1 << 2
|
|
|
|
PE_ACCESSED equ 1 << 5
|
|
|
|
PE_DIRTY equ 1 << 6
|
|
|
|
|
2023-01-15 19:25:25 +00:00
|
|
|
section .data
|
|
|
|
align 4096
|
|
|
|
|
|
|
|
page_directory:
|
2023-01-17 14:36:21 +00:00
|
|
|
times 1024 dd 0x00000000
|
2023-01-15 19:25:25 +00:00
|
|
|
|
|
|
|
section .text
|
|
|
|
|
2023-05-17 07:51:10 +00:00
|
|
|
; Function: setup_paging
|
|
|
|
;
|
|
|
|
; in:
|
|
|
|
; none
|
|
|
|
;
|
|
|
|
; out:
|
|
|
|
; none
|
|
|
|
;
|
2023-01-15 19:25:25 +00:00
|
|
|
global setup_paging
|
|
|
|
setup_paging:
|
|
|
|
mov eax, page_directory
|
|
|
|
mov cr3, eax
|
|
|
|
|
|
|
|
mov eax, cr0
|
2023-05-17 07:51:10 +00:00
|
|
|
or eax, 1 << 31 ; enable paging
|
2023-01-15 19:25:25 +00:00
|
|
|
mov cr0, eax
|
|
|
|
|
|
|
|
ret
|