ST_STORE::StWorkItemProcess
__int64 __fastcall ST_STORE::StWorkItemProcess(__int64 a1, __int64 a2){
__int64 v2;
int v4;
_DWORD *v5;
unsigned int v6;
int v7;
unsigned int Stats;
unsigned int v9;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
__int64 v17;
int v18;
struct _EX_RUNDOWN_REF *v19;
int v20;
__int64 v21;
int v22;
int v23;
char v24;
int v25;
v2 = a2 & 0xFFFFFFFFFFFFFFFEui64;
v4 = 0;
v5 = 0i64;
if( (a2 & 1) == 0 )
v2 = a2;
v6 = -1;
v7 = *(_DWORD *)v2 & 7;
if( (a2 & 1) == 0 )
ST_STORE::StLazyWorkMgrResetIdle(a1 + 5744);
if( !v7 )
{
Stats = ST_STORE::StDmPageAdd(a1 + 80, v2);
LABEL_7:
v9 = Stats;
goto LABEL_8;
}
v11 = v7 - 1;
if( !v11 )
{
Stats = ST_STORE::StDmPageRemove(a1 + 80, v2);
goto LABEL_7;
}
v12 = v11 - 1;
if( !v12 )
{
Stats = ST_STORE::StDmPageRetrieve(a1 + 80, a1 + 992, v2);
goto LABEL_7;
}
v13 = v12 - 1;
if( !v13 )
{
Stats = ST_STORE::StGetStats(a1, v2);
goto LABEL_7;
}
v14 = v13 - 1;
if( !v14 )
{
if( (*(_DWORD *)(v2 + 8) & 7) != 0 )
{
if( (*(_DWORD *)(v2 + 8) & 7u) - 4 <= 1 )
{
Stats = ST_STORE::StAddRemoveRegions(a1, v2);
v6 = 0;
goto LABEL_7;
}
goto LABEL_56;
}
ST_STORE::StEmptyStore(a1, 0);
goto LABEL_38;
}
v15 = v14 - 1;
if( !v15 )
{
v21 = a1 + 80;
v22 = *(_DWORD *)(v2 + 8) & 7;
if( !v22 )
{
ST_STORE::StDmEtaRefresh(v21);
goto LABEL_38;
}
if( v22 != 1 )
{
if( v22 == 3 )
{
v23 = ST_STORE::StDmCheckForCompaction(v21, 0);
if( v23 )
ST_STORE::StQueueCompaction(a1 + 80, v23);
}
else
{
while( (unsigned int)ST_STORE::StDmCheckForCompaction(v21, 1) == 2 )
{
v24 = *(_BYTE *)(a1 + 1984);
*(_BYTE *)(a1 + 1984) = v24 | 3;
v25 = ST_STORE::StCompactionPerformInMem(a1 + 80, 0);
*(_BYTE *)(a1 + 1984) ^= (*(_BYTE *)(a1 + 1984) ^ v24) & 3;
if( v25 < 0 )
break;
v21 = a1 + 80;
}
}
goto LABEL_38;
}
goto LABEL_41;
}
v16 = v15 - 1;
if( v16 )
{
if( v16 == 1 )
{
ST_STORE::StDmDeviceIoCompletion(a1 + ((*(_DWORD *)(v2 + 28) & 2) != 0 ? 2016i64 : 80i64), v2);
v9 = 259;
}
else
{
v9 = -1073741822;
}
goto LABEL_8;
}
v5 = (_DWORD *)v2;
v6 = 259;
if( *(_DWORD *)(v2 + 8) == 1 )
v5 = 0i64;
v17 = -(__int64)SmKmStoreReference((INT64)&SmGlobals, *(unsigned int *)(*(_QWORD *)(a1 + 24) + 6016i64));
v9 = v17 == 0 ? 0xC0000189 : 0;
if( v17 )
{
v18 = *(_DWORD *)(v2 + 8);
v4 = 1;
if( v18 != 1 )
{
switch( v18 )
{
case 2:
Stats = ST_STORE::StDmEtaRefresh(a1 + 80);
goto LABEL_7;
case 3:
Stats = ST_STORE::StMetaRegionsUpdate(a1, (_DWORD *)v2);
v5 = 0i64;
goto LABEL_7;
case 4:
ST_STORE::StLazyWorkMgrQueueWork(
*(_QWORD *)(a1 + 1992),
2i64,
(*(_WORD *)(v2 + 14) & 1) != 0 ? 200 : 2000,
(*(_WORD *)(v2 + 14) & 1) != 0 ? 2000 : 30000);
goto LABEL_33;
case 5:
_InterlockedAnd16((volatile signed __int16 *)(v2 + 12), 0xFFFEu);
LABEL_33:
v5 = 0i64;
goto LABEL_8;
case 6:
_InterlockedAnd16((volatile signed __int16 *)(v2 + 12), 0xFFFEu);
v5 = 0i64;
if( KiQueryUnbiasedInterruptTime(1u) - *(_QWORD *)(a1 + 6008) >= 0x989680
&& (unsigned int)ST_STORE::StDmCheckForCompaction(a1 + 80, 2) == 2 )
{
ST_STORE::StCompactionPerformEmergency(a1 + 80);
*(_QWORD *)(a1 + 6008) = KiQueryUnbiasedInterruptTime(1u);
}
goto LABEL_8;
}
LABEL_56:
v9 = -1073741811;
goto LABEL_8;
}
v20 = *(_DWORD *)(v2 + 16);
if( v20 < 0 )
goto LABEL_8;
if( v20 <= 1 )
{
Stats = ST_STORE::StCompactionWorker(a1 + (v20 != 0 ? 2016i64 : 80i64));
goto LABEL_7;
}
switch( v20 )
{
case 4:
SmHpChunkHeapProtect(a1 + 272, 0, 0i64);
goto LABEL_38;
case 3:
v21 = a1 + 80;
LABEL_41:
ST_STORE::StDmInvalidateCurrentRegions(v21);
goto LABEL_38;
case 2:
Stats = ST_STORE::StDmLazyRegionsWorker(a1 + 80, 0, a1 + 944);
goto LABEL_7;
}
if( v20 != 5 )
{
if( v20 != 6 )
goto LABEL_8;
goto LABEL_56;
}
ST_STORE::StDmCombineLazyCleanup(a1 + 80);
LABEL_38:
v9 = 0;
}
LABEL_8:
if( v9 == -1073741818 )
ST_STORE::StEmptyStore(a1, 0);
if( v5 )
ST_STORE::StStoreWorkItemCleanup(a1, v5);
if( v4 )
{
v19 = (struct _EX_RUNDOWN_REF *)SmKmStoreRefFromStoreIndex(
(INT64)&SmGlobals,
*(_DWORD *)(*(_QWORD *)(a1 + 24) + 6016i64) & 0x3FF);
ExReleaseRundownProtection(v19 + 1);
}
if( v6 == -1 )
return v9;
return v6;
}
Referenced by:
No references.