From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] x86_emulate: Use DstReg when emulating xchg instructions Date: Sun, 15 Jun 2008 21:10:48 -0700 Message-ID: <4855E7C8.6020406@qumranet.com> References: <52d4a3890806150937g272f8848ydfa5711ddaf7a985@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, riel@surriel.com To: Mohammed Gamal Return-path: Received: from il.qumranet.com ([212.179.150.194]:59273 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbYFPEKv (ORCPT ); Mon, 16 Jun 2008 00:10:51 -0400 In-Reply-To: <52d4a3890806150937g272f8848ydfa5711ddaf7a985@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Mohammed Gamal wrote: > As per Avi's recommendation, this patch uses DstReg to autodecode destination > registers when emulating xchg instructions > > Applied, thanks. I had to fix some coding style errors, please read Documentation/CodingStyle (or just follow the style in the surrounding code). > + case 0x91 ... 0x97: /* xchg reg,rax */ > + c->src.type = c->dst.type = OP_REG; > + c->src.bytes = c->dst.bytes = c->op_bytes; > + c->src.ptr = (unsigned long *) &c->regs[VCPU_REGS_RAX]; > + c->src.val = *(c->src.ptr); > + goto xchg; > How about SrcAcc and DstAcc so this code doesn't have to be repeated? There are many potential use cases. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.