Skip to content

Commit

Permalink
KVM: x86 emulator: fix handling for unemulated instructions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent ef2533d commit 91269b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 91269b8

Please sign in to comment.