HalpSetTimer
NTSTATUS __fastcall HalpSetTimer(_KDPC *Dpc, UINT64 a2, UINT64 a3, CHAR a4, INT64 a5){
UINT64 v5;
unsigned int v8;
NTSTATUS v9;
UINT64 v10;
unsigned int DeferredRoutine_high;
unsigned __int64 v12;
void *v13;
void *v14;
UINT64 v15;
UINT64 v16;
UINT64 v17;
unsigned __int128 v18;
__int64 v19;
UINT64 pullResult;
__int64 v22[4];
v22[0] = 0i64;
v5 = 0i64;
pullResult = 0i64;
v8 = a2;
switch( (_DWORD)a2 )
{
case 1:
if( ((__int64)Dpc[3].DeferredContext & 0x10) == 0 )
{
Dpc[4].TargetInfoAsUlong = 0;
HalpTimerLastProblem = 17;
v9 = -1073741637;
HIDWORD(Dpc[3].DpcData) = 17;
Dpc[4].DpcListEntry.Next = (_SINGLE_LIST_ENTRY *)"minkernel\\hals\\lib\\timers\\common\\timersup.c";
LODWORD(Dpc[4].ProcessorHistory) = 692;
goto LABEL_18;
}
break;
case 2:
if( ((__int64)Dpc[3].DeferredContext & 0x50) == 0 )
{
Dpc[4].TargetInfoAsUlong = 0;
HalpTimerLastProblem = 17;
v9 = -1073741637;
HIDWORD(Dpc[3].DpcData) = 17;
Dpc[4].DpcListEntry.Next = (_SINGLE_LIST_ENTRY *)"minkernel\\hals\\lib\\timers\\common\\timersup.c";
LODWORD(Dpc[4].ProcessorHistory) = 683;
goto LABEL_18;
}
break;
case 3:
if( ((__int64)Dpc[3].DeferredContext & 0x20) == 0 )
{
Dpc[4].TargetInfoAsUlong = 0;
HalpTimerLastProblem = 17;
v9 = -1073741637;
HIDWORD(Dpc[3].DpcData) = 17;
Dpc[4].DpcListEntry.Next = (_SINGLE_LIST_ENTRY *)"minkernel\\hals\\lib\\timers\\common\\timersup.c";
LODWORD(Dpc[4].ProcessorHistory) = 671;
goto LABEL_18;
}
break;
default:
goto LABEL_27;
}
v9 = RtlULongLongMult(*(_QWORD *)&Dpc[3].TargetInfoAsUlong, a3, &pullResult);
if( v9 < 0 )
goto LABEL_18;
if( v8 == 3 )
{
v10 = pullResult + 9999999;
if( pullResult + 9999999 < pullResult )
{
v9 = -1073741675;
v10 = -1i64;
}
else
{
v9 = 0;
}
if( v9 < 0 )
goto LABEL_18;
}
else
{
v10 = pullResult;
}
DeferredRoutine_high = HIDWORD(Dpc[3].DeferredRoutine);
v12 = v10 / 0x989680;
if( DeferredRoutine_high < 0x40 && v12 >= 1i64 << DeferredRoutine_high )
{
LABEL_27:
v9 = -1073741811;
goto LABEL_18;
}
if( RtlULongLongMult(v12, 0x2540BE400ui64, (ULONGLONG *)v22) < 0 )
v16 = HalpTimerScaleCounter(v12, *(_QWORD *)&Dpc[3].TargetInfoAsUlong, v15);
else
v16 = v22[0] / *(_QWORD *)&Dpc[3].TargetInfoAsUlong;
v17 = v16;
Dpc->ProcessorHistory = v12;
HIDWORD(Dpc->SystemArgument2) = 1;
v18 = v16 * (unsigned __int128)0x624DD2F1A9FBE77ui64;
v5 = (*((_QWORD *)&v18 + 1) + ((v17 - *((_QWORD *)&v18 + 1)) >> 1)) >> 9;
if( v8 == 2 && ((__int64)Dpc[3].DeferredContext & 0x40) == 0 )
v8 = 1;
if( a4 )
{
HalpTimerGetInternalData(Dpc, *((PVOID *)&v18 + 1), v13, v14);
v9 = (*(__int64(__fastcall **)(__int64, _QWORD, unsigned __int64))&Dpc[2].TargetInfoAsUlong)(v19, v8, v12);
if( v9 < 0 )
{
Dpc[4].TargetInfoAsUlong = v9;
HalpTimerLastProblem = 18;
HIDWORD(Dpc[3].DpcData) = 18;
Dpc[4].DpcListEntry.Next = (_SINGLE_LIST_ENTRY *)"minkernel\\hals\\lib\\timers\\common\\timersup.c";
LODWORD(Dpc[4].ProcessorHistory) = 782;
}
}
else
{
v9 = 0;
}
LABEL_18:
*(_QWORD *)a5 = v5;
return v9;
}Referenced by:
HalpSetTimerAnyMode
HalpTimerClockArm
HalpTimerInitializeClock
HalpTimerRestartProfileInterrupt
HalpTimerSetTimerBackedProfileInterval
HalpTimerStartProfileInterrupt
HalpTimerTestHypervisorTimer
HalpTimerWatchdogResetCountdown
HalpTimerWatchdogStart
HalpTimerWatchdogTriggerSystemReset
HalpWatchdogDelayExpiration