aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-04-30 11:56:02 -0400
committerAvi Kivity <avi@qumranet.com>2008-07-20 05:40:48 -0400
commit54e445ca8411ec892f986d9f8c11b8c1806ecde4 (patch)
treee6fd3aa72296eba31a23977d2c6d82d186a8f4aa /arch/x86/kvm/x86.c
parenta069805579a390f0fa91694f6963bcc4b2cecc6b (diff)
KVM: add missing kvmtrace bits
This patch adds some kvmtrace bits to the generic x86 code where it is instrumented from SVM. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 45dc2b6a9c82..59084a3981c0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2020,6 +2020,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
2020 2020
2021int emulate_clts(struct kvm_vcpu *vcpu) 2021int emulate_clts(struct kvm_vcpu *vcpu)
2022{ 2022{
2023 KVMTRACE_0D(CLTS, vcpu, handler);
2023 kvm_x86_ops->set_cr0(vcpu, vcpu->arch.cr0 & ~X86_CR0_TS); 2024 kvm_x86_ops->set_cr0(vcpu, vcpu->arch.cr0 & ~X86_CR0_TS);
2024 return X86EMUL_CONTINUE; 2025 return X86EMUL_CONTINUE;
2025} 2026}
@@ -2600,27 +2601,41 @@ void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw,
2600 2601
2601unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr) 2602unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr)
2602{ 2603{
2604 unsigned long value;
2605
2603 kvm_x86_ops->decache_cr4_guest_bits(vcpu); 2606 kvm_x86_ops->decache_cr4_guest_bits(vcpu);
2604 switch (cr) { 2607 switch (cr) {
2605 case 0: 2608 case 0:
2606 return vcpu->arch.cr0; 2609 value = vcpu->arch.cr0;
2610 break;
2607 case 2: 2611 case 2:
2608 return vcpu->arch.cr2; 2612 value = vcpu->arch.cr2;
2613 break;
2609 case 3: 2614 case 3:
2610 return vcpu->arch.cr3; 2615 value = vcpu->arch.cr3;
2616 break;
2611 case 4: 2617 case 4:
2612 return vcpu->arch.cr4; 2618 value = vcpu->arch.cr4;
2619 break;
2613 case 8: 2620 case 8:
2614 return kvm_get_cr8(vcpu); 2621 value = kvm_get_cr8(vcpu);
2622 break;
2615 default: 2623 default:
2616 vcpu_printf(vcpu, "%s: unexpected cr %u\n", __func__, cr); 2624 vcpu_printf(vcpu, "%s: unexpected cr %u\n", __func__, cr);
2617 return 0; 2625 return 0;
2618 } 2626 }
2627 KVMTRACE_3D(CR_READ, vcpu, (u32)cr, (u32)value,
2628 (u32)((u64)value >> 32), handler);
2629
2630 return value;
2619} 2631}
2620 2632
2621void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val, 2633void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val,
2622 unsigned long *rflags) 2634 unsigned long *rflags)
2623{ 2635{
2636 KVMTRACE_3D(CR_WRITE, vcpu, (u32)cr, (u32)val,
2637 (u32)((u64)val >> 32), handler);
2638
2624 switch (cr) { 2639 switch (cr) {
2625 case 0: 2640 case 0:
2626 kvm_set_cr0(vcpu, mk_cr_64(vcpu->arch.cr0, val)); 2641 kvm_set_cr0(vcpu, mk_cr_64(vcpu->arch.cr0, val));