ptos: mm: Add page allocation helpers
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -39,6 +39,23 @@ static USIZE PageSizeTable[] = {
|
||||
static UPTR VallocBump = VALLOC_BASE;
|
||||
static MM_VAD_TREE VadTree;
|
||||
|
||||
PT_STATUS
|
||||
MmAllocatePages(USIZE Count, MM_RANGE *Result)
|
||||
{
|
||||
MM_VAD *Vad;
|
||||
|
||||
if (Count == 0 || Result == NULL) {
|
||||
return STATUS_INVALID_PARAM;
|
||||
}
|
||||
|
||||
Vad = MmVadTreeAllocate(&VadTree, Count);
|
||||
if (Vad == NULL) {
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
*Result = Vad->Range;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
PT_STATUS MmUnmapRange(MMU_VAS *Vas, const MM_RANGE *Range, MMU_PAGESIZE PageSize)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user