qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to


From: Richard Henderson
Subject: Re: [PATCH v15 8/9] target/loongarch: Adjust functions and structure to support user-mode
Date: Mon, 13 Jun 2022 09:05:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

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

[Prev in Thread] Current Thread [Next in Thread]