On 1/31/23 14:46, Ilya Leoshkevich wrote:
GCC lowers __builtin_trap() to "ta 5", which in turn generates trap
0x105. Follow what kernel's bad_trap() is doing there.

Signed-off-by: Ilya Leoshkevich <[email protected]>
---
  linux-user/sparc/cpu_loop.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index 434c90a55f8..fa36d452a51 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -225,6 +225,9 @@ void cpu_loop (CPUSPARCState *env)
              restore_window(env);
              break;
  #ifndef TARGET_ABI32
+        case 0x105:
+            force_sig_fault(TARGET_SIGILL, ILL_ILLTRP, env->pc);
+            break;
          case 0x16e:
              flush_windows(env);
              sparc64_get_context(env);

Quite a lot of ttable{32,64}.S is missing here. We should certainly make use of TT_TRAP, instead of hard-coding 0x100 vs 0x80.


r~

Reply via email to