Last active
May 28, 2017 22:07
-
-
Save le4ker/2134037 to your computer and use it in GitHub Desktop.
Change the page protection in Linux kernel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void disable_page_protection(void) | |
{ | |
unsigned long cr0 = read_cr0(); | |
if(cr0 & (1 << 16)) | |
{ | |
cr0 &= ~ (1 << 16); | |
write_cr0(cr0); | |
} | |
} | |
static void enable_page_protection(void) | |
{ | |
unsigned long cr0 = read_cr0(); | |
if(!(cr0 & (1 << 16))) | |
{ | |
cr0 |= (1 << 16); | |
write_cr0(cr0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment