2 ms·
> ARM still requires aligned access, I believe. ARMv7 supports unaligned access but not on all operations (e.g. LDM or STM don't support it). And the operation
by masklinn 8y ago
> ARM still requires aligned access, I believe.
ARMv7 supports unaligned access but not on all operations (e.g. LDM or STM don't support it). And the operation will simply be split into multiple aligned accesses, which are not necessarily atomic.
ARM64 further expands this, according to ARM
> Except for exclusive and ordered accesses, all loads and stores support the use of unaligned addresses when accessing normal memory.
On ARMv5, some operations could be given unaligned addresses but would round them down, and possibly rotate the result.
ARMv6 is/was switchable between ARMv7 and ARMv5 behaviour.
Also ARMv7+ can be configured to fault on all unaligned access.
- glandium 8y agohttps://blog.einval.com/2019/01/07#rebuilding_on_arm64 https://blog.einval.com/2019/01/07#rebuilding_on_arm64 says the Linux kernel sends SIGBUS on unaligned accesses on arm64.
- pm215 8y agoThat is for arm32 userspace binaries being run under an arm64 kernel, and applies only to the handful of instructions which in Armv8 still generate alignment faults. With an arm32 kernel you could configure the kernel to fix those up as well; with an arm64 kernel you cannot. This only really matters for broken programs which do unaligned accesses without telling the compiler about it (which can also trip you up, though more rarely, under x86, if the compiler decides to use a simd instruction). As Steve says, it only affects a really tiny set of programs, which can have their bugs fixed.