On 9/3/25 10:48, Bibo Mao wrote:
With function loongarch_tlb_search(), it is to search TLB entry with
speficied virtual address, the difference is selection with asid and
global bit. Here add selection callback with asid and global bit.
Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
target/loongarch/tcg/tlb_helper.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index 00422f259d..006fe1b207 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -21,6 +21,17 @@
#include "cpu-csr.h"
#include "tcg/tcg_loongarch.h"
+typedef bool (*tlb_match)(int global, int asid, int tlb_asid);
Should global parameter be bool?
+
+static bool tlb_match_any(int global, int asid, int tlb_asid)
+{
+ if (global == 1 || tlb_asid == asid) {
+ return true;
+ }
+
+ return false;
+}
More compact as
return global || tlb_asid == asid;
Otherwise,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
r~