KiSetCacheInformation

VOID __stdcall KiSetCacheInformation(){
  _KPRCB *v0; 
  KPCR *Pcr; 
  struct _KPRCB *CurrentPrcb; 
  unsigned __int8 CpuVendor; 
  unsigned int v4; 
  _CACHE_DESCRIPTOR *Cache; 
  unsigned int i; 
  unsigned __int8 Associativity; 

  Pcr = KeGetPcr();
  CurrentPrcb = KeGetCurrentPrcb();
  CpuVendor = CurrentPrcb->CpuVendor;
  if( CpuVendor == 1 )
  {
    KiSetCacheInformationAmd(v0);
  }
  else
  {
    if( (unsigned __int8)(CpuVendor - 2) > 1u )
      KeBugCheck(0x5Du);
    KiSetCacheInformationIntel(v0);
  }
  v4 = 0;
  Cache = CurrentPrcb->Cache;
  Pcr->SecondLevelCacheSize = 0;
  for( i = 0; i < CurrentPrcb->CacheCount; ++i )
  {
    if( Cache->Level >= 2u && (Cache->Type & 0xFFFFFFFD) == 0 )
    {
      Associativity = Cache->Associativity;
      if( Associativity == 0xFF )
        Associativity = 16;
      if( Associativity && Cache->Size / Associativity > v4 )
      {
        v4 = Cache->Size / Associativity;
        Pcr->SecondLevelCacheSize = Cache->Size;
        Pcr->SecondLevelCacheAssociativity = Associativity;
      }
      if( Cache->LineSize > (unsigned int)KeLargestCacheLine )
        KeLargestCacheLine = Cache->LineSize;
      if( Cache->Size > KiLargestCacheSize )
        KiLargestCacheSize = Cache->Size;
    }
    ++Cache;
  }
}

Referenced by:

KiInitializeKernel