HalpInterruptMarkProcessorStarted

VOID __stdcall HalpInterruptMarkProcessorStarted(UINT64 LocalUnitIdentifier, PROCESSOR_NUMBER *Number){
  int v2; 
  char v3; 
  char v4; 
  unsigned int v5; 
  char v6; 
  unsigned int v7; 
  int i; 
  char v9; 
  ULONG_PTR v10; 
  int v11; 
  unsigned int v12; 
  __int64 v13; 
  int v14; 
  v2 = LocalUnitIdentifier;
  HIBYTE(v14) = 0;
  if( HalpInterruptProcessorStateInitialized )
  {
    v3 = 0;
    v4 = 0;
    v5 = *((unsigned __int8 *)KeGetCurrentPrcb() + 208);
    LOWORD(v14) = v5;
    v6 = *((_BYTE *)KeGetCurrentPrcb() + 209);
    BYTE2(v14) = v6;
    v7 = 0;
    for( i = ~(*((_DWORD *)KeGetCurrentPrcb() + 39) * *((_DWORD *)KeGetCurrentPrcb() + 38) - 1);
          v7 < (unsigned int)HalpInterruptProcessorCount;
          ++v7 )
    {
      v9 = 0;
      v10 = HalpInterruptProcessorState + ((unsigned __int64)v7 << 6);
      if( *(_BYTE *)(v10 + 12) || !(_WORD)v5 && !v6 )
        v9 = 1;
      if( (unsigned int)HalpInterruptGicVersion >= 3 )
        v11 = (*(_QWORD *)(v10 + 48) >> 8) ^ (*(_DWORD *)(v10 + 48) ^ (*(_DWORD *)(v10 + 48) >> 8)) & 0xFFFFFF;
      else
        v11 = *(_DWORD *)v10;
      if( v9 && v11 == (_DWORD)LocalUnitIdentifier )
      {
        if( !*(_BYTE *)(v10 + 13) )
          _InterlockedAdd((volatile signed __int32 *)HalpInterruptProcessorsStarted, 1u);
        *(_BYTE *)(v10 + 15) = 1;
        *(_BYTE *)(v10 + 13) = 1;
        *(_DWORD *)(v10 + 16) = v14;
        *(_DWORD *)(v10 + 20) = *((_DWORD *)KeGetPcr() + 105);
        if( !(_WORD)v5 && !v6 )
          *(_BYTE *)(v10 + 12) = 1;
        v3 = 1;
      }
      else
      {
        if( *(_BYTE *)(v10 + 13) && (i & *(_DWORD *)v10) == ((unsigned int)LocalUnitIdentifier & i) )
          v4 = 1;
        if( !v3 )
          continue;
      }
      if( v4 )
        break;
    }
    v12 = 0;
    if( (_DWORD)HalpInterruptProcessorCount )
    {
      v13 = HalpInterruptDynamicProcessorState;
      while( !*(_BYTE *)(v13 + 12) || *(_DWORD *)v13 != v2 )
      {
        ++v12;
        v13 += 64i64;
        if( v12 >= (unsigned int)HalpInterruptProcessorCount )
          goto LABEL_26;
      }
      *(_BYTE *)(v13 + 13) = 1;
      *(_DWORD *)(v13 + 16) = v14;
      *(_DWORD *)(v13 + 20) = *((_DWORD *)KeGetPcr() + 105);
    }
LABEL_26:
    if( !v4 )
      ++HalpInterruptPackagesStarted;
    if( v5 > HalpInterruptMaxGroupStarted )
      HalpInterruptMaxGroupStarted = v5;
  }
}

Referenced by:

HalpInterruptInitializeLocalUnit