diff options
author | Joerg Roedel <jroedel@lemmy.amd.com> | 2007-12-06 09:46:52 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:19 -0500 |
commit | 152ff9be2ed11e76ed3014b94eacdd6bc9275518 (patch) | |
tree | 9c5c561bddb17e3195ee51b559184bd6fa636884 | |
parent | e5314067f6a77688a3d36548e7618430ce4a6236 (diff) |
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>
-rw-r--r-- | drivers/kvm/x86.c | 5 |
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) | |||
2236 | return vcpu->cr3; | 2236 | return vcpu->cr3; |
2237 | case 4: | 2237 | case 4: |
2238 | return vcpu->cr4; | 2238 | return vcpu->cr4; |
2239 | case 8: | ||
2240 | return get_cr8(vcpu); | ||
2239 | default: | 2241 | default: |
2240 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); | 2242 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); |
2241 | return 0; | 2243 | return 0; |
@@ -2259,6 +2261,9 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val, | |||
2259 | case 4: | 2261 | case 4: |
2260 | set_cr4(vcpu, mk_cr_64(vcpu->cr4, val)); | 2262 | set_cr4(vcpu, mk_cr_64(vcpu->cr4, val)); |
2261 | break; | 2263 | break; |
2264 | case 8: | ||
2265 | set_cr8(vcpu, val & 0xfUL); | ||
2266 | break; | ||
2262 | default: | 2267 | default: |
2263 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); | 2268 | vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr); |
2264 | } | 2269 | } |