aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-09-13 03:45:42 -0400
committerAvi Kivity <avi@redhat.com>2011-09-25 12:52:49 -0400
commitb1ea50b2b63a95aa5a7944b48ba4d0e9b32211d3 (patch)
treebba618fcdb50535ee25e5f06e9a704b5734068e6 /arch/x86/kvm/emulate.c
parenta99455499a86bde28fccd84e2119be9cd7c23a3f (diff)
KVM: x86 emulator: expand decode flags to 64 bits
Unifiying the operands means not taking advantage of the fact that some operand types can only go into certain operands (for example, DI can only be used by the destination), so we need more bits to hold the operand type. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 6a6aed9a29df..8c65ff274785 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -31,18 +31,18 @@
31/* 31/*
32 * Operand types 32 * Operand types
33 */ 33 */
34#define OpNone 0 34#define OpNone 0ull
35#define OpImplicit 1 /* No generic decode */ 35#define OpImplicit 1ull /* No generic decode */
36#define OpReg 2 /* Register */ 36#define OpReg 2ull /* Register */
37#define OpMem 3 /* Memory */ 37#define OpMem 3ull /* Memory */
38#define OpAcc 4 /* Accumulator: AL/AX/EAX/RAX */ 38#define OpAcc 4ull /* Accumulator: AL/AX/EAX/RAX */
39#define OpDI 5 /* ES:DI/EDI/RDI */ 39#define OpDI 5ull /* ES:DI/EDI/RDI */
40#define OpMem64 6 /* Memory, 64-bit */ 40#define OpMem64 6ull /* Memory, 64-bit */
41#define OpImmUByte 7 /* Zero-extended 8-bit immediate */ 41#define OpImmUByte 7ull /* Zero-extended 8-bit immediate */
42#define OpDX 8 /* DX register */ 42#define OpDX 8ull /* DX register */
43 43
44#define OpBits 4 /* Width of operand field */ 44#define OpBits 4 /* Width of operand field */
45#define OpMask ((1 << OpBits) - 1) 45#define OpMask ((1ull << OpBits) - 1)
46 46
47/* 47/*
48 * Opcode effective-address decode tables. 48 * Opcode effective-address decode tables.
@@ -108,12 +108,12 @@
108#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */ 108#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */
109#define No64 (1<<28) 109#define No64 (1<<28)
110/* Source 2 operand type */ 110/* Source 2 operand type */
111#define Src2None (0<<29) 111#define Src2None (0u<<29)
112#define Src2CL (1<<29) 112#define Src2CL (1u<<29)
113#define Src2ImmByte (2<<29) 113#define Src2ImmByte (2u<<29)
114#define Src2One (3<<29) 114#define Src2One (3u<<29)
115#define Src2Imm (4<<29) 115#define Src2Imm (4u<<29)
116#define Src2Mask (7<<29) 116#define Src2Mask (7u<<29)
117 117
118#define X2(x...) x, x 118#define X2(x...) x, x
119#define X3(x...) X2(x), x 119#define X3(x...) X2(x), x
@@ -125,8 +125,8 @@
125#define X16(x...) X8(x), X8(x) 125#define X16(x...) X8(x), X8(x)
126 126
127struct opcode { 127struct opcode {
128 u32 flags; 128 u64 flags : 56;
129 u8 intercept; 129 u64 intercept : 8;
130 union { 130 union {
131 int (*execute)(struct x86_emulate_ctxt *ctxt); 131 int (*execute)(struct x86_emulate_ctxt *ctxt);
132 struct opcode *group; 132 struct opcode *group;
@@ -3530,7 +3530,7 @@ done_prefixes:
3530 return EMULATION_FAILED; 3530 return EMULATION_FAILED;
3531 } 3531 }
3532 3532
3533 ctxt->d &= ~GroupMask; 3533 ctxt->d &= ~(u64)GroupMask;
3534 ctxt->d |= opcode.flags; 3534 ctxt->d |= opcode.flags;
3535 } 3535 }
3536 3536