aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-07-29 08:11:48 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:50:19 -0400
commit3885d530b0eb26c82b6f085c181442b0aa6f8fed (patch)
treecaea0a988553012b49c88faed30c65c8b7b72c88
parent9f5d3220e3047536f702ed67309f6a581c0bed8b (diff)
KVM: x86 emulator: drop support for old-style groups
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 2fe731c82299..20a7a167df1d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -82,7 +82,6 @@
82#define Stack (1<<13) /* Stack instruction (push/pop) */ 82#define Stack (1<<13) /* Stack instruction (push/pop) */
83#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */ 83#define Group (1<<14) /* Bits 3:5 of modrm byte extend opcode */
84#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */ 84#define GroupDual (1<<15) /* Alternate decoding of mod == 3 */
85#define GroupMask 0x0f /* Group number stored in bits 0:3 */
86/* Misc flags */ 85/* Misc flags */
87#define Undefined (1<<25) /* No Such Instruction */ 86#define Undefined (1<<25) /* No Such Instruction */
88#define Lock (1<<26) /* lock prefix is allowed for the instruction */ 87#define Lock (1<<26) /* lock prefix is allowed for the instruction */
@@ -104,10 +103,6 @@
104#define X8(x) X4(x), X4(x) 103#define X8(x) X4(x), X4(x)
105#define X16(x) X8(x), X8(x) 104#define X16(x) X8(x), X8(x)
106 105
107enum {
108 NoGrp,
109};
110
111struct opcode { 106struct opcode {
112 u32 flags; 107 u32 flags;
113 union { 108 union {
@@ -174,12 +169,6 @@ static struct group_dual group9 = { {
174 N, N, N, N, N, N, N, N, 169 N, N, N, N, N, N, N, N,
175} }; 170} };
176 171
177static struct opcode group_table[] = {
178};
179
180static struct opcode group2_table[] = {
181};
182
183static struct opcode opcode_table[256] = { 172static struct opcode opcode_table[256] = {
184 /* 0x00 - 0x07 */ 173 /* 0x00 - 0x07 */
185 D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock), 174 D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock),
@@ -959,7 +948,7 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
959 struct decode_cache *c = &ctxt->decode; 948 struct decode_cache *c = &ctxt->decode;
960 int rc = X86EMUL_CONTINUE; 949 int rc = X86EMUL_CONTINUE;
961 int mode = ctxt->mode; 950 int mode = ctxt->mode;
962 int def_op_bytes, def_ad_bytes, group, dual, goffset; 951 int def_op_bytes, def_ad_bytes, dual, goffset;
963 struct opcode opcode, *g_mod012, *g_mod3; 952 struct opcode opcode, *g_mod012, *g_mod3;
964 953
965 /* we cannot decode insn before we complete previous rep insn */ 954 /* we cannot decode insn before we complete previous rep insn */
@@ -1059,24 +1048,17 @@ done_prefixes:
1059 c->d = opcode.flags; 1048 c->d = opcode.flags;
1060 1049
1061 if (c->d & Group) { 1050 if (c->d & Group) {
1062 group = c->d & GroupMask;
1063 dual = c->d & GroupDual; 1051 dual = c->d & GroupDual;
1064 c->modrm = insn_fetch(u8, 1, c->eip); 1052 c->modrm = insn_fetch(u8, 1, c->eip);
1065 --c->eip; 1053 --c->eip;
1066 1054
1067 if (group) { 1055 if (c->d & GroupDual) {
1068 g_mod012 = g_mod3 = &group_table[group * 8]; 1056 g_mod012 = opcode.u.gdual->mod012;
1069 if (c->d & GroupDual) 1057 g_mod3 = opcode.u.gdual->mod3;
1070 g_mod3 = &group2_table[group * 8]; 1058 } else
1071 } else { 1059 g_mod012 = g_mod3 = opcode.u.group;
1072 if (c->d & GroupDual) {
1073 g_mod012 = opcode.u.gdual->mod012;
1074 g_mod3 = opcode.u.gdual->mod3;
1075 } else
1076 g_mod012 = g_mod3 = opcode.u.group;
1077 }
1078 1060
1079 c->d &= ~(Group | GroupDual | GroupMask); 1061 c->d &= ~(Group | GroupDual);
1080 1062
1081 goffset = (c->modrm >> 3) & 7; 1063 goffset = (c->modrm >> 3) & 7;
1082 1064