From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH] KVM: x86 emulator: fix handling for unemulated instructions Date: Sun, 25 Jul 2010 14:51:16 +0300 Message-ID: <1280058676-8367-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org, Mohammed Gamal Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40865 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751162Ab0GYLvT (ORCPT ); Sun, 25 Jul 2010 07:51:19 -0400 Sender: kvm-owner@vger.kernel.org List-ID: 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 --- arch/x86/kvm/emulate.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index b38bd8b..a12512d 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3029,6 +3029,8 @@ special_insn: if (c->modrm_reg == 5) goto jump_far; goto grp45; + default: + goto cannot_emulate; } writeback: @@ -3354,6 +3356,8 @@ twobyte_insn: if (rc != X86EMUL_CONTINUE) goto done; break; + default: + goto cannot_emulate; } goto writeback; -- 1.7.1