KiSendThawExecution

INT64 __fastcall KiSendThawExecution(CHAR a1){
  char v2; 
  INT64 CurrentPrcb; 
  unsigned int v4; 
  __int64 v5; 
  __int64 v6; 
  unsigned __int16 *v7[2]; 
  __int16 v8; 
  int v9; 
  __int16 v10; 
  int v11; 
  _DWORD result[43]; 
  LODWORD(v6) = 0;
  v9 = 0;
  v10 = 0;
  memset((INT64)&result[1], 0i64);
  *((_DWORD *)KeGetCurrentPrcb() + 2914) = 0;
  KiSetDebuggerOwner(0i64);
  if( (KiBugCheckActive & 3) != 0 )
  {
    v2 = 1;
    LODWORD(v6) = (unsigned int)KiBugCheckActive >> 4;
  }
  else
  {
    v2 = 0;
  }
  if( KiRecoveryInProgress )
    v2 = 0;
  if( !v2
    || (CurrentPrcb = (INT64)KeGetCurrentPrcb(), (_DWORD)v6 != *(_DWORD *)(CurrentPrcb + 36))
    || KiResumeForReboot )
  {
    CurrentPrcb = (unsigned int)KeNumberProcessors_0;
    if( (unsigned int)KeNumberProcessors_0 >= 2 && !PoAllProcIntrDisabled )
    {
      v11 = 1310721;
      memset((INT64)result, 0i64);
      LODWORD(v6) = 0;
      if( (_DWORD)KeNumberProcessors_0 )
      {
        v4 = v6;
        do
        {
          v5 = (__int64)*(&KiProcessorBlock + v4);
          if( (struct _KPRCB *)v5 != KeGetCurrentPrcb() )
          {
            if( (*(_DWORD *)(v5 + 11656) & 0xF) == 2 )
            {
              *(_DWORD *)(v5 + 11656) = 3;
              if( a1 )
                KeAddProcessorAffinityEx(&v11, v6);
            }
            else
            {
              *(_DWORD *)(v5 + 11656) = 0;
            }
          }
          LODWORD(v6) = v6 + 1;
          v4 = v6;
        }
        while( (unsigned int)v6 < (unsigned int)KeNumberProcessors_0 );
      }
      v7[1] = *(unsigned __int16 **)&result[1];
      v7[0] = (unsigned __int16 *)&v11;
      v8 = 0;
      while( 1 )
      {
        CurrentPrcb = KeEnumerateNextProcessor(&v6, v7);
        if( (_DWORD)CurrentPrcb )
          break;
        while( *((_DWORD *)*(&KiProcessorBlock + (unsigned int)v6) + 2914) == 3 )
          _mm_pause();
      }
    }
  }
  return CurrentPrcb;
}

Referenced by:

KeBugCheck2
KeThawExecution