aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorDavid Kaplan <david.kaplan@amd.com>2015-03-06 15:44:35 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2015-03-13 10:46:41 -0400
commit5e57518d99725e8b4ee34cc94669afb79e4cfe4e (patch)
treef24dfcd5423ea842dc74129ef2ccb24e124861a6 /arch/x86
parent2b25385761976f4670b83548f3276183d7b4ceac (diff)
x86: svm: use cr_interception for SVM_EXIT_CR0_SEL_WRITE
Another patch in my war on emulate_on_interception() use as a svm exit handler. These were pulled out of a larger patch at the suggestion of Radim Krcmar, see https://lkml.org/lkml/2015/2/25/559 Changes since v1: * fixed typo introduced after test, retested Signed-off-by: David Kaplan <david.kaplan@amd.com> [separated out just cr_interception part from larger removal of INTERCEPT_CR0_WRITE, forward ported, tested] Signed-off-by: Joel Schopp <joel.schopp@amd.com> Reviewed-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/svm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 8f665851724f..001e630ea7c6 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2944,7 +2944,10 @@ static int cr_interception(struct vcpu_svm *svm)
2944 return emulate_on_interception(svm); 2944 return emulate_on_interception(svm);
2945 2945
2946 reg = svm->vmcb->control.exit_info_1 & SVM_EXITINFO_REG_MASK; 2946 reg = svm->vmcb->control.exit_info_1 & SVM_EXITINFO_REG_MASK;
2947 cr = svm->vmcb->control.exit_code - SVM_EXIT_READ_CR0; 2947 if (svm->vmcb->control.exit_code == SVM_EXIT_CR0_SEL_WRITE)
2948 cr = SVM_EXIT_WRITE_CR0 - SVM_EXIT_READ_CR0;
2949 else
2950 cr = svm->vmcb->control.exit_code - SVM_EXIT_READ_CR0;
2948 2951
2949 err = 0; 2952 err = 0;
2950 if (cr >= 16) { /* mov to cr */ 2953 if (cr >= 16) { /* mov to cr */
@@ -3328,7 +3331,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = {
3328 [SVM_EXIT_READ_CR3] = cr_interception, 3331 [SVM_EXIT_READ_CR3] = cr_interception,
3329 [SVM_EXIT_READ_CR4] = cr_interception, 3332 [SVM_EXIT_READ_CR4] = cr_interception,
3330 [SVM_EXIT_READ_CR8] = cr_interception, 3333 [SVM_EXIT_READ_CR8] = cr_interception,
3331 [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, 3334 [SVM_EXIT_CR0_SEL_WRITE] = cr_interception,
3332 [SVM_EXIT_WRITE_CR0] = cr_interception, 3335 [SVM_EXIT_WRITE_CR0] = cr_interception,
3333 [SVM_EXIT_WRITE_CR3] = cr_interception, 3336 [SVM_EXIT_WRITE_CR3] = cr_interception,
3334 [SVM_EXIT_WRITE_CR4] = cr_interception, 3337 [SVM_EXIT_WRITE_CR4] = cr_interception,