I took some "working" programs under userspace emulation into a linux instance running on a fork with comprehensive system mode support and discovered a compiler bug causing unaligned accesses. This bug had gone undetected in userspace tests because they were not handled correctly by QEMU.
With these patches, unaligned accesses cause an exception that generates SIGBUS. Changes for v2: moved linux-user cpu loop to its own commit. v1: https://lore.kernel.org/qemu-devel/[email protected]/ Brian Cain (5): target/hexagon: handle misaligned load/store cause codes in cpu_loop target/hexagon: raise SIGBUS on unaligned scalar loads target/hexagon: raise SIGBUS on unaligned scalar stores target/hexagon: raise SIGBUS on unaligned data access in sysemu tests/tcg/hexagon: add unaligned scalar test linux-user/hexagon/cpu_loop.c | 5 + target/hexagon/cpu.c | 25 +++++ target/hexagon/genptr.c | 10 +- target/hexagon/idef-parser/parser-helpers.c | 2 +- target/hexagon/macros.h | 26 +++-- target/hexagon/op_helper.c | 13 ++- target/hexagon/translate.c | 6 +- tests/tcg/hexagon/Makefile.target | 2 + tests/tcg/hexagon/unaligned_data.c | 118 ++++++++++++++++++++ 9 files changed, 185 insertions(+), 22 deletions(-) create mode 100644 tests/tcg/hexagon/unaligned_data.c -- 2.34.1
