[PATCH v2 0/5] Fixes for unaligned scalar accesses

Brian Cain posted 5 patches 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260714010955.2226493-1-brian.cain@oss.qualcomm.com
Maintainers: Brian Cain <brian.cain@oss.qualcomm.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Laurent Vivier <laurent@vivier.eu>, Helge Deller <deller@gmx.de>, Alessandro Di Federico <ale@rev.ng>, Anton Johansson <anjo@rev.ng>
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
[PATCH v2 0/5] Fixes for unaligned scalar accesses
Posted by Brian Cain 1 week, 4 days ago
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/20260709233436.3075100-1-brian.cain@oss.qualcomm.com/

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