[PATCH unit-tests 11/16] Set WP bit in CR0 to make write protection work.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
---
 lib/x86/vm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index 4d0a955..1ca8a05 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -9,6 +9,7 @@
 #endif
 
 #define X86_CR0_PE      0x00000001
+#define X86_CR0_WP      0x00010000
 #define X86_CR0_PG      0x80000000
 #define X86_CR4_PSE     0x00000010
 static void *free = 0;
@@ -176,7 +177,7 @@ static void setup_mmu(unsigned long len)
 #ifndef __x86_64__
     write_cr4(X86_CR4_PSE);
 #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("cr0 = %x\n", read_cr0());
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux