ntoskrnl.exe: Implement ExInitializePagedLookasideList.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47014 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8b787945ef
commit
fac633495d
|
@ -2060,6 +2060,28 @@ void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag )
|
|||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
}
|
||||
|
||||
static void initialize_lookaside_list( GENERAL_LOOKASIDE *lookaside, PALLOCATE_FUNCTION allocate, PFREE_FUNCTION free,
|
||||
ULONG type, SIZE_T size, ULONG tag )
|
||||
{
|
||||
|
||||
RtlInitializeSListHead( &lookaside->u.ListHead );
|
||||
lookaside->Depth = 4;
|
||||
lookaside->MaximumDepth = 256;
|
||||
lookaside->TotalAllocates = 0;
|
||||
lookaside->u2.AllocateMisses = 0;
|
||||
lookaside->TotalFrees = 0;
|
||||
lookaside->u3.FreeMisses = 0;
|
||||
lookaside->Type = type;
|
||||
lookaside->Tag = tag;
|
||||
lookaside->Size = size;
|
||||
lookaside->u4.Allocate = allocate ? allocate : ExAllocatePoolWithTag;
|
||||
lookaside->u5.Free = free ? free : ExFreePool;
|
||||
lookaside->LastTotalAllocates = 0;
|
||||
lookaside->u6.LastAllocateMisses = 0;
|
||||
|
||||
/* FIXME: insert in global list of lookadside lists */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExInitializeNPagedLookasideList (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
|
@ -2072,37 +2094,22 @@ void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST lookaside,
|
|||
USHORT depth)
|
||||
{
|
||||
TRACE( "%p, %p, %p, %u, %lu, %u, %u\n", lookaside, allocate, free, flags, size, tag, depth );
|
||||
|
||||
RtlInitializeSListHead( &lookaside->L.u.ListHead );
|
||||
lookaside->L.Depth = 4;
|
||||
lookaside->L.MaximumDepth = 256;
|
||||
lookaside->L.TotalAllocates = 0;
|
||||
lookaside->L.u2.AllocateMisses = 0;
|
||||
lookaside->L.TotalFrees = 0;
|
||||
lookaside->L.u3.FreeMisses = 0;
|
||||
lookaside->L.Type = NonPagedPool | flags;
|
||||
lookaside->L.Tag = tag;
|
||||
lookaside->L.Size = size;
|
||||
lookaside->L.u4.Allocate = allocate ? allocate : ExAllocatePoolWithTag;
|
||||
lookaside->L.u5.Free = free ? free : ExFreePool;
|
||||
lookaside->L.LastTotalAllocates = 0;
|
||||
lookaside->L.u6.LastAllocateMisses = 0;
|
||||
|
||||
/* FIXME: insert in global list of lookadside lists */
|
||||
initialize_lookaside_list( &lookaside->L, allocate, free, NonPagedPool | flags, size, tag );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExInitializePagedLookasideList (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
void WINAPI ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PALLOCATE_FUNCTION Allocate,
|
||||
PFREE_FUNCTION Free,
|
||||
ULONG Flags,
|
||||
SIZE_T Size,
|
||||
ULONG Tag,
|
||||
USHORT Depth)
|
||||
void WINAPI ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST lookaside,
|
||||
PALLOCATE_FUNCTION allocate,
|
||||
PFREE_FUNCTION free,
|
||||
ULONG flags,
|
||||
SIZE_T size,
|
||||
ULONG tag,
|
||||
USHORT depth)
|
||||
{
|
||||
FIXME( "stub: %p, %p, %p, %u, %lu, %u, %u\n", Lookaside, Allocate, Free, Flags, Size, Tag, Depth );
|
||||
TRACE( "%p, %p, %p, %u, %lu, %u, %u\n", lookaside, allocate, free, flags, size, tag, depth );
|
||||
initialize_lookaside_list( &lookaside->L, allocate, free, PagedPool | flags, size, tag );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -950,6 +950,7 @@ static void test_stack_callout(void)
|
|||
static void test_lookaside_list(void)
|
||||
{
|
||||
NPAGED_LOOKASIDE_LIST list;
|
||||
PAGED_LOOKASIDE_LIST paged_list;
|
||||
ULONG tag = 0x454e4957; /* WINE */
|
||||
|
||||
ExInitializeNPagedLookasideList(&list, NULL, NULL, POOL_NX_ALLOCATION, LOOKASIDE_MINIMUM_BLOCK_SIZE, tag, 0);
|
||||
|
@ -974,6 +975,29 @@ static void test_lookaside_list(void)
|
|||
ok(list.L.MaximumDepth == 256, "Expected 256 got %u\n", list.L.MaximumDepth);
|
||||
ok(list.L.Type == NonPagedPool, "Expected NonPagedPool got %u\n", list.L.Type);
|
||||
ExDeleteNPagedLookasideList(&list);
|
||||
|
||||
ExInitializePagedLookasideList(&paged_list, NULL, NULL, POOL_NX_ALLOCATION, LOOKASIDE_MINIMUM_BLOCK_SIZE, tag, 0);
|
||||
ok(paged_list.L.Depth == 4, "Expected 4 got %u\n", paged_list.L.Depth);
|
||||
ok(paged_list.L.MaximumDepth == 256, "Expected 256 got %u\n", paged_list.L.MaximumDepth);
|
||||
ok(paged_list.L.TotalAllocates == 0, "Expected 0 got %u\n", paged_list.L.TotalAllocates);
|
||||
ok(paged_list.L.AllocateMisses == 0, "Expected 0 got %u\n", paged_list.L.AllocateMisses);
|
||||
ok(paged_list.L.TotalFrees == 0, "Expected 0 got %u\n", paged_list.L.TotalFrees);
|
||||
ok(paged_list.L.FreeMisses == 0, "Expected 0 got %u\n", paged_list.L.FreeMisses);
|
||||
ok(paged_list.L.Type == (PagedPool|POOL_NX_ALLOCATION),
|
||||
"Expected PagedPool|POOL_NX_ALLOCATION got %u\n", paged_list.L.Type);
|
||||
ok(paged_list.L.Tag == tag, "Expected %x got %x\n", tag, paged_list.L.Tag);
|
||||
ok(paged_list.L.Size == LOOKASIDE_MINIMUM_BLOCK_SIZE,
|
||||
"Expected %u got %u\n", LOOKASIDE_MINIMUM_BLOCK_SIZE, paged_list.L.Size);
|
||||
ok(paged_list.L.LastTotalAllocates == 0,"Expected 0 got %u\n", paged_list.L.LastTotalAllocates);
|
||||
ok(paged_list.L.LastAllocateMisses == 0,"Expected 0 got %u\n", paged_list.L.LastAllocateMisses);
|
||||
ExDeletePagedLookasideList(&paged_list);
|
||||
|
||||
paged_list.L.Depth = 0;
|
||||
ExInitializePagedLookasideList(&paged_list, NULL, NULL, 0, LOOKASIDE_MINIMUM_BLOCK_SIZE, tag, 20);
|
||||
ok(paged_list.L.Depth == 4, "Expected 4 got %u\n", paged_list.L.Depth);
|
||||
ok(paged_list.L.MaximumDepth == 256, "Expected 256 got %u\n", paged_list.L.MaximumDepth);
|
||||
ok(paged_list.L.Type == PagedPool, "Expected PagedPool got %u\n", paged_list.L.Type);
|
||||
ExDeletePagedLookasideList(&paged_list);
|
||||
}
|
||||
|
||||
static void test_version(void)
|
||||
|
|
|
@ -211,7 +211,6 @@ typedef struct _ETHREAD *PETHREAD;
|
|||
typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
|
||||
typedef struct _EPROCESS *PEPROCESS;
|
||||
typedef struct _IO_WORKITEM *PIO_WORKITEM;
|
||||
typedef struct _PAGED_LOOKASIDE_LIST *PPAGED_LOOKASIDE_LIST;
|
||||
typedef struct _OBJECT_TYPE *POBJECT_TYPE;
|
||||
typedef struct _OBJECT_HANDLE_INFORMATION *POBJECT_HANDLE_INFORMATION;
|
||||
typedef struct _ZONE_HEADER *PZONE_HEADER;
|
||||
|
@ -1364,6 +1363,14 @@ typedef struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST
|
|||
#endif
|
||||
} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
|
||||
|
||||
typedef struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST
|
||||
{
|
||||
GENERAL_LOOKASIDE L;
|
||||
#if defined(__i386__)
|
||||
FAST_MUTEX Lock__ObsoleteButDoNotDelete;
|
||||
#endif
|
||||
} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
|
||||
|
||||
typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION)(void *CallbackContext, void *Argument1, void *Argument2);
|
||||
typedef EX_CALLBACK_FUNCTION *PEX_CALLBACK_FUNCTION;
|
||||
|
||||
|
@ -1538,12 +1545,14 @@ 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 ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST);
|
||||
void WINAPI ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST);
|
||||
NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*);
|
||||
void WINAPI ExFreePool(PVOID);
|
||||
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
|
||||
ULONG WINAPI ExGetExclusiveWaiterCount(ERESOURCE*);
|
||||
ULONG WINAPI ExGetSharedWaiterCount(ERESOURCE*);
|
||||
void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST,PALLOCATE_FUNCTION,PFREE_FUNCTION,ULONG,SIZE_T,ULONG,USHORT);
|
||||
void WINAPI ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST,PALLOCATE_FUNCTION,PFREE_FUNCTION,ULONG,SIZE_T,ULONG,USHORT);
|
||||
NTSTATUS WINAPI ExInitializeResourceLite(ERESOURCE*);
|
||||
PSLIST_ENTRY WINAPI ExInterlockedFlushSList(PSLIST_HEADER);
|
||||
PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
|
||||
|
|
Loading…
Reference in New Issue