aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2010-08-08 23:39:14 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:51:03 -0400
commitba7ff2b76dcf05c4681c2648019b8301ada6f3df (patch)
tree5a894a3f010c0aa1b959addbdc5d9a768a22bf2b /arch/x86/kvm/emulate.c
parent3885f18fe3034a10b3e3923885d70d31ba522844 (diff)
KVM: x86 emulator: mask group 8 instruction as BitOp
Mask group 8 instruction as BitOp, so we can share the code for adjust the source operand. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 9b81cde8ffa2..a9b2b9e6a3f0 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -737,6 +737,9 @@ static void fetch_bit_operand(struct decode_cache *c)
737 737
738 c->dst.addr.mem += (sv >> 3); 738 c->dst.addr.mem += (sv >> 3);
739 } 739 }
740
741 /* only subword offset */
742 c->src.val &= (c->dst.bytes << 3) - 1;
740} 743}
741 744
742static int read_emulated(struct x86_emulate_ctxt *ctxt, 745static int read_emulated(struct x86_emulate_ctxt *ctxt,
@@ -2336,7 +2339,7 @@ static struct opcode twobyte_table[256] = {
2336 D(DstReg | SrcMem16 | ModRM | Mov), 2339 D(DstReg | SrcMem16 | ModRM | Mov),
2337 /* 0xB8 - 0xBF */ 2340 /* 0xB8 - 0xBF */
2338 N, N, 2341 N, N,
2339 G(0, group8), D(DstMem | SrcReg | ModRM | BitOp | Lock), 2342 G(BitOp, group8), D(DstMem | SrcReg | ModRM | BitOp | Lock),
2340 N, N, D(ByteOp | DstReg | SrcMem | ModRM | Mov), 2343 N, N, D(ByteOp | DstReg | SrcMem | ModRM | Mov),
2341 D(DstReg | SrcMem16 | ModRM | Mov), 2344 D(DstReg | SrcMem16 | ModRM | Mov),
2342 /* 0xC0 - 0xCF */ 2345 /* 0xC0 - 0xCF */
@@ -3419,8 +3422,6 @@ twobyte_insn:
3419 break; 3422 break;
3420 case 0xab: 3423 case 0xab:
3421 bts: /* bts */ 3424 bts: /* bts */
3422 /* only subword offset */
3423 c->src.val &= (c->dst.bytes << 3) - 1;
3424 emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags); 3425 emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags);
3425 break; 3426 break;
3426 case 0xac: /* shrd imm8, r, r/m */ 3427 case 0xac: /* shrd imm8, r, r/m */
@@ -3448,8 +3449,6 @@ twobyte_insn:
3448 break; 3449 break;
3449 case 0xb3: 3450 case 0xb3:
3450 btr: /* btr */ 3451 btr: /* btr */
3451 /* only subword offset */
3452 c->src.val &= (c->dst.bytes << 3) - 1;
3453 emulate_2op_SrcV_nobyte("btr", c->src, c->dst, ctxt->eflags); 3452 emulate_2op_SrcV_nobyte("btr", c->src, c->dst, ctxt->eflags);
3454 break; 3453 break;
3455 case 0xb6 ... 0xb7: /* movzx */ 3454 case 0xb6 ... 0xb7: /* movzx */
@@ -3471,8 +3470,6 @@ twobyte_insn:
3471 break; 3470 break;
3472 case 0xbb: 3471 case 0xbb:
3473 btc: /* btc */ 3472 btc: /* btc */
3474 /* only subword offset */
3475 c->src.val &= (c->dst.bytes << 3) - 1;
3476 emulate_2op_SrcV_nobyte("btc", c->src, c->dst, ctxt->eflags); 3473 emulate_2op_SrcV_nobyte("btc", c->src, c->dst, ctxt->eflags);
3477 break; 3474 break;
3478 case 0xbe ... 0xbf: /* movsx */ 3475 case 0xbe ... 0xbf: /* movsx */