ptos: mm: Add high-level page mapping interface

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
2026-07-11 22:12:37 +00:00
parent e03a6d0e91
commit 14afdcf62e
2 changed files with 127 additions and 0 deletions
+39
View File
@@ -10,6 +10,10 @@
#define _MM_VM_H_ 1
#include <ke/bpal.h>
#include <hal/vas.h>
#include <hal/mmu.h>
#include <ptapi/ptmm.h>
#include <ptdef.h>
/*
* Virtual memory allocation region. This is outside the
@@ -28,4 +32,39 @@
#define VMA_TO_PMA(VMA) \
(UPTR)PTR_NOFFSET(VMA, KeBpalLoadBase())
/*
* Represents a virtual memory range
*
* @VirtualBase: Virtual address base
* @PhysicalBase: Physical address base
* @Length: Length of memory range
*/
typedef struct {
UPTR VirtualBase;
UPTR PhysicalBase;
USIZE Length;
} MM_RANGE;
/*
* Unmap a virtual memory range
*
* @Vas: Virtual address space to unmap
* @Range: Range to unmap
* @PageSize: Page size to unmap
*/
PT_STATUS MmUnmapRange(MMU_VAS *Vas, const MM_RANGE *Range, MMU_PAGESIZE PageSize);
/*
* Map a virtual memory range
*
* @Vas: Virtual address space to map within
* @Range: Range to map
* @Prot: Protection flags to map with
* @PageSize: Page size to map
*/
PT_STATUS MmMapRange(
MMU_VAS *Vas, const MM_RANGE *Range,
MM_PROT Prot, MMU_PAGESIZE PageSize
);
#endif /* !_MM_VM_H_ */