Skip to content

Commit a3ded3b

Browse files
GorrayLiRbb666
authored andcommitted
[bugfix][risc-v]fix the PPN length error in GET_PPN(pte). (#10020)
1 parent 87f109e commit a3ded3b

File tree

1 file changed

+1
-1
lines changed
  • libcpu/risc-v/common64

1 file changed

+1
-1
lines changed

libcpu/risc-v/common64/mmu.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct mem_desc
4141
#define GET_L2(addr) __PARTBIT(addr, VPN1_SHIFT, VPN1_BIT)
4242
#define GET_L3(addr) __PARTBIT(addr, VPN0_SHIFT, VPN0_BIT)
4343
#define GET_PPN(pte) \
44-
(__PARTBIT(pte, PTE_PPN_SHIFT, PHYSICAL_ADDRESS_WIDTH_BITS - PTE_PPN_SHIFT))
44+
(__PARTBIT(pte, PTE_PPN_SHIFT, PHYSICAL_ADDRESS_WIDTH_BITS - PAGE_OFFSET_BIT))
4545
#define GET_PADDR(pte) (GET_PPN(pte) << PAGE_OFFSET_BIT)
4646
#define VPN_TO_PPN(vaddr, pv_off) (((rt_uintptr_t)(vaddr)) + (pv_off))
4747
#define PPN_TO_VPN(paddr, pv_off) (((rt_uintptr_t)(paddr)) - (pv_off))

0 commit comments

Comments
 (0)