KiSetCacheInformationAmd

char KiSetCacheInformationAmd(){
  struct _KPRCB *CurrentPrcb; 
  int v1; 
  char *v2; 
  unsigned int i; 
  char v4; 
  int v5; 
  __int16 v6; 
  unsigned int v7; 
  unsigned __int32 v8; 
  unsigned __int32 v9; 
  __int64 v10; 
  _QWORD *v11; 
  unsigned __int32 v12; 
  __int32 v13; 
  __int64 v14; 
  __int16 v16; 
  __int16 v17; 
  CurrentPrcb = KeGetCurrentPrcb();
  *((_DWORD *)CurrentPrcb + 8389) = 0;
  if( (ECX(__cpuid(-2147483647, 0)) & 0x400000) != 0 )
  {
    LOBYTE(v1) = KiSetStandardizedCacheInformation((__int64)CurrentPrcb, -2147483619);
  }
  else
  {
    v2 = (char *)CurrentPrcb + 33496;
    for( i = 0; i < 4; ++i )
    {
      if( i <= 1 )
      {
        v4 = 1;
        v14 = __cpuid(-2147483643, 0);
        v13 = ECX(v14);
        v12 = EDX(v14);
        if( !i )
          v12 = v13;
        v6 = (unsigned __int8)v12;
        v9 = HIBYTE(v12) << 10;
        v8 = HIWORD(v12);
        v1 = -i;
        v5 = 2 - (i != 0);
      }
      else if( i == 2 )
      {
        v16 = ECX(__cpuid(-2147483642, 0));
        v6 = (unsigned __int8)v16;
        v5 = 0;
        v4 = 2;
        LOBYTE(v1) = KiGetL2L3AssociativityAmd(HIBYTE(v16) >> 4);
        LOBYTE(v8) = v1;
      }
      else
      {
        v17 = EDX(__cpuid(-2147483642, 0));
        v4 = 3;
        v5 = 0;
        v6 = (unsigned __int8)v17;
        LOBYTE(v1) = KiGetL2L3AssociativityAmd(HIBYTE(v17) >> 4);
        LOBYTE(v8) = v1;
        v9 = v7 >> 18 << 19;
        if( !v9 )
          return v1;
        if( *((char *)CurrentPrcb + 64) <= 21 )
        {
          v10 = 0i64;
          *((_QWORD *)CurrentPrcb + 4241) = *((_QWORD *)CurrentPrcb + 25);
          for( LOBYTE(v1) = KeNumberProcessors_0;
                (unsigned int)v10 < (unsigned int)KeNumberProcessors_0;
                v10 = (unsigned int)(v10 + 1) )
          {
            v11 = *(&KiProcessorBlock + v10);
            if( v11[24] == *((_QWORD *)CurrentPrcb + 24)
              && ((*((_QWORD *)CurrentPrcb
                   + ((unsigned __int64)(unsigned int)KiProcessorIndexToNumberMappingTable[v10] >> 6)
                   + 4211) >> (KiProcessorIndexToNumberMappingTable[v10] & 0x3F)) & 1) != 0 )
            {
              *((_QWORD *)CurrentPrcb + 4241) |= v11[25];
              v11[4241] |= *((_QWORD *)CurrentPrcb + 25);
            }
            LOBYTE(v1) = KeNumberProcessors_0;
          }
        }
      }
      *((_DWORD *)v2 + 2) = v5;
      *v2 = v4;
      v2[1] = v8;
      *((_WORD *)v2 + 1) = v6;
      *((_DWORD *)v2 + 1) = v9;
      v2 += 12;
      ++*((_DWORD *)CurrentPrcb + 8389);
    }
  }
  return v1;
}

Referenced by:

KiSetCacheInformation