PspIumReplenishPartitionPages
BOOL __stdcall PspIumReplenishPartitionPages(INT64 a1, UINT64 a2){
unsigned int v2;
__int64 v3;
unsigned __int8 CurrentIrql;
__int64 v7;
unsigned int i;
int v9;
__int64 v10;
__int64 v11;
UINT64 v12;
v2 = a2;
v3 = *(_QWORD *)(a1 + 160) + 48i64;
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
if( !(unsigned int)ExTryAcquireSpinLockExclusiveAtDpcLevel((INT64 *)(a1 + 88)) )
{
if( *(_DWORD *)(a1 + 4) >= v2 )
{
__writecr8(CurrentIrql);
return 1;
}
ExAcquireSpinLockExclusiveAtDpcLevel((INT64 *)(a1 + 88));
}
v7 = *(unsigned int *)(a1 + 156);
LODWORD(v12) = *(_DWORD *)(a1 + 152) - v7 - *(_DWORD *)(a1 + 4);
if( (_DWORD)v12 )
{
MmAllocateNonChargedSecurePages(*(UINT64 ***)(a1 + 8), &v12, (INT64 *)(v3 + 8 * v7));
*(_DWORD *)(a1 + 156) += v12;
}
i = *(_DWORD *)(a1 + 4);
if( i < 8 )
{
while( _interlockedbittestandset((volatile signed __int32 *)a1, 0) )
_mm_pause();
for( i = *(_DWORD *)(a1 + 4); i < 8; *(_DWORD *)(a1 + 4) = i )
{
v9 = *(_DWORD *)(a1 + 156);
if( !v9 )
break;
v10 = *(unsigned int *)(a1 + 4);
v11 = (unsigned int)(v9 - 1);
*(_DWORD *)(a1 + 156) = v11;
*(_QWORD *)(a1 + 8 * v10 + 24) = *(_QWORD *)(v3 + 8 * v11);
i = *(_DWORD *)(a1 + 4) + 1;
}
_interlockedbittestandreset((volatile signed __int32 *)a1, 0);
}
ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(a1 + 88));
__writecr8(CurrentIrql);
return i >= v2;
}Referenced by:
PsDispatchIumService
PspIumGetPhysicalPage