qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v16 7/9] target/loongarch: Adjust functions and structure to


From: Richard Henderson
Subject: Re: [PATCH v16 7/9] target/loongarch: Adjust functions and structure to support user-mode
Date: Tue, 14 Jun 2022 09:43:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 6/14/22 02:05, Song Gao wrote:
@@ -172,17 +173,20 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
          update_badinstr = 0;
          break;
      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;

This is incorrect still.

(1) env->badaddr (in this patch renamed badvaddr) is actually unused prior to this patch and should go away. It seems to have been copied from RISC-V? The correct LoongArch variable is env->CSR_BADV (see raise_mmu_exception in tlb_helper.c).

(2) EXCCODE_ADEM is on the wrong side of this FALLTHROUGH. This is the exception raised by TLB faults, and should retain the BADV address of the fault, not the faulting instruction.

Also, this patch is trying to do too many things at once. Please split it into smaller logical changes. Any bug fixes for the system code, for instance raising EXCCODE_BCE instead of EXCCODE_ADEM for helper_asrtle_d should be completely separated.


r~



reply via email to

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