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

[Xen-changelog] [xen-unstable] [SVM] Make sure that the WP bit is always set in CR0 when running SVM guests.



# HG changeset patch
# User Steven Smith <ssmith@xxxxxxxxxxxxx>
# Node ID 4ddda0bbb57c025b8620af613def2c2bbb8b77ae
# Parent  2ef0f17a9af9b6b3b2f76460e0f9da5112c0bd79
[SVM] Make sure that the WP bit is always set in CR0 when running SVM guests.
This is necessary to be sure that the shadow mode code can always detect
writes to guest page tables.

This should fix Windows restore from hibernation on SVM platforms.

Signed-off-by: Tom Woller <thomas.woller@xxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c  |    4 ++--
 xen/arch/x86/hvm/svm/vmcb.c |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff -r 2ef0f17a9af9 -r 4ddda0bbb57c xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Wed Nov 22 18:36:48 2006 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Nov 23 09:36:48 2006 +0000
@@ -1441,7 +1441,7 @@ static int svm_set_cr0(unsigned long val
     /* We don't want to lose PG.  ET is reserved and should be always be 1*/
     paging_enabled = svm_paging_enabled(v);
     value |= X86_CR0_ET;
-    vmcb->cr0 = value | X86_CR0_PG;
+    vmcb->cr0 = value | X86_CR0_PG | X86_CR0_WP;
     v->arch.hvm_svm.cpu_shadow_cr0 = value;
 
     /* TS cleared? Then initialise FPU now. */
@@ -2094,7 +2094,7 @@ static int svm_do_vmmcall_reset_to_realm
     vmcb->tsc_offset = 0;
 
     /* VMCB State */
-    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG;
+    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG | X86_CR0_WP;
     v->arch.hvm_svm.cpu_shadow_cr0 = X86_CR0_ET;
 
     vmcb->cr2 = 0;
diff -r 2ef0f17a9af9 -r 4ddda0bbb57c xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Wed Nov 22 18:36:48 2006 +0000
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Thu Nov 23 09:36:48 2006 +0000
@@ -197,6 +197,7 @@ static int construct_vmcb(struct vcpu *v
     /* Guest CR0. */
     vmcb->cr0 = read_cr0();
     arch_svm->cpu_shadow_cr0 = vmcb->cr0 & ~(X86_CR0_PG | X86_CR0_TS);
+    vmcb->cr0 |= X86_CR0_WP;
 
     /* Guest CR4. */
     arch_svm->cpu_shadow_cr4 =

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.