ViDeadlockRemoveResource
VOID __stdcall ViDeadlockRemoveResource(
_VI_DEADLOCK_RESOURCE *Resource,
UINT64 DisableConsistencyChecks,
PVOID *NodesToFree){
unsigned int v4;
_VI_DEADLOCK_THREAD *ThreadOwner;
_VI_DEADLOCK_RESOURCE *Flink;
_VI_DEADLOCK_NODE *v8;
_QWORD *v9;
_LIST_ENTRY *v10;
_LIST_ENTRY *Blink;
unsigned __int64 v12;
__int64 v13;
v4 = DisableConsistencyChecks;
if( *((_DWORD *)ViDeadlockGlobals + 8196) || *((int *)ViDeadlockGlobals + 8282) > 1024 )
v4 = 1;
if( !v4 )
{
ThreadOwner = Resource->ThreadOwner;
if( ThreadOwner )
{
ViDeadlockPreprocessOptions(
&byte_140C12D70,
"Deleted lock 0x%p is still owned by the thread 0x%p.",
0x100Bui64,
(UINT64)Resource->ResourceAddress,
(UINT64)ThreadOwner->Thread,
(UINT64)Resource);
VfReportIssueWithOptions(
0xC4ui64,
0x100Bui64,
(UINT64)Resource->ResourceAddress,
(UINT64)Resource->ThreadOwner->Thread,
(UINT64)Resource,
&byte_140C12D70);
}
}
Flink = (_VI_DEADLOCK_RESOURCE *)Resource->ResourceList.Flink;
while( Flink != (_VI_DEADLOCK_RESOURCE *)&Resource->ResourceList )
{
v8 = (_VI_DEADLOCK_NODE *)&Flink[-1].LastReleaseTrace[3];
Flink = *(_VI_DEADLOCK_RESOURCE **)&Flink->Type;
ViDeadlockRemoveNode(v8, v4);
*(_QWORD *)v8 = *NodesToFree;
*NodesToFree = v8;
}
v9 = ViDeadlockGlobals;
--*((_QWORD *)ViDeadlockGlobals + 3);
v10 = Resource->HashChainList.Flink;
if( ($83D8CB0ADEB8D57E408F1D1999F60E11 *)v10->Blink != &Resource->40
|| (Blink = Resource->HashChainList.Blink, ($83D8CB0ADEB8D57E408F1D1999F60E11 *)Blink->Flink != &Resource->40) )
{
__fastfail(3u);
}
Blink->Flink = v10;
v10->Blink = Blink;
v12 = ((unsigned __int64)Resource->ResourceAddress >> 12) % 0x3FF;
v13 = 2 * (v12 + 2);
if( *(_QWORD *)(16 * v12 + v9[2]) == 16 * v12 + v9[2] )
{
v9[v13] = 0i64;
v9[v13 + 1] = 0i64;
}
else
{
VfUtilAddressRangeRemove(
&v9[v13],
(__int64)Resource->ResourceAddress,
(unsigned int)ViDeadlockResourceTypeSizeInfo[Resource->Type]);
}
}Referenced by:
ViDeadlockAddResource
ViDeadlockEmptyDatabase
ViDeadlockRemoveMemoryRangeResources