[PATCH 0/4] Fixes for unaligned scalar accesses

Brian Cain posted 4 patches 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260709233436.3075100-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 0/4] Fixes for unaligned scalar accesses
Posted by Brian Cain 2 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.

Brian Cain (4):
  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
Re: [PATCH 0/4] Fixes for unaligned scalar accesses
Posted by Pierrick Bouvier 1 day, 4 hours ago
On 7/9/2026 4:34 PM, Brian Cain wrote:
> 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.
> 
> Brian Cain (4):
>   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
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Re: [PATCH 0/4] Fixes for unaligned scalar accesses
Posted by Matheus Tavares Bernardino 1 day, 6 hours ago
On Thu,  9 Jul 2026 16:34:32 -0700 Brian Cain <brian.cain@oss.qualcomm.com> wrote:
>
> 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.
> 
> Brian Cain (4):
>   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

Reviewed-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>