From patchwork Sat Aug 14 15:51:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 119587 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 o7EFpsP4007103 for ; Sat, 14 Aug 2010 15:51:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756827Ab0HNPvv (ORCPT ); Sat, 14 Aug 2010 11:51:51 -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 S1755994Ab0HNPvu (ORCPT ); Sat, 14 Aug 2010 11:51:50 -0400 Received: by wwj40 with SMTP id 40so4351140wwj.1 for ; Sat, 14 Aug 2010 08:51:49 -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; bh=F5PpTl0tYkHBXtPAtm3fyftG4/v/cNK8x+snad454pY=; b=VgKMKx2xTCYPDxkfubb+wSUkevPBvQoJT8Ms+ENte3ejzXxdn+dHdmVVzhxcN40CKw MUmXds4jqxCsoTdutOWVkXXl99aHLOfj6AvOVC1b3h2BcGMOLhdukBPvB+HtNlxRawmp iDf4Q4jJoVG2Gh6fwabVr62F8lwddWx42Vjlo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=M4WKYJpi9yGz6zFz2mVrjg2KQ86ectR1+BZ7TbgD/x2YIcvThJKts50JLa5dgioYW+ DADApIZEV9g7/0CblgjhCtM88NrfNO41tEtZQCUXHGRnIRcK6N70iBIJPEurhPLT+dF3 GLEGnF7YD8h0zj6k2HKd8sDX7X60FIfaq7vBI= Received: by 10.227.147.204 with SMTP id m12mr2662107wbv.131.1281801109132; Sat, 14 Aug 2010 08:51:49 -0700 (PDT) Received: from localhost.localdomain ([188.55.88.49]) by mx.google.com with ESMTPS id a28sm3467727wbe.9.2010.08.14.08.51.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 14 Aug 2010 08:51:48 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH 1/2] x86 emulator: Fix emulator return values Date: Sat, 14 Aug 2010 18:51:33 +0300 Message-Id: <1281801094-4515-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 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:51:55 +0000 (UTC) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c476a67..c718589 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2434,7 +2434,7 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt) break; #endif default: - return -1; + return X86EMUL_UNHANDLEABLE; } c->op_bytes = def_op_bytes; @@ -2531,7 +2531,7 @@ done_prefixes: /* Unrecognised? */ if (c->d == 0 || (c->d & Undefined)) { DPRINTF("Cannot emulate %02x\n", c->b); - return -1; + return X86EMUL_UNHANDLEABLE; } if (mode == X86EMUL_MODE_PROT64 && (c->d & Stack)) @@ -2720,11 +2720,11 @@ done_prefixes: /* Special instructions do their own operand decoding. */ default: c->dst.type = OP_NONE; /* Disable writeback. */ - return 0; + return X86EMUL_CONTINUE; } done: - return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; + return rc; } int @@ -3256,7 +3256,7 @@ writeback: ctxt->eip = c->eip; done: - return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; + return rc; twobyte_insn: switch (c->b) { @@ -3558,5 +3558,5 @@ twobyte_insn: cannot_emulate: DPRINTF("Cannot emulate %02x\n", c->b); - return -1; + return X86EMUL_UNHANDLEABLE; }