提交 aca06a83 编写于 作者: G Gleb Natapov 提交者: Avi Kivity

KVM: x86 emulator: cleanup grp3 return value

When x86_emulate_insn() does not know how to emulate instruction it
exits via cannot_emulate label in all cases except when emulating
grp3. Fix that.
Signed-off-by: NGleb Natapov <gleb@redhat.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
上级 a41ffb75
...@@ -1397,7 +1397,6 @@ static inline int emulate_grp3(struct x86_emulate_ctxt *ctxt, ...@@ -1397,7 +1397,6 @@ static inline int emulate_grp3(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops) struct x86_emulate_ops *ops)
{ {
struct decode_cache *c = &ctxt->decode; struct decode_cache *c = &ctxt->decode;
int rc = X86EMUL_CONTINUE;
switch (c->modrm_reg) { switch (c->modrm_reg) {
case 0 ... 1: /* test */ case 0 ... 1: /* test */
...@@ -1410,11 +1409,9 @@ static inline int emulate_grp3(struct x86_emulate_ctxt *ctxt, ...@@ -1410,11 +1409,9 @@ static inline int emulate_grp3(struct x86_emulate_ctxt *ctxt,
emulate_1op("neg", c->dst, ctxt->eflags); emulate_1op("neg", c->dst, ctxt->eflags);
break; break;
default: default:
DPRINTF("Cannot emulate %02x\n", c->b); return 0;
rc = X86EMUL_UNHANDLEABLE;
break;
} }
return rc; return 1;
} }
static inline int emulate_grp45(struct x86_emulate_ctxt *ctxt, static inline int emulate_grp45(struct x86_emulate_ctxt *ctxt,
...@@ -2374,9 +2371,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) ...@@ -2374,9 +2371,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
c->dst.type = OP_NONE; /* Disable writeback. */ c->dst.type = OP_NONE; /* Disable writeback. */
break; break;
case 0xf6 ... 0xf7: /* Grp3 */ case 0xf6 ... 0xf7: /* Grp3 */
rc = emulate_grp3(ctxt, ops); if (!emulate_grp3(ctxt, ops))
if (rc != X86EMUL_CONTINUE) goto cannot_emulate;
goto done;
break; break;
case 0xf8: /* clc */ case 0xf8: /* clc */
ctxt->eflags &= ~EFLG_CF; ctxt->eflags &= ~EFLG_CF;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册