HalpTscAdvSynchTarget
NTSTATUS __stdcall HalpTscAdvSynchTarget(){
unsigned int Number;
__int64 i;
int v2;
int v3;
int v4;
int v5;
int v6;
int v7;
unsigned __int64 v8;
int v9;
NTSTATUS result;
int j;
signed __int32 v12[10];
Number = KeGetCurrentPrcb()->Number;
for( i = (__int64)(int)Number << 7; ; *(_DWORD *)(i + qword_140C4A418) = 0 )
{
while( 1 )
{
v2 = *(_DWORD *)(i + qword_140C4A418);
if( v2 )
break;
_mm_pause();
}
v3 = v2 - 1;
if( !v3 )
{
_InterlockedOr(v12, 0);
HalpTscAdvSynchSkewCounter(*(_QWORD *)(i + qword_140C4A418 + 8));
goto LABEL_11;
}
v4 = v3 - 1;
if( !v4 )
{
_InterlockedOr(v12, 0);
for( j = *(_DWORD *)(i + qword_140C4A418 + 4); j; --j )
HalpTscAdvSynchSkewCounter(*(_QWORD *)(i + qword_140C4A418 + 8));
goto LABEL_11;
}
v5 = v4 - 1;
if( !v5 )
{
_InterlockedOr(v12, 0);
__writemsr(0x3Bu, *(_QWORD *)(i + qword_140C4A418 + 8) + __readmsr(0x3Bu));
goto LABEL_11;
}
v6 = v5 - 1;
if( !v6 )
{
_InterlockedOr(v12, 0);
*(_DWORD *)(i + qword_140C4A418) = 6;
LODWORD(v8) = HalpTscAdvSynchComputeMinimumDelta(Number, (unsigned int)HalpTscRequestedIterations);
goto LABEL_10;
}
v7 = v6 - 1;
if( !v7 )
{
_InterlockedOr(v12, 0);
*(_DWORD *)(i + qword_140C4A418) = 6;
LODWORD(v8) = HalpTscAdvSynchComputeMinimumDeltaAlternate(
*(unsigned int *)(i + qword_140C4A418 + 4),
(unsigned int)HalpTscRequestedIterations);
LABEL_10:
*(_QWORD *)(i + qword_140C4A418 + 8) = v8;
goto LABEL_11;
}
v9 = v7 - 2;
if( !v9 )
{
HalpProcessorFence();
v8 = __rdtsc();
goto LABEL_10;
}
if( v9 == 1 )
break;
LABEL_11:
_InterlockedOr(v12, 0);
}
_InterlockedOr(v12, 0);
result = qword_140C4A418;
*(_DWORD *)(i + qword_140C4A418) = 0;
return result;
}Referenced by:
HalpTscSynchronizationWorker