From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC PATCH 2/2] KVM: x86 emulator: Cleanup emulate_push() writebacks Date: Sun, 03 Apr 2011 17:50:15 +0300 Message-ID: <4D988927.4020003@redhat.com> References: <20110329013229.20e6168f.takuya.yoshikawa@gmail.com> <20110329013407.c7bcadcc.takuya.yoshikawa@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, gleb@redhat.com To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048Ab1DCOuV (ORCPT ); Sun, 3 Apr 2011 10:50:21 -0400 In-Reply-To: <20110329013407.c7bcadcc.takuya.yoshikawa@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 03/28/2011 06:34 PM, Takuya Yoshikawa wrote: > From: Takuya Yoshikawa > > Recently, emulate_push family functions started to call writeback() > during their emulation. This clearly shows that the usual writeback() > which is done at the end of x86_emulate_insn() cannot cover all cases. > Furthermore, suppressing writeback by changing dst operand's type is > not simple when conditional writeback must be taken care of. > > This patch improves this situation a bit by making emulate_push() > itself do writeback and removes scattered writebacks from callers. > > This is done by splitting the writeback for OP_MEM case out from > writeback() as a new helper function, writeback_to_mem(), and call it > directly from emulate_push(). I think it's easier to just write directly instead of going through 'struct operand'. Probably emulate_push() should do the write (look at segmented_write() in my 'Emulator segment checks' patchset), and everything else can call that. 'struct operand' is for multiplexing register/memory accesses, which is not the case with the stack. -- error compiling committee.c: too many arguments to function