KeConfigureHeteroProcessors

UINT64 __stdcall KeConfigureHeteroProcessors(
        _KAFFINITY_EX *SmallProcessors,
        UINT64 EfficiencyClassSystem,
        UINT8 MostFavoredClass,
        UINT64 *HeteroSystem){
  int v4; 
  unsigned int v6; 
  unsigned int v7; 
  unsigned __int8 v8; 
  unsigned __int8 v9; 
  unsigned __int8 v10; 
  char *v11; 
  __int64 v12; 
  unsigned __int8 v13; 
  unsigned __int8 v14; 
  unsigned __int8 v15; 
  unsigned __int8 v16; 
  unsigned int v17; 
  unsigned __int64 *Bitmap; 
  unsigned __int8 v19; 
  unsigned __int8 v20; 
  unsigned int v21; 
  int v22; 
  unsigned int v23; 
  unsigned __int8 v25; 
  unsigned __int8 v26; 
  _KHETERO_CPU_POLICY v27; 
  int v28; 
  _DWORD *v30; 
  _BYTE v31[704]; 

  v4 = EfficiencyClassSystem;
  v27 = KiDefaultHeteroCpuPolicy;
  v30 = (_DWORD *)MostFavoredClass;
  v28 = KeHeteroSystem;
  memset(v31, 0i64, 0x2B8u);
  *(_QWORD *)v31 = SmallProcessors;
  *(_DWORD *)&v31[8] = v4;
  *(_DWORD *)&v31[24] = 1310721;
  memset(&v31[28], 0i64, 0xA4u);
  *(_DWORD *)&v31[192] = 1310721;
  memset(&v31[196], 0i64, 0xA4u);
  *(_DWORD *)&v31[360] = 1310721;
  memset(&v31[364], 0i64, 0xA4u);
  *(_DWORD *)&v31[528] = 1310721;
  memset(&v31[532], 0i64, 0xA4u);
  v6 = KeNumberProcessors_0;
  v7 = 0;
  v8 = 0;
  v9 = 0;
  v10 = 0;
  if( (_DWORD)KeNumberProcessors_0 )
  {
    v11 = (char *)&SmallProcessors->Reserved + 3;
    v12 = (unsigned int)KeNumberProcessors_0;
    do
    {
      v13 = *(v11 - 1);
      v14 = v9;
      v15 = v10;
      v10 = v11[1];
      if( v10 <= v15 )
        v10 = v15;
      v9 = *v11;
      v11 += 3;
      if( v9 <= v14 )
        v9 = v14;
      if( v13 <= v8 )
        v13 = v8;
      v8 = v13;
      --v12;
    }
    while( v12 );
    v26 = v9;
    v25 = v10;
    if( v10 || v9 )
    {
      v16 = BYTE1(SmallProcessors->Reserved);
      v17 = 0;
      Bitmap = SmallProcessors->Bitmap;
      *(_DWORD *)&v31[16] = 1;
      while( 1 )
      {
        v19 = *(_BYTE *)Bitmap;
        if( *(_BYTE *)Bitmap >= v16 )
        {
          KeAddProcessorAffinityEx((UINT16 *)&v31[24], v17);
          if( v19 == v25 )
            KeAddProcessorAffinityEx((UINT16 *)&v31[192], v17);
        }
        if( v13 )
        {
          v20 = *((_BYTE *)Bitmap - 1);
          KiEfficiencyClassSystem = 1;
          if( v20 < LOBYTE(SmallProcessors->Reserved) )
            goto LABEL_23;
          KeAddProcessorAffinityEx((UINT16 *)&v31[360], v17);
          if( v20 != v26 )
            goto LABEL_23;
        }
        else
        {
          if( v16 && v19 >= v16 )
            goto LABEL_23;
          KeAddProcessorAffinityEx((UINT16 *)&v31[360], v17);
        }
        KeAddProcessorAffinityEx((UINT16 *)&v31[528], v17);
LABEL_23:
        ++v17;
        Bitmap = (unsigned __int64 *)((char *)Bitmap + 3);
        if( v17 >= v6 )
          goto LABEL_28;
      }
    }
  }
  v21 = 0;
  if( (_DWORD)KeNumberProcessors_0 )
  {
    do
      KeAddProcessorAffinityEx((UINT16 *)&v31[24], v21++);
    while( v21 < v6 );
  }
  KeCopyAffinityEx((_KAFFINITY_EX *)&v31[192], (_KAFFINITY_EX *)&v31[24]);
  KeCopyAffinityEx((_KAFFINITY_EX *)&v31[360], (_KAFFINITY_EX *)&v31[24]);
  KeCopyAffinityEx((_KAFFINITY_EX *)&v31[528], (_KAFFINITY_EX *)&v31[24]);
  *(_DWORD *)&v31[12] = v4;
  *(_DWORD *)&v31[16] = v8 != 0;
LABEL_28:
  KeGenericCallDpc((__int64)KiConfigureHeteroProcessorsTarget, (__int64)v31);
  v22 = KeHeteroSystem;
  v23 = 0;
  *v30 = KeHeteroSystem;
  for( KiDefaultHeteroCpuPolicy = v22 != 0 ? KiDesiredHeteroCpuPolicy : KHeteroCpuPolicyAll;
        v23 < (unsigned int)KeNumberProcessors_0;
        ++v23 )
  {
    KiConfigureCpuSetSchedulingInformation(*(&KiProcessorBlock + v23));
  }
  if( v27 != KiDefaultHeteroCpuPolicy || v28 != KeHeteroSystem )
    return 1;
  return v7;
}

Referenced by:

PopInitializeHeteroProcessors