From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH 4/9] Complete short/near jcc decoding in decode stage.
Date: Sun, 05 Apr 2009 16:59:18 +0300 [thread overview]
Message-ID: <20090405135918.3014.13331.stgit@trex.usersys.redhat.com> (raw)
In-Reply-To: <20090405135902.3014.62767.stgit@trex.usersys.redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
arch/x86/kvm/x86_emulate.c | 50 ++++++++++++++++----------------------------
1 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index e7e4db1..1790933 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -136,11 +136,15 @@ static u32 opcode_table[256] = {
SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* insb, insw/insd */
SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* outsb, outsw/outsd */
/* 0x70 - 0x77 */
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
/* 0x78 - 0x7F */
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
+ ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte,
/* 0x80 - 0x87 */
Group | Group1_80, Group | Group1_81,
Group | Group1_82, Group | Group1_83,
@@ -232,10 +236,12 @@ static u32 twobyte_table[256] = {
/* 0x70 - 0x7F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x80 - 0x8F */
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
- ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+ SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+ SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+ SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+ SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps,
+ SrcImm | ImplicitOps,
/* 0x90 - 0x9F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xA0 - 0xA7 */
@@ -1539,13 +1545,10 @@ special_insn:
return -1;
}
return 0;
- case 0x70 ... 0x7f: /* jcc (short) */ {
- int rel = insn_fetch(s8, 1, c->eip);
-
+ case 0x70 ... 0x7f: /* jcc (short) */
if (test_cc(c->b, ctxt->eflags))
- jmp_rel(c, rel);
+ jmp_rel(c, c->src.val);
break;
- }
case 0x80 ... 0x83: /* Grp1 */
switch (c->modrm_reg) {
case 0:
@@ -2031,28 +2034,11 @@ twobyte_insn:
if (!test_cc(c->b, ctxt->eflags))
c->dst.type = OP_NONE; /* no writeback */
break;
- case 0x80 ... 0x8f: /* jnz rel, etc*/ {
- long int rel;
-
- switch (c->op_bytes) {
- case 2:
- rel = insn_fetch(s16, 2, c->eip);
- break;
- case 4:
- rel = insn_fetch(s32, 4, c->eip);
- break;
- case 8:
- rel = insn_fetch(s64, 8, c->eip);
- break;
- default:
- DPRINTF("jnz: Invalid op_bytes\n");
- goto cannot_emulate;
- }
+ case 0x80 ... 0x8f: /* jnz rel, etc*/
if (test_cc(c->b, ctxt->eflags))
- jmp_rel(c, rel);
+ jmp_rel(c, c->src.val);
c->dst.type = OP_NONE;
break;
- }
case 0xa3:
bt: /* bt */
c->dst.type = OP_NONE;
next prev parent reply other threads:[~2009-04-05 13:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-05 13:59 [PATCH 1/9] Add decoding of 16bit second immediate argument Gleb Natapov
2009-04-05 13:59 ` [PATCH 2/9] Add lcall decoding Gleb Natapov
2009-04-11 11:09 ` Avi Kivity
2009-04-05 13:59 ` [PATCH 3/9] Complete ljmp decoding at decode stage Gleb Natapov
2009-04-05 13:59 ` Gleb Natapov [this message]
2009-04-05 13:59 ` [PATCH 5/9] Complete decoding of call near in " Gleb Natapov
2009-04-05 13:59 ` [PATCH 6/9] Completely decode in/out at decoding stage Gleb Natapov
2009-04-11 11:08 ` Avi Kivity
2009-04-05 13:59 ` [PATCH 7/9] Decode soft interrupt instructions Gleb Natapov
2009-04-05 13:59 ` [PATCH 8/9] Add new mode of instruction emulation: skip Gleb Natapov
2009-04-05 13:59 ` [PATCH 9/9] [AMD] Skip instruction on a task switch only when appropriate Gleb Natapov
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=20090405135918.3014.13331.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