MiMirrorOmitPagesFromCopy
VOID __fastcall MiMirrorOmitPagesFromCopy(INT64 a1, UINT64 a2, UINT64 a3){
UINT64 v3;
UINT64 v5;
UINT64 v6;
UINT64 v7;
volatile signed __int32 *v8;
int v9;
UINT64 v10;
_DWORD *v11;
void *v12;
unsigned __int64 v13;
v3 = a3;
v5 = a3;
v6 = a2;
v7 = a2 & 0x1F;
v8 = (volatile signed __int32 *)(qword_140C4E468 + 4 * (a2 >> 5));
if( v7 + v5 > 0x20 )
{
if( (a2 & 0x1F) != 0 )
{
_InterlockedAnd(v8, ~(((1 << (32 - (a2 & 0x1F))) - 1) << v7));
v5 = v3 - (32 - (unsigned int)(a2 & 0x1F));
++v8;
}
if( v5 >= 0x20 )
{
v10 = v5 >> 5;
v5 += -32i64 * (v5 >> 5);
do
{
*v8++ = 0;
--v10;
}
while( v10 );
}
if( v5 )
{
v9 = -1 << v5;
goto LABEL_4;
}
}
else
{
if( v5 != 32 )
{
v9 = ~(((1 << v5) - 1) << v7);
LABEL_4:
_InterlockedAnd(v8, v9);
goto LABEL_5;
}
*v8 = 0;
}
LABEL_5:
if( *(_QWORD *)(a1 + 24) )
RtlClearBitsEx((INT64)qword_140C4E450, v6, v3);
if( (*(_DWORD *)(a1 + 32) & 0x20) != 0 && v3 )
{
do
{
LODWORD(v11) = MiMapPageInHyperSpaceWorker(v6, 0i64, 0i64);
v12 = v11;
v13 = 1024i64;
if( ((unsigned __int8)v11 & 4) != 0 )
{
*v11 = -2;
v12 = v11 + 1;
v13 = 1023i64;
}
memset64(v12, 0xFFFFFFFEFFFFFFFEui64, v13 >> 1);
if( (v13 & 1) != 0 )
*((_DWORD *)v12 + v13 - 1) = -2;
MiUnmapPageInHyperSpaceWorker(v11, 0x11u, 0i64);
++v6;
--v3;
}
while( v3 );
}
}Referenced by:
MiMirrorNodeLargePages
MiMirrorReduceBlackWrites
MiMirrorRemoveBlackChildPartitionPages
MiMirrorRemoveInactivePages
MiRemoveEnclavePagesFromMirror