Added enable/disable paging function.

This commit is contained in:
HyperAssembler 2015-01-27 23:58:26 -08:00
parent 7510138980
commit e1b29f2966
1 changed files with 15 additions and 0 deletions

View File

@ -61,4 +61,19 @@ xor eax,eax
.end
mov esp,ebp
pop ebp
ret
;void hk_disable_paging(void)
hk_disable_paging:
mov eax, cr0 ; Set the A-register to control register 0.
and eax, 01111111111111111111111111111111b ; Clear the PG-bit, which is bit 31.
mov cr0, eax ; Set control register 0 to the A-register.
ret
;void hk_enable_paging(void)
hk_enable_paging:
mov eax, cr0 ; Set the A-register to control register 0.
or eax, 1 << 31 ; Set the PG-bit, which is bit 31.
mov cr0, eax ; Set control register 0 to the A-register.
ret