summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorGuorui Li <[email protected]>2025-02-28 08:23:46 +0800
committerGitHub <[email protected]>2025-02-28 08:23:46 +0800
commit8adae0725d9fa37665ad9b5d83359705b1a9bc8c (patch)
treecc08508d33836c91bb471a8a8ca14991ea1df7cc /libcpu
parent58e587bfbca7e8c04b3e32c5a6a6a79e3664d295 (diff)
[bugfix][risc-v]fix the PPN length error in GET_PPN(pte). (#10020)
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/risc-v/common64/mmu.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpu/risc-v/common64/mmu.h b/libcpu/risc-v/common64/mmu.h
index e5385d2bf2..97d2cd0f32 100644
--- a/libcpu/risc-v/common64/mmu.h
+++ b/libcpu/risc-v/common64/mmu.h
@@ -41,7 +41,7 @@ struct mem_desc
#define GET_L2(addr) __PARTBIT(addr, VPN1_SHIFT, VPN1_BIT)
#define GET_L3(addr) __PARTBIT(addr, VPN0_SHIFT, VPN0_BIT)
#define GET_PPN(pte) \
- (__PARTBIT(pte, PTE_PPN_SHIFT, PHYSICAL_ADDRESS_WIDTH_BITS - PTE_PPN_SHIFT))
+ (__PARTBIT(pte, PTE_PPN_SHIFT, PHYSICAL_ADDRESS_WIDTH_BITS - PAGE_OFFSET_BIT))
#define GET_PADDR(pte) (GET_PPN(pte) << PAGE_OFFSET_BIT)
#define VPN_TO_PPN(vaddr, pv_off) (((rt_uintptr_t)(vaddr)) + (pv_off))
#define PPN_TO_VPN(paddr, pv_off) (((rt_uintptr_t)(paddr)) - (pv_off))