HalpApicSetupRegisterAccess
NTSTATUS __stdcall HalpApicSetupRegisterAccess(){
bool v0;
INT64 v1;
INT64 v2;
CHAR v3;
INT64 v4;
unsigned __int64 v5;
void *v6;
void(__fastcall *v7)(_QWORD);
void *v8;
void *v9;
void *v10;
INT64 v11;
NTSTATUS result;
INT64 v13;
unsigned __int64 v14;
__int128 v15;
CHAR v16;
CHAR v17;
CHAR v18;
CHAR v19;
v0 = 0;
v17 = 0;
v19 = 0;
v15 = 0i64;
v16 = 0;
v18 = 0;
if( HalpIsXboxNanovisorPresent() )
goto LABEL_21;
HalSocRequestConfigurationData(4i64, v1, &v17);
HalSocRequestConfigurationData(5i64, v4, &v19);
v2 = 27i64;
v5 = __readmsr(0x1Bu);
if( (v5 & 0x400) != 0 )
{
if( !v17 )
{
HalSocRequestConfigurationData(6i64, (unsigned __int64)HIDWORD(v5) << 32, &v16);
HalSocRequestConfigurationData(8i64, v13, &v18);
if( v16 )
{
if( !v18 )
*(&stru_140CF2E80 + 7328) = 1;
}
}
v3 = 1;
}
else
{
v3 = v17;
}
if( v19 || v3 )
{
LABEL_21:
byte_140C50778 = 1;
v6 = HalpApicX2ReadRegister;
v7 = (void(__fastcall *)(_QWORD))HalpApicX2WriteRegister;
v8 = HalpApicX2WriteCommand;
v9 = xHalTimerWatchdogStop;
v10 = HalpApicX2EndOfInterrupt;
if( v3 )
{
v14 = __readmsr(0x1Bu);
if( (v14 & 0x400) == 0 )
{
__writemsr(0x1Bu, v14 | 0x400);
if( !*(&stru_140CF2E80 + 6617) )
HalpApicRestoreNonX2ModeOnReset = 1;
}
v2 = 27i64;
if( (__readmsr(0x1Bu) & 0x400) != 0 )
{
*(&stru_140CF2E80 + 6617) = 1;
goto LABEL_8;
}
}
if( !*(&stru_140CF2E80 + 6617) )
goto LABEL_8;
return -1073741438;
}
if( *(&stru_140CF2E80 + 6617) )
return -1073741438;
byte_140C50778 = 0;
v6 = HalpApic1ReadRegister;
v7 = (void(__fastcall *)(_QWORD))HalpApic1WriteRegister;
v8 = HalpApic1WriteIcr;
v9 = HalpApic1WaitForIcr;
v10 = HalpApic1EndOfInterrupt;
LABEL_8:
HalSocRequestApi(v2, (INT64)HalpApicHvUpdateCallback, 5i64, 0x10ui64, &v15);
if( (_QWORD)v15 )
v10 = (void *)v15;
if( *((_QWORD *)&v15 + 1) )
v8 = (void *)*((_QWORD *)&v15 + 1);
if( !*(&stru_140CF2E80 + 6617) && !byte_140C50778 )
{
HalSocRequestConfigurationData(6i64, v11, &v16);
v0 = v16 == 0;
}
byte_140C50788 = v0;
result = 0;
qword_140C50760 = (__int64)v6;
qword_140C50768 = v7;
qword_140C50780 = (__int64)v8;
qword_140C50758 = (__int64)v9;
qword_140C50790 = (__int64)v10;
return result;
}Referenced by:
HalpApicDiscover
HalpApicHvUpdateCallback
HalpApicInitializeLocalUnit