Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215631
b: refs/heads/master
c: d65b1de
h: refs/heads/master
i:
  215629: 0c094c0
  215627: b6d11cb
  215623: e665f70
  215615: 2d15f91
v: v3
  • Loading branch information
Avi Kivity committed Oct 24, 2010
1 parent 617d2b5 commit 9a31039
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 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: ea9ef04e19c7c441b1ce9fe28ff6d9522c848baa
refs/heads/master: d65b1dee408243daa45110ee494d204508d31657
20 changes: 12 additions & 8 deletions trunk/arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ enum {
Group1, Group1A, Group3, Group4, Group5, Group7, Group8, Group9,
};

static u32 opcode_table[256] = {
struct opcode {
u32 flags;
};

static struct opcode opcode_table[256] = {
/* 0x00 - 0x07 */
ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock,
ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
Expand Down Expand Up @@ -222,7 +226,7 @@ static u32 opcode_table[256] = {
ImplicitOps, ImplicitOps, Group | Group4, Group | Group5,
};

static u32 twobyte_table[256] = {
static struct opcode twobyte_table[256] = {
/* 0x00 - 0x0F */
0, Group | GroupDual | Group7, 0, 0,
0, ImplicitOps, ImplicitOps | Priv, 0,
Expand Down Expand Up @@ -284,7 +288,7 @@ static u32 twobyte_table[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

static u32 group_table[] = {
static struct opcode group_table[] = {
[Group1*8] =
X7(Lock), 0,
[Group1A*8] =
Expand Down Expand Up @@ -313,7 +317,7 @@ static u32 group_table[] = {
0, DstMem64 | ModRM | Lock, 0, 0, 0, 0, 0, 0,
};

static u32 group2_table[] = {
static struct opcode group2_table[] = {
[Group7*8] =
SrcNone | ModRM | Priv, 0, 0, SrcNone | ModRM | Priv,
SrcNone | ModRM | DstMem | Mov, 0,
Expand Down Expand Up @@ -1008,13 +1012,13 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
c->op_bytes = 8; /* REX.W */

/* Opcode byte(s). */
c->d = opcode_table[c->b];
c->d = opcode_table[c->b].flags;
if (c->d == 0) {
/* Two-byte opcode? */
if (c->b == 0x0f) {
c->twobyte = 1;
c->b = insn_fetch(u8, 1, c->eip);
c->d = twobyte_table[c->b];
c->d = twobyte_table[c->b].flags;
}
}

Expand All @@ -1027,9 +1031,9 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
group = (group << 3) + ((c->modrm >> 3) & 7);
c->d &= ~(Group | GroupDual | GroupMask);
if (dual && (c->modrm >> 6) == 3)
c->d |= group2_table[group];
c->d |= group2_table[group].flags;
else
c->d |= group_table[group];
c->d |= group_table[group].flags;
}

/* Unrecognised? */
Expand Down

0 comments on commit 9a31039

Please sign in to comment.