ptos: pm: Add page frame conversion helpers

Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
2026-07-10 18:05:21 -04:00
parent 050221a0de
commit 7aa3c946a3
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Physical memory management
* Author: Chloe M.
*/
#ifndef _MM_PM_H_
#define _MM_PM_H_ 1
#include <ptdef.h>
#include <hal/page.h>
/* Page frame number type */
typedef USIZE MM_PFN;
/*
* These macros allow the conversion of page frame numbers
* to physical addresses and vice versa.
*/
#define PFN_TO_ADDRESS(PFN) \
((PFN) << LOG2_PAGESIZE)
#define ADDRESS_TO_PFN(ADDR) \
((ADDR) >> LOG2_PAGESIZE)
#endif /* !_MM_PM_H_ */