68000 CPUs do not save format in the exception stack frame.
This patch adds feature checking to prevent format saving for 68000.
m68k_ret() already includes this modification, this patch fixes
the exception processing function too.

Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru>
---
 target/m68k/op_helper.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 3a7f7f2..e367133 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -301,8 +301,11 @@ static inline void do_stack_frame(CPUM68KState *env, 
uint32_t *sp,
         cpu_stl_kernel(env, *sp, addr);
         break;
     }
-    *sp -= 2;
-    cpu_stw_kernel(env, *sp, (format << 12) + (cs->exception_index << 2));
+    if (m68k_feature(env, M68K_FEATURE_QUAD_MULDIV)) {
+        /*  all except 68000 */
+        *sp -= 2;
+        cpu_stw_kernel(env, *sp, (format << 12) + (cs->exception_index << 2));
+    }
     *sp -= 4;
     cpu_stl_kernel(env, *sp, retaddr);
     *sp -= 2;


Reply via email to