HalpDmaAllocateMapRegistersAtHighLevel
__int64 __fastcall HalpDmaAllocateMapRegistersAtHighLevel(__int64 a1, int *a2){
char v2;
char v3;
int v4;
__int64 v6;
int v8;
__int64 v9;
bool v10;
__int64 result;
__int64 ScatterPagesFromScatterPoolAtHighLevel;
__int64 v13;
__int64 v14;
unsigned int v15;
__int64 ScatterPagesFromContiguousPoolAtHighLevelV2;
__int64 v17;
__int64 **v18;
__int64 **v19;
__int64 v20;
__int64 v21;
__int64 v22;
__int64 v23;
_QWORD *v24;
__int64 v25;
int v26;
int v27;
v2 = *(_BYTE *)(a1 + 434);
v3 = 0;
v4 = *a2;
v6 = *(_QWORD *)(a1 + 152);
v26 = 0;
v8 = 0;
v27 = 0;
v9 = 0i64;
if( v2 )
{
if( *(_QWORD *)(a1 + 104) )
goto LABEL_32;
v10 = *(_DWORD *)(a1 + 112) == 0;
}
else
{
if( *(_QWORD *)(a1 + 88) )
goto LABEL_32;
v10 = *(_DWORD *)(a1 + 96) == 0;
}
if( v10 )
{
if( !*(_BYTE *)(a1 + 337) )
{
if( v2 )
{
result = HalpDmaAllocateScatterPagesFromScatterPoolAtHighLevel(a1);
v8 = v27;
v9 = result;
if( v27 == v4 )
return result;
}
else
{
result = HalpDmaAllocateContiguousPagesFromContiguousPoolAtHighLevel(a1);
v9 = result;
if( result )
return result;
}
}
if( *(_BYTE *)(a1 + 434) )
{
ScatterPagesFromScatterPoolAtHighLevel = HalpDmaAllocateScatterPagesFromScatterPoolAtHighLevel(a1);
if( ScatterPagesFromScatterPoolAtHighLevel )
{
v13 = HalpDmaPrependTranslations(ScatterPagesFromScatterPoolAtHighLevel, v26, v9);
v8 += v26;
v9 = v13;
v27 = v8;
}
if( v8 == v4 )
return v9;
if( (unsigned int)HalpDmaGetAdapterVersion(a1) == 2 )
ScatterPagesFromContiguousPoolAtHighLevelV2 = HalpDmaAllocateScatterPagesFromContiguousPoolAtHighLevelV2(
v14,
v6,
v15,
(unsigned int *)&v26);
else
ScatterPagesFromContiguousPoolAtHighLevelV2 = HalpDmaAllocateScatterPagesFromContiguousPoolAtHighLevelV3(
v14,
v6,
v15,
(unsigned int *)&v26);
if( ScatterPagesFromContiguousPoolAtHighLevelV2 )
{
v17 = HalpDmaPrependTranslations(ScatterPagesFromContiguousPoolAtHighLevelV2, v26, v9);
v8 += v26;
v9 = v17;
v27 = v8;
}
if( v8 == v4 )
return v9;
}
else
{
result = HalpDmaAllocateContiguousPagesFromContiguousPoolAtHighLevel(a1);
v9 = result;
if( result )
return result;
}
if( HalpHiberInProgress )
{
if( *(_BYTE *)(a1 + 434) )
{
*a2 = v27;
}
else if( !v9 )
{
*a2 = 0;
}
return v9;
}
v8 = v27;
}
LABEL_32:
if( *(_BYTE *)(a1 + 434) )
{
v18 = (__int64 **)(a1 + 104);
v19 = (__int64 **)(v6 + 104);
while( 1 )
{
if( *(_BYTE *)(a1 + 337) )
{
v9 = 0i64;
}
else
{
result = HalpDmaForceAllocation((__int64)&v27, *(__int64 **)(a1 + 48), v18, v4, 0, &v27);
v8 = v27;
v9 = result;
if( v27 == v4 )
return result;
v19 = (__int64 **)(v6 + 104);
}
v20 = HalpDmaForceAllocation((__int64)v19, *(__int64 **)(v6 + 48), v19, v4 - v8, 0, &v26);
if( v20 )
{
v22 = HalpDmaPrependTranslations(v20, v26, v9);
v8 += v26;
v9 = v22;
v27 = v8;
}
if( v8 == v4 )
return v9;
v23 = HalpDmaForceAllocation(v21, *(__int64 **)(v6 + 40), (__int64 **)(v6 + 88), v4 - v8, 0, &v26);
if( v23 )
{
v25 = HalpDmaPrependTranslations(v23, v26, v9);
v8 += v26;
v24 = (_QWORD *)(v6 + 88);
v27 = v8;
v9 = v25;
}
if( v8 == v4 )
return v9;
if( v3 )
goto LABEL_50;
*(_DWORD *)(a1 + 112) = 0;
v18 = (__int64 **)(a1 + 104);
*(_QWORD *)(a1 + 104) = 0i64;
v19 = (__int64 **)(v6 + 104);
*(_QWORD *)(v6 + 104) = 0i64;
v3 = 1;
*(_DWORD *)(v6 + 112) = 0;
*v24 = 0i64;
*(_DWORD *)(v6 + 96) = 0;
}
}
if( *(_BYTE *)(a1 + 337)
|| (result = HalpDmaForceAllocation(a1, *(__int64 **)(a1 + 40), (__int64 **)(a1 + 88), v4, 1, 0i64)) == 0 )
{
result = HalpDmaForceAllocation(a1, *(__int64 **)(v6 + 40), (__int64 **)(v6 + 88), v4, 1, 0i64);
if( !result )
{
LABEL_50:
*a2 = 0;
return 0i64;
}
}
return result;
}Referenced by:
HalAllocateCrashDumpRegisters
HalDmaAllocateCrashDumpRegistersEx