summaryrefslogtreecommitdiffstats
path: root/drivers/kvm
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@lemmy.amd.com>2007-12-06 15:46:52 +0100
committerAvi Kivity <avi@qumranet.com>2008-01-30 16:53:19 +0100
commit152ff9be2ed11e76ed3014b94eacdd6bc9275518 (patch)
tree9c5c561bddb17e3195ee51b559184bd6fa636884 /drivers/kvm
parentKVM: VMX: Avoid exit when setting cr8 if the local apic is in the kernel (diff)
downloadlinux-152ff9be2ed11e76ed3014b94eacdd6bc9275518.tar.xz
linux-152ff9be2ed11e76ed3014b94eacdd6bc9275518.zip
KVM: SVM: Emulate read/write access to cr8
This patch adds code to emulate the access to the cr8 register to the x86 instruction emulator in kvm. This is needed on svm, where there is no hardware decode for control register access. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Markus Rechberger <markus.rechberger@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r--drivers/kvm/x86.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 6deb052b5f93..9db4e3242b62 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -2236,6 +2236,8 @@ unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr)
return vcpu->cr3;
case 4:
return vcpu->cr4;
+ case 8:
+ return get_cr8(vcpu);
default:
vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr);
return 0;
@@ -2259,6 +2261,9 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val,
case 4:
set_cr4(vcpu, mk_cr_64(vcpu->cr4, val));
break;
+ case 8:
+ set_cr8(vcpu, val & 0xfUL);
+ break;
default:
vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr);
}