ptos: pm: Add page frame conversion helpers
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -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_ */
|
||||||
Reference in New Issue
Block a user