aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-07-25 07:51:16 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:49:47 -0400
commit91269b8f94eedce1767b2f208d656e5a5683326a (patch)
treec689dd55c0146c9eb3a14efdfc6344fb181ccc7f /arch/x86/kvm/emulate.c
parentef2533dae5a93527f2aac9449c0b1564c5ed2c2f (diff)
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>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 66ca98aafdd6..70e47d3593d8 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3028,6 +3028,8 @@ special_insn:
3028 if (c->modrm_reg == 5) 3028 if (c->modrm_reg == 5)
3029 goto jump_far; 3029 goto jump_far;
3030 goto grp45; 3030 goto grp45;
3031 default:
3032 goto cannot_emulate;
3031 } 3033 }
3032 3034
3033writeback: 3035writeback:
@@ -3353,6 +3355,8 @@ twobyte_insn:
3353 if (rc != X86EMUL_CONTINUE) 3355 if (rc != X86EMUL_CONTINUE)
3354 goto done; 3356 goto done;
3355 break; 3357 break;
3358 default:
3359 goto cannot_emulate;
3356 } 3360 }
3357 goto writeback; 3361 goto writeback;
3358 3362