From the ARM Reference Manual: (A2.8)
Prior to ARMv6, doubleword (
LDRD
/
STRD
) accesses to memory, where the a
ddress is not doubleword-aligned,
are
UNPREDICTABLE
. Also, data accesses to non-aligned word an
d halfword data are treated as aligned from
the memory interface perspective. That is:
• the address is treated as truncat
ed, with address bits[1:0] treate
d as zero for word accesses, and
address bit[0] treated as
zero for halfword accesses.
• load single word ARM instructions
are architecturally defined to ro
tate right the wo
rd-aligned data
transferred by a non word-aligned address one, two
or three bytes depending on the value of the two
least significant address bits.
• alignment checking is defined fo
r implementations supporting a Syst
em Control coprocessor using
the A bit in CP15 register 1
As previously suggested, printout the "thing" being pointed to (message) at point A (where correct) then again at point B (where incorrect) and look for differences.
The Linux 2.6.10 is a very old kernel. Might be some library/kernel issue as well. . .
Is this structure "statically" allocated (i.e. not on the stack)?
Also, check the compiler directives w.r.t. alignment issues.
Your idea of a test program is also very good.