Export memory manager pool allocation and free functions
This commit is contained in:
@@ -61,6 +61,7 @@ list(APPEND XTOSKRNL_SOURCE
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/alloc.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/colors.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/data.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/exports.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/hlpool.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/kpool.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/mmgr.cc
|
||||
|
||||
102
xtoskrnl/mm/exports.cc
Normal file
102
xtoskrnl/mm/exports.cc
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/mm/exports.cc
|
||||
* DESCRIPTION: C-compatible API wrappers for exported kernel functions
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
MmAllocatePool(IN MMPOOL_TYPE PoolType,
|
||||
IN SIZE_T Bytes,
|
||||
OUT PVOID *Memory)
|
||||
{
|
||||
return MM::Allocator::AllocatePool(PoolType, Bytes, Memory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
MmAllocatePoolWithTag(IN MMPOOL_TYPE PoolType,
|
||||
IN SIZE_T Bytes,
|
||||
OUT PVOID *Memory,
|
||||
IN ULONG Tag)
|
||||
{
|
||||
return MM::Allocator::AllocatePool(PoolType, Bytes, Memory, Tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
MmFreePool(IN PVOID VirtualAddress)
|
||||
{
|
||||
return MM::Allocator::FreePool(VirtualAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
MmFreePoolWithTag(IN PVOID VirtualAddress,
|
||||
IN ULONG Tag)
|
||||
{
|
||||
return MM::Allocator::FreePool(VirtualAddress, Tag);
|
||||
}
|
||||
@@ -42,6 +42,10 @@
|
||||
@ stdcall KeSetTimer(ptr long long long ptr)
|
||||
@ stdcall KeSignalCallDpcDone(ptr)
|
||||
@ stdcall KeSignalCallDpcSynchronize(ptr)
|
||||
@ stdcall MmAllocatePool(long long ptr)
|
||||
@ stdcall MmAllocatePoolWithTag(long long ptr long)
|
||||
@ stdcall MmFreePool(ptr)
|
||||
@ stdcall MmFreePoolWithTag(ptr long)
|
||||
@ stdcall RtlClearAllBits(ptr)
|
||||
@ stdcall RtlClearBit(ptr long)
|
||||
@ stdcall RtlClearBits(ptr long long)
|
||||
|
||||
Reference in New Issue
Block a user