From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysdpx-0005g6-8y for qemu-devel@nongnu.org; Wed, 13 May 2015 17:05:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ysdpu-0001sC-2P for qemu-devel@nongnu.org; Wed, 13 May 2015 17:05:05 -0400 Received: from mail-ig0-f171.google.com ([209.85.213.171]:37527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysdpt-0001rS-VN for qemu-devel@nongnu.org; Wed, 13 May 2015 17:05:02 -0400 Received: by igbsb11 with SMTP id sb11so56620188igb.0 for ; Wed, 13 May 2015 14:05:01 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1431544200-13371-4-git-send-email-rth@twiddle.net> References: <1431544200-13371-1-git-send-email-rth@twiddle.net> <1431544200-13371-4-git-send-email-rth@twiddle.net> From: Peter Maydell Date: Wed, 13 May 2015 22:04:41 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 3/3] tcg: Add MO_ALIGN, MO_UNALN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Yongbok Kim , Leon Alrae , QEMU Developers On 13 May 2015 at 20:10, Richard Henderson wrote: > These modifiers control, on a per-memory-op basis, whether > unaligned memory accesses are allowed. The default setting > reflects the target's definition of ALIGNED_ONLY. > > Signed-off-by: Richard Henderson > diff --git a/tcg/tcg.h b/tcg/tcg.h > index f9fb380..ff5bd8a 100644 > --- a/tcg/tcg.h > +++ b/tcg/tcg.h > @@ -241,6 +241,15 @@ typedef enum TCGMemOp { > MO_TE = MO_LE, > #endif > > + MO_AMASK = 16, /* Target reverse "align-ness". */ > +#ifdef ALIGNED_ONLY > + MO_ALIGN = 0, > + MO_UNALN = MO_AMASK, > +#else > + MO_ALIGN = MO_AMASK, > + MO_UNALN = 0, > +#endif I feel like the semantics could use a little clarification here. Something like: MO_ALIGN = ... /* Accesses must be aligned (or CPU do_unaligned_access hook is called) */ MO_UNALN = ... /* Unaligned accesses are permitted */ or put something similar in a block comment before the ifdef: /* MO_UNALN accesses are never checked for alignment; MO_ALIGN * accesses will result in a call to the CPU's do_unaligned_access * hook if the guest address is not aligned. The default depends * on whether the target CPU defines ALIGNED_ONLY. */ Otherwise Reviewed-by: Peter Maydell Are unaligned accesses always slow-path, by the way? Presumably they must be, or this code wouldn't work... thanks -- PMM