From patchwork Sun Aug 16 00:53:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 41656 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 n7G0sKiq018836 for ; Sun, 16 Aug 2009 00:54:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753135AbZHPAxf (ORCPT ); Sat, 15 Aug 2009 20:53:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753101AbZHPAxf (ORCPT ); Sat, 15 Aug 2009 20:53:35 -0400 Received: from mail-bw0-f222.google.com ([209.85.218.222]:48451 "EHLO mail-bw0-f222.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753077AbZHPAxd (ORCPT ); Sat, 15 Aug 2009 20:53:33 -0400 Received: by bwz22 with SMTP id 22so1720679bwz.18 for ; Sat, 15 Aug 2009 17:53:33 -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=JJA7y9RXYpUI28ufxjFkTiiEr4F8dSrCvrExsi1XUQk=; b=b3zWJPDLHy+Jsj0HuYESlQnaoGqGFefwjABl4NlLcPtp7iFwElS4Dv4x6UhNDkAYQB F5QB7fPfmEIFvMdZ+HyHxPfjNYAmM1G9pED+1AZSugqsjfhppSrwhqOTPECDFAKYuDou rHArALQRdK3HNtfcbhU5ZUdhVFKVthmm1YHGs= 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=NJM5ajSiK+0ZMpAql6sICbmRMpYbROs8pBK+OQ5MtrSCNAl86/mYJsPzIdKjmEnIeV 9/mxDVfUzuyqIS8YS4VMTOeQEGugVVICkjEudn83nS133ni2WxOf/MZtxIYp1kt9qWE1 eMGlwL50HDzMBWH7vSn0dugAFP/tEyVkXSB2s= Received: by 10.103.76.29 with SMTP id d29mr967846mul.50.1250384013412; Sat, 15 Aug 2009 17:53:33 -0700 (PDT) Received: from localhost ([188.51.98.214]) by mx.google.com with ESMTPS id s10sm13375904muh.17.2009.08.15.17.53.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 15 Aug 2009 17:53:32 -0700 (PDT) Date: Sun, 16 Aug 2009 03:53:30 +0300 From: Mohammed Gamal To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] x86 emulator: Add 'push es' instruction (opcode 0x06) Message-ID: <20090816005330.GA19989@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 Signed-off-by: Mohammed Gamal --- arch/x86/kvm/emulate.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2eb807a..6305a12 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,14 @@ 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; + struct kvm_segment segment; + 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 +1715,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);