Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjIYj-0006jb-OT for qemu-devel@nongnu.org; Thu, 03 Sep 2009 16:05:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjIYf-0006gG-Ai for qemu-devel@nongnu.org; Thu, 03 Sep 2009 16:05:29 -0400 Received: from [199.232.76.173] (port=54588 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjIYf-0006gB-13 for qemu-devel@nongnu.org; Thu, 03 Sep 2009 16:05:25 -0400 Received: from mail-fx0-f211.google.com ([209.85.220.211]:52089) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjIYe-0007n2-72 for qemu-devel@nongnu.org; Thu, 03 Sep 2009 16:05:24 -0400 Received: by fxm7 with SMTP id 7so214927fxm.34 for ; Thu, 03 Sep 2009 13:05:23 -0700 (PDT) Date: Thu, 3 Sep 2009 22:01:02 +0200 From: "Edgar E. Iglesias" Message-ID: <20090903200102.GB22808@laped.iglesias.mooo.com> References: <200909031110.n83BAwuM023891@d03av03.boulder.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: [Qemu-devel] Re: [Qemu-commits] [COMMIT 968a40f] microblaze: Trap on unaligned data accesses. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: "Edgar E. Iglesias" , qemu-devel On Thu, Sep 03, 2009 at 09:10:40PM +0300, Blue Swirl wrote: > On Thu, Sep 3, 2009 at 2:11 PM, Anthony Liguori wrote: > > From: Edgar E. Iglesias > > > +void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size) > > +{ > > +    uint32_t mask; > > + > > +    switch (size) { > > +        case 4: mask = 3; break; > > +        case 2: mask = 1; break; > > +        default: > > +        case 1: mask = 0; break; > > +    } > > For additional performance (and to avoid the check for mask == 0 case > ;-)), you could perform most of the math above during translation. Thanks, I beleive part of what you say is already done. The case 1 is there for completeness but translate.c doesn't call the helper for size 1. I'll move the computing of the mask into translate.c. Thanks, Edgar > > Sparc32 actually avoids most of these explicit tests, but I still > can't understand Fabrice's magic that made it possible.