SMKM_STORE_MGR::SmPageWrite
__int64 __fastcall SMKM_STORE_MGR::SmPageWrite(
__int64 a1,
unsigned int *a2,
int a3,
__int64 a4,
__int64 a5,
__int64 a6,
int a7){
_ETHREAD *v7;
_OWORD *PoolWithTag;
void *v9;
UINT64 v10;
UINT64 v14;
_DWORD *v15;
__int64 v16;
unsigned int *v17;
unsigned int v18;
int v19;
int v20;
PVOID v21;
bool v22;
int v23;
UINT64 v25;
UINT64 v26;
unsigned int v27;
int v28;
unsigned int v29;
struct _EX_RUNDOWN_REF *v30;
__int64 v32;
int v33;
v7 = (_ETHREAD *)a6;
PoolWithTag = 0i64;
v9 = 0i64;
v32 = a6;
v10 = a3 & 0x7FF;
*(_QWORD *)(a6 + 8) = 0i64;
*(_QWORD *)v7 = a5;
v33 = *(_DWORD *)(a4 + 40) >> 12;
if( (_DWORD)v10 == 1024 || (v14 = SmKmStoreReferenceEx(a1, v10), (v15 = (_DWORD *)v14) == 0i64) )
{
v23 = -1073741811;
goto LABEL_29;
}
LODWORD(a6) = 0;
v16 = (unsigned __int16)a3 >> 13;
ST_STORE::StDmGetSpaceStats(v14 + 80, &a6, 0i64);
if( v15[234] <= (unsigned int)a6 )
{
v27 = v15[2 * v16 + 477];
v28 = v15[2 * v16 + 476];
v29 = v28 * (v15[216] >> 4);
if( v29 >= v27 && v29 - v27 < v28 << 8 )
{
v23 = -1073741110;
goto LABEL_23;
}
}
if( (a3 & 0x40000) != 0 && (unsigned int)(v16 - 5) <= 1 )
LODWORD(v16) = 6;
if( (_DWORD)v16 == 6 )
SMKM_STORE_MGR::SmHighMemPriorityTimerStart(a1);
if( (*(_DWORD *)(a1 + 1840) & 0x20) == 0 || (*v15 & 0x400) != 0 )
{
v25 = 40i64;
v26 = 1767337331i64;
}
else
{
PoolWithTag = RtlpInterlockedPopEntrySList((PSLIST_HEADER)(a1 + 1408));
if( PoolWithTag )
goto LABEL_10;
v25 = 4096i64;
v26 = 2002218355i64;
}
PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, v25, v26);
if( !PoolWithTag )
{
v23 = -1073741670;
goto LABEL_23;
}
LABEL_10:
v17 = a2;
*PoolWithTag = 0i64;
PoolWithTag[1] = 0i64;
*((_QWORD *)PoolWithTag + 4) = 0i64;
*((_DWORD *)PoolWithTag + 6) = *a2;
v18 = *((_DWORD *)PoolWithTag + 2) & 0xFFFFFFF8;
*((_QWORD *)PoolWithTag + 2) = a4;
v19 = v16 | v18;
*((_DWORD *)PoolWithTag + 2) = v19;
if( (a3 & 0x10000) != 0 )
{
v19 |= 0x40000000u;
*((_DWORD *)PoolWithTag + 2) = v19;
}
if( (a3 & 0x20000) != 0 )
*((_DWORD *)PoolWithTag + 2) = v19 | 0x40000000;
*((_QWORD *)PoolWithTag + 4) = v7;
v20 = v15[1504] & 0x3FF;
if( (*(_DWORD *)(a1 + 1840) & 2) != 0 )
{
if( (*(_BYTE *)(a4 + 10) & 5) != 0 )
{
v9 = *(void **)(a4 + 24);
}
else
{
v21 = MmMapLockedPagesSpecifyCache((PMDL)a4, 0, MmCached, 0i64, 0, 0x40000020u);
v17 = a2;
v9 = v21;
}
if( !v9 )
{
v23 = -1073741688;
goto LABEL_23;
}
}
if( (*(_DWORD *)(a1 + 1840) & 0x20) == 0 || (*v15 & 0x400) != 0 )
{
v23 = SMKM_STORE_MGR::SmFeAddInitiate(a1, v17, v33, v20, (__int64)PoolWithTag, v7, 0);
if( v23 < 0 )
goto LABEL_23;
goto LABEL_22;
}
v22 = a7 != 0;
a7 = -a7;
v23 = SMKM_STORE_MGR::SmFeAddInitiate(a1, v17, v33, v20, 0i64, 0i64, v22 + 2);
if( v23 >= 0 )
{
memset((INT64)PoolWithTag + 40, 0i64);
*((_QWORD *)PoolWithTag + 15) = PoolWithTag;
*((_QWORD *)PoolWithTag + 13) = v15;
SMKM_STORE_MGR::SmCompressContextQueueEntry((PEX_SPIN_LOCK)(a1 + 1264), (__int64)PoolWithTag + 40);
LABEL_22:
v15 = 0i64;
PoolWithTag = 0i64;
v9 = 0i64;
v23 = 259;
v32 = 0i64;
}
LABEL_23:
if( v15 )
{
v30 = (struct _EX_RUNDOWN_REF *)SmKmStoreRefFromStoreIndex(a1, v15[1504] & 0x3FF);
ExReleaseRundownProtection(v30 + 1);
}
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
if( v9 )
MmUnmapLockedPages(v9, (PMDL)a4);
LABEL_29:
if( v32 )
{
*(_OWORD *)v7 = 0i64;
*(_DWORD *)v7 = v23;
}
return(unsigned int)v23;
}
Referenced by:
No references.