HalpMcaExtendedLogInitialize

INT64 __fastcall HalpMcaExtendedLogInitialize(INT64 a1, INT64 a2, WCHAR a3){
  _LARGE_INTEGER *v3; 
  UINT64 v4; 
  _LARGE_INTEGER v5; 
  _LARGE_INTEGER *v6; 
  unsigned int v7; 
  unsigned __int64 QuadPart; 
  _LARGE_INTEGER *v9; 
  void *v10; 
  _LARGE_INTEGER PhysicalAddress; 
  PhysicalAddress.QuadPart = 0i64;
  v3 = 0i64;
  v4 = 4096i64;
  if( HalpMcaExtendedLogGetL1DirectoryBase(&PhysicalAddress, a2, a3) < 0 )
    goto LABEL_13;
  v5 = PhysicalAddress;
  if( !PhysicalAddress.QuadPart )
    goto LABEL_13;
  MmMapIoSpaceEx(PhysicalAddress, 0x1000ui64, 0x204ui64);
  v3 = v6;
  if( !v6 )
  {
LABEL_4:
    v7 = -1073741670;
    goto LABEL_14;
  }
  if( v6->LowPart != 256 )
    goto LABEL_13;
  if( v6->HighPart != 64 )
    goto LABEL_13;
  QuadPart = v6[1].QuadPart;
  if( QuadPart <= 0x40 )
    goto LABEL_13;
  v4 = QuadPart;
  MmUnmapIoSpace(v3, 0x1000ui64);
  MmMapIoSpaceEx(v5, v4, 0x204ui64);
  v3 = v9;
  if( !v9 )
    goto LABEL_4;
  qword_140CF6228 = (__int64)v9;
  dword_140CF6238 = v9[6].LowPart;
  qword_140CF6230 = (v9[1].QuadPart - (unsigned __int64)(unsigned int)v9->HighPart) >> 3;
  if( qword_140CF6230 < (unsigned __int64)(unsigned int)dword_140CF6238 )
  {
LABEL_13:
    v7 = -1073741637;
LABEL_14:
    HalpMcaExtendedLoggingSupported = 0;
    if( qword_140CF6248 )
      MmUnmapIoSpace(qword_140CF6248, v3[3].QuadPart);
    goto LABEL_16;
  }
  MmMapIoSpaceEx(v9[2], v9[3].QuadPart, 0x204ui64);
  qword_140CF6248 = v10;
  if( v10 )
  {
    qword_140CF6240 = v3[2].QuadPart;
    qword_140CF6250 = v3[3].QuadPart;
    v3[4].LowPart |= 1u;
    return 0;
  }
  v7 = -1073741670;
  HalpMcaExtendedLoggingSupported = 0;
LABEL_16:
  if( v3 )
    MmUnmapIoSpace(v3, v4);
  memset(&qword_140CF6228, 0, 0x30ui64);
  return v7;
}

Referenced by:

HalpInitializeMce