KiCopyCounters

VOID __stdcall KiCopyCounters(_ETHREAD *Thread){
  _KTHREAD_COUNTERS *ThreadCounters; 
  unsigned __int8 CurrentIrql; 
  volatile unsigned __int64 CycleTime; 
  NTSTATUS v5; 

  ThreadCounters = Thread->Tcb.ThreadCounters;
  CurrentIrql = KeGetCurrentIrql();
  __writecr8(1ui64);
  do
  {
    CycleTime = Thread->Tcb.CycleTime;
    _enable();
    v5 = KiCopyCountersWorker(&Thread->Tcb, ThreadCounters);
    _disable();
  }
  while( !v5 && CycleTime != Thread->Tcb.CycleTime );
  __writecr8(CurrentIrql);
  if( (KeGetCurrentPrcb()->PairRegister & 2) != 0 )
    KiUpdateStibpPairing(0i64);
}

Referenced by:

KiApcInterrupt
KiBoundFault
KiControlProtectionFault
KiDpcInterrupt
KiExceptionDispatch
KiFastFailDispatch
KiInvalidOpcodeFault
KiIpiInterrupt
KiMcheckAbort
KiNmiInterruptStart
KiPageFault
KiRestoreSetContextState
KiSpuriousDispatchNoEOI
KiSwInterrupt
KiSystemCall64
KiUmsFastReturnToUser
KiVirtualizationException
KxIsrLinkage
KxMcheckAlternateReturn
KxStartUserThread
NtCallEnclave
NtContinueEx
NtRaiseException