aboutsummaryrefslogtreecommitdiff
path: root/target/sh4/cpu.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-12-27 07:01:27 -0800
committerLaurent Vivier <laurent@vivier.eu>2022-01-06 11:40:52 +0100
commit4da06fb306276946e227669bfc4df2077a8fa6c9 (patch)
tree5c03601e404ad94039fe33c41a789a8bfec1cf32 /target/sh4/cpu.h
parent217d1a5ef887c2013dc7446adff856e795cd8488 (diff)
downloadqemu-4da06fb306276946e227669bfc4df2077a8fa6c9.zip
qemu-4da06fb306276946e227669bfc4df2077a8fa6c9.tar.gz
qemu-4da06fb306276946e227669bfc4df2077a8fa6c9.tar.bz2
target/sh4: Implement prctl_unalign_sigbus
Leave TARGET_ALIGNED_ONLY set, but use the new CPUState flag to set MO_UNALN for the instructions that the kernel handles in the unaligned trap. The Linux kernel does not handle all memory operations: no floating-point and no MAC. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20211227150127.2659293-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'target/sh4/cpu.h')
-rw-r--r--target/sh4/cpu.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
index 4cfb109..fb9dd9d 100644
--- a/target/sh4/cpu.h
+++ b/target/sh4/cpu.h
@@ -83,6 +83,7 @@
#define DELAY_SLOT_RTE (1 << 2)
#define TB_FLAG_PENDING_MOVCA (1 << 3)
+#define TB_FLAG_UNALIGN (1 << 4)
#define GUSA_SHIFT 4
#ifdef CONFIG_USER_ONLY
@@ -373,6 +374,9 @@ static inline void cpu_get_tb_cpu_state(CPUSH4State *env, target_ulong *pc,
| (env->sr & ((1u << SR_MD) | (1u << SR_RB))) /* Bits 29-30 */
| (env->sr & (1u << SR_FD)) /* Bit 15 */
| (env->movcal_backup ? TB_FLAG_PENDING_MOVCA : 0); /* Bit 3 */
+#ifdef CONFIG_USER_ONLY
+ *flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus;
+#endif
}
#endif /* SH4_CPU_H */