KxFlushEntireTb

VOID __stdcall KxFlushEntireTb(_KTBFLUSH_TARGET ProcessorSet){
  UINT64 RequestType; 
  char v2; 
  unsigned __int8 CurrentIrql; 
  struct _KPRCB *CurrentPrcb; 
  int v5; 
  int v6[8]; 
  INT64 v7; 

  RequestType = 3i64;
  v2 = 1;
  if( ProcessorSet == FlushAllAwakeProcessors )
  {
    RequestType = 2147483651i64;
  }
  else if( ProcessorSet == FlushSubsetProcessors && KiKvaShadow )
  {
    v2 = 0;
  }
  CurrentIrql = KeGetCurrentIrql();
  __writecr8(0xCui64);
  if( v2 )
  {
    if( KxSetTimeStampBusy((INT64 *)&KiTbFlushTimeStamp) )
    {
      KiIpiSendRequestEx(
        KeGetCurrentPrcb(),
        IpiAllButSelf,
        0i64,
        0i64,
        RequestType,
        (INT64)KiFlushCurrentTbWorker,
        0i64);
      _InterlockedIncrement((volatile signed __int32 *)&KiTbFlushTimeStamp);
    }
  }
  else
  {
    _InterlockedOr(v6, 0);
    CurrentPrcb = KeGetCurrentPrcb();
    KeCopyAffinityEx(
      &CurrentPrcb->StaticAffinity.KeFlushTbAffinity,
      (_KAFFINITY_EX *)&CurrentPrcb->CurrentThread->Tcb.ApcState.Process->Pcb.ActiveProcessors);
    KeRemoveProcessorAffinityEx(&CurrentPrcb->StaticAffinity.KeFlushTbAffinity.Count, CurrentPrcb->Number);
    if( KiAffinityContainsProcessorsOtherThanSelf(
           (INT64)CurrentPrcb,
           &CurrentPrcb->StaticAffinity.KeFlushTbAffinity.Count) )
    {
      KiIpiSendRequest(CurrentPrcb, IpiAffinity, &CurrentPrcb->StaticAffinity.KeFlushTbAffinity, 0i64, RequestType, v7);
      KiFlushCurrentTbWorker();
      v5 = 0;
      while( CurrentPrcb->PacketBarrier )
      {
        ++v5;
        _mm_pause();
      }
    }
    else
    {
      KiFlushCurrentTbWorker();
    }
  }
  __writecr8(CurrentIrql);
}

Referenced by:

KeFlushEntireTb
KeFlushTb