KVM: x86 emulator: fix handling for unemulated instructions

If an instruction is present in the decode tables but not in the execution
switch, it will be emulated as a NOP.  An example is IRET (0xcf).

Fix by adding default: labels to the execution switches.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Avi Kivity 2010-07-25 14:51:16 +03:00
parent ef2533dae5
commit 91269b8f94
1 changed files with 4 additions and 0 deletions

View File

@ -3028,6 +3028,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
if (c->modrm_reg == 5)
goto jump_far;
goto grp45;
default:
goto cannot_emulate;
}
writeback:
@ -3353,6 +3355,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
if (rc != X86EMUL_CONTINUE)
goto done;
break;
default:
goto cannot_emulate;
}
goto writeback;