From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/2] KVM: x86 emulator: put register operand write back to a function Date: Mon, 16 Aug 2010 11:55:55 +0300 Message-ID: <4C68FD1B.3070101@redhat.com> References: <4C63F947.7020808@cn.fujitsu.com> <4C67CFC5.6060900@redhat.com> <4C689B56.4000405@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Wei Yongjun Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751088Ab0HPI4C (ORCPT ); Mon, 16 Aug 2010 04:56:02 -0400 In-Reply-To: <4C689B56.4000405@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/16/2010 04:58 AM, Wei Yongjun wrote: > >> It's cleaner to take val and bytes from struct operand, and do the >> assignment from the callers, no? >> > take val and bytes from struct operand may have other issue, when we > writeback > the source register, we need do the assignment from the caller, and then > change > the val back before write src val to dst val. Such as xadd: > c->src.val = c->dst.val; > write_register_operand(&c->src); > c->src.val = c->src.orig_val; > goto add; Or avoid the 'goto add'. XADD is not ADD. write_register_operand(struct operand *) is easy to understand. With the two additional arguments it becomes confusing since it uses some parts of the operand but ignores others. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.