From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 29 Oct 2009 07:01:11 +0200 Subject: [U-Boot] [PATCH] Make the generic unaligned access code safe for unaligned access In-Reply-To: <1256764421-27799-4-git-send-email-linux@bohmer.net> References: <1256764421-27799-1-git-send-email-linux@bohmer.net> <1256764421-27799-3-git-send-email-linux@bohmer.net> <1256764421-27799-4-git-send-email-linux@bohmer.net> Message-ID: <200910290601.11199.sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Remy, On Wednesday 28 October 2009 22:13:38 Remy Bohmer wrote: > The current generic code for handling unaligned access assumes that > the processor can properly handle unaligned accesses itself. > This is at least not the case for ARM, which results in runtime > errors. > > Rewrite it such that it works for ARM as well. I introduced this header some time ago for UBIFS support (for PowerPC). As you may have noticed, it's a copy from the Linux version. And I would like to keep it this way if possible. Looking at the Linux ARM version, the basic difference seems to be the header "include/asm-arm/unaligned.h" which includes this file. The Linux version of "unaligned.h" does *not* include "access_ok.h" at all. It includes "le_byteshift.h" and "be_byteshift.h" instead. And I would really like to keep this in sync with Linux if possible. So why not do it this way (totally untested):