MiReferencePfBackedSection

_SUBSECTION *__stdcall MiReferencePfBackedSection(_MMPTE *ProtoPte){
  _MI_CONTROL_AREA_WAIT_BLOCK *v1; 
  _SUBSECTION *v2; 
  unsigned __int8 v4; 
  _RTL_BALANCED_NODE *Root; 
  unsigned __int64 v6; 
  unsigned __int64 ParentValue; 
  unsigned __int64 v8; 
  _MI_CONTROL_AREA_WAIT_BLOCK *v9; 
  __int64 v11; 

  v1 = 0i64;
  v2 = 0i64;
LABEL_2:
  v4 = ExAcquireSpinLockShared(&qword_140C4C880);
  Root = RootPointer.Root;
  v6 = v4;
  while( 1 )
  {
    ParentValue = 0i64;
    if( !Root )
      break;
    v11 = 0i64;
    v8 = MiObtainProtoBaseFromNode(Root, &v11);
    if( (unsigned __int64)ProtoPte < v8 )
    {
      Root = Root->Children[0];
    }
    else
    {
      if( (unsigned __int64)ProtoPte < v8 + 8 * v11 )
      {
        if( ((__int64)Root[1].Children[0] & 7) != 1 )
          break;
        ParentValue = Root[-3].ParentValue;
        if( !(unsigned int)ExTryAcquireSpinLockExclusiveAtDpcLevel((INT64 *)(ParentValue + 72)) )
        {
          ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)&qword_140C4C880);
          __writecr8(v6);
          goto LABEL_2;
        }
        if( (*(_DWORD *)(ParentValue + 56) & 3) == 0 )
        {
          v9 = MiBuildWakeList((_CONTROL_AREA *)ParentValue, 4ui64);
          ++*(_DWORD *)(ParentValue + 76);
          v1 = v9;
          MiRemoveUnusedSegment((_CONTROL_AREA *)ParentValue);
          v2 = (_SUBSECTION *)&Root[-3].16;
        }
        break;
      }
      Root = Root->Children[1];
    }
  }
  ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)&qword_140C4C880);
  if( ParentValue )
    ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(ParentValue + 72));
  __writecr8(v6);
  if( v1 )
    MiReleaseControlAreaWaiters(v1);
  return v2;
}

Referenced by:

MiGetPageFileSectionForReservation
MiTrimSharedPage