]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/arm: Fix BLXNS helper store alignment checks
authorWilliam Kosasih <kosasihwilliam4@gmail.com>
Thu, 3 Jul 2025 08:55:55 +0000 (18:25 +0930)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 4 Jul 2025 12:44:20 +0000 (13:44 +0100)
This patch adds alignment checks in the store operations (when stacking the
return pc and psr) in the BLXNS instruction.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1154
Signed-off-by: William Kosasih <kosasihwilliam4@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250703085604.154449-3-kosasihwilliam4@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/tcg/m_helper.c

index 251e12edf9cb96d9712e1fc6cd1a4aa520e3ec18..f342d934896b90dfb6ac0d53d4f1db0da46ec82a 100644 (file)
@@ -632,8 +632,11 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
     }
 
     /* Note that these stores can throw exceptions on MPU faults */
-    cpu_stl_data_ra(env, sp, nextinst, GETPC());
-    cpu_stl_data_ra(env, sp + 4, saved_psr, GETPC());
+    ARMMMUIdx mmu_idx = arm_mmu_idx(env);
+    MemOpIdx oi = make_memop_idx(MO_TEUL | MO_ALIGN,
+                                 arm_to_core_mmu_idx(mmu_idx));
+    cpu_stl_mmu(env, sp, nextinst, oi, GETPC());
+    cpu_stl_mmu(env, sp + 4, saved_psr, oi, GETPC());
 
     env->regs[13] = sp;
     env->regs[14] = 0xfeffffff;