HalpAddMcaToProcessorGenericSection

NTSTATUS __stdcall HalpAddMcaToProcessorGenericSection(
        _WHEA_XPF_MCA_SECTION *Mca,
        _WHEA_PROCESSOR_GENERIC_ERROR_SECTION *ProcGen){
  __int16 CommonBits; 
  int v3; 
  unsigned __int64 v5; 
  __int64 v6; 
  _MCI_STATUS v7; 

  CommonBits = (__int16)Mca->Status.CommonBits;
  v3 = -1;
  if( (unsigned __int16)(CommonBits - 1) <= 4u
    || CommonBits == 1024
    || (CommonBits & 0xFC00) == 1024 && (CommonBits & 0x3FF) != 0 )
  {
    v5 = ProcGen->ValidBits.ValidBits | 4;
    ProcGen->ErrorType = 8;
  }
  else
  {
    v5 = ProcGen->ValidBits.ValidBits | 4;
    if( (CommonBits & 0xEFFC) == 12 )
    {
      ProcGen->ErrorType = 1;
LABEL_7:
      ProcGen->Level = CommonBits & 3;
      v5 |= 0x20ui64;
      goto LABEL_25;
    }
    if( (CommonBits & 0xEFF0) == 16 )
    {
      ProcGen->ErrorType = 2;
      goto LABEL_7;
    }
    if( (CommonBits & 0xEF00) == 256 )
    {
      ProcGen->ErrorType = 1;
LABEL_14:
      v3 = (unsigned __int8)CommonBits >> 4;
      ProcGen->Level = CommonBits & 3;
      v5 |= 0x20ui64;
      goto LABEL_17;
    }
    if( (CommonBits & 0xE800) == 2048 )
    {
      ProcGen->ErrorType = 4;
      goto LABEL_14;
    }
    ProcGen->ErrorType = 0;
  }
LABEL_17:
  if( v3 != -1 )
  {
    v5 |= 8ui64;
    switch( v3 )
    {
      case 3:
        ProcGen->Operation = 1;
        break;
      case 4:
        ProcGen->Operation = 2;
        break;
      case 5:
        ProcGen->Operation = 3;
        break;
      default:
        ProcGen->Operation = 0;
        break;
    }
  }
LABEL_25:
  v6 = v5 | 0x10;
  ProcGen->ValidBits.ValidBits = v6;
  v7.CommonBits = (_MCI_STATUS_BITS_COMMON)Mca->Status;
  if( (v7.QuadPart & 0x200000000000000i64) == 0 )
  {
    ProcGen->Flags &= 1u;
    v7.CommonBits = (_MCI_STATUS_BITS_COMMON)Mca->Status;
  }
  if( (v7.QuadPart & 0x4000000000000000i64) != 0 )
  {
    ProcGen->Flags &= 4u;
    v7.CommonBits = (_MCI_STATUS_BITS_COMMON)Mca->Status;
  }
  if( (v7.QuadPart & 0x2000000000000000i64) == 0 )
    ProcGen->Flags &= 8u;
  if( (*(_BYTE *)&Mca->GlobalStatus.0 & 2) != 0 )
  {
    ProcGen->ValidBits.ValidBits = v6 | 0x1000;
    ProcGen->InstructionPointer = Mca->InstructionPointer;
  }
  return 0;
}

Referenced by:

HalpCreateMcaMemoryErrorRecord
HalpCreateMcaProcessorErrorRecord