MiLockSectionControlArea

_CONTROL_AREA *__stdcall MiLockSectionControlArea(
        _MI_SECTION_OBJECT_POINTERS *SectionObjectPointer,
        UINT64 DataSection,
        UINT8 *OldIrql){
  int v4; 
  UINT8 v6; 
  unsigned __int64 v7; 
  __int64 v8; 
  unsigned __int64 v10; 

  v4 = DataSection;
  while( 1 )
  {
    v6 = ExAcquireSpinLockExclusive(&SpinLock);
    v7 = v6;
    *OldIrql = v6;
    v8 = v4 == 1 ? *(_QWORD *)SectionObjectPointer : *((_QWORD *)SectionObjectPointer + 2);
    if( !v8 )
      break;
    if( (unsigned int)ExTryAcquireSpinLockExclusiveAtDpcLevel((INT64 *)(v8 + 72)) )
    {
      ExReleaseSpinLockExclusiveFromDpcLevel(&SpinLock);
      return(_CONTROL_AREA *)v8;
    }
    v10 = *OldIrql;
    ExReleaseSpinLockExclusiveFromDpcLevel(&SpinLock);
    __writecr8(v10);
  }
  ExReleaseSpinLockExclusiveFromDpcLevel(&SpinLock);
  __writecr8(v7);
  return 0i64;
}

Referenced by:

MiComputeFlushRange
MiFlushDataSection
MiReferenceExistingControlArea
MmDisableModifiedWriteOfSection
MmEnoughMemoryForWrite
MmGetImageFileSignatureInformation
MmOnlySystemCacheViewsPresent
MmUpdateSectionIoAttribution