From: Sergey Dyasli Date: Fri, 5 Jul 2019 08:33:55 +0000 (+0200) Subject: x86/vvmx: set CR4 before CR0 X-Git-Tag: archive/raspbian/4.11.3+24-g14b62ab3e5-1+rpi1^2~55^2~121 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1cf304fc55d9afa86b700d78423379ae8a39d8b3;p=xen.git x86/vvmx: set CR4 before CR0 Otherwise hvm_set_cr0() will check the wrong CR4 bits (L1 instead of L2 and vice-versa). Signed-off-by: Sergey Dyasli Reviewed-by: Andrew Cooper Reviewed-by: Roger Pau Monné Acked-by: Kevin Tian master commit: 3af3c95b81625adf7e6ea71c94b641424741eded master date: 2019-06-28 13:17:53 +0100 --- diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 5b2c43a9a7..a5fb442539 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1059,11 +1059,11 @@ static void load_shadow_guest_state(struct vcpu *v) nvcpu->guest_cr[0] = get_vvmcs(v, CR0_READ_SHADOW); nvcpu->guest_cr[4] = get_vvmcs(v, CR4_READ_SHADOW); - rc = hvm_set_cr0(get_vvmcs(v, GUEST_CR0), 1); + rc = hvm_set_cr4(get_vvmcs(v, GUEST_CR4), 1); if ( rc == X86EMUL_EXCEPTION ) hvm_inject_hw_exception(TRAP_gp_fault, 0); - rc = hvm_set_cr4(get_vvmcs(v, GUEST_CR4), 1); + rc = hvm_set_cr0(get_vvmcs(v, GUEST_CR0), 1); if ( rc == X86EMUL_EXCEPTION ) hvm_inject_hw_exception(TRAP_gp_fault, 0); @@ -1273,11 +1273,11 @@ static void load_vvmcs_host_state(struct vcpu *v) __vmwrite(vmcs_h2g_field[i].guest_field, r); } - rc = hvm_set_cr0(get_vvmcs(v, HOST_CR0), 1); + rc = hvm_set_cr4(get_vvmcs(v, HOST_CR4), 1); if ( rc == X86EMUL_EXCEPTION ) hvm_inject_hw_exception(TRAP_gp_fault, 0); - rc = hvm_set_cr4(get_vvmcs(v, HOST_CR4), 1); + rc = hvm_set_cr0(get_vvmcs(v, HOST_CR0), 1); if ( rc == X86EMUL_EXCEPTION ) hvm_inject_hw_exception(TRAP_gp_fault, 0);