From patchwork Tue May 11 19:22:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 98825 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4BJN8pC024186 for ; Tue, 11 May 2010 19:23:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534Ab0EKTXE (ORCPT ); Tue, 11 May 2010 15:23:04 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:38490 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751117Ab0EKTXC (ORCPT ); Tue, 11 May 2010 15:23:02 -0400 Received: by wwi18 with SMTP id 18so209642wwi.19 for ; Tue, 11 May 2010 12:23:00 -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=P5tDLKOsKqYNAGKtt1AOvorhB4LZUFOlh6n2vjn1z7c=; b=IpqKc36StleMksuCuAPiGDx8zgCYHgqr/NSPYgUG42jVELP2RrvsmJh3sfK72yHxIs BFiWt1sF5ky7k/8QQVBIAUek0Oz6f0COGz2SXwfcZdQoGVmpbBP/iXcEKavxDL8atj6w 4daQjY1vxwL9cN5cQ5Rv1UF+cYnAKF2fqOnAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=V9ujwRC8h5I8d26P6mahZv/YEov7HQ/MnXb5YB3+FFmo2zHzKID4drATjnNu/LoVF8 Dn+4y4YgRuAvRkNMgw2M8hTnd3iWsFUu4qhK6w1IBx7n+MptWiGlYsuGgjBxCEjBmKqm pYFx1DRnQQDvLcGc5APF67xasmxCW67HUhtLI= Received: by 10.216.168.74 with SMTP id j52mr3834226wel.119.1273605780490; Tue, 11 May 2010 12:23:00 -0700 (PDT) Received: from localhost ([41.239.68.91]) by mx.google.com with ESMTPS id k13sm2366800wed.23.2010.05.11.12.22.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 11 May 2010 12:22:59 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH] x86 emulator: Add test acc, imm instruction (opcodes 0xA8 - 0xA9) Date: Tue, 11 May 2010 22:22:40 +0300 Message-Id: <1273605760-12081-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]); Tue, 11 May 2010 19:23:08 +0000 (UTC) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index b43ac98..be5e78d 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -181,7 +181,7 @@ static u32 opcode_table[256] = { ByteOp | SrcSI | DstDI | Mov | String, SrcSI | DstDI | Mov | String, ByteOp | SrcSI | DstDI | String, SrcSI | DstDI | String, /* 0xA8 - 0xAF */ - 0, 0, ByteOp | DstDI | Mov | String, DstDI | Mov | String, + DstAcc | SrcImmByte | ByteOp, DstAcc | SrcImm, ByteOp | DstDI | Mov | String, DstDI | Mov | String, ByteOp | SrcSI | DstAcc | Mov | String, SrcSI | DstAcc | Mov | String, ByteOp | DstDI | String, DstDI | String, /* 0xB0 - 0xB7 */ @@ -2754,6 +2754,7 @@ special_insn: } break; case 0x84 ... 0x85: + test: emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags); break; case 0x86 ... 0x87: /* xchg */ @@ -2852,6 +2853,8 @@ special_insn: c->dst.type = OP_NONE; /* Disable writeback. */ DPRINTF("cmps: mem1=0x%p mem2=0x%p\n", c->src.ptr, c->dst.ptr); goto cmp; + case 0xa8 ... 0xa9: /* test ax, imm */ + goto test; case 0xaa ... 0xab: /* stos */ c->dst.val = c->regs[VCPU_REGS_RAX]; break;