diff options
| -rw-r--r-- | arch/x86/kvm/vmx.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 72f78396bc09..880f371705bc 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -7913,11 +7913,13 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu, | |||
| 7913 | { | 7913 | { |
| 7914 | unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); | 7914 | unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); |
| 7915 | int cr = exit_qualification & 15; | 7915 | int cr = exit_qualification & 15; |
| 7916 | int reg = (exit_qualification >> 8) & 15; | 7916 | int reg; |
| 7917 | unsigned long val = kvm_register_readl(vcpu, reg); | 7917 | unsigned long val; |
| 7918 | 7918 | ||
| 7919 | switch ((exit_qualification >> 4) & 3) { | 7919 | switch ((exit_qualification >> 4) & 3) { |
| 7920 | case 0: /* mov to cr */ | 7920 | case 0: /* mov to cr */ |
| 7921 | reg = (exit_qualification >> 8) & 15; | ||
| 7922 | val = kvm_register_readl(vcpu, reg); | ||
| 7921 | switch (cr) { | 7923 | switch (cr) { |
| 7922 | case 0: | 7924 | case 0: |
| 7923 | if (vmcs12->cr0_guest_host_mask & | 7925 | if (vmcs12->cr0_guest_host_mask & |
| @@ -7972,6 +7974,7 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu, | |||
| 7972 | * lmsw can change bits 1..3 of cr0, and only set bit 0 of | 7974 | * lmsw can change bits 1..3 of cr0, and only set bit 0 of |
| 7973 | * cr0. Other attempted changes are ignored, with no exit. | 7975 | * cr0. Other attempted changes are ignored, with no exit. |
| 7974 | */ | 7976 | */ |
| 7977 | val = (exit_qualification >> LMSW_SOURCE_DATA_SHIFT) & 0x0f; | ||
| 7975 | if (vmcs12->cr0_guest_host_mask & 0xe & | 7978 | if (vmcs12->cr0_guest_host_mask & 0xe & |
| 7976 | (val ^ vmcs12->cr0_read_shadow)) | 7979 | (val ^ vmcs12->cr0_read_shadow)) |
| 7977 | return true; | 7980 | return true; |
