ntoskrnl.exe: Implemented a number of memory allocation functions.

This commit is contained in:
Alexandre Julliard 2007-05-16 17:39:32 +02:00
parent 8530cb0aec
commit 982d6ccbe4
3 changed files with 90 additions and 8 deletions

View File

@ -214,6 +214,84 @@ void WINAPI IofCompleteRequest( IRP *irp, UCHAR priority_boost )
}
/***********************************************************************
* ExAllocatePool (NTOSKRNL.EXE.@)
*/
PVOID WINAPI ExAllocatePool( POOL_TYPE type, SIZE_T size )
{
return ExAllocatePoolWithTag( type, size, 0 );
}
/***********************************************************************
* ExAllocatePoolWithQuota (NTOSKRNL.EXE.@)
*/
PVOID WINAPI ExAllocatePoolWithQuota( POOL_TYPE type, SIZE_T size )
{
return ExAllocatePoolWithTag( type, size, 0 );
}
/***********************************************************************
* ExAllocatePoolWithTag (NTOSKRNL.EXE.@)
*/
PVOID WINAPI ExAllocatePoolWithTag( POOL_TYPE type, SIZE_T size, ULONG tag )
{
/* FIXME: handle page alignment constraints */
void *ret = HeapAlloc( GetProcessHeap(), 0, size );
TRACE( "%lu pool %u -> %p\n", size, type, ret );
return ret;
}
/***********************************************************************
* ExAllocatePoolWithQuotaTag (NTOSKRNL.EXE.@)
*/
PVOID WINAPI ExAllocatePoolWithQuotaTag( POOL_TYPE type, SIZE_T size, ULONG tag )
{
return ExAllocatePoolWithTag( type, size, tag );
}
/***********************************************************************
* ExFreePool (NTOSKRNL.EXE.@)
*/
void WINAPI ExFreePool( void *ptr )
{
ExFreePoolWithTag( ptr, 0 );
}
/***********************************************************************
* ExFreePoolWithTag (NTOSKRNL.EXE.@)
*/
void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag )
{
TRACE( "%p\n", ptr );
HeapFree( GetProcessHeap(), 0, ptr );
}
/***********************************************************************
* MmAllocateNonCachedMemory (NTOSKRNL.EXE.@)
*/
LPVOID WINAPI MmAllocateNonCachedMemory( SIZE_T size )
{
TRACE( "%lu\n", size );
return VirtualAlloc( NULL, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE|PAGE_NOCACHE );
}
/***********************************************************************
* MmFreeNonCachedMemory (NTOSKRNL.EXE.@)
*/
void WINAPI MmFreeNonCachedMemory( void *addr, SIZE_T size )
{
TRACE( "%p %lu\n", addr, size );
VirtualFree( addr, 0, MEM_RELEASE );
}
/*****************************************************
* DllMain
*/

View File

@ -116,10 +116,10 @@
@ stub ExAcquireSharedStarveExclusive
@ stub ExAcquireSharedWaitForExclusive
@ stub ExAllocateFromPagedLookasideList
@ stub ExAllocatePool
@ stub ExAllocatePoolWithQuota
@ stub ExAllocatePoolWithQuotaTag
@ stub ExAllocatePoolWithTag
@ stdcall ExAllocatePool(long long)
@ stdcall ExAllocatePoolWithQuota(long long)
@ stdcall ExAllocatePoolWithQuotaTag(long long long)
@ stdcall ExAllocatePoolWithTag(long long long)
@ stub ExAllocatePoolWithTagPriority
@ stub ExConvertExclusiveToSharedLite
@ stub ExCreateCallback
@ -131,8 +131,8 @@
@ stub ExEnumHandleTable
@ stub ExEventObjectType
@ stub ExExtendZone
@ stub ExFreePool
@ stub ExFreePoolWithTag
@ stdcall ExFreePool(ptr)
@ stdcall ExFreePoolWithTag(ptr long)
@ stub ExFreeToPagedLookasideList
@ stub ExGetCurrentProcessorCounts
@ stub ExGetCurrentProcessorCpuUsage
@ -658,7 +658,7 @@
@ stub MmAllocateContiguousMemory
@ stub MmAllocateContiguousMemorySpecifyCache
@ stub MmAllocateMappingAddress
@ stub MmAllocateNonCachedMemory
@ stdcall MmAllocateNonCachedMemory(long)
@ stub MmAllocatePagesForMdl
@ stub MmBuildMdlForNonPagedPool
@ stub MmCanFileBeTruncated
@ -671,7 +671,7 @@
@ stub MmFreeContiguousMemory
@ stub MmFreeContiguousMemorySpecifyCache
@ stub MmFreeMappingAddress
@ stub MmFreeNonCachedMemory
@ stdcall MmFreeNonCachedMemory(ptr long)
@ stub MmFreePagesFromMdl
@ stub MmGetPhysicalAddress
@ stub MmGetPhysicalMemoryRanges

View File

@ -865,6 +865,7 @@ PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T);
PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG);
PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG);
void WINAPI ExFreePool(PVOID);
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);
NTSTATUS WINAPI IoCreateSymbolicLink(UNICODE_STRING*,UNICODE_STRING*);
@ -874,6 +875,9 @@ PEPROCESS WINAPI IoGetCurrentProcess(void);
PKTHREAD WINAPI KeGetCurrentThread(void);
LPVOID WINAPI MmAllocateNonCachedMemory(SIZE_T);
void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T);
#define PsGetCurrentProcess() IoGetCurrentProcess()
#define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
HANDLE WINAPI PsGetCurrentProcessId(void);