Unaligned and Mixed-endian Data Access Support
ARM DDI 0301H
Copyright © 2004-2009 ARM Limited. All rights reserved.
4-20
ID012310
Non-Confidential, Unrestricted Access
4.6
Instructions to reverse bytes in a general-purpose register
When an application or device driver has to interface to memory-mapped peripheral registers or
shared-memory DMA structures that are not the same endianness as that of the internal data
structures, or the endianness of the Operating System, an efficient way of being able to explicitly
transform the endianness of the data is required. The following new instructions are added to the
ARM and Thumb instruction sets to provide this functionality:
•
reverse word, 4 bytes, register, for transforming big and little-endian 32-bit
representations
•
reverse halfword and sign-extend, for transforming signed 16-bit representations
•
Reverse packed halfwords in a register for transforming big- and little-endian 16-bit
representations.
ARM1176JZF-S instruction set summary
on page 1-32 describes these instructions.
4.6.1
All load and store operations
All load and store instructions take account of the CPSR E bit. Data is transferred directly to
registers when E = 0, and byte reversed if E = 1 for halfword, word, or multiple word transfers.
Operation:
When CPSR[<E-bit>] = 1 then byte reverse load/store data