diff options
author | Avi Kivity <avi.kivity@gmail.com> | 2013-01-04 09:18:51 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-01-09 14:39:21 -0500 |
commit | 75f728456f368140e6b34b6a79f3408774076325 (patch) | |
tree | d1696391384cb0eabfd0f76ef4a012aea0ca2ff6 /arch/x86/kvm/emulate.c | |
parent | b6744dc3fb55fda7cfcb53beecfa056f02415e6d (diff) |
KVM: x86 emulator: mark CMP, CMPS, SCAS, TEST as NoWrite
Acked-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index fe113fbb3737..2af0c4475605 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -3069,16 +3069,12 @@ static int em_xor(struct x86_emulate_ctxt *ctxt) | |||
3069 | static int em_cmp(struct x86_emulate_ctxt *ctxt) | 3069 | static int em_cmp(struct x86_emulate_ctxt *ctxt) |
3070 | { | 3070 | { |
3071 | emulate_2op_SrcV(ctxt, "cmp"); | 3071 | emulate_2op_SrcV(ctxt, "cmp"); |
3072 | /* Disable writeback. */ | ||
3073 | ctxt->dst.type = OP_NONE; | ||
3074 | return X86EMUL_CONTINUE; | 3072 | return X86EMUL_CONTINUE; |
3075 | } | 3073 | } |
3076 | 3074 | ||
3077 | static int em_test(struct x86_emulate_ctxt *ctxt) | 3075 | static int em_test(struct x86_emulate_ctxt *ctxt) |
3078 | { | 3076 | { |
3079 | emulate_2op_SrcV(ctxt, "test"); | 3077 | emulate_2op_SrcV(ctxt, "test"); |
3080 | /* Disable writeback. */ | ||
3081 | ctxt->dst.type = OP_NONE; | ||
3082 | return X86EMUL_CONTINUE; | 3078 | return X86EMUL_CONTINUE; |
3083 | } | 3079 | } |
3084 | 3080 | ||
@@ -3747,7 +3743,7 @@ static const struct opcode group1[] = { | |||
3747 | I(Lock | PageTable, em_and), | 3743 | I(Lock | PageTable, em_and), |
3748 | I(Lock, em_sub), | 3744 | I(Lock, em_sub), |
3749 | I(Lock, em_xor), | 3745 | I(Lock, em_xor), |
3750 | I(0, em_cmp), | 3746 | I(NoWrite, em_cmp), |
3751 | }; | 3747 | }; |
3752 | 3748 | ||
3753 | static const struct opcode group1A[] = { | 3749 | static const struct opcode group1A[] = { |
@@ -3755,8 +3751,8 @@ static const struct opcode group1A[] = { | |||
3755 | }; | 3751 | }; |
3756 | 3752 | ||
3757 | static const struct opcode group3[] = { | 3753 | static const struct opcode group3[] = { |
3758 | I(DstMem | SrcImm, em_test), | 3754 | I(DstMem | SrcImm | NoWrite, em_test), |
3759 | I(DstMem | SrcImm, em_test), | 3755 | I(DstMem | SrcImm | NoWrite, em_test), |
3760 | I(DstMem | SrcNone | Lock, em_not), | 3756 | I(DstMem | SrcNone | Lock, em_not), |
3761 | I(DstMem | SrcNone | Lock, em_neg), | 3757 | I(DstMem | SrcNone | Lock, em_neg), |
3762 | I(SrcMem, em_mul_ex), | 3758 | I(SrcMem, em_mul_ex), |
@@ -3920,7 +3916,7 @@ static const struct opcode opcode_table[256] = { | |||
3920 | /* 0x30 - 0x37 */ | 3916 | /* 0x30 - 0x37 */ |
3921 | I6ALU(Lock, em_xor), N, N, | 3917 | I6ALU(Lock, em_xor), N, N, |
3922 | /* 0x38 - 0x3F */ | 3918 | /* 0x38 - 0x3F */ |
3923 | I6ALU(0, em_cmp), N, N, | 3919 | I6ALU(NoWrite, em_cmp), N, N, |
3924 | /* 0x40 - 0x4F */ | 3920 | /* 0x40 - 0x4F */ |
3925 | X16(D(DstReg)), | 3921 | X16(D(DstReg)), |
3926 | /* 0x50 - 0x57 */ | 3922 | /* 0x50 - 0x57 */ |
@@ -3946,7 +3942,7 @@ static const struct opcode opcode_table[256] = { | |||
3946 | G(DstMem | SrcImm, group1), | 3942 | G(DstMem | SrcImm, group1), |
3947 | G(ByteOp | DstMem | SrcImm | No64, group1), | 3943 | G(ByteOp | DstMem | SrcImm | No64, group1), |
3948 | G(DstMem | SrcImmByte, group1), | 3944 | G(DstMem | SrcImmByte, group1), |
3949 | I2bv(DstMem | SrcReg | ModRM, em_test), | 3945 | I2bv(DstMem | SrcReg | ModRM | NoWrite, em_test), |
3950 | I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_xchg), | 3946 | I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_xchg), |
3951 | /* 0x88 - 0x8F */ | 3947 | /* 0x88 - 0x8F */ |
3952 | I2bv(DstMem | SrcReg | ModRM | Mov | PageTable, em_mov), | 3948 | I2bv(DstMem | SrcReg | ModRM | Mov | PageTable, em_mov), |
@@ -3966,12 +3962,12 @@ static const struct opcode opcode_table[256] = { | |||
3966 | I2bv(DstAcc | SrcMem | Mov | MemAbs, em_mov), | 3962 | I2bv(DstAcc | SrcMem | Mov | MemAbs, em_mov), |
3967 | I2bv(DstMem | SrcAcc | Mov | MemAbs | PageTable, em_mov), | 3963 | I2bv(DstMem | SrcAcc | Mov | MemAbs | PageTable, em_mov), |
3968 | I2bv(SrcSI | DstDI | Mov | String, em_mov), | 3964 | I2bv(SrcSI | DstDI | Mov | String, em_mov), |
3969 | I2bv(SrcSI | DstDI | String, em_cmp), | 3965 | I2bv(SrcSI | DstDI | String | NoWrite, em_cmp), |
3970 | /* 0xA8 - 0xAF */ | 3966 | /* 0xA8 - 0xAF */ |
3971 | I2bv(DstAcc | SrcImm, em_test), | 3967 | I2bv(DstAcc | SrcImm | NoWrite, em_test), |
3972 | I2bv(SrcAcc | DstDI | Mov | String, em_mov), | 3968 | I2bv(SrcAcc | DstDI | Mov | String, em_mov), |
3973 | I2bv(SrcSI | DstAcc | Mov | String, em_mov), | 3969 | I2bv(SrcSI | DstAcc | Mov | String, em_mov), |
3974 | I2bv(SrcAcc | DstDI | String, em_cmp), | 3970 | I2bv(SrcAcc | DstDI | String | NoWrite, em_cmp), |
3975 | /* 0xB0 - 0xB7 */ | 3971 | /* 0xB0 - 0xB7 */ |
3976 | X8(I(ByteOp | DstReg | SrcImm | Mov, em_mov)), | 3972 | X8(I(ByteOp | DstReg | SrcImm | Mov, em_mov)), |
3977 | /* 0xB8 - 0xBF */ | 3973 | /* 0xB8 - 0xBF */ |