Skip to content

Commit 318c2d1

Browse files
committed
mm/vmm: Mask physical address bits in RISC-V pte_new
1 parent b081d47 commit 318c2d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/mm/vmm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_
295295
#define PT_IS_LARGE(x) (((x) & (PT_FLAG_VALID | PT_FLAG_RWX)) > PT_FLAG_VALID)
296296
#define PT_TO_VMM_FLAGS(x) (pt_to_vmm_flags_internal(x))
297297

298-
#define pte_new(addr, flags) (((pt_entry_t)(addr) >> 2) | (flags))
298+
#define pte_new(addr, flags) ((((pt_entry_t)(addr) >> 2) & PT_PADDR_MASK) | (flags))
299299
#define pte_addr(pte) (((pte) & PT_PADDR_MASK) << 2)
300300

301301
static uint64_t pt_to_vmm_flags_internal(pt_entry_t entry) {

0 commit comments

Comments
 (0)