diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2010-07-06 04:54:19 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 23:40:26 -0400 |
commit | 07cbc6c185aee2c0479776845988242a040c7c93 (patch) | |
tree | b47ff3619fe38985273a51e663a81d41674a9ee0 /arch/x86/kvm/emulate.c | |
parent | b16b2b7bb5a78afceb7fe22f2a04476cd70182b7 (diff) |
KVM: x86 emulator: fix cli/sti instruction emulation
If IOPL check fail, the cli/sti emulate GP and then we should
skip writeback since the default write OP is OP_REG.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8337567a0f44..286572a5675b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -2979,17 +2979,19 @@ special_insn: | |||
2979 | c->dst.type = OP_NONE; /* Disable writeback. */ | 2979 | c->dst.type = OP_NONE; /* Disable writeback. */ |
2980 | break; | 2980 | break; |
2981 | case 0xfa: /* cli */ | 2981 | case 0xfa: /* cli */ |
2982 | if (emulator_bad_iopl(ctxt, ops)) | 2982 | if (emulator_bad_iopl(ctxt, ops)) { |
2983 | emulate_gp(ctxt, 0); | 2983 | emulate_gp(ctxt, 0); |
2984 | else { | 2984 | goto done; |
2985 | } else { | ||
2985 | ctxt->eflags &= ~X86_EFLAGS_IF; | 2986 | ctxt->eflags &= ~X86_EFLAGS_IF; |
2986 | c->dst.type = OP_NONE; /* Disable writeback. */ | 2987 | c->dst.type = OP_NONE; /* Disable writeback. */ |
2987 | } | 2988 | } |
2988 | break; | 2989 | break; |
2989 | case 0xfb: /* sti */ | 2990 | case 0xfb: /* sti */ |
2990 | if (emulator_bad_iopl(ctxt, ops)) | 2991 | if (emulator_bad_iopl(ctxt, ops)) { |
2991 | emulate_gp(ctxt, 0); | 2992 | emulate_gp(ctxt, 0); |
2992 | else { | 2993 | goto done; |
2994 | } else { | ||
2993 | ctxt->interruptibility = KVM_X86_SHADOW_INT_STI; | 2995 | ctxt->interruptibility = KVM_X86_SHADOW_INT_STI; |
2994 | ctxt->eflags |= X86_EFLAGS_IF; | 2996 | ctxt->eflags |= X86_EFLAGS_IF; |
2995 | c->dst.type = OP_NONE; /* Disable writeback. */ | 2997 | c->dst.type = OP_NONE; /* Disable writeback. */ |