1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Enable page write protection for both kernel and user space

If the WP bit in CR0 is not set then write protection for pages is only
enforced for user-land code.
This commit is contained in:
Achilleas Anagnostopoulos 2017-06-22 06:24:30 +01:00
parent 42ee2d1325
commit 56d23f50ae

View File

@ -304,9 +304,9 @@ _rt0_enter_long_mode:
or eax, (1 << 8) | (1<<11)
wrmsr
; Finally enable paging
; Finally enable paging (bit 31) and user/kernel page write protection (bit 16)
mov eax, cr0
or eax, 1 << 31
or eax, (1 << 31) | (1<<16)
mov cr0, eax
; We are in 32-bit compatibility submode. We need to load a 64bit GDT