[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] target/loongarch: Fix index calculation for variable length pte
From: |
Miao Hao |
Subject: |
[PATCH] target/loongarch: Fix index calculation for variable length pte |
Date: |
Mon, 30 Dec 2024 15:26:13 +0800 |
Signed-off-by: Miao Hao <haomiao23s@ict.ac.cn>
---
target/loongarch/tcg/tlb_helper.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index 97f38fc391..a57ddfe8ad 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -538,9 +538,9 @@ target_ulong helper_lddir(CPULoongArchState *env,
target_ulong base,
badvaddr = env->CSR_TLBRBADV;
base = base & TARGET_PHYS_MASK;
- /* 0:64bit, 1:128bit, 2:192bit, 3:256bit */
+ /* 0:64bit, 1:128bit, 2:256bit, 3:512bit */
shift = FIELD_EX64(env->CSR_PWCL, CSR_PWCL, PTEWIDTH);
- shift = (shift + 1) * 3;
+ shift = shift + 3;
get_dir_base_width(env, &dir_base, &dir_width, level);
index = (badvaddr >> dir_base) & ((1 << dir_width) - 1);
@@ -595,9 +595,9 @@ void helper_ldpte(CPULoongArchState *env, target_ulong
base, target_ulong odd,
tmp0 += MAKE_64BIT_MASK(ps, 1);
}
} else {
- /* 0:64bit, 1:128bit, 2:192bit, 3:256bit */
+ /* 0:64bit, 1:128bit, 2:256bit, 3:512bit */
shift = FIELD_EX64(env->CSR_PWCL, CSR_PWCL, PTEWIDTH);
- shift = (shift + 1) * 3;
+ shift = shift + 3;
badv = env->CSR_TLBRBADV;
ptindex = (badv >> ptbase) & ((1 << ptwidth) - 1);
--
2.34.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] target/loongarch: Fix index calculation for variable length pte,
Miao Hao <=