KiInitMachineDependent
UINT8 __stdcall KiInitMachineDependent(){
int v0;
UINT8 v1;
unsigned int v2;
UINT8 result;
int v4;
_GROUP_AFFINITY PreviousAffinity;
PreviousAffinity = 0i64;
if( (KiCacheErrataMonitor & 3) != 0 )
{
if( (KiCacheErrataMonitor & 2) != 0 )
{
v4 = 2;
}
else if( KUSER_SHARED_DATA.SafeBootMode )
{
v4 = 1;
}
else
{
v4 = KiTLBCOverride & 1;
}
KiTLBCOverride = v4;
}
else
{
KiTLBCOverride = 0;
}
v0 = 0;
v1 = 0;
v2 = 0;
if( (_DWORD)KeNumberProcessors_0 )
{
while( 1 )
{
if( v0 )
{
KiSetSystemAffinityThreadToProcessor(v2, 0i64);
}
else
{
KiSetSystemAffinityThreadToProcessor(v2, &PreviousAffinity);
v0 = 1;
}
if( v2 == (_DWORD)KeNumberProcessors_0 - 1 )
v1 = 1;
if( (KiCacheErrataMonitor & 3) != 0 )
{
result = KiInitializeCacheErrataSupport(v1);
if( !result )
break;
}
KiInitializeMTRR(v1);
if( ((unsigned __int64)KeFeatureBits & 0x400000) != 0 )
__writemsr(0x1A0u, __readmsr(0x1A0u) | 0x8000000);
if( ++v2 >= (unsigned int)KeNumberProcessors_0 )
goto LABEL_12;
}
}
else
{
LABEL_12:
if( KeGetCurrentPrcb()->CpuVendor == 2 )
KiIa32MiscEnable = __readmsr(0x1A0u);
if( v0 )
KeRevertToUserGroupAffinityThread(&PreviousAffinity);
KiUserCodePatchMutex.Owner = 0i64;
KiUserCodePatchMutex.Contention = 0;
result = 1;
*(_DWORD *)&KiUserCodePatchMutex.gap14[8] = 0;
*(_QWORD *)&KiUserCodePatchMutex.gap14[20] = &KiUserCodePatchMutex.gap14[12];
*(_QWORD *)&KiUserCodePatchMutex.gap14[12] = &KiUserCodePatchMutex.gap14[12];
KiUserCodePatchMutex.Count = 1;
*(_WORD *)&KiUserCodePatchMutex.gap14[4] = 1;
KiUserCodePatchMutex.gap14[6] = 6;
}
return result;
}Referenced by:
KeInitSystem