From patchwork Sun Aug 16 01:07:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 41660 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7G17hvw021386 for ; Sun, 16 Aug 2009 01:07:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753033AbZHPBHj (ORCPT ); Sat, 15 Aug 2009 21:07:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752908AbZHPBHj (ORCPT ); Sat, 15 Aug 2009 21:07:39 -0400 Received: from mail-fx0-f215.google.com ([209.85.220.215]:33680 "EHLO mail-fx0-f215.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbZHPBHi (ORCPT ); Sat, 15 Aug 2009 21:07:38 -0400 Received: by fxm11 with SMTP id 11so1744573fxm.39 for ; Sat, 15 Aug 2009 18:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=hbf6atYhPIzD0EIZODrhhRBranScNfg+dsbG53pM8v4=; b=GzqF/hoO5wcwY2A/Lu0n0cYarIUEPGuq1kehN8Aqh4AnczYN9r0iZWmcF+Enq8r3sq J/EJ1DBdUQLVfwo6nv2mdmii2KZsx4PJh5ckVOLqSDEFZfWz4KLre9IDFSn/DhcXMnj4 4AjJzlctrHHPFulWgM3QCpHZtNHK4ipeARggs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=h2BHJJnFUALBuCXyuAbYA2hGsR/sSZs25ih2lWlXiqBoGPuVK/jbC+vj/EuGKbOZ0r A+YC+573RwBQ4FGm0Uf0G1zK8mGdQT7yfKnSrt95iY4t4lWrhwt+anb/iopJkmw1NZUl DxyefhY3lxTACIXF0WjXpp1jRvY7VjA/KzCo8= Received: by 10.103.81.38 with SMTP id i38mr958762mul.92.1250384858878; Sat, 15 Aug 2009 18:07:38 -0700 (PDT) Received: from localhost ([188.51.98.214]) by mx.google.com with ESMTPS id 7sm12937698mup.54.2009.08.15.18.07.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 15 Aug 2009 18:07:38 -0700 (PDT) Date: Sun, 16 Aug 2009 04:07:36 +0300 From: Mohammed Gamal To: avi@vger.kernel.org Cc: kvm@vger.kernel.org Subject: [PATCH] x86 emulator: Add 'push es' instruction (opcode 0x06) Message-ID: <20090816010736.GA22091@mohd-laptop> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org [Removed an unused variable] Signed-off-by: Mohammed Gamal --- arch/x86/kvm/emulate.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2eb807a..065131e 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -92,7 +92,7 @@ static u32 opcode_table[256] = { /* 0x00 - 0x07 */ ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, - ByteOp | DstAcc | SrcImm, DstAcc | SrcImm, 0, 0, + ByteOp | DstAcc | SrcImm, DstAcc | SrcImm, ImplicitOps | Stack, 0, /* 0x08 - 0x0F */ ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, @@ -1186,6 +1186,13 @@ static int emulate_pop(struct x86_emulate_ctxt *ctxt, return rc; } +static void emulate_push_sreg(struct x86_emulate_ctxt *ctxt, int seg) +{ + struct decode_cache *c = &ctxt->decode; + c->src.ptr = (unsigned long *) &c->regs[seg]; + emulate_push(ctxt); +} + static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) { @@ -1707,6 +1714,9 @@ special_insn: add: /* add */ emulate_2op_SrcV("add", c->src, c->dst, ctxt->eflags); break; + case 0x06: /* push es */ + emulate_push_sreg(ctxt, VCPU_SREG_ES); + break; case 0x08 ... 0x0d: or: /* or */ emulate_2op_SrcV("or", c->src, c->dst, ctxt->eflags);