HalpApicDiscover

NTSTATUS __stdcall HalpApicDiscover(){
  _LARGE_INTEGER *AcpiTable; 
  NTSTATUS result; 
  _LARGE_INTEGER v2; 
  char *v3; 
  unsigned __int64 v4; 
  __int64 v5; 
  char *v6; 

  *(&CmpDummyThreadEvent + 878) = 0i64;
  AcpiTable = HalSocGetAcpiTable(0x43495041ui64);
  if( !AcpiTable )
    return -1073741438;
  result = HalpApicSetupRegisterAccess();
  if( result >= 0 )
  {
    v2.QuadPart = (unsigned int)AcpiTable[4].anonymous_0.HighPart;
    *(&CmpDummyThreadEvent + 878) = v2.QuadPart;
    result = HalRegisterPermanentAddressUsage(v2, 0x400u);
    if( result >= 0 )
    {
      v3 = (char *)&AcpiTable[5].QuadPart + 4;
      v4 = (unsigned __int64)AcpiTable + (unsigned int)AcpiTable->anonymous_0.HighPart;
      while( (unsigned __int64)(v3 + 2) <= v4 )
      {
        v5 = (unsigned __int8)v3[1];
        if( (unsigned __int8)v5 < 2u || (unsigned __int64)&v3[v5] > v4 )
          break;
        v6 = v3;
        v3 += v5;
        if( *v6 == 1 && (_BYTE)v5 == 12 )
          HalpApicRegisterIoUnit((_LARGE_INTEGER)*((unsigned int *)v6 + 1));
      }
      return 0;
    }
  }
  return result;
}

Referenced by:

HalpInitializeInterrupts