summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-07-26 14:37:48 +0300
committerAvi Kivity <avi@redhat.com>2010-10-24 10:49:58 +0200
commit52811d7de565b2db988257591fbf2a6be31c1459 (patch)
tree670998588f9abc9f5d1a39781159b58bd6e79f56
parent047a4818094217a1323d8f31f9318ea2e142f745 (diff)
KVM: x86 emulator: mix decode bits from opcode and group decode tables
Allow bits that are common to all members of a group to be specified in the opcode table instead of the group table. This allows some simplification of the decode tables. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index b1e3e8c2aff..ef2b5af33a3 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -955,7 +955,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;
+ int def_op_bytes, def_ad_bytes, group, dual;
/* we cannot decode insn before we complete previous rep insn */
@@ -1055,14 +1055,16 @@ done_prefixes:
if (c->d & Group) {
group = c->d & GroupMask;
+ dual = c->d & GroupDual;
c->modrm = insn_fetch(u8, 1, c->eip);
--c->eip;
group = (group << 3) + ((c->modrm >> 3) & 7);
- if ((c->d & GroupDual) && (c->modrm >> 6) == 3)
- c->d = group2_table[group];
+ c->d &= ~(Group | GroupDual | GroupMask);
+ if (dual && (c->modrm >> 6) == 3)
+ c->d |= group2_table[group];
else
- c->d = group_table[group];
+ c->d |= group_table[group];
}
/* Unrecognised? */