On 9/3/25 10:48, Bibo Mao wrote:
Invalid tlb entry in function invalidate_tlb(), and its usage is
simple and easy to use.

Signed-off-by: Bibo Mao <[email protected]>
---
  target/loongarch/tcg/tlb_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/loongarch/tcg/tlb_helper.c 
b/target/loongarch/tcg/tlb_helper.c
index c074c956a2..ee40684a18 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -161,6 +161,7 @@ static void invalidate_tlb(CPULoongArchState *env, int 
index)
          return;
      }
      invalidate_tlb_entry(env, index);
+    tlb->tlb_misc = FIELD_DP64(tlb->tlb_misc, TLB_MISC, E, 0);
  }

Why not move it all the way down into invalidate_elf_entry, after we've checked 
that E != 0?


r~

static void fill_tlb_entry(CPULoongArchState *env, LoongArchTLB *tlb)
@@ -340,7 +341,6 @@ void helper_tlbwr(CPULoongArchState *env)
      old = env->tlb + index;
      if (FIELD_EX64(env->CSR_TLBIDX, CSR_TLBIDX, NE)) {
          invalidate_tlb(env, index);
-        old->tlb_misc = FIELD_DP64(old->tlb_misc, TLB_MISC, E, 0);
          return;
      }


Reply via email to