diff options
-rw-r--r-- | arch/x86/kvm/emulate.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index f1e3be18a08f..a10950a37928 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -125,8 +125,9 @@ | |||
125 | #define Lock (1<<26) /* lock prefix is allowed for the instruction */ | 125 | #define Lock (1<<26) /* lock prefix is allowed for the instruction */ |
126 | #define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */ | 126 | #define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */ |
127 | #define No64 (1<<28) | 127 | #define No64 (1<<28) |
128 | #define PageTable (1 << 29) /* instruction used to write page table */ | ||
128 | /* Source 2 operand type */ | 129 | /* Source 2 operand type */ |
129 | #define Src2Shift (29) | 130 | #define Src2Shift (30) |
130 | #define Src2None (OpNone << Src2Shift) | 131 | #define Src2None (OpNone << Src2Shift) |
131 | #define Src2CL (OpCL << Src2Shift) | 132 | #define Src2CL (OpCL << Src2Shift) |
132 | #define Src2ImmByte (OpImmByte << Src2Shift) | 133 | #define Src2ImmByte (OpImmByte << Src2Shift) |
@@ -3033,10 +3034,10 @@ static struct opcode group7_rm7[] = { | |||
3033 | 3034 | ||
3034 | static struct opcode group1[] = { | 3035 | static struct opcode group1[] = { |
3035 | I(Lock, em_add), | 3036 | I(Lock, em_add), |
3036 | I(Lock, em_or), | 3037 | I(Lock | PageTable, em_or), |
3037 | I(Lock, em_adc), | 3038 | I(Lock, em_adc), |
3038 | I(Lock, em_sbb), | 3039 | I(Lock, em_sbb), |
3039 | I(Lock, em_and), | 3040 | I(Lock | PageTable, em_and), |
3040 | I(Lock, em_sub), | 3041 | I(Lock, em_sub), |
3041 | I(Lock, em_xor), | 3042 | I(Lock, em_xor), |
3042 | I(0, em_cmp), | 3043 | I(0, em_cmp), |
@@ -3096,18 +3097,21 @@ static struct group_dual group7 = { { | |||
3096 | 3097 | ||
3097 | static struct opcode group8[] = { | 3098 | static struct opcode group8[] = { |
3098 | N, N, N, N, | 3099 | N, N, N, N, |
3099 | D(DstMem | SrcImmByte | ModRM), D(DstMem | SrcImmByte | ModRM | Lock), | 3100 | D(DstMem | SrcImmByte | ModRM), |
3100 | D(DstMem | SrcImmByte | ModRM | Lock), D(DstMem | SrcImmByte | ModRM | Lock), | 3101 | D(DstMem | SrcImmByte | ModRM | Lock | PageTable), |
3102 | D(DstMem | SrcImmByte | ModRM | Lock), | ||
3103 | D(DstMem | SrcImmByte | ModRM | Lock | PageTable), | ||
3101 | }; | 3104 | }; |
3102 | 3105 | ||
3103 | static struct group_dual group9 = { { | 3106 | static struct group_dual group9 = { { |
3104 | N, D(DstMem64 | ModRM | Lock), N, N, N, N, N, N, | 3107 | N, D(DstMem64 | ModRM | Lock | PageTable), N, N, N, N, N, N, |
3105 | }, { | 3108 | }, { |
3106 | N, N, N, N, N, N, N, N, | 3109 | N, N, N, N, N, N, N, N, |
3107 | } }; | 3110 | } }; |
3108 | 3111 | ||
3109 | static struct opcode group11[] = { | 3112 | static struct opcode group11[] = { |
3110 | I(DstMem | SrcImm | ModRM | Mov, em_mov), X7(D(Undefined)), | 3113 | I(DstMem | SrcImm | ModRM | Mov | PageTable, em_mov), |
3114 | X7(D(Undefined)), | ||
3111 | }; | 3115 | }; |
3112 | 3116 | ||
3113 | static struct gprefix pfx_0f_6f_0f_7f = { | 3117 | static struct gprefix pfx_0f_6f_0f_7f = { |
@@ -3120,7 +3124,7 @@ static struct opcode opcode_table[256] = { | |||
3120 | I(ImplicitOps | Stack | No64 | Src2ES, em_push_sreg), | 3124 | I(ImplicitOps | Stack | No64 | Src2ES, em_push_sreg), |
3121 | I(ImplicitOps | Stack | No64 | Src2ES, em_pop_sreg), | 3125 | I(ImplicitOps | Stack | No64 | Src2ES, em_pop_sreg), |
3122 | /* 0x08 - 0x0F */ | 3126 | /* 0x08 - 0x0F */ |
3123 | I6ALU(Lock, em_or), | 3127 | I6ALU(Lock | PageTable, em_or), |
3124 | I(ImplicitOps | Stack | No64 | Src2CS, em_push_sreg), | 3128 | I(ImplicitOps | Stack | No64 | Src2CS, em_push_sreg), |
3125 | N, | 3129 | N, |
3126 | /* 0x10 - 0x17 */ | 3130 | /* 0x10 - 0x17 */ |
@@ -3132,7 +3136,7 @@ static struct opcode opcode_table[256] = { | |||
3132 | I(ImplicitOps | Stack | No64 | Src2DS, em_push_sreg), | 3136 | I(ImplicitOps | Stack | No64 | Src2DS, em_push_sreg), |
3133 | I(ImplicitOps | Stack | No64 | Src2DS, em_pop_sreg), | 3137 | I(ImplicitOps | Stack | No64 | Src2DS, em_pop_sreg), |
3134 | /* 0x20 - 0x27 */ | 3138 | /* 0x20 - 0x27 */ |
3135 | I6ALU(Lock, em_and), N, N, | 3139 | I6ALU(Lock | PageTable, em_and), N, N, |
3136 | /* 0x28 - 0x2F */ | 3140 | /* 0x28 - 0x2F */ |
3137 | I6ALU(Lock, em_sub), N, I(ByteOp | DstAcc | No64, em_das), | 3141 | I6ALU(Lock, em_sub), N, I(ByteOp | DstAcc | No64, em_das), |
3138 | /* 0x30 - 0x37 */ | 3142 | /* 0x30 - 0x37 */ |
@@ -3165,11 +3169,11 @@ static struct opcode opcode_table[256] = { | |||
3165 | G(ByteOp | DstMem | SrcImm | ModRM | No64 | Group, group1), | 3169 | G(ByteOp | DstMem | SrcImm | ModRM | No64 | Group, group1), |
3166 | G(DstMem | SrcImmByte | ModRM | Group, group1), | 3170 | G(DstMem | SrcImmByte | ModRM | Group, group1), |
3167 | I2bv(DstMem | SrcReg | ModRM, em_test), | 3171 | I2bv(DstMem | SrcReg | ModRM, em_test), |
3168 | I2bv(DstMem | SrcReg | ModRM | Lock, em_xchg), | 3172 | I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_xchg), |
3169 | /* 0x88 - 0x8F */ | 3173 | /* 0x88 - 0x8F */ |
3170 | I2bv(DstMem | SrcReg | ModRM | Mov, em_mov), | 3174 | I2bv(DstMem | SrcReg | ModRM | Mov | PageTable, em_mov), |
3171 | I2bv(DstReg | SrcMem | ModRM | Mov, em_mov), | 3175 | I2bv(DstReg | SrcMem | ModRM | Mov, em_mov), |
3172 | I(DstMem | SrcNone | ModRM | Mov, em_mov_rm_sreg), | 3176 | I(DstMem | SrcNone | ModRM | Mov | PageTable, em_mov_rm_sreg), |
3173 | D(ModRM | SrcMem | NoAccess | DstReg), | 3177 | D(ModRM | SrcMem | NoAccess | DstReg), |
3174 | I(ImplicitOps | SrcMem16 | ModRM, em_mov_sreg_rm), | 3178 | I(ImplicitOps | SrcMem16 | ModRM, em_mov_sreg_rm), |
3175 | G(0, group1A), | 3179 | G(0, group1A), |
@@ -3182,7 +3186,7 @@ static struct opcode opcode_table[256] = { | |||
3182 | II(ImplicitOps | Stack, em_popf, popf), N, N, | 3186 | II(ImplicitOps | Stack, em_popf, popf), N, N, |
3183 | /* 0xA0 - 0xA7 */ | 3187 | /* 0xA0 - 0xA7 */ |
3184 | I2bv(DstAcc | SrcMem | Mov | MemAbs, em_mov), | 3188 | I2bv(DstAcc | SrcMem | Mov | MemAbs, em_mov), |
3185 | I2bv(DstMem | SrcAcc | Mov | MemAbs, em_mov), | 3189 | I2bv(DstMem | SrcAcc | Mov | MemAbs | PageTable, em_mov), |
3186 | I2bv(SrcSI | DstDI | Mov | String, em_mov), | 3190 | I2bv(SrcSI | DstDI | Mov | String, em_mov), |
3187 | I2bv(SrcSI | DstDI | String, em_cmp), | 3191 | I2bv(SrcSI | DstDI | String, em_cmp), |
3188 | /* 0xA8 - 0xAF */ | 3192 | /* 0xA8 - 0xAF */ |
@@ -3280,12 +3284,13 @@ static struct opcode twobyte_table[256] = { | |||
3280 | D(DstMem | SrcReg | Src2CL | ModRM), N, N, | 3284 | D(DstMem | SrcReg | Src2CL | ModRM), N, N, |
3281 | /* 0xA8 - 0xAF */ | 3285 | /* 0xA8 - 0xAF */ |
3282 | I(Stack | Src2GS, em_push_sreg), I(Stack | Src2GS, em_pop_sreg), | 3286 | I(Stack | Src2GS, em_push_sreg), I(Stack | Src2GS, em_pop_sreg), |
3283 | DI(ImplicitOps, rsm), D(DstMem | SrcReg | ModRM | BitOp | Lock), | 3287 | DI(ImplicitOps, rsm), |
3288 | D(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable), | ||
3284 | D(DstMem | SrcReg | Src2ImmByte | ModRM), | 3289 | D(DstMem | SrcReg | Src2ImmByte | ModRM), |
3285 | D(DstMem | SrcReg | Src2CL | ModRM), | 3290 | D(DstMem | SrcReg | Src2CL | ModRM), |
3286 | D(ModRM), I(DstReg | SrcMem | ModRM, em_imul), | 3291 | D(ModRM), I(DstReg | SrcMem | ModRM, em_imul), |
3287 | /* 0xB0 - 0xB7 */ | 3292 | /* 0xB0 - 0xB7 */ |
3288 | D2bv(DstMem | SrcReg | ModRM | Lock), | 3293 | D2bv(DstMem | SrcReg | ModRM | Lock | PageTable), |
3289 | I(DstReg | SrcMemFAddr | ModRM | Src2SS, em_lseg), | 3294 | I(DstReg | SrcMemFAddr | ModRM | Src2SS, em_lseg), |
3290 | D(DstMem | SrcReg | ModRM | BitOp | Lock), | 3295 | D(DstMem | SrcReg | ModRM | BitOp | Lock), |
3291 | I(DstReg | SrcMemFAddr | ModRM | Src2FS, em_lseg), | 3296 | I(DstReg | SrcMemFAddr | ModRM | Src2FS, em_lseg), |
@@ -3293,7 +3298,7 @@ static struct opcode twobyte_table[256] = { | |||
3293 | D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), | 3298 | D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), |
3294 | /* 0xB8 - 0xBF */ | 3299 | /* 0xB8 - 0xBF */ |
3295 | N, N, | 3300 | N, N, |
3296 | G(BitOp, group8), D(DstMem | SrcReg | ModRM | BitOp | Lock), | 3301 | G(BitOp, group8), D(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable), |
3297 | D(DstReg | SrcMem | ModRM), D(DstReg | SrcMem | ModRM), | 3302 | D(DstReg | SrcMem | ModRM), D(DstReg | SrcMem | ModRM), |
3298 | D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), | 3303 | D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), |
3299 | /* 0xC0 - 0xCF */ | 3304 | /* 0xC0 - 0xCF */ |