Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215644
b: refs/heads/master
c: 3885d53
h: refs/heads/master
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent 1ed6f10 commit 5424226
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f5d3220e3047536f702ed67309f6a581c0bed8b
refs/heads/master: 3885d530b0eb26c82b6f085c181442b0aa6f8fed
32 changes: 7 additions & 25 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
#define Stack (1<<13) /* Stack instruction (push/pop) */
#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */
#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */
#define GroupMask 0x0f /* Group number stored in bits 0:3 */
/* Misc flags */
#define Undefined (1<<25) /* No Such Instruction */
#define Lock (1<<26) /* lock prefix is allowed for the instruction */
Expand All @@ -104,10 +103,6 @@
#define X8(x) X4(x), X4(x)
#define X16(x) X8(x), X8(x)

enum {
NoGrp,
};

struct opcode {
u32 flags;
union {
Expand Down Expand Up @@ -174,12 +169,6 @@ static struct group_dual group9 = { {
N, N, N, N, N, N, N, N,
} };

static struct opcode group_table[] = {
};

static struct opcode group2_table[] = {
};

static struct opcode opcode_table[256] = {
/* 0x00 - 0x07 */
D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock),
Expand Down Expand Up @@ -959,7 +948,7 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
struct decode_cache *c = &ctxt->decode;
int rc = X86EMUL_CONTINUE;
int mode = ctxt->mode;
int def_op_bytes, def_ad_bytes, group, dual, goffset;
int def_op_bytes, def_ad_bytes, dual, goffset;
struct opcode opcode, *g_mod012, *g_mod3;

/* we cannot decode insn before we complete previous rep insn */
Expand Down Expand Up @@ -1059,24 +1048,17 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
c->d = opcode.flags;

if (c->d & Group) {
group = c->d & GroupMask;
dual = c->d & GroupDual;
c->modrm = insn_fetch(u8, 1, c->eip);
--c->eip;

if (group) {
g_mod012 = g_mod3 = &group_table[group * 8];
if (c->d & GroupDual)
g_mod3 = &group2_table[group * 8];
} else {
if (c->d & GroupDual) {
g_mod012 = opcode.u.gdual->mod012;
g_mod3 = opcode.u.gdual->mod3;
} else
g_mod012 = g_mod3 = opcode.u.group;
}
if (c->d & GroupDual) {
g_mod012 = opcode.u.gdual->mod012;
g_mod3 = opcode.u.gdual->mod3;
} else
g_mod012 = g_mod3 = opcode.u.group;

c->d &= ~(Group | GroupDual | GroupMask);
c->d &= ~(Group | GroupDual);

goffset = (c->modrm >> 3) & 7;

Expand Down

0 comments on commit 5424226

Please sign in to comment.