KiInitMachineDependent

UINT8 __stdcall KiInitMachineDependent(){
  int v0; 
  UINT8 v1; 
  unsigned int v2; 
  UINT8 result; 
  int v4; 
  struct _GROUP_AFFINITY PreviousAffinity; 
  PreviousAffinity = 0i64;
  if( (KiCacheErrataMonitor & 3) != 0 )
  {
    if( (KiCacheErrataMonitor & 2) != 0 )
    {
      v4 = 2;
    }
    else if( KUSER_SHARED_DATA.SafeBootMode )
    {
      v4 = 1;
    }
    else
    {
      v4 = KiTLBCOverride & 1;
    }
    KiTLBCOverride = v4;
  }
  else
  {
    KiTLBCOverride = 0;
  }
  v0 = 0;
  v1 = 0;
  v2 = 0;
  if( (_DWORD)KeNumberProcessors_0 )
  {
    while( 1 )
    {
      if( v0 )
      {
        KiSetSystemAffinityThreadToProcessor(v2, 0i64);
      }
      else
      {
        KiSetSystemAffinityThreadToProcessor(v2, &PreviousAffinity);
        v0 = 1;
      }
      if( v2 == (_DWORD)KeNumberProcessors_0 - 1 )
        v1 = 1;
      if( (KiCacheErrataMonitor & 3) != 0 )
      {
        result = KiInitializeCacheErrataSupport(v1);
        if( !result )
          break;
      }
      KiInitializeMTRR(v1);
      if( (KeFeatureBits & 0x400000) != 0 )
        __writemsr(0x1A0u, __readmsr(0x1A0u) | 0x8000000);
      if( ++v2 >= (unsigned int)KeNumberProcessors_0 )
        goto LABEL_12;
    }
  }
  else
  {
LABEL_12:
    if( *((_BYTE *)KeGetCurrentPrcb() + 141) == 2 )
      KiIa32MiscEnable = __readmsr(0x1A0u);
    if( v0 )
      KeRevertToUserGroupAffinityThread(&PreviousAffinity);
    KiUserCodePatchMutex.Owner = 0i64;
    KiUserCodePatchMutex.Contention = 0;
    result = 1;
    KiUserCodePatchMutex.Event.Header.SignalState = 0;
    KiUserCodePatchMutex.Event.Header.WaitListHead.Blink = &KiUserCodePatchMutex.Event.Header.WaitListHead;
    KiUserCodePatchMutex.Event.Header.WaitListHead.Flink = &KiUserCodePatchMutex.Event.Header.WaitListHead;
    KiUserCodePatchMutex.Count = 1;
    LOWORD(KiUserCodePatchMutex.Event.Header.Lock) = 1;
    KiUserCodePatchMutex.Event.Header.Size = 6;
  }
  return result;
}

Referenced by:

KeInitSystem