aboutsummaryrefslogtreecommitdiff
path: root/target/m68k/op_helper.c
diff options
context:
space:
mode:
authorDaniel Palmer <daniel@0x0f.com>2024-01-15 19:16:42 +0900
committerThomas Huth <thuth@redhat.com>2024-02-23 08:12:27 +0100
commitf3c6376c8475388e5218a9503f0c545ca26492a5 (patch)
tree6eb7e2a99cd5eae038f945ab80c6aac2ac4b5fa3 /target/m68k/op_helper.c
parent3d54cbf269d63ff1d500b35b2bcf4565ff8ad485 (diff)
target/m68k: Fix exception frame format for 68010
From the 68010 a word with the frame format and exception vector are placed on the stack before the PC and SR. M68K_FEATURE_QUAD_MULDIV is currently checked to workout if to do this or not for the configured CPU but that flag isn't set for 68010 so currently the exception stack when 68010 is configured is incorrect. It seems like checking M68K_FEATURE_MOVEFROMSR_PRIV would do but adding a new flag that shows exactly what is going on here is maybe clearer. Add a new flag for the behaviour, M68K_FEATURE_EXCEPTION_FORMAT_VEC, and set it for 68010 and above, and then use it to control if the format and vector word are pushed/pop during exception entry/exit. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2164 Signed-off-by: Daniel Palmer <daniel@0x0f.com> Message-ID: <20240115101643.2165387-1-daniel@0x0f.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'target/m68k/op_helper.c')
-rw-r--r--target/m68k/op_helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 47b4173bb9..956e76eb5f 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -52,7 +52,7 @@ throwaway:
sp += 2;
env->pc = cpu_ldl_mmuidx_ra(env, sp, MMU_KERNEL_IDX, 0);
sp += 4;
- if (m68k_feature(env, M68K_FEATURE_QUAD_MULDIV)) {
+ if (m68k_feature(env, M68K_FEATURE_EXCEPTION_FORMAT_VEC)) {
/* all except 68000 */
fmt = cpu_lduw_mmuidx_ra(env, sp, MMU_KERNEL_IDX, 0);
sp += 2;
@@ -256,7 +256,7 @@ static inline void do_stack_frame(CPUM68KState *env, uint32_t *sp,
uint16_t format, uint16_t sr,
uint32_t addr, uint32_t retaddr)
{
- if (m68k_feature(env, M68K_FEATURE_QUAD_MULDIV)) {
+ if (m68k_feature(env, M68K_FEATURE_EXCEPTION_FORMAT_VEC)) {
/* all except 68000 */
CPUState *cs = env_cpu(env);
switch (format) {