Skip to content

Commit e47a5f5

Browse files
avikivityGleb Natapov
authored andcommitted
KVM: x86 emulator: convert XADD to fastop
Signed-off-by: Avi Kivity <[email protected]> Signed-off-by: Gleb Natapov <[email protected]>
1 parent 203831e commit e47a5f5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

arch/x86/kvm/emulate.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,8 @@ FASTOP2W(bts);
853853
FASTOP2W(btr);
854854
FASTOP2W(btc);
855855

856+
FASTOP2(xadd);
857+
856858
static u8 test_cc(unsigned int condition, unsigned long flags)
857859
{
858860
u8 rc;
@@ -3861,7 +3863,7 @@ static const struct opcode twobyte_table[256] = {
38613863
F(DstReg | SrcMem | ModRM, em_bsf), F(DstReg | SrcMem | ModRM, em_bsr),
38623864
D(DstReg | SrcMem8 | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov),
38633865
/* 0xC0 - 0xC7 */
3864-
D2bv(DstMem | SrcReg | ModRM | Lock),
3866+
F2bv(DstMem | SrcReg | ModRM | SrcWrite | Lock, em_xadd),
38653867
N, D(DstMem | SrcReg | ModRM | Mov),
38663868
N, N, N, GD(0, &group9),
38673869
/* 0xC8 - 0xCF */
@@ -4698,12 +4700,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
46984700
ctxt->dst.val = (ctxt->src.bytes == 1) ? (s8) ctxt->src.val :
46994701
(s16) ctxt->src.val;
47004702
break;
4701-
case 0xc0 ... 0xc1: /* xadd */
4702-
fastop(ctxt, em_add);
4703-
/* Write back the register source. */
4704-
ctxt->src.val = ctxt->dst.orig_val;
4705-
write_register_operand(&ctxt->src);
4706-
break;
47074703
case 0xc3: /* movnti */
47084704
ctxt->dst.bytes = ctxt->op_bytes;
47094705
ctxt->dst.val = (ctxt->op_bytes == 4) ? (u32) ctxt->src.val :

0 commit comments

Comments
 (0)