PnprMarkOrMirrorPages
INT64 __fastcall PnprMarkOrMirrorPages(_LARGE_INTEGER PhysicalAddress, _LARGE_INTEGER NumberOfBytes, UINT8 Mirror){
UINT64 v4;
unsigned __int64 v5;
UINT64 v7;
RTL_BITMAP *v8;
unsigned __int64 v9;
unsigned __int64 v10;
unsigned __int64 v11;
unsigned __int64 v12;
unsigned __int64 v13;
unsigned __int64 v14;
UINT64 v15;
int v16;
int v17;
struct _KLOCK_QUEUE_HANDLE LockHandle;
v4 = PnprContext;
v5 = (unsigned __int64)PhysicalAddress.QuadPart >> 12;
memset(&LockHandle, 0, sizeof(LockHandle));
v7 = PnprContext + 152;
v8 = *(RTL_BITMAP **)(PnprContext + 152);
v9 = ((unsigned __int64)NumberOfBytes.QuadPart >> 12) + v5;
v10 = v9 - 1;
while( v8 != (RTL_BITMAP *)v7 )
{
v11 = *(_QWORD *)&v8[1].SizeOfBitMap;
if( v10 < v11 )
break;
v12 = v5;
v13 = v9;
if( v5 <= v11 )
v12 = *(_QWORD *)&v8[1].SizeOfBitMap;
if( (unsigned int *)v10 >= (unsigned int *)((char *)v8[1].Buffer + v11 - 1) )
v13 = (unsigned __int64)v8[1].Buffer + v11;
v14 = v13 - 1;
if( v12 <= v14 )
{
if( Mirror )
{
if( (*(int(__fastcall **)(_QWORD, unsigned __int64, unsigned __int64))(v4 + 20928))(
*(_QWORD *)(v4 + 20880),
v12 << 12,
(v14 << 12) - (v12 << 12) + 4096) < 0 )
{
v15 = PnprContext;
v16 = *(_DWORD *)(PnprContext + 20984);
if( !v16 )
v16 = 3424;
*(_DWORD *)(PnprContext + 20984) = v16;
v17 = *(_DWORD *)(v15 + 20988);
if( !v17 )
v17 = 8;
*(_DWORD *)(v15 + 20988) = v17;
}
}
else
{
KeAcquireInStackQueuedSpinLock((UINT64 *)(v4 + 168), &LockHandle);
RtlClearBits(v8 + 2, (unsigned int)(v12 - v11), (unsigned int)(v14 - v12 + 1));
KeReleaseInStackQueuedSpinLock(&LockHandle);
}
}
v4 = PnprContext;
v8 = *(RTL_BITMAP **)&v8->SizeOfBitMap;
v7 = PnprContext + 152;
}
return 0i64;
}Referenced by:
PnprMirrorPhysicalMemory
PnprRecopyAddress
PnprRecopyMappingReserve