Skip to content

Commit

Permalink
riscv/hardware.h: simplify RISCV_GET_PT_INDEX
Browse files Browse the repository at this point in the history
This simplifies RISCV_GET_PT_INDEX by reusing RISCV_GET_LVL_PGSIZE_BITS.

Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 authored and lsf37 committed Dec 4, 2024
1 parent 5041eda commit b67ff0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/arch/riscv/arch/machine/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* configured RISC-V system with CONFIG_PT_LEVEL (which can be 2 on Sv32,
* 3 on Sv39, or 4 on Sv48)
*/
#define RISCV_GET_PT_INDEX(addr, n) (((addr) >> (((PT_INDEX_BITS) * (((CONFIG_PT_LEVELS) - 1) - (n))) + seL4_PageBits)) & MASK(PT_INDEX_BITS))
#define RISCV_GET_PT_INDEX(addr, n) (((addr) >> RISCV_GET_LVL_PGSIZE_BITS(n)) & MASK(PT_INDEX_BITS))
#define RISCV_GET_LVL_PGSIZE_BITS(n) (((PT_INDEX_BITS) * (((CONFIG_PT_LEVELS) - 1) - (n))) + seL4_PageBits)
#define RISCV_GET_LVL_PGSIZE(n) BIT(RISCV_GET_LVL_PGSIZE_BITS((n)))
/*
Expand Down

0 comments on commit b67ff0b

Please sign in to comment.