Re: [PATCH] target/arm: Don't enforce alignment faults on Device memory for SCTLR.U == 0

Richard Henderson <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 8/19/26 12:00, Peter Maydell wrote:
> We enforce that we take alignment faults for unaligned accesses
> when the MMU is disabled or the access is to Device memory. This
> is correct for the new-style unaligned accesses rules that were
> introduced in ARMv6 when SCTLR.U == 1 and then became the only
> option from ARMv7 (where SCTLR.U is RES1). However, it isn't
> right for the old ARMv4 and ARMv5 setup (and ARMv6 when SCTLR.U = 0).
> 
> We don't emulate the v4/v5 alignment rules (which notably include
> "for unaligned LDR, do an aligned load and rotate"); but taking an
> alignment fault is definitely wrong and isn't what QEMU has
> traditionally done.  Restrict this behaviour to when SCTLR.U is 1.
> 
> (The other place we enable alignment checks on Device memory is in
> ptw.c, but we only set TLB_CHECK_ALIGNED for LPAE translations, which
> are guaranteed to be v7 or later.)
> 
> Signed-off-by: Peter Maydell<[email protected]>
> ---
>   target/arm/tcg/hflags.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)

Reviewed-by: Richard Henderson <[email protected]>

r~
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.