From patchwork Tue Aug 17 01:19:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 119837 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7H1MAdN007816 for ; Tue, 17 Aug 2010 01:22:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752653Ab0HQBWH (ORCPT ); Mon, 16 Aug 2010 21:22:07 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:50276 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751743Ab0HQBWG (ORCPT ); Mon, 16 Aug 2010 21:22:06 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 300E1170134; Tue, 17 Aug 2010 09:22:04 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o7H1IpjG029553; Tue, 17 Aug 2010 09:18:51 +0800 Received: from [10.167.141.76] (unknown [10.167.141.76]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id C982014C017; Tue, 17 Aug 2010 09:23:03 +0800 (CST) Message-ID: <4C69E3A6.4020500@cn.fujitsu.com> Date: Tue, 17 Aug 2010 09:19:34 +0800 From: Wei Yongjun User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100528 Thunderbird/3.0.5 MIME-Version: 1.0 To: Avi Kivity CC: kvm@vger.kernel.org Subject: [PATCH 2/2 v4] KVM: x86 emulator: add XADD instruction emulation References: <4C69E32A.1070801@cn.fujitsu.com> In-Reply-To: <4C69E32A.1070801@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 17 Aug 2010 01:22:10 +0000 (UTC) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d690daf..41ca98b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2386,7 +2386,8 @@ static struct opcode twobyte_table[256] = { D(DstReg | SrcMem | ModRM), D(DstReg | SrcMem | ModRM), D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), /* 0xC0 - 0xCF */ - N, N, N, D(DstMem | SrcReg | ModRM | Mov), + D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock), + N, D(DstMem | SrcReg | ModRM | Mov), N, N, N, GD(0, &group9), N, N, N, N, N, N, N, N, /* 0xD0 - 0xDF */ @@ -3532,6 +3533,12 @@ twobyte_insn: c->dst.val = (c->d & ByteOp) ? (s8) c->src.val : (s16) c->src.val; break; + case 0xc0 ... 0xc1: /* xadd */ + emulate_2op_SrcV("add", c->src, c->dst, ctxt->eflags); + /* Write back the register source. */ + c->src.val = c->dst.orig_val; + write_register_operand(&c->src); + break; case 0xc3: /* movnti */ c->dst.bytes = c->op_bytes; c->dst.val = (c->op_bytes == 4) ? (u32) c->src.val :