MiPfCoalesceAndIssueIOs
INT64 __fastcall MiPfCoalesceAndIssueIOs(union _MM_STORE_KEY *a1, union _SM_PAGE_KEY *a2){
_QWORD *v2;
unsigned int v3;
__int64 v4;
_QWORD *v5;
__int64 v8;
__int64 EntireKey;
NTSTATUS v10;
union _MM_STORE_KEY **v11;
unsigned int v13;
__int64 v14;
_QWORD *v15;
union _SM_PAGE_KEY **v16;
__int64 v17;
unsigned __int64 v18;
unsigned int v19;
__int64 v20;
_QWORD *v21;
_LIST_ENTRY *Blink;
unsigned __int64 v23;
union _SM_PAGE_KEY **v24;
LIST_ENTRY CandidateListHead;
v3 = 0;
CandidateListHead.Blink = &CandidateListHead;
v4 = 0i64;
v5 = v2;
CandidateListHead.Flink = &CandidateListHead;
v8 = 0i64;
while( 1 )
{
EntireKey = a1->EntireKey;
if( (union _MM_STORE_KEY *)a1->EntireKey == a1 )
break;
v13 = *(_DWORD *)(EntireKey + 184);
if( v13 < 0x100000 )
{
if( CandidateListHead.Flink != &CandidateListHead )
{
LABEL_29:
v17 = *(_QWORD *)(EntireKey + 96);
goto LABEL_20;
}
if( v5 && *v5 < 0x100000ui64 )
goto LABEL_4;
v4 = *(_QWORD *)(EntireKey + 96);
v8 = *(_QWORD *)(EntireKey + 200);
v17 = v4;
LABEL_20:
if( v4 <= v17
&& v8 == *(_QWORD *)(EntireKey + 200)
&& (v18 = v17 - v4, v19 = v13 + v18, v18 <= 0x20000)
&& v19 + v3 <= 0x100000 )
{
v20 = *(_QWORD *)EntireKey;
if( *(_QWORD *)(*(_QWORD *)EntireKey + 8i64) != EntireKey )
goto LABEL_38;
v21 = *(_QWORD **)(EntireKey + 8);
if( *v21 != EntireKey )
goto LABEL_38;
*v21 = v20;
*(_QWORD *)(v20 + 8) = v21;
Blink = CandidateListHead.Blink;
if( CandidateListHead.Blink->Flink != &CandidateListHead )
goto LABEL_38;
*(_QWORD *)(EntireKey + 8) = CandidateListHead.Blink;
*(_QWORD *)EntireKey = &CandidateListHead;
v3 += v19;
Blink->Flink = (_LIST_ENTRY *)EntireKey;
v4 += v19;
CandidateListHead.Blink = (_LIST_ENTRY *)EntireKey;
if( v5 )
*v5 -= *(unsigned int *)(EntireKey + 184);
}
else
{
v10 = MiPfIssueCoalesceCandidates(&CandidateListHead, v3, (LIST_ENTRY *)a2);
if( v10 < 0 )
goto LABEL_5;
v3 = 0;
}
}
else
{
if( CandidateListHead.Flink != &CandidateListHead )
goto LABEL_29;
v14 = *(_QWORD *)EntireKey;
if( *(_QWORD *)(*(_QWORD *)EntireKey + 8i64) != EntireKey )
goto LABEL_38;
v15 = *(_QWORD **)(EntireKey + 8);
if( *v15 != EntireKey )
goto LABEL_38;
*v15 = v14;
*(_QWORD *)(v14 + 8) = v15;
if( v5 )
*v5 -= *(unsigned int *)(EntireKey + 184);
MiIssueHardFaultIo(EntireKey, 0, 0i64);
v16 = (union _SM_PAGE_KEY **)*((_QWORD *)a2 + 1);
if( *v16 != a2 )
LABEL_38:
__fastfail(3u);
*(_QWORD *)EntireKey = a2;
*(_QWORD *)(EntireKey + 8) = v16;
*v16 = (union _SM_PAGE_KEY *)EntireKey;
*((_QWORD *)a2 + 1) = EntireKey;
}
}
if( CandidateListHead.Flink == &CandidateListHead
|| (v10 = MiPfIssueCoalesceCandidates(&CandidateListHead, v3, (LIST_ENTRY *)a2), v10 >= 0) )
{
LABEL_4:
v10 = 0;
}
LABEL_5:
if( !v5 )
{
while( 1 )
{
v11 = (union _MM_STORE_KEY **)a1->EntireKey;
if( (union _MM_STORE_KEY *)a1->EntireKey == a1 )
break;
if( v11[1] != a1 )
goto LABEL_38;
v23 = (unsigned __int64)*v11;
if( (union _MM_STORE_KEY **)(*v11)[1].EntireKey != v11 )
goto LABEL_38;
a1->EntireKey = v23;
*(_QWORD *)(v23 + 8) = a1;
MiIssueHardFaultIo((__int64)v11, 0, 0i64);
v24 = (union _SM_PAGE_KEY **)*((_QWORD *)a2 + 1);
if( *v24 != a2 )
goto LABEL_38;
*v11 = (union _MM_STORE_KEY *)a2;
v11[1] = (union _MM_STORE_KEY *)v24;
*v24 = (union _SM_PAGE_KEY *)v11;
*((_QWORD *)a2 + 1) = v11;
}
}
return(unsigned int)v10;
}Referenced by:
MiPfCompletePrefetchIos
MiPrefetchVirtualMemory