MiObtainProtoReference

VOID __stdcall MiObtainProtoReference(_MMPFN *ProtoPfn, UINT64 Flags){
  UINT64 SpinCount; 

  if( (Flags & 1) != 0 )
  {
    MiLockNestedPageAtDpcInline(ProtoPfn);
  }
  else
  {
    LODWORD(SpinCount) = 0;
    while( _interlockedbittestandset64((volatile signed __int32 *)&ProtoPfn->u2, 0x3Fui64) )
    {
      do
        KeYieldProcessorEx(&SpinCount);
      while( ProtoPfn->u2._bf_0 < 0 );
    }
  }
  MiAddLockedPageCharge(ProtoPfn, 1ui64);
  _InterlockedAnd64(&ProtoPfn->u2.Lock, 0x7FFFFFFFFFFFFFFFui64);
}

Referenced by:

MiCopyDataPageToImagePage
MiCopyFileOnlyGlobalSubsectionPage
MiCopyImageExtentContents
MiFinishMdlForMappedFileFault
MiFlushSectionInternal
MiHandleCollidedFault
MiIdealClusterPage
MiPfPutPagesInTransition
MiResolvePageFileFault
MiTranslatePageForCopy
MiWalkEntireImage