diff mbox series

[07/14] linux-user/sparc: Handle division by zero traps

Message ID 20230202005204.2055899-8-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user/sparc: Handle missing traps | expand

Commit Message

Richard Henderson Feb. 2, 2023, 12:51 a.m. UTC
In addition to the hw trap vector, there is a software trap
assigned for older sparc without hw division instructions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/sparc/cpu_loop.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index 573d97c60b..398418174f 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -215,6 +215,11 @@  void cpu_loop (CPUSPARCState *env)
             force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc);
             break;
 
+        case TT_TRAP + 0x02: /* div0 */
+        case TT_DIV_ZERO:
+            force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->pc);
+            break;
+
         case TT_TRAP + 0x03: /* flush windows */
             flush_windows(env);
             /* next instruction */