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>
This commit is contained in:
parent
fd72c41922
commit
2d04a05bd7
3 changed files with 11 additions and 9 deletions
|
@ -2579,6 +2579,16 @@ static int em_invlpg(struct x86_emulate_ctxt *ctxt)
|
|||
return X86EMUL_CONTINUE;
|
||||
}
|
||||
|
||||
static int em_clts(struct x86_emulate_ctxt *ctxt)
|
||||
{
|
||||
ulong cr0;
|
||||
|
||||
cr0 = ctxt->ops->get_cr(ctxt, 0);
|
||||
cr0 &= ~X86_CR0_TS;
|
||||
ctxt->ops->set_cr(ctxt, 0, cr0);
|
||||
return X86EMUL_CONTINUE;
|
||||
}
|
||||
|
||||
static bool valid_cr(int nr)
|
||||
{
|
||||
switch (nr) {
|
||||
|
@ -4079,7 +4089,7 @@ twobyte_insn:
|
|||
rc = emulate_syscall(ctxt, ops);
|
||||
break;
|
||||
case 0x06:
|
||||
emulate_clts(ctxt->vcpu);
|
||||
rc = em_clts(ctxt);
|
||||
break;
|
||||
case 0x09: /* wbinvd */
|
||||
kvm_emulate_wbinvd(ctxt->vcpu);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue