From patchwork Mon Aug 17 19:16:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 42118 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 n7HJGMa4015803 for ; Mon, 17 Aug 2009 19:16:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752895AbZHQTQT (ORCPT ); Mon, 17 Aug 2009 15:16:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752121AbZHQTQT (ORCPT ); Mon, 17 Aug 2009 15:16:19 -0400 Received: from ey-out-2122.google.com ([74.125.78.25]:60730 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751937AbZHQTQS (ORCPT ); Mon, 17 Aug 2009 15:16:18 -0400 Received: by ey-out-2122.google.com with SMTP id 22so732393eye.37 for ; Mon, 17 Aug 2009 12:16:18 -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=UiCQLZgekUKTgCold1DDXOxRyjZALbH7uCzqVH6xEiQ=; b=HIZ4ovhVyxvjShaDC+zseTnHiarMQ2YtGDKMWABat7yYt3vXMPVpLI1I+mfhH8ugs3 cl2eeFcYeIrHzkD5GOcBINfOrSggSqlio52zOBO/mJThhTOWwdfWKOXeSpHx607dVsvu l9akN2mHOMxcwBf4sWypvHlPpr3hCw18I+ekY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=R1NGYsGI1z5VcGdjwHaUQ6X5FCDQEWUEgM0LxlKee9wPeuz42CMCoNgCaD2vQjIg0q 92g/djm+8valomKQyygRmzZn+MRshEV7+7C2Q+H082pGAXLWP4ZDyEahezGQ1EK3VM5E Piblyuxc8pbtofVBJqiCgWbPTd2bw+R4dKp+g= Received: by 10.211.199.11 with SMTP id b11mr7406370ebq.68.1250536578678; Mon, 17 Aug 2009 12:16:18 -0700 (PDT) Received: from localhost.localdomain ([188.51.87.106]) by mx.google.com with ESMTPS id 5sm856031eyh.36.2009.08.17.12.16.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 Aug 2009 12:16:17 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH] x86 emulator: Add 'push es' instruction (opcode 0x06) Date: Mon, 17 Aug 2009 22:16:14 +0300 Message-Id: <1250536574-8396-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.6.0.4 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 | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2eb807a..fc8a745 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,17 @@ 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.val = segment.selector; + emulate_push(ctxt); +} + static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) { @@ -1707,6 +1718,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);