From 7bcd1577bee6ed1e2663f4ea2686b4aa725b020b Mon Sep 17 00:00:00 2001 From: Max Wash Date: Wed, 1 Apr 2026 18:20:50 +0100 Subject: [PATCH] pmap: fix PFN() not clearing upper PTE control bits --- arch/x86_64/pmap.c | 2 +- include/kernel/pmap.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86_64/pmap.c b/arch/x86_64/pmap.c index 5ba7fbd..9b50eb5 100644 --- a/arch/x86_64/pmap.c +++ b/arch/x86_64/pmap.c @@ -19,7 +19,7 @@ #define PTR_TO_ENTRY(x) (((x) & ~VM_PAGE_MASK) | PTE_PRESENT | PTE_RW | PTE_USR) #define ENTRY_TO_PTR(x) ((x) & ~VM_PAGE_MASK) -#define PFN(x) ((x) >> VM_PAGE_SHIFT) +#define PFN(x) (((x) >> VM_PAGE_SHIFT) & 0xFFFFFFFFFF) static int can_use_gbpages = 0; static pmap_t kernel_pmap; diff --git a/include/kernel/pmap.h b/include/kernel/pmap.h index 77e3079..7a6137c 100644 --- a/include/kernel/pmap.h +++ b/include/kernel/pmap.h @@ -9,7 +9,6 @@ #include #define PMAP_INVALID ML_PMAP_INVALID -#define PFN(x) ((x) >> VM_PAGE_SHIFT) #ifdef __cplusplus extern "C" {