From patchwork Sat Aug 14 15:51:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 119588 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7EFq0mV007134 for ; Sat, 14 Aug 2010 15:52:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756877Ab0HNPv5 (ORCPT ); Sat, 14 Aug 2010 11:51:57 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:33946 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755994Ab0HNPv5 (ORCPT ); Sat, 14 Aug 2010 11:51:57 -0400 Received: by mail-ww0-f44.google.com with SMTP id 40so4351140wwj.1 for ; Sat, 14 Aug 2010 08:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=xFZR8IyAj4KS0j89zgd05za7X4qjcaH1pascicgVktk=; b=LgLficJnEJKI3qj/njHKvfMJS4B+tMAfzTxYnAqJ0v92ceKPjgVU0NMbDk+3sZ5l8C mbP6jsn0OpqWOKJcRWr2Uh6YL9E8amp9/vIrh7jfIOdHBiFmymzOdJzlNp7AsTB+MJCm YyxKEJmy13Kx7dhS7PTFaZz9PWQmuciPPzd9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=fz8cugymoT41D878h6EMYPmxCu4QsCQA7cvZ3C6NXCvhXj3dFdRCVtFA1PMz8uU7t9 8aCx4rcZ12xmn+9kWDu80Py7TtP3YGxIKJ7YA4lTLv461ynsYBZVVMpekWVU0Uzsp+JT +98D9Rw/pEoilVSECy0uMNx2SSBMnIRGGHO30= Received: by 10.227.147.75 with SMTP id k11mr2519392wbv.161.1281801116514; Sat, 14 Aug 2010 08:51:56 -0700 (PDT) Received: from localhost.localdomain ([188.55.88.49]) by mx.google.com with ESMTPS id a28sm3467727wbe.9.2010.08.14.08.51.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 14 Aug 2010 08:51:55 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH 2/2] x86: Bail out on unemulated instructions Date: Sat, 14 Aug 2010 18:51:34 +0300 Message-Id: <1281801094-4515-2-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1281801094-4515-1-git-send-email-m.gamal005@gmail.com> References: <1281801094-4515-1-git-send-email-m.gamal005@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 14 Aug 2010 15:52:00 +0000 (UTC) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 416aa0e..a31db44 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4036,6 +4036,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu, } ++vcpu->stat.insn_emulation; + if (r == X86EMUL_UNHANDLEABLE) + return handle_emulation_failure(vcpu); + if (r) { if (reexecute_instruction(vcpu, cr2)) return EMULATE_DONE; @@ -4057,6 +4060,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu, restart: r = x86_emulate_insn(&vcpu->arch.emulate_ctxt); + if (r == X86EMUL_UNHANDLEABLE) + return handle_emulation_failure(vcpu); + if (r) { /* emulation failed */ if (reexecute_instruction(vcpu, cr2)) return EMULATE_DONE;