Introduce pool allocation and free routines
Все проверки выполнены успешно
Builds / ExectOS (i686, debug) (push) Successful in 42s
Builds / ExectOS (amd64, debug) (push) Successful in 43s
Builds / ExectOS (amd64, release) (push) Successful in 52s
Builds / ExectOS (i686, release) (push) Successful in 49s

Этот коммит содержится в:
2026-03-16 13:54:42 +01:00
родитель 22f9525e92
Коммит 76d99dc9db
2 изменённых файлов: 116 добавлений и 6 удалений

Просмотреть файл

@@ -26,7 +26,17 @@ namespace MM
STATIC XTAPI XTSTATUS AllocatePages(IN MMPOOL_TYPE PoolType,
IN SIZE_T Bytes,
OUT PVOID *Memory);
STATIC XTAPI XTSTATUS AllocatePool(IN MMPOOL_TYPE PoolType,
IN SIZE_T Bytes,
OUT PVOID *Memory);
STATIC XTAPI XTSTATUS AllocatePool(IN MMPOOL_TYPE PoolType,
IN SIZE_T Bytes,
OUT PVOID *Memory,
IN ULONG Tag);
STATIC XTAPI XTSTATUS FreePages(IN PVOID VirtualAddress);
STATIC XTAPI XTSTATUS FreePool(IN PVOID VirtualAddress);
STATIC XTAPI XTSTATUS FreePool(IN PVOID VirtualAddress,
IN ULONG Tag);
STATIC XTAPI VOID InitializeNonPagedPool(VOID);
STATIC XTAPI VOID InitializePagedPool(VOID);

Просмотреть файл

@@ -16,7 +16,7 @@
* Specifies the number of pages to allocate.
*
* @param Memory
* Supplies a pointer to the allocated pool.
* Supplies a pointer to the allocated pool of pages.
*
* @return This routine returns a status code.
*
@@ -189,7 +189,7 @@ MM::Allocator::AllocateNonPagedPoolPages(IN PFN_COUNT Pages,
* Specifies the number of pages to allocate.
*
* @param Memory
* Supplies a pointer to the allocated pool.
* Supplies a pointer to the allocated pool of pages.
*
* @return This routine returns a status code.
*
@@ -216,7 +216,7 @@ MM::Allocator::AllocatePagedPoolPages(IN PFN_COUNT Pages,
* Specifies the number of bytes to allocate.
*
* @param Memory
* Supplies a pointer to the allocated pool.
* Supplies a pointer to the allocated pool of pages.
*
* @return This routine returns a status code.
*
@@ -258,11 +258,69 @@ MM::Allocator::AllocatePages(IN MMPOOL_TYPE PoolType,
return STATUS_INVALID_PARAMETER;
}
/**
* Allocates a block of memory from the specified pool type.
*
* @param PoolType
* Specifies the type of pool to allocate from.
*
* @param Bytes
* Specifies the number of bytes to allocate.
*
* @param Memory
* Supplies a pointer to the allocated memory.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::AllocatePool(IN MMPOOL_TYPE PoolType,
IN SIZE_T Bytes,
OUT PVOID *Memory)
{
/* Allocate pool */
return AllocatePool(PoolType, Bytes, Memory, SIGNATURE32('N', 'o', 'n', 'e'));
}
/**
* Allocates a block of memory from the specified pool type.
*
* @param PoolType
* Specifies the type of pool to allocate from.
*
* @param Bytes
* Specifies the number of bytes to allocate.
*
* @param Memory
* Supplies a pointer to the allocated memory.
*
* @param Tag
* Specifies the allocation identifying tag.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::AllocatePool(IN MMPOOL_TYPE PoolType,
IN SIZE_T Bytes,
OUT PVOID *Memory,
IN ULONG Tag)
{
UNIMPLEMENTED;
/* Allocate pages */
return AllocatePages(PoolType, Bytes, Memory);
}
/**
* Frees a previously allocated block of pages from the non-paged pool.
*
* @param VirtualAddress
* Supplies the base virtual address of the non-paged pool allocation to free.
* Supplies the base virtual address of the non-paged pool pages allocation to free.
*
* @return This routine returns a status code.
*
@@ -445,7 +503,7 @@ MM::Allocator::FreeNonPagedPoolPages(IN PVOID VirtualAddress)
* Frees a previously allocated block of pages from the paged pool.
*
* @param VirtualAddress
* Supplies the base virtual address of the paged pool allocation to free.
* Supplies the base virtual address of the paged pool pages allocation to free.
*
* @return This routine returns a status code.
*
@@ -465,7 +523,7 @@ MM::Allocator::FreePagedPoolPages(IN PVOID VirtualAddress)
* Frees a previously allocated block of pages.
*
* @param VirtualAddress
* Supplies the base virtual address of the paged pool allocation to free.
* Supplies the base virtual address of the pages allocation to free.
*
* @return This routine returns a status code.
*
@@ -493,6 +551,48 @@ MM::Allocator::FreePages(IN PVOID VirtualAddress)
}
}
/**
* Frees a previously allocated memory pool.
*
* @param VirtualAddress
* Supplies the base virtual address of the pool allocation to free.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::FreePool(IN PVOID VirtualAddress)
{
/* Free pool */
return FreePool(VirtualAddress, SIGNATURE32('N', 'o', 'n', 'e'));
}
/**
* Frees a previously allocated memory pool.
*
* @param VirtualAddress
* Supplies the base virtual address of the pool allocation to free.
*
* @param Tag
* Specifies the allocation identifying tag.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Allocator::FreePool(IN PVOID VirtualAddress,
IN ULONG Tag)
{
UNIMPLEMENTED;
/* Free pages */
return FreePages(VirtualAddress);
}
/**
* Initializes the non-paged pool for memory allocator.
*