aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-04-20 08:32:49 -0400
committerAvi Kivity <avi@redhat.com>2011-05-22 08:39:14 -0400
commit2d04a05bd7e93c13f13a82ac40de4065a99d069b (patch)
tree6fc122171050ca4b0a6aca5ab5aeb8d94add0108 /arch/x86/kvm/emulate.c
parentfd72c4192220d0086fb24356ac6ff9c3b1e067d9 (diff)
KVM: x86 emulator: emulate CLTS internally
Avoid using ctxt->vcpu; we can do everything with ->get_cr() and ->set_cr(). A side effect is that we no longer activate the fpu on emulated CLTS; but that should be very rare. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 6a512532866..2b903a32609 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2579,6 +2579,16 @@ static int em_invlpg(struct x86_emulate_ctxt *ctxt)
2579 return X86EMUL_CONTINUE; 2579 return X86EMUL_CONTINUE;
2580} 2580}
2581 2581
2582static int em_clts(struct x86_emulate_ctxt *ctxt)
2583{
2584 ulong cr0;
2585
2586 cr0 = ctxt->ops->get_cr(ctxt, 0);
2587 cr0 &= ~X86_CR0_TS;
2588 ctxt->ops->set_cr(ctxt, 0, cr0);
2589 return X86EMUL_CONTINUE;
2590}
2591
2582static bool valid_cr(int nr) 2592static bool valid_cr(int nr)
2583{ 2593{
2584 switch (nr) { 2594 switch (nr) {
@@ -4079,7 +4089,7 @@ twobyte_insn:
4079 rc = emulate_syscall(ctxt, ops); 4089 rc = emulate_syscall(ctxt, ops);
4080 break; 4090 break;
4081 case 0x06: 4091 case 0x06:
4082 emulate_clts(ctxt->vcpu); 4092 rc = em_clts(ctxt);
4083 break; 4093 break;
4084 case 0x09: /* wbinvd */ 4094 case 0x09: /* wbinvd */
4085 kvm_emulate_wbinvd(ctxt->vcpu); 4095 kvm_emulate_wbinvd(ctxt->vcpu);