From patchwork Sun Aug 16 17:51:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 41800 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 n7GHqLGC029394 for ; Sun, 16 Aug 2009 17:52:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755404AbZHPRvv (ORCPT ); Sun, 16 Aug 2009 13:51:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755366AbZHPRvv (ORCPT ); Sun, 16 Aug 2009 13:51:51 -0400 Received: from mail-bw0-f222.google.com ([209.85.218.222]:61578 "EHLO mail-bw0-f222.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755230AbZHPRvu (ORCPT ); Sun, 16 Aug 2009 13:51:50 -0400 Received: by mail-bw0-f222.google.com with SMTP id 22so1934397bwz.18 for ; Sun, 16 Aug 2009 10:51:51 -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=KvHIZ0P2itpu+GF4ZunuPoHbiKs7ojbc1n3b8gEIelI=; b=aO1Zf+RAenM/L1s3AVPHLtVFFgdb3QRI9+63iKnlS1UgQ8Ixt3vXDMwJlthmvJAS1O VIjr4jSmukW91aCWSB/Erj55j4/4uv+/XyEmF3IhKiflLtW1xJq4xBg+T0sx1y+PnM5L HvH5vsx9Pt2uiv/NnLI2QgHcolkOxdeVCyN/8= 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=rNj87VHM8e1/CpaJPGiHMR7t5Niwp348vxB0/o/5yfahDCAufe7S929NCIHKEYs1yL 4wxAq3mDZhOEMYSFiYhWj2KC0EHhnKmOEk2su7sPxUN8QJNuZrvvc+5oUoEpZdunhxTE J4V7zHuRGbt2NYv6pnF7EfMre4dGAkG9EyXE8= Received: by 10.103.48.19 with SMTP id a19mr1019114muk.136.1250445111428; Sun, 16 Aug 2009 10:51:51 -0700 (PDT) Received: from localhost ([188.51.87.106]) by mx.google.com with ESMTPS id s11sm15578401mue.41.2009.08.16.10.51.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 16 Aug 2009 10:51:51 -0700 (PDT) Date: Sun, 16 Aug 2009 20:51:38 +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: <20090816175138.GA8521@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 | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2eb807a..7688c0b 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,15 @@ 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; + kvm_x86_ops->get_segment(ctxt->vcpu, &segment, seg); + c->src.ptr = (unsigned long *) &segment.selector; + emulate_push(ctxt); +} + static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) { @@ -1707,6 +1716,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);