Unaligned and Mixed-endian Data Access Support
ARM DDI 0301H
Copyright © 2004-2009 ARM Limited. All rights reserved.
4-18
ID012310
Non-Confidential, Unrestricted Access
Mixed-endian data access
The operating-system typically has a required endian representation of internal data structures,
but applications and device drivers have to work with data shared with other processors, DSP or
DMA interfaces, that might have fixed big-endian or little-endian data formatting.
A byte-invariant addressing mechanism is provided that enables the load/store architecture to be
qualified by the CPSR E bit that provides byte reversing of big-endian data in to, and out of, the
processor register bank transparently. This byte-invariant big-endian representation is referred
to as BE-8 in this document.
Mixed-endian configuration supported
on page 4-19 describes the effect on byte, halfword,
word, and multi-word accesses of setting the CPSR E bit when the U bit enables unaligned
support.
Byte data access
The same physical byte in memory is accessed whether big-endian, BE-8, or little-endian:
•
unsigned byte load as
Load unsigned byte, endian independent
on page 4-6 describes
•
signed byte load as
Load signed byte, endian independent
on page 4-6 describes
•
byte store as
Store byte, endian independent
on page 4-6 describes.
Halfword data access
The same two physical bytes in memory are accessed whether big-endian, BE-8, or little-endian.
Big-endian halfword load data is byte-reversed as read into the processor register to ensure
little-endian internal representation, and similarly is byte-reversed on store to memory:
•
unsigned halfword load as
Load unsigned halfword, little-endian
on page 4-7, LE, and
Load unsigned halfword, big-endian
on page 4-7, BE-8 describe
•
signed halfword load as
Load signed halfword, little-endian
on page 4-8, LE, and
Load
signed halfword, big-endian
on page 4-8, BE-8 describe
•
halfword store as
Store halfword, little-endian
on page 4-9, LE, and
Store halfword,
big-endian
on page 4-9, BE-8 describe.
Word data access
The same four physical bytes in memory are accessed whether big-endian, BE-8, or
little-endian. Big-endian word load data is byte reversed as read into the processor register to
ensure little-endian internal representation, and similarly is byte-reversed on store to memory:
•
word load as
Load word, little-endian
on page 4-10, LE, and
Load word, big-endian
on
page 4-10, BE-8 describes
•
word store as
Store word, little-endian
on page 4-11, LE, and
Store word, big-endian
on
page 4-11, BE-8 describes.