Skip to content
Snippets Groups Projects
Commit 97011120 authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity
Browse files

Set WP bit in CR0 to make write protection work


Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 63254428
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#endif #endif
#define X86_CR0_PE 0x00000001 #define X86_CR0_PE 0x00000001
#define X86_CR0_WP 0x00010000
#define X86_CR0_PG 0x80000000 #define X86_CR0_PG 0x80000000
#define X86_CR4_PSE 0x00000010 #define X86_CR4_PSE 0x00000010
static void *free = 0; static void *free = 0;
...@@ -176,7 +177,7 @@ static void setup_mmu(unsigned long len) ...@@ -176,7 +177,7 @@ static void setup_mmu(unsigned long len)
#ifndef __x86_64__ #ifndef __x86_64__
write_cr4(X86_CR4_PSE); write_cr4(X86_CR4_PSE);
#endif #endif
write_cr0(X86_CR0_PG |X86_CR0_PE); write_cr0(X86_CR0_PG |X86_CR0_PE | X86_CR0_WP);
printf("paging enabled\n"); printf("paging enabled\n");
printf("cr0 = %x\n", read_cr0()); printf("cr0 = %x\n", read_cr0());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment