KiSendFreeze

VOID __stdcall KiSendFreeze(_KAFFINITY_EX *Affinity, UINT8 Wait){
  int v4; 
  int v5; 
  __int64 v6; 
  signed __int32 v7; 
  _KAFFINITY_ENUMERATION_CONTEXT Context; 
  UINT64 ProcIndex; 

  *(_DWORD *)(&Context.CurrentIndex + 1) = 0;
  *(&Context.CurrentIndex + 3) = 0;
  v4 = 0;
  Context.CurrentIndex = 0;
  LODWORD(ProcIndex) = 0;
  Context.CurrentMask = Affinity->Bitmap[0];
  Context.Affinity = Affinity;
  while( 1 )
  {
    KeEnumerateNextProcessor(&ProcIndex, &Context);
    if( v5 )
      break;
    v6 = (__int64)*(&KiProcessorBlock + (unsigned int)ProcIndex);
    v7 = _InterlockedCompareExchange((volatile signed __int32 *)(v6 + 11656), 5, 0);
    if( Wait )
    {
      if( v7 )
      {
        do
        {
          do
            _mm_pause();
          while( *(_DWORD *)(v6 + 11656) );
        }
        while( _InterlockedCompareExchange((volatile signed __int32 *)(v6 + 11656), 5, 0) );
      }
LABEL_7:
      ++v4;
    }
    else
    {
      if( !v7 )
        goto LABEL_7;
      KeRemoveProcessorAffinityEx(&Affinity->Count, (unsigned int)ProcIndex);
    }
  }
  if( v4 )
    HalSendNMI(Affinity);
}

Referenced by:

KeBugCheck2
KeFreezeExecution