From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOBy0-0004z3-D4 for qemu-devel@nongnu.org; Sun, 22 May 2011 12:57:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOBxz-0006Nm-7T for qemu-devel@nongnu.org; Sun, 22 May 2011 12:57:24 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:37246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOBxz-0006Nc-2p for qemu-devel@nongnu.org; Sun, 22 May 2011 12:57:23 -0400 Received: by pvg3 with SMTP id 3so2871517pvg.4 for ; Sun, 22 May 2011 09:57:21 -0700 (PDT) Sender: Richard Henderson Message-ID: <4DD9406F.9030407@twiddle.net> Date: Sun, 22 May 2011 09:57:19 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1305671572-5899-1-git-send-email-jcmvbkbc@gmail.com> <1305671572-5899-22-git-send-email-jcmvbkbc@gmail.com> <4DD593E6.1060704@twiddle.net> <201105221610.17663.jcmvbkbc@gmail.com> In-Reply-To: <201105221610.17663.jcmvbkbc@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 21/26] target-xtensa: implement unaligned exception option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov Cc: qemu-devel@nongnu.org On 05/22/2011 05:10 AM, Max Filippov wrote: > There are three alignment possibilities for xtensa: no unaligned > exception, unaligned exception and hardware alignment. In the first > case unaligned access silently goes to aligned address. It looks like > it cannot be done via do_unaligned_access, can it? In the third case > most unaligned accesses are handled transparently by the hardware. > But e.g. unaligned access by multiprocessor synchronization > instructions still cause alignment exception. Do I need to implement > a different alignment checking mechanism for those unhandled cases? Case (1), silently going to an aligned address, should be handled inside the translator by masking the address before the load. See the ARM and Alpha targets for examples. Case (2) and (3) are both handled by using ALIGNED_ONLY. All you need to do to handle (3) is *not* throw an exception from the do_unaligned_access function. See how the code is structured inside softmmu_template.h. As for sync insns... You may need to handle it all out-of-line and check for alignment there. r~