Unaligned and Mixed-endian Data Access Support
ARM DDI 0301H
Copyright © 2004-2009 ARM Limited. All rights reserved.
4-17
ID012310
Non-Confidential, Unrestricted Access
4.5
Mixed-endian access support
The following sections describe mixed-endian data access:
•
Legacy fixed instruction and data endianness
•
ARMv6 support for mixed-endian data
•
Instructions to change the CPSR E bit
on page 4-21.
For more information, see
The ARM Architecture Reference Manual
.
4.5.1
Legacy fixed instruction and data endianness
Prior to ARMv6 the endianness of both instructions and data are locked together, and the
configuration of the processor and the external memory system must either be hard-wired or
programmed in the first few instructions of the bootstrap code.
Where the endianness is configurable under program control, the MMU provides a mechanism
in CP15 c1 to set the B bit, that enables byte addressing renaming with 32-bit words. This model
of big-endian access, called BE-32 in this document, relies on a word-invariant view of memory
where an aligned 32-bit word reads and writes the same word of data in memory when
configured as either big-endian or little-endian.
For more information, see
Endianness
on page 8-38.
This behavior is still provided for legacy software when the U bit in CP15 Register c1 is zero,
as Table 4-4 lists.
4.5.2
ARMv6 support for mixed-endian data
In ARMv6 the instruction and data endianness are separated:
•
instructions are fixed little-endian
•
data accesses can be either little-endian or big-endian as controlled by bit 9, the E bit, of
the Program Status Register.
The value of the E bit on any exception entry, including reset, is determined by the CPSR
Register 15 EE bit.
Fixed little-endian Instructions
Instructions must be naturally aligned and are always treated as being stored in memory in
little-endian format. That is, the PC points to the least-significant-byte of the instruction.
Instructions must be treated as data by exception handlers, decoding SVC calls and Undefined
instructions, for example.
Instructions can also be written as data by debuggers,
Just-In-Time
(JIT) compilers, or in
operating systems that update exception vectors.
Table 4-4 Legacy endianness using CP15 c1
U
B
Instruction
endianness
Data
endianness
Description
0
0
LE
LE
LE, reset condition
0
1
BE-32
BE-32
Legacy BE, 32-bit word-invariant