ViDeadlockRemoveMemoryRangeResources
VOID __stdcall ViDeadlockRemoveMemoryRangeResources(
UINT8 *StartOfRange,
UINT8 *EndOfRange,
UINT8 *StartOfAllocation,
UINT8 *EndOfAllocation){
UINT8 *v4;
_VI_DEADLOCK_RESOURCE *v6;
unsigned int v7;
UINT64 v8;
__int64 v9;
_QWORD **v10;
_QWORD *v11;
_VI_DEADLOCK_RESOURCE *v12;
unsigned __int64 ResourceAddress;
_QWORD *v14;
_QWORD *v15;
_VI_DEADLOCK_RESOURCE *v16;
UINT8 OldIrql;
VOID *NodesToFree;
UINT64 v19;
NodesToFree = 0i64;
v4 = EndOfRange;
v6 = 0i64;
v19 = ViDeadlockDatabaseHashIndex(StartOfRange);
v7 = 0;
v8 = v19;
OldIrql = ViRaiseIrqlToDpcLevel();
v9 = 16 * v19;
LABEL_2:
ViDeadlockDetectionLock(v7);
v10 = (_QWORD **)(v9 + *((_QWORD *)ViDeadlockGlobals + 2));
v11 = *v10;
if( *v10 != v10
&& (unsigned int)VfUtilAddressRangeFit((_VF_ADDRESS_RANGE *)ViDeadlockGlobals + v8 + 2, StartOfRange, v4) )
{
while( v11 != v10 )
{
v12 = (_VI_DEADLOCK_RESOURCE *)(v11 - 5);
v11 = (_QWORD *)*v11;
ResourceAddress = (unsigned __int64)v12->ResourceAddress;
if( ResourceAddress >= (unsigned __int64)StartOfAllocation && ResourceAddress < (unsigned __int64)EndOfAllocation )
{
if( !v7 )
{
v7 = 1;
if( !(unsigned int)ViDeadlockDetectionTryConvertSharedToExclusive() )
{
ViDeadlockDetectionUnlock(0i64);
v4 = EndOfRange;
goto LABEL_2;
}
}
ViDeadlockRemoveResource(v12, 0i64, &NodesToFree);
*(_QWORD *)&v12->Type = v6;
v6 = v12;
}
}
}
ViDeadlockDetectionUnlock(v7);
ViLowerIrql(OldIrql);
v14 = NodesToFree;
if( NodesToFree )
{
do
{
v15 = (_QWORD *)*v14;
ViDeadlockFree(v14, ViDeadlockNode);
v14 = v15;
}
while( v15 );
}
if( v6 )
{
do
{
v16 = *(_VI_DEADLOCK_RESOURCE **)&v6->Type;
ViDeadlockFree(v6, ViDeadlockResource);
v6 = v16;
}
while( v16 );
}
}Referenced by:
VfDeadlockDeleteMemoryRange