[mc1322x] Non-aligned structure copies

Jon Smirl jonsmirl at gmail.com
Wed Nov 4 08:29:21 EST 2009


On Wed, Nov 4, 2009 at 6:38 AM, Mariano Alvira <mar at devl.org> wrote:
> On Tue, Nov 03, 2009 at 11:30:10PM -0500, Jon Smirl wrote:
>>
>> Now I'm afraid of how many other places this problem may be hidden.
>>
>> Maybe Mar can get Qemu fired up and convince it to generate exceptions
>> on unaligned access. that would help locate the problems.
>> My familiarity with Qemu is zero.
>
> My familiarity is 0.0016. (what are the units of familiarity?)
>
> Anyway, I can certainly try. Jim knows Qemu quite well...
>
> Is this something OpenOCD can watch for?

On the ARM site it says there is an option on the ARM7 core that would
detect these accesses and cause an exception. From the doc I don't
believe Freescale added the option. Of course this chip isn't doc'd
very well. OpenOCD might be able to detect this by examining each
instruction before running it.

It you do a 32b store of ABCD to location 1 on ARM7 it writes DABC
into the word starting at zero.  The code expects it to write xABC
into the word at 0 and Dxxx into the word at 4. Qemu should be able to
detect this in its implementation of the LOAD/STORE instructions.  We
always want an exception on an un-aligned access. So is Qemu if is
byte swapping, trigger the exception instead of doing the operation.

I'll keep searching by hand.

>
> -Mar.
>



-- 
Jon Smirl
jonsmirl at gmail.com



More information about the mc1322x mailing list