Implement page allocation interface
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 25s
Builds / ExectOS (i686, debug) (push) Successful in 26s
Builds / ExectOS (amd64, release) (push) Successful in 36s
Builds / ExectOS (i686, release) (push) Successful in 34s

This commit is contained in:
2026-02-26 13:42:58 +01:00
parent 278def3081
commit 511dd15c0c
6 changed files with 190 additions and 5 deletions

View File

@@ -9,3 +9,133 @@
#include <xtos.hh>
/**
* Allocates pages from the non-paged pool.
*
* @param Pages
* Specifies the number of pages to allocate.
*
* @param Memory
* Supplies a pointer to the allocated pool.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::AllocateNonPagedPoolPages(IN PFN_COUNT Pages,
OUT PVOID *Memory)
{
UNIMPLEMENTED;
/* Return not implemented status code */
return STATUS_NOT_IMPLEMENTED;
}
/**
* Allocates pages from the paged pool.
*
* @param Pages
* Specifies the number of pages to allocate.
*
* @param Memory
* Supplies a pointer to the allocated pool.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::AllocatePagedPoolPages(IN PFN_COUNT Pages,
OUT PVOID *Memory)
{
UNIMPLEMENTED;
/* Return not implemented status code */
return STATUS_NOT_IMPLEMENTED;
}
/**
* Allocates pages from the specified pool type.
*
* @param PoolType
* Specifies the type of pool to allocate pages from.
*
* @param Bytes
* Specifies the number of bytes to allocate.
*
* @param Memory
* Supplies a pointer to the allocated pool.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::AllocatePages(IN MMPOOL_TYPE PoolType,
IN SIZE_T Bytes,
OUT PVOID *Memory)
{
PFN_COUNT Pages;
/* Initialize the output parameter */
*Memory = NULLPTR;
/* Convert bytes to pages */
Pages = SIZE_TO_PAGES(Bytes);
/* Check if there are any pages to allocate */
if(!Pages)
{
/* Nothing to allocate, return NULLPTR */
return STATUS_INVALID_PARAMETER;
}
/* Switch on pool type */
switch(PoolType & MM_POOL_TYPE_MASK)
{
case NonPagedPool:
/* Allocate non-paged pool */
return AllocateNonPagedPoolPages(Pages, Memory);
case PagedPool:
/* Allocate paged pool */
return AllocatePagedPoolPages(Pages, Memory);
}
/* Invalid pool type specified, return error */
return STATUS_INVALID_PARAMETER;
}
/**
* Initializes the non-paged pool for memory allocator.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Allocator::InitializeNonPagedPool(VOID)
{
UNIMPLEMENTED;
/* Map PTEs for the non-paged pool */
MapNonPagedPool();
}
/**
* Initializes the non-paged pool for memory allocator.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Allocator::InitializePagedPool(VOID)
{
UNIMPLEMENTED;
}

View File

@@ -9,14 +9,19 @@
#include <xtos.hh>
/**
* Maps the PTE for the base of the non-paged pool.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Allocator::InitializeNonPagedPool(VOID)
MM::Allocator::MapNonPagedPool(VOID)
{
PMMMEMORY_LAYOUT MemoryLayout;
UNIMPLEMENTED;
/* Retrieve memory layout */
MemoryLayout = MM::Manager::GetMemoryLayout();

View File

@@ -9,12 +9,18 @@
#include <xtos.hh>
/**
* Maps the PTE for the base of the non-paged pool.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Allocator::InitializeNonPagedPool(VOID)
MM::Allocator::MapNonPagedPool(VOID)
{
PMMMEMORY_LAYOUT MemoryLayout;
UNIMPLEMENTED;
/* Retrieve memory layout */
MemoryLayout = MM::Manager::GetMemoryLayout();