On 6/12/22 20:50, gaosong wrote:
Thank you for your advice.
like this:

  void helper_asrtle_d(CPULoongArchState *env, target_ulong rj, target_ulong rk)
  {
+    CPUState *cs = env_cpu(env);
+
      if (rj > rk) {
-        env->badaddr = env->pc;
-        do_raise_exception(env, EXCCODE_BCE, env->badaddr);
+        cpu_restore_state(cs, GETPC(), true);
+        cs->exception_index = EXCCODE_BCE;
+        cpu_loop_exit(cs);
      }
  }

This is not required -- better to continue using do_raise_exception.


cpu.c


      case EXCCODE_ADEM:
+    case EXCCODE_BCE:
      case EXCCODE_SYS:
      case EXCCODE_BRK:
+    case EXCCODE_INE:
+    case EXCCODE_IPE:
+    case EXCCODE_FPE:
+        env->badvaddr = env->pc;
+        QEMU_FALLTHROUGH;
      case EXCCODE_PIL:
      case EXCCODE_PIS:
      case EXCCODE_PME:
      case EXCCODE_PNR:
      case EXCCODE_PNX:
      case EXCCODE_PPI:
-    case EXCCODE_INE:
-    case EXCCODE_IPE:
-    case EXCCODE_FPE:
          cause = cs->exception_index;
          break;

But this looks correct, and sufficient to solve the problem.


r~

Reply via email to