MiAllocatePagesForMdl
_MDL *__stdcall MiAllocatePagesForMdl(
_MI_PARTITION *Partition,
_LARGE_INTEGER LowAddress,
_LARGE_INTEGER HighAddress,
_LARGE_INTEGER SkipBytes,
UINT64 TotalBytes,
_MI_PFN_CACHE_ATTRIBUTE CacheAttribute,
UINT16 IdealNode,
UINT64 Flags){
INT64 PerformanceCounter;
UINT64 v13;
UINT64 v14;
UINT64 v15;
unsigned __int64 v16;
UINT64 v17;
_MI_PFN_CACHE_ATTRIBUTE v18;
INT64 v19;
unsigned int v20;
void *v21;
_MI_PFN_CACHE_ATTRIBUTE v22;
UINT64 v23;
int v24;
__int64 v25;
int v27;
UINT64 SizeInPages;
UINT64 SizeInPagesa;
_MI_PFN_CACHE_ATTRIBUTE LowPage;
UINT64 LowPagea;
INT64 v32;
INT64 v33;
INT64 v34;
INT64 v35;
INT64 v36;
INT64 v37;
UINT16 v38;
int v39;
INT64 rcx0[10];
__int64 v41[6];
int v42;
int v43;
_EVENT_DATA_DESCRIPTOR UserData;
memset(rcx0, 0i64, sizeof(rcx0));
PerformanceCounter = KeQueryPerformanceCounter(0i64);
LODWORD(v37) = Flags;
LODWORD(v35) = IdealNode;
LODWORD(v32) = CacheAttribute;
if( MiValidateMdlAllocationRequest(
(INT64)rcx0,
(INT64)Partition,
LowAddress.QuadPart,
HighAddress.QuadPart,
SkipBytes.QuadPart,
TotalBytes,
v32,
v35,
v37) >= 0
&& (int)MiObtainMdlCharges((_MI_PARTITION *)rcx0, v13, v14, v15, SizeInPages, LowPage, v33) >= 0 )
{
v19 = rcx0[8];
UserData.Ptr = rcx0[5];
*(_DWORD *)(rcx0[8] + 40) = 0;
v20 = 0;
while( 1 )
{
v39 = *(_DWORD *)(v19 + 40);
MiFindPagesForMdl((_MI_PARTITION *)rcx0, (_MDL *)v16, v17, v18, SizeInPagesa, LowPagea, v34, v36, v38);
v16 = *(unsigned int *)(v19 + 40);
if( v16 >> 12 == UserData.Ptr )
break;
v27 = rcx0[1];
if( SLOBYTE(rcx0[1]) >= 0 )
goto LABEL_21;
if( v39 == (_DWORD)v16 )
{
if( v20 > 3 || KeGetCurrentIrql() >= 2u || (rcx0[1] & 8) != 0 )
{
LABEL_21:
MiReturnMdlExcess((INT64)rcx0);
break;
}
KeDelayExecutionThread(0, 0, (_LARGE_INTEGER *)&Mi10Milliseconds);
v27 = rcx0[1];
++v20;
}
else
{
v20 = 0;
}
LODWORD(rcx0[1]) = v27 & 0xFFFEFFFF;
}
v21 = (void *)rcx0[8];
if( rcx0[8] )
{
if( (Flags & 0x40) == 0 )
{
MiInitializeMdlBatchPages((INT64)rcx0);
MiInitializeMdlPages((ULONG_PTR)v21, LODWORD(rcx0[1]), v22, v23, SizeInPagesa);
}
if( (rcx0[1] & 0x100) != 0 )
rcx0[8] = (INT64)MiRemoveMdlPages(v21, LODWORD(rcx0[1]));
}
}
v24 = rcx0[1];
v25 = rcx0[8];
if( EtwEventEnabled(*(&ExBootDevicesRemovedEvent + 251), &KERNEL_MEM_EVENT_MDL_ALLOCATION) )
{
v41[0] = EtwpGetDurationSince(PerformanceCounter);
v41[1] = TotalBytes;
v41[5] = v25;
UserData.Ptr = (unsigned __int64)v41;
v41[2] = LowAddress.QuadPart;
v41[3] = HighAddress.QuadPart;
v41[4] = SkipBytes.QuadPart;
v42 = IdealNode;
v43 = v24;
*(_QWORD *)&UserData.Size = 56i64;
EtwWriteEx(*(&ExBootDevicesRemovedEvent + 251), &KERNEL_MEM_EVENT_MDL_ALLOCATION, 0i64, 1u, 0, 0, 1u, &UserData);
}
return(_MDL *)rcx0[8];
}Referenced by:
MiAllocatePartitionPhysicalPages
MiAllocateUserPhysicalPages
MiPopulateCombineMdls
MmAllocateNonCachedMemory
MmAllocatePagesForMdl
MmAllocatePartitionNodePagesForMdlEx