HalpSetupAcpiPhase0
NTSTATUS __stdcall HalpSetupAcpiPhase0(INT64 a1){
NTSTATUS result;
_LARGE_INTEGER *Table;
_LARGE_INTEGER *v4;
unsigned int HighPart;
size_t v6;
_FADT *v7;
__int64 v8;
_LARGE_INTEGER *v9;
__int64 v10;
_LARGE_INTEGER *v11;
UINT64 v12;
PSTR MemoryInternal;
__int64 v14;
PSTR v15;
__int64 v16;
UINT64 Protection;
_LARGE_INTEGER MaxPhysicalAddress;
if( !byte_140C49D2A )
{
HalpAcpiTableCacheInit((_LOADER_PARAMETER_BLOCK *)a1);
if( result < 0 )
return result;
Table = HalpAcpiGetTable((_LOADER_PARAMETER_BLOCK *)a1, (const UINT8 *)0x50434146, 0i64);
v4 = Table;
if( !Table )
return -1073741275;
HighPart = Table->anonymous_0.HighPart;
v6 = 276;
if( HighPart < 0x114 )
v6 = HighPart;
memmove(&Fadt, v4, v6);
HalpSetPlatformFlags(&Fadt, (_LOADER_PARAMETER_BLOCK *)a1);
HalpAcpiInitializePmRegisters(&Fadt);
if( (Fadt.flags & 0x40000) != 0 )
HalpInterruptClusterModeForced = 1;
if( (Fadt.flags & 0x80000) != 0 )
*(&stru_140CF2E80 + 6616) = 1;
HalpAcpiDetectMachineSpecificActions((_LOADER_PARAMETER_BLOCK *)a1, v7);
HalpNumaInitializeStaticConfiguration((_LOADER_PARAMETER_BLOCK *)a1);
MaxPhysicalAddress.anonymous_0.LowPart = 0;
*(&CmpDummyThreadEvent + 873) = HalpAcpiGetTable((_LOADER_PARAMETER_BLOCK *)a1, (const UINT8 *)0x54414D48, 0i64);
if( *(&CmpDummyThreadEvent + 873) )
{
if( *(&CmpDummyThreadEvent + 869) )
{
if( (int)HalpNumaParseHmat(v8, 0i64, 0, (size_t *)&MaxPhysicalAddress) >= 0 )
{
MemoryInternal = HalpMmAllocateMemoryInternal(MaxPhysicalAddress.anonymous_0.LowPart, MmCached);
v15 = MemoryInternal;
if( MemoryInternal )
{
if( (int)HalpNumaParseHmat(
v14,
MemoryInternal,
MaxPhysicalAddress.anonymous_0.LowPart,
(size_t *)&MaxPhysicalAddress) >= 0 )
*(&CmpDummyThreadEvent + 872) = v15;
}
}
}
}
qword_140C507E0 = 0i64;
v9 = HalpAcpiGetTable((_LOADER_PARAMETER_BLOCK *)a1, (const UINT8 *)0x54544450, 0i64);
v10 = (__int64)v9;
if( v9 )
{
v16 = BYTE4(v9[4].QuadPart);
if( *(unsigned int *)(v10 + 4) >= (unsigned __int64)*(unsigned int *)(v10 + 40) + 2 * v16 )
{
qword_140C507E8 = (__int64)HalpMmAllocateMemoryInternal((unsigned int)(136 * v16), MmCached);
if( qword_140C507E8 )
qword_140C507E0 = v10;
}
}
v11 = HalpAcpiGetTable((_LOADER_PARAMETER_BLOCK *)a1, (const UINT8 *)0x54454157, 0i64);
if( v11 )
dword_140C49EF0 = v11[4].anonymous_0.HighPart;
if( !BaseAddress )
{
MaxPhysicalAddress.QuadPart = 0x100000i64;
v12 = HalpAllocPhysicalMemory((_LOADER_PARAMETER_BLOCK *)a1, &MaxPhysicalAddress, 1ui64, 0i64);
BaseAddress = v12;
if( v12 )
{
LODWORD(Protection) = 4;
qword_140C49E98 = HalpMap((_LARGE_INTEGER)v12, MmCached, MmCached, 0, Protection);
}
}
if( (Fadt.flags & 3) == 0 )
{
LODWORD(Protection) = 4;
qword_140C49D50 = HalpMap((_LARGE_INTEGER)BaseAddress, MmCached, MmCached, 0, Protection);
}
byte_140C49D2A = 1;
qword_140C00B08 = (__int64)HalAcpiGetTableDispatch;
qword_140C00B10 = (__int64)xHalTimerWatchdogStop;
HalpInitBootTable((_LOADER_PARAMETER_BLOCK *)a1);
}
return 0;
}Referenced by:
HalpAcpiInitDiscard