At 12:28 PM 12/18/2001 -0800, David S. Miller wrote:
>Unaligned kernel loads and stores must be properly handled by the
>platform code, and on ARM chips where that is possible it is.
I don't know what arch you're using, but I work with ARM7TDMI, which has a
behavior I believe can be found documented in some obscure .pdf from arm.com:
Unaligned accesses wrap.
If you have this:
[mem.] 00 01 02 03 04 05 06 07
[data] 00 11 22 33 44 55 66 77
in little-endian mode,
*(int*)0x00 == 0x33221100
*(int*)0x01 == 0x00332211
*(int*)0x02 == 0x11003322
*(int*)0x03 == 0x22110033
*(int*)0x04 == 0x77665544
At least, that's how ARM's docs seem to describe it. I work with this cpu
embedded in a microcontroller (AT91M40800), and these values result:
*(int*)0x00 == 0x33221100
*(int*)0x01 == 0x33221100
*(int*)0x02 == 0x33221100
*(int*)0x03 == 0x33221100
*(int*)0x04 == 0x77665544
An unaligned access to an assembly-declared variable caused me much grief
once, overwriting the task scheduler's ready-to-run list under certain
conditions...
The moral of the story:
RISC cpus abhor unaligned accesses.
-- Stevie-OReal programmers use COPY CON PROGRAM.EXE
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Dec 23 2001 - 21:00:21 EST