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

[Xen-changelog] [xen-unstable] hvm svm: Fix nested paging to support domain save/restore.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1176459611 -3600
# Node ID 52d1022c431aa058a9df7c8591c42e2614b0b6a7
# Parent  f92a79e39da872c5632a8490ebb97e2e1fcbca28
hvm svm: Fix nested paging to support domain save/restore.
Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff -r f92a79e39da8 -r 52d1022c431a xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Apr 13 11:14:26 2007 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Apr 13 11:20:11 2007 +0100
@@ -321,9 +321,7 @@ int svm_vmcb_restore(struct vcpu *v, str
     vmcb->rflags = c->rflags;
 
     v->arch.hvm_svm.cpu_shadow_cr0 = c->cr0;
-    vmcb->cr0 = c->cr0 | X86_CR0_WP | X86_CR0_ET;
-    if ( !paging_mode_hap(v->domain) ) 
-        vmcb->cr0 |= X86_CR0_PG;
+    vmcb->cr0 = c->cr0 | X86_CR0_WP | X86_CR0_ET | X86_CR0_PG;
 
     v->arch.hvm_svm.cpu_cr2 = c->cr2;
 
@@ -423,6 +421,16 @@ int svm_vmcb_restore(struct vcpu *v, str
     vmcb->sysenter_cs =  c->sysenter_cs;
     vmcb->sysenter_esp = c->sysenter_esp;
     vmcb->sysenter_eip = c->sysenter_eip;
+
+    /* update VMCB for nested paging restore */
+    if ( paging_mode_hap(v->domain) ) {
+        vmcb->cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
+        vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4;
+        vmcb->cr3 = c->cr3;
+        vmcb->np_enable = 1;
+        vmcb->g_pat = 0x0007040600070406ULL; /* guest PAT */
+        vmcb->h_cr3 = pagetable_get_paddr(v->domain->arch.phys_table);
+    }
 
     vmcb->dr6 = c->dr6;
     vmcb->dr7 = c->dr7;

_______________________________________________
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®.