MiLockProtoPoolPage
_MMPFN *__stdcall MiLockProtoPoolPage(_MMPTE *ProtoPte, UINT8 *PageIrql){
UINT64 *v3;
union {$8D9ED47C9F2F2CD645B633E301950288 __s0;unsigned __int64 EntireField;} *p_u4;
UINT64 v5;
UINT64 v6;
__int64 v7;
_MMPFN *v8;
UINT8 CurrentIrql;
UINT64 v10;
UINT64 SpinCount;
UINT64 v13;
UINT64 v14;
v3 = (unsigned __int64 *)((char *)&MmGetPteBase()->u.Long + (((unsigned __int64)ProtoPte >> 9) & 0x7FFFFFFFF8i64));
p_u4 = &MmGetPfnDb()->u4;
v14 = *v3;
v5 = v14 & 1;
do
{
if( !v5 )
return 0i64;
v6 = v14;
if( (v14 & 0x200) != 0 )
return 0i64;
MiPteInShadowRange((UINT64)&v14);
v7 = (v6 >> 12) & 0xFFFFFFFFFi64;
}
while( (p_u4[6 * v7]._bf_0 & 0x4000000000000i64) == 0 );
v8 = &MmGetPfnDb()[v7];
if( PageIrql )
{
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
LODWORD(SpinCount) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)&v8->u2, 0x3Fui64) )
{
do
KeYieldProcessorEx(&SpinCount);
while( v8->u2._bf_0 < 0 );
}
}
else
{
LODWORD(v13) = 0;
CurrentIrql = 17;
while( _interlockedbittestandset64((volatile signed __int32 *)&v8->u2, 0x3Fui64) )
{
do
KeYieldProcessorEx(&v13);
while( v8->u2._bf_0 < 0 );
}
}
v10 = *v3;
v14 = v10;
if( (v10 & 1) == 0 || (v10 & 0x200) != 0 || v7 != ((v10 >> 12) & 0xFFFFFFFFFi64) )
{
_InterlockedAnd64(&v8->u2.Lock, 0x7FFFFFFFFFFFFFFFui64);
if( CurrentIrql != 17 )
__writecr8(CurrentIrql);
return 0i64;
}
if( !MiAreChargesNeededToLockPage(v8) || MiChargeForLockedPage(v8, 1ui64) )
++v8->u3.ReferenceCount;
if( CurrentIrql != 17 )
*PageIrql = CurrentIrql;
MiLockOwnedProtoPage(v8, CurrentIrql);
return v8;
}Referenced by:
MiAllocateInPageSupport
MiConvertPrivateToProto
MiConvertStandbyToProto
MiDeleteMergedPte
MiDeletePerSessionProtos
MiDeleteSubsectionPages
MiEliminateStaleExtents
MiEnableLargeSubsection
MiGetPageFileSectionForReservation
MiInitializeDynamicPfns
MiInitializeImageProtos
MiInitializeProtoPfn
MiInsertLargeVadMapping
MiLockCode
MiMakeImageReadOnly
MiMigratePfn
MiPfPutPagesInTransition
MiPurgeImageSection
MiReplaceLockedPage
MiResolveProtoCombine
MiSectionCreated
MiSoftFaultMappedView
MiTranslatePageForCopy
MiWalkEntireImage
MiWalkVaRange
MiZeroCfgSystemWideBitmapWorker
MmCheckCachedPageStates
MmCopyToCachedPage