public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH v3 06/10] Add unsigned byte immediate decode.
Date: Sun, 12 Apr 2009 13:36:41 +0300	[thread overview]
Message-ID: <20090412103641.16966.50099.stgit@trex.usersys.redhat.com> (raw)
In-Reply-To: <20090412103614.16966.89723.stgit@trex.usersys.redhat.com>

Extend "Source operand type" opcode description field to 4 bites
to accommodate new option.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 arch/x86/kvm/x86_emulate.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 4a9cd4c..0988a13 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -59,13 +59,14 @@
 #define SrcImm      (5<<4)	/* Immediate operand. */
 #define SrcImmByte  (6<<4)	/* 8-bit sign-extended immediate operand. */
 #define SrcOne      (7<<4)	/* Implied '1' */
-#define SrcMask     (7<<4)
+#define SrcImmUByte (8<<4)      /* 8-bit unsigned immediate operand. */
+#define SrcMask     (0xf<<4)
 /* Generic ModRM decode. */
-#define ModRM       (1<<7)
+#define ModRM       (1<<8)
 /* Destination is only written; never read. */
-#define Mov         (1<<8)
-#define BitOp       (1<<9)
-#define MemAbs      (1<<10)      /* Memory operand is absolute displacement */
+#define Mov         (1<<9)
+#define BitOp       (1<<10)
+#define MemAbs      (1<<11)      /* Memory operand is absolute displacement */
 #define String      (1<<12)     /* String instruction (rep capable) */
 #define Stack       (1<<13)     /* Stack instruction (push/pop) */
 #define Group       (1<<14)     /* Bits 3:5 of modrm byte extend opcode */
@@ -1044,10 +1045,14 @@ done_prefixes:
 		}
 		break;
 	case SrcImmByte:
+	case SrcImmUByte:
 		c->src.type = OP_IMM;
 		c->src.ptr = (unsigned long *)c->eip;
 		c->src.bytes = 1;
-		c->src.val = insn_fetch(s8, 1, c->eip);
+		if ((c->d & SrcMask) == SrcImmByte)
+			c->src.val = insn_fetch(s8, 1, c->eip);
+		else
+			c->src.val = insn_fetch(u8, 1, c->eip);
 		break;
 	case SrcOne:
 		c->src.bytes = 1;


  parent reply	other threads:[~2009-04-12 10:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12 10:36 [PATCH v3 01/10] Add decoding of 16bit second immediate argument Gleb Natapov
2009-04-12 10:36 ` [PATCH v3 02/10] Add lcall decoding Gleb Natapov
2009-04-12 10:36 ` [PATCH v3 03/10] Complete ljmp decoding at decode stage Gleb Natapov
2009-04-12 10:36 ` [PATCH v3 04/10] Complete short/near jcc decoding in " Gleb Natapov
2009-04-12 10:36 ` [PATCH v3 05/10] Complete decoding of call near " Gleb Natapov
2009-04-12 10:36 ` Gleb Natapov [this message]
2009-04-12 10:36 ` [PATCH v3 07/10] Completely decode in/out at decoding stage Gleb Natapov
2009-04-12 10:36 ` [PATCH v3 08/10] Decode soft interrupt instructions Gleb Natapov
2009-04-12 10:36 ` [PATCH v3 09/10] Add new mode of instruction emulation: skip Gleb Natapov
2009-04-12 10:37 ` [PATCH v3 10/10] [AMD] Skip instruction on a task switch only when appropriate Gleb Natapov
2009-04-12 11:43 ` [PATCH v3 01/10] Add decoding of 16bit second immediate argument Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090412103641.16966.50099.stgit@trex.usersys.redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox