Export memory manager pool allocation and free functions
This commit is contained in:
40
sdk/xtdk/mmfuncs.h
Normal file
40
sdk/xtdk/mmfuncs.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: sdk/xtdk/mmfuncs.h
|
||||||
|
* DESCRIPTION: XTOS memory manager routine definitions
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTDK_MMFUNCS_H
|
||||||
|
#define __XTDK_MMFUNCS_H
|
||||||
|
|
||||||
|
#include <xtdefs.h>
|
||||||
|
#include <xtstruct.h>
|
||||||
|
#include <xttypes.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Memory manager routines forward references */
|
||||||
|
XTAPI
|
||||||
|
XTSTATUS
|
||||||
|
MmAllocatePool(IN MMPOOL_TYPE PoolType,
|
||||||
|
IN SIZE_T Bytes,
|
||||||
|
OUT PVOID *Memory);
|
||||||
|
|
||||||
|
XTAPI
|
||||||
|
XTSTATUS
|
||||||
|
MmAllocatePoolWithTag(IN MMPOOL_TYPE PoolType,
|
||||||
|
IN SIZE_T Bytes,
|
||||||
|
OUT PVOID *Memory,
|
||||||
|
IN ULONG Tag);
|
||||||
|
|
||||||
|
XTAPI
|
||||||
|
XTSTATUS
|
||||||
|
MmFreePool(IN PVOID VirtualAddress);
|
||||||
|
|
||||||
|
XTAPI
|
||||||
|
XTSTATUS
|
||||||
|
MmFreePoolWithTag(IN PVOID VirtualAddress,
|
||||||
|
IN ULONG Tag);
|
||||||
|
|
||||||
|
#endif /* __XTDK_MMFUNCS_H */
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
#include <hlfuncs.h>
|
#include <hlfuncs.h>
|
||||||
#include <kdfuncs.h>
|
#include <kdfuncs.h>
|
||||||
#include <kefuncs.h>
|
#include <kefuncs.h>
|
||||||
|
#include <mmfuncs.h>
|
||||||
#include <rtlfuncs.h>
|
#include <rtlfuncs.h>
|
||||||
|
|
||||||
/* Architecture specific XT routines */
|
/* Architecture specific XT routines */
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||||||
${XTOSKRNL_SOURCE_DIR}/mm/alloc.cc
|
${XTOSKRNL_SOURCE_DIR}/mm/alloc.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/colors.cc
|
${XTOSKRNL_SOURCE_DIR}/mm/colors.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/data.cc
|
${XTOSKRNL_SOURCE_DIR}/mm/data.cc
|
||||||
|
${XTOSKRNL_SOURCE_DIR}/mm/exports.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/hlpool.cc
|
${XTOSKRNL_SOURCE_DIR}/mm/hlpool.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/kpool.cc
|
${XTOSKRNL_SOURCE_DIR}/mm/kpool.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/mm/mmgr.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 KeSetTimer(ptr long long long ptr)
|
||||||
@ stdcall KeSignalCallDpcDone(ptr)
|
@ stdcall KeSignalCallDpcDone(ptr)
|
||||||
@ stdcall KeSignalCallDpcSynchronize(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 RtlClearAllBits(ptr)
|
||||||
@ stdcall RtlClearBit(ptr long)
|
@ stdcall RtlClearBit(ptr long)
|
||||||
@ stdcall RtlClearBits(ptr long long)
|
@ stdcall RtlClearBits(ptr long long)
|
||||||
|
|||||||
Reference in New Issue
Block a user