From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCHv5 4/4] KVM: emulator: optimize "rep ins" handling. Date: Sun, 05 Aug 2012 18:20:29 +0300 Message-ID: <501E8F3D.3080603@redhat.com> References: <1343659101-24877-1-git-send-email-gleb@redhat.com> <1343659101-24877-5-git-send-email-gleb@redhat.com> <501E8B30.4060702@redhat.com> <20120805151837.GT27579@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:21165 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754561Ab2HEPUb (ORCPT ); Sun, 5 Aug 2012 11:20:31 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q75FKVO6007892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 5 Aug 2012 11:20:31 -0400 In-Reply-To: <20120805151837.GT27579@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/05/2012 06:18 PM, Gleb Natapov wrote: > On Sun, Aug 05, 2012 at 06:03:12PM +0300, Avi Kivity wrote: >> On 07/30/2012 05:38 PM, Gleb Natapov wrote: >> > Optimize "rep ins" by allowing emulator to write back more than one >> > datum at a time. Introduce new operand type OP_MEM_STR which tells >> > writeback() that dst contains pointer to an array that should be written >> > back as opposite to just one data element. >> > >> > >> > if (ctxt->rep_prefix && (ctxt->d & String)) { >> > + unsigned int count; >> > struct read_cache *r = &ctxt->io_read; >> > - register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RCX], -1); >> > + if ((ctxt->d & SrcMask) == SrcSI) >> > + count = ctxt->src.count; >> > + else >> > + count = ctxt->dst.count; >> > + register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RCX], >> > + -count); >> > >> >> count is unsigned. Does it sign extend correctly in >> register_address_increment()? >> > I think it sign extent before register_address_increment() when compiler > sees -count. count is in the range 1-1024 here, so there shouldn't be a > problem. By I welcome better suggestions. There is actually no problem since the 'inc' parameter is signed. -- error compiling committee.c: too many arguments to function