SMKM_STORE_MGR::SmCompressContextUpdateMemoryCondition

__int64 __fastcall SMKM_STORE_MGR::SmCompressContextUpdateMemoryCondition(INT64 *SpinLock, int a2, int a3){
  int v5; 
  unsigned int ActiveProcessorCount; 
  unsigned int v7; 
  unsigned int v8; 
  unsigned __int64 v9; 
  __int64 result; 
  INT64 i; 

  if( a2 == 4 )
    v5 = 7;
  else
    v5 = *((_DWORD *)`SMKM_STORE::SmStGetPriorityByMemoryCondition'::`2'::PriorityByMemoryCondition + a2);
  ActiveProcessorCount = KeQueryActiveProcessorCountEx(0xFFFFu);
  v7 = ActiveProcessorCount;
  if( !a3 )
    goto LABEL_4;
  if( v5 <= 7 )
  {
    v7 = 3 * ActiveProcessorCount;
LABEL_9:
    v8 = v7 >> 2;
    goto LABEL_10;
  }
  if( v5 > 8 )
  {
    if( v5 <= 10 )
      goto LABEL_9;
    v8 = ActiveProcessorCount >> 3;
  }
  else
  {
    v8 = ActiveProcessorCount >> 1;
  }
LABEL_10:
  if( !v8 )
  {
LABEL_4:
    v8 = 1;
    goto LABEL_5;
  }
  if( v8 >= 0x10 )
    v8 = 16;
LABEL_5:
  v9 = (unsigned __int8)ExAcquireSpinLockExclusive(SpinLock);
  if( *((_DWORD *)SpinLock + 32) != v5 )
  {
    *((_DWORD *)SpinLock + 32) = v5;
    for( i = SpinLock[9]; (INT64 *)i != SpinLock + 9; i = *(_QWORD *)i )
      KeSetActualBasePriorityThread(*(_KTHREAD **)(i + 16), (unsigned int)v5);
  }
  *((_DWORD *)SpinLock + 22) = v8;
  ExReleaseSpinLockExclusiveFromDpcLevel(SpinLock);
  result = (unsigned int)KiIrqlFlags;
  __writecr8(v9);
  return result;
}

Referenced by:

No references.