ia64/xen-unstable

changeset 14843:52d1022c431a

hvm svm: Fix nested paging to support domain save/restore.
Signed-off-by: Wei Huang <wei.huang2@amd.com>
author kfraser@localhost.localdomain
date Fri Apr 13 11:20:11 2007 +0100 (2007-04-13)
parents f92a79e39da8
children 986b102f84c2
files xen/arch/x86/hvm/svm/svm.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Fri Apr 13 11:14:26 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Fri Apr 13 11:20:11 2007 +0100
     1.3 @@ -321,9 +321,7 @@ int svm_vmcb_restore(struct vcpu *v, str
     1.4      vmcb->rflags = c->rflags;
     1.5  
     1.6      v->arch.hvm_svm.cpu_shadow_cr0 = c->cr0;
     1.7 -    vmcb->cr0 = c->cr0 | X86_CR0_WP | X86_CR0_ET;
     1.8 -    if ( !paging_mode_hap(v->domain) ) 
     1.9 -        vmcb->cr0 |= X86_CR0_PG;
    1.10 +    vmcb->cr0 = c->cr0 | X86_CR0_WP | X86_CR0_ET | X86_CR0_PG;
    1.11  
    1.12      v->arch.hvm_svm.cpu_cr2 = c->cr2;
    1.13  
    1.14 @@ -424,6 +422,16 @@ int svm_vmcb_restore(struct vcpu *v, str
    1.15      vmcb->sysenter_esp = c->sysenter_esp;
    1.16      vmcb->sysenter_eip = c->sysenter_eip;
    1.17  
    1.18 +    /* update VMCB for nested paging restore */
    1.19 +    if ( paging_mode_hap(v->domain) ) {
    1.20 +        vmcb->cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
    1.21 +        vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4;
    1.22 +        vmcb->cr3 = c->cr3;
    1.23 +        vmcb->np_enable = 1;
    1.24 +        vmcb->g_pat = 0x0007040600070406ULL; /* guest PAT */
    1.25 +        vmcb->h_cr3 = pagetable_get_paddr(v->domain->arch.phys_table);
    1.26 +    }
    1.27 +
    1.28      vmcb->dr6 = c->dr6;
    1.29      vmcb->dr7 = c->dr7;
    1.30