HalpTscAdjustToTarget

NTSTATUS __stdcall HalpTscAdjustToTarget(UINT64 a1){
  unsigned int v1; 
  INT64 v2; 
  unsigned int v3; 
  unsigned int v4; 
  NTSTATUS result; 

  v1 = a1;
  v2 = HalpTscAdvSynchCalculateRemoteDelta(a1, (unsigned int)HalpTscRequestedIterations, 0i64);
  v3 = 0;
  v4 = 0;
  do
  {
    if( !v3 )
    {
      __writemsr(0x3Bu, v2 + __readmsr(0x3Bu));
      HalpTscTraceProcessorSynchronization(v1, KeGetCurrentPrcb()->Number, v2);
    }
    v2 = HalpTscAdvSynchCalculateRemoteDelta(v1, (unsigned int)HalpTscRequestedIterations, 0i64);
    ++v3;
    if( (unsigned __int64)(v2 + 24) > 0x30 )
      v3 = 0;
    ++v4;
  }
  while( v4 < 0x32 && v3 < 2 );
  result = qword_140C4A3D8;
  *(_DWORD *)(qword_140C4A3D8 + 4i64 * KeGetCurrentPrcb()->Number) = v4;
  return result;
}

Referenced by:

HalpTscAdvSynchLeader