/*
*OA3.c - Decompiled source for OA3.efi
*
*Copyright (c) HR650X BIOS Decompilation Project
*/
#include "OA3.h"
char *InternalMemCopyMem(char *dst, char *src, unsigned __int64 n6)
{
char *dst_1; // rax unsigned __int64 n6_1; // rcx char *dst_2; // rdi char *src_1; // rsi dst_1 = dst; /*0x290*/
if ( src < dst && &src[n6 - 1] >= dst ) /*0x298*/
{
src_1 = &src[n6 - 1]; /*0x2b0*/
dst_2 = &dst[n6 - 1]; /*0x2b3*/
}
else
{
n6_1 = n6; /*0x29a*/
n6 &= 7u; /*0x29d*/
n6_1 >>= 3; /*0x2a4*/
qmemcpy(dst, src, 8 *n6_1); /*0x2a8*/
src_1 = &src[8 *n6_1]; /*0x2a8*/
dst_2 = &dst[8 *n6_1]; /*0x2a8*/
}
qmemcpy(dst_2, src_1, n6); /*0x2bc*/
return dst_1; /*0x2bf*/
}
unsigned __int64 InternalCompareMem(_BYTE *TableGuid, _BYTE *a2, __int64 n16)
{
bool Protocol; // zf do /*0x2db*/
{
if ( !n16 ) /*0x2db*/
break; /*0x2db*/
Protocol = *TableGuid++ == *a2++; /*0x2db*/
--n16; /*0x2db*/
}
while ( Protocol ); /*0x2db*/
return (unsigned __int8)*(TableGuid - 1) - (unsigned __int64)(unsigned __int8)*(a2 - 1); /*0x2ea*/
}
void CpuPause()
{
_mm_pause(); /*0x350*/
}
unsigned __int64 ReadTsc()
{
return __rdtsc(); /*0x369*/
}
void CpuEnableInterrupts()
{
_enable(); /*0x370*/
}
void CpuDisableInterrupts()
{
_disable(); /*0x380*/
}
unsigned __int64 ReadEflags()
{
return __getcallerseflags(); /*0x392*/
}
EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
__int64 ( **AcpiSupport)(_QWORD, __int64, __int64, __int64 *); // rcx Oa3DriverEntryPoint((__int64)ImageHandle, SystemTable); /*0x3c4*/
return Oa3PublishMsdmTable(AcpiSupport); /*0x3ce*/
}
// Oa3DriverEntryPoint - Entry point for OA3 driver void Oa3DriverEntryPoint(__int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
signed __int64 SystemConfigurationTable; // rax __int64 EfiConfigStatus; // rbx __int64 Status; // rax __int64 PcdProtocolInit; // rax __int64 PcdProtocol; // rax char *src; // rbx __int64 PcdProtocol2; // rax __int64 PcdProtocol3; // rax unsigned __int64 PcdSize; // rax _WORD *PciExpressAddress; // rax _BYTE *PciRegPtr; // rax __int16 Eflags; // bx bool InterruptsEnabled; // bl UINT32 IoValue; // edi
::ImageHandle = ImageHandle; /*0x3e3*/
if ( !ImageHandle ) /*0x3f7*/
DebugAssert( /*0x406*/
"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c",
0x33u,
"gImageHandle != ((void *) 0)");
::SystemTable = (__int64)SystemTable; /*0x40b*/
if ( !SystemTable ) /*0x415*/
DebugAssert( /*0x424*/
"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c",
0x39u,
"gST != ((void *) 0)");
BootServices = (__int64)SystemTable->BootServices; /*0x42d*/
if ( !BootServices ) /*0x437*/
DebugAssert( /*0x446*/
"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c",
0x3Fu,
"gBS != ((void *) 0)");
RuntimeServices = (__int64)SystemTable->RuntimeServices; /*0x44f*/
if ( !RuntimeServices ) /*0x459*/
DebugAssert( /*0x46c*/
"e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c",
0x2Fu,
"gRT != ((void *) 0)");
SystemConfigurationTable = EfiGetSystemConfigurationTable(&TableGuid, &Table); /*0x47f*/
EfiConfigStatus = SystemConfigurationTable; /*0x48b*/
if ( SystemConfigurationTable < 0 ) /*0x496*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", SystemConfigurationTable); /*0x4a0*/
DebugAssert("e:\\hs\\MdePkg\\Library\\DxeServicesTableLib\\DxeServicesTableLib.c", 0x40u, "!EFI_ERROR (Status)"); /*0x4b8*/
}
if ( !Table ) /*0x4c5*/
DebugAssert("e:\\hs\\MdePkg\\Library\\DxeServicesTableLib\\DxeServicesTableLib.c", 0x41u, "gDS != ((void *) 0)"); /*0x4da*/
if ( EfiConfigStatus < 0 ) /*0x4e2*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", EfiConfigStatus); /*0x4ed*/
DebugAssert( /*0x505*/
"e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiModulePkg\\OemActivation\\OA3\\OA3\\DEBUG\\AutoGen.c",
0x1BCu,
"!EFI_ERROR (Status)");
}
if ( !qword_1978 ) /*0x512*/
{
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_18F0, 0, &qword_1978); /*0x52b*/
if ( Status < 0 ) /*0x534*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x53f*/
DebugAssert("e:\\hs\\CpRcPkg\\Library\\DxeMmPciBaseLib\\DxeMmPciBaseLib.c", 0x34u, "!EFI_ERROR (Status)"); /*0x557*/
}
if ( !qword_1978 ) /*0x564*/
DebugAssert("e:\\hs\\CpRcPkg\\Library\\DxeMmPciBaseLib\\DxeMmPciBaseLib.c", 0x35u, "mPciUsra != ((void *) 0)"); /*0x579*/
}
GetHobList(); /*0x57e*/
PcdProtocolInit = GetPcdProtocol(); /*0x583*/
qword_1988 = (*(__int64 ( **)(__int64))(PcdProtocolInit + 32))(5); /*0x590*/
PcdProtocol = GetPcdProtocol(); /*0x597*/
src = (char *)(*(__int64 ( **)(__int64))(PcdProtocol + 40))(7); /*0x5a6*/
PcdProtocol2 = GetPcdProtocol(); /*0x5a9*/
if ( (unsigned __int64)(*(__int64 ( **)(__int64))(PcdProtocol2 + 56))(7) > 0x48 ) /*0x5b7*/
DebugAssert( /*0x5ca*/
"e:\\hs\\AmiCRBPkg\\Library\\AmiPcieSegBusLib\\AmiPcieSegBusDxeSmm.c",
0x3Cu,
"sizeof (PCIE_SEG_BUS_TABLE) >= LibPcdGetSize(7U)");
PcdProtocol3 = GetPcdProtocol(); /*0x5cf*/
PcdSize = (*(__int64 ( **)(__int64))(PcdProtocol3 + 56))(7); /*0x5d7*/
if ( PcdSize ) /*0x5dd*/
InternalCopyMem(dst, src, PcdSize); /*0x5ec*/
if ( *(char *)PciExpressLibGetPciExpressAddress(1024068) >= 0 ) /*0x601*/
{
PciExpressAddress = (_WORD *)PciExpressLibGetPciExpressAddress(1024064); /*0x606*/
PciExpressLibWrite16(PciExpressAddress); /*0x60e*/
PciRegPtr = (_BYTE *)PciExpressLibGetPciExpressAddress(1024068); /*0x615*/
*PciRegPtr |= 0x80u; /*0x61f*/
}
Eflags = ReadEflags(); /*0x626*/
CpuDisableInterrupts(); /*0x629*/
InterruptsEnabled = (Eflags & 0x200) != 0; /*0x638*/
IoValue = IoRead32(0x508u) & 0xFFFFFF; /*0x642*/
ReadTsc(); /*0x648*/
while ( ((IoValue + 357 - IoRead32(0x508u)) & 0x800000) == 0 ) /*0x668*/
CpuPause(); /*0x64f*/
ReadTsc(); /*0x66a*/
if ( InterruptsEnabled ) /*0x671*/
CpuEnableInterrupts(); /*0x673*/
else CpuDisableInterrupts(); /*0x67a*/
}
unsigned __int64 Oa3PreserveProductKey(__int64 SystemTable)
{
unsigned __int64 Index; // r14 unsigned __int64 Status; // rsi __int64 TableGuid; // rdi _WORD *NextHobByType; // rbx __int64 SystemTable_1; // rcx __int64 HobData; // rcx GUID Guid1; // [rsp+20h] [rbp-10h] BYREF Index = 0; /*0x6b2*/
Status = 0x800000000000000EuLL; /*0x6b5*/
Guid1.Data1 = -624702568; /*0x6bf*/
*(_DWORD *)&Guid1.Data2 = 1093542549; /*0x6c6*/
*(_DWORD *)Guid1.Data4 = -285381246; /*0x6cd*/
TableGuid = *(_QWORD *)(::SystemTable + 112); /*0x6d4*/
for ( *(_DWORD *)&Guid1.Data4[4] = 835657891; Index < *(_QWORD *)(::SystemTable + 104); TableGuid += 24 ) /*0x6df*/
{
if ( (EFI_GUID *)TableGuid == &TableGuid_ ) /*0x6f3*/
goto LABEL_10; /*0x6f3*/
if ( !TableGuid ) /*0x6f8*/
DebugAssert( /*0x70b*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CompareMemWrapper.c",
0x3Cu,
"DestinationBuffer != ((void *) 0)");
if ( (unsigned __int64)~TableGuid < 0xF ) /*0x71a*/
DebugAssert( /*0x72f*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CompareMemWrapper.c",
0x3Eu,
"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)DestinationBuffer)");
if ( (unsigned __int64)(-1LL - (_QWORD)&TableGuid_) < 0xF ) /*0x73f*/
DebugAssert( /*0x754*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CompareMemWrapper.c",
0x3Fu,
"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)");
if ( !InternalCompareMem((_BYTE *)TableGuid, &TableGuid_, 16) ) /*0x765*/
{
LABEL_10:
NextHobByType = GetNextHobByType(SystemTable, *(_WORD **)(TableGuid + 16)); /*0x778*/
if ( NextHobByType ) /*0x77e*/
{
do /*0x7a3*/
{
if ( CompareGuid(&Guid1, (const GUID *)(NextHobByType + 4)) ) /*0x788*/
break; /*0x78f*/
NextHobByType = GetNextHobByType( /*0x79d*/
SystemTable_1,
(_WORD *)((char *)NextHobByType + (unsigned __int16)NextHobByType[1]));
}
while ( NextHobByType ); /*0x7a3*/
if ( NextHobByType ) /*0x7a8*/
{
if ( !*((_BYTE *)NextHobByType + 32) ) /*0x7aa*/
{
HobData = *((_QWORD *)NextHobByType + 3); /*0x7b0*/
if ( HobData ) /*0x7b7*/
{
InternalCopyMem((char *)(HobData + 12251136), (char *)0xFFBAF000LL, 0x31u); /*0x7cb*/
Status = 0; /*0x7d0*/
}
}
}
}
}
SystemTable = ::SystemTable; /*0x7d2*/
++Index; /*0x7d9*/
}
DebugPrint(0x40u, "PreserveProductKey: Status %r\n", Status);
return Status; /*0x810*/
}
__int64 Oa3PublishMsdmTable(__int64 ( **AcpiSupport)(_QWORD, __int64, __int64, __int64 *))
{
__int64 SystemTable; // rcx __int64 result; // rax __int64 PcdProtocol; // rax char *OemId; // rax __int64 ProductKeyData; // rax unsigned __int64 Index; // rax __int64 SetVariableStatus; // rax __int64 SetVariableStatus_1; // rbx const CHAR8 *OEM_Activation:_MSDM_table_has_been_published._n; // rdx UINTN DebugLevel; // rcx _DWORD VendorGuid[4]; // [rsp+30h] [rbp-30h] BYREF __int64 DataBuffer; // [rsp+40h] [rbp-20h] BYREF __int64 MsdmAddress; // [rsp+48h] [rbp-18h]
__int64 ProductData; // [rsp+50h] [rbp-10h]
__int64 ( **AcpiSupport_1)(_QWORD, __int64, __int64, __int64 *); // [rsp+80h] [rbp+20h] BYREF __int64 MsdmAddress_1; // [rsp+88h] [rbp+28h] BYREF __int64 TableHandle; // [rsp+90h] [rbp+30h] BYREF AcpiSupport_1 = AcpiSupport; /*0x826*/
MsdmAddress_1 = 0; /*0x836*/
DataBuffer = 0; /*0x83d*/
MsdmAddress = 0; /*0x842*/
ProductData = 0; /*0x846*/
VendorGuid[0] = 20351105; /*0x84a*/
VendorGuid[1] = 1260242093; /*0x851*/
VendorGuid[2] = 2060792246; /*0x858*/
VendorGuid[3] = 1809565838; /*0x85f*/
if ( *((_DWORD *)GetHobList() + 3) == 32 || *((_DWORD *)GetHobList() + 3) == 18 ) /*0x87e*/
return Oa3PreserveProductKey(SystemTable); /*0xa57*/
result = (*(__int64 ( **)(__int64, __int64, __int64 *))(BootServices + 64))(10, 85, &MsdmAddress_1); /*0x899*/
if ( result < 0 ) /*0x89f*/
return result; /*0x89f*/
*(_DWORD *)MsdmAddress_1 = 1296323405; /*0x8a9*/
*(_DWORD *)(MsdmAddress_1 + 4) = 85; /*0x8b3*/
*(_BYTE *)(MsdmAddress_1 + 8) = 3; /*0x8ba*/
*(_DWORD *)(MsdmAddress_1 + 24) = 17244169; /*0x8c2*/
*(_DWORD *)(MsdmAddress_1 + 28) = 541674817; /*0x8cd*/
*(_DWORD *)(MsdmAddress_1 + 32) = 16777235; /*0x8d8*/
PcdProtocol = GetPcdProtocol(); /*0x8df*/
OemId = (char *)(*(__int64 ( **)(__int64))(PcdProtocol + 40))(31); /*0x8e7*/
InternalCopyMem((char *)(MsdmAddress_1 + 10), OemId, 6u); /*0x8fb*/
ProductKeyData = GetPcdProtocol(); /*0x900*/
*(_QWORD *)(MsdmAddress_1 + 16) = (*(__int64 ( **)(__int64))(ProductKeyData + 32))(32); /*0x91c*/
InternalCopyMem((char *)(MsdmAddress_1 + 36), (char *)0xFFBAF000LL, 0x31u); /*0x928*/
for ( Index = 0; Index < 0x1D; ++Index )
{
if ( *(_BYTE *)(MsdmAddress_1 + Index + 56) != 0xFF )
{
AcpiSupport_1 = 0; /*0x9df*/
TableHandle = 0; /*0x9eb*/
SetVariableStatus_1 = (*(__int64 ( **)(void *, _QWORD, __int64 ( ***)(_QWORD, __int64, __int64, __int64 *)))(BootServices + 320))( /*0x9f8*/
&unk_1910,
0,
&AcpiSupport_1);
if ( SetVariableStatus_1 >= 0 )
{
SetVariableStatus_1 = (*AcpiSupport_1)(AcpiSupport_1, MsdmAddress_1, 85, &TableHandle); /*0xa22*/
if ( SetVariableStatus_1 >= 0 )
{
OEM_Activation:_MSDM_table_has_been_published._n = "OEM Activation: MSDM table has been published.\n";
DebugLevel = 64; /*0xa3a*/
goto LABEL_16; /*0xa3a*/
}
OEM_Activation:_MSDM_table_has_been_published._n = "OEM Activation: SetAcpiTable failed!\n";
}
else
{
OEM_Activation:_MSDM_table_has_been_published._n = "OEM Activation: Unable to locate AcpiSupportProtocol!\n";
}
DebugLevel = 0x80000000LL; /*0xa07*/
LABEL_16:
DebugPrint(DebugLevel, OEM_Activation:_MSDM_table_has_been_published._n); /*0xa3f*/
(*(void ( **)(__int64))(BootServices + 72))(MsdmAddress_1); /*0xa4f*/
return SetVariableStatus_1; /*0xa4f*/
}
}
DebugPrint(0x40u, "OEM Activation: Found empty Product Key.\n");
MsdmAddress = MsdmAddress_1; /*0x962*/
ProductData = 4290441216LL; /*0x96e*/
SetVariableStatus = (*(__int64 ( **)(const __int16 *, _DWORD *, __int64, __int64, __int64 *))(RuntimeServices + 88))( /*0x988*/
L"OA3MSDMvariable",
VendorGuid,
6,
24,
&DataBuffer);
SetVariableStatus_1 = SetVariableStatus; /*0x98b*/
if ( SetVariableStatus < 0 ) /*0x991*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", SetVariableStatus); /*0x9a2*/
DebugAssert("e:\\hs\\AmiModulePkg\\OemActivation\\OA3\\OA3.c", 0x179u, "!EFI_ERROR (Status)"); /*0x9ba*/
}
DebugPrint(0x40u, "OEM Activation: MsdmAddress=%X\n", MsdmAddress);
return SetVariableStatus_1; /*0xa64*/
}
__int64 GetDebugOutputProtocol()
{
__int64 ProtocolResult_1; // rax unsigned __int64 PoolPages; // rbx __int64 LocateStatus; // rax __int64 ProtocolResult; // rcx ProtocolResult_1 = ::ProtocolResult; /*0xa7a*/
if ( !::ProtocolResult ) /*0xa86*/
{
PoolPages = (*(__int64 ( **)(__int64))(BootServices + 24))(31); /*0xa9f*/
(*(void ( **)(unsigned __int64))(BootServices + 32))(PoolPages); /*0xaa2*/
if ( PoolPages <= 0x10 ) /*0xaa9*/
{
LocateStatus = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))( /*0xac6*/
&unk_18E0,
0,
&::ProtocolResult);
ProtocolResult = ::ProtocolResult; /*0xacc*/
if ( LocateStatus < 0 ) /*0xad6*/
ProtocolResult = 0; /*0xad6*/
::ProtocolResult = ProtocolResult; /*0xada*/
return ProtocolResult; /*0xae1*/
}
else
{
return 0; /*0xaab*/
}
}
return ProtocolResult_1; /*0xae9*/
}
void DebugPrint(UINTN ErrorLevel, const CHAR8 *Format, ...)
{
__int64 DebugOutputProtocol; // rax __int64 PrintMask; // r8 void ( **DebugOutputProtocol_1)(UINTN, const CHAR8 *, __int64 *); // r9 unsigned __int8 PrevCmosVal; // al char BootDisplayFlags_1; // al char BootDisplayFlags; // cl va_list va; // [rsp+40h] [rbp+18h] BYREF va_start(va, Format);
DebugOutputProtocol = GetDebugOutputProtocol(); /*0xb07*/
PrintMask = 0; /*0xb0c*/
DebugOutputProtocol_1 = (void ( **)(UINTN, const CHAR8 *, __int64 *))DebugOutputProtocol; /*0xb0f*/
if ( DebugOutputProtocol ) /*0xb15*/
{
PrevCmosVal = __inbyte(0x70u); /*0xb1b*/
__outbyte(0x70u, PrevCmosVal & 0x80 | 0x4B); /*0xb20*/
BootDisplayFlags_1 = __inbyte(0x71u); /*0xb25*/
BootDisplayFlags = BootDisplayFlags_1; /*0xb26*/
if ( (unsigned __int8)BootDisplayFlags_1 > 3u ) /*0xb2c*/
{
BootDisplayFlags = n3; /*0xb2e*/
if ( !n3 ) /*0xb36*/
BootDisplayFlags = MEMORY[0xFDAF0490] & 2 | 1; /*0xb42*/
}
if ( (unsigned __int8)(BootDisplayFlags - 1) <= 0xFDu ) /*0xb4a*/
{
PrintMask = 2147483718LL; /*0xb53*/
if ( BootDisplayFlags == 1 ) /*0xb59*/
PrintMask = 2147483652LL; /*0xb59*/
}
if ( (PrintMask & ErrorLevel) != 0 ) /*0xb60*/
(*DebugOutputProtocol_1)(ErrorLevel, Format, (__int64 *)va); /*0xb6f*/
}
}
void DebugAssert(const CHAR8 *FileName, UINTN LineNumber, const CHAR8 *Description)
{
__int64 DebugOutputProtocol; // rax DebugOutputProtocol = GetDebugOutputProtocol(); /*0xb90*/
if ( DebugOutputProtocol ) /*0xb98*/
(*(void ( **)(const CHAR8 *, UINTN, const CHAR8 *))(DebugOutputProtocol + 8))( /*0xba3*/
FileName,
LineNumber,
Description);
}
__int64 GetPcdProtocol()
{
__int64 result; // rax __int64 LocateStatus; // rax result = qword_1968; /*0xbbc*/
if ( !qword_1968 ) /*0xbc6*/
{
LocateStatus = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))( /*0xbdf*/
&unk_1900,
0,
&qword_1968);
if ( LocateStatus < 0 ) /*0xbe8*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", LocateStatus); /*0xbf9*/
DebugAssert("e:\\hs\\MdePkg\\Library\\DxePcdLib\\DxePcdLib.c", 0x4Eu, "!EFI_ERROR (Status)"); /*0xc11*/
}
result = qword_1968; /*0xc16*/
if ( !qword_1968 ) /*0xc20*/
{
DebugAssert("e:\\hs\\MdePkg\\Library\\DxePcdLib\\DxePcdLib.c", 0x4Fu, "mPcd != ((void *) 0)"); /*0xc33*/
return qword_1968; /*0xc38*/
}
}
return result; /*0xc3f*/
}
char *InternalCopyMem(char *dst, char *src, unsigned __int64 n6)
{
unsigned __int64 SrcEndOffset; // rbp SrcEndOffset = n6 - 1; /*0xc61*/
if ( n6 - 1 > -1 - (__int64)dst ) /*0xc77*/
DebugAssert( /*0xc8a*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
0x38u,
"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)DestinationBuffer)");
if ( SrcEndOffset > -1 - (__int64)src ) /*0xc95*/
DebugAssert( /*0xcaa*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
0x39u,
"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)");
if ( dst == src ) /*0xcb2*/
return dst; /*0xcb4*/
else return InternalMemCopyMem(dst, src, n6); /*0xcc2*/
}
BOOLEAN CompareGuid(const GUID *Guid1, const GUID *Guid2)
{
__int128 GuidPair; // rdi UINT64 Unaligned64; // rbx
*((_QWORD *)&GuidPair + 1) = ReadUnaligned64((const UINT64 *)&Guid1->Data1); /*0xd06*/
Unaligned64 = ReadUnaligned64((const UINT64 *)&Guid2->Data1); /*0xd12*/
*(_QWORD *)&GuidPair = ReadUnaligned64((const UINT64 *)Guid1->Data4); /*0xd1e*/
return GuidPair == __PAIR128__(Unaligned64, ReadUnaligned64((const UINT64 *)Guid2->Data4)); /*0xd45*/
}
UINT64 ReadUnaligned64(const UINT64 *Buffer)
{
if ( !Buffer ) /*0xd58*/
DebugAssert("e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c", 0xC0u, "Buffer != ((void *) 0)"); /*0xd6d*/
return *Buffer; /*0xd75*/
}
EFI_STATUS EfiGetSystemConfigurationTable(EFI_GUID *TableGuid, void **Table)
{
__int64 SystemTable; // rdi __int64 TableIndex; // rbx __int64 TableOffset; // r14 if ( !TableGuid ) /*0xd9e*/
DebugAssert("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 0x61u, "TableGuid != ((void *) 0)"); /*0xdb1*/
if ( !Table ) /*0xdb9*/
DebugAssert("e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 0x62u, "Table != ((void *) 0)"); /*0xdcc*/
SystemTable = SystemTable; /*0xdd1*/
TableIndex = 0; /*0xdd8*/
*Table = 0; /*0xdda*/
if ( !*(_QWORD *)(SystemTable + 104) ) /*0xdde*/
return 0x800000000000000EuLL; /*0xe07*/
for ( TableOffset = 0; /*0xde4*/
!CompareGuid(TableGuid, (const GUID *)(TableOffset + *(_QWORD *)(SystemTable + 112)));
TableOffset += 24 )
{
if ( (unsigned __int64)++TableIndex >= *(_QWORD *)(SystemTable + 104) ) /*0xe05*/
return 0x800000000000000EuLL; /*0xe05*/
}
*Table = *(void **)(*(_QWORD *)(SystemTable + 112) + 24 *TableIndex + 16); /*0xe3b*/
return 0; /*0xe25*/
}
void *GetHobList()
{
void *Table_; // rax signed __int64 SystemConfigurationTable; // rax Table_ = Table_; /*0xe44*/
if ( !Table_ ) /*0xe4e*/
{
SystemConfigurationTable = EfiGetSystemConfigurationTable(&TableGuid_, &Table_); /*0xe5e*/
if ( SystemConfigurationTable < 0 ) /*0xe66*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", SystemConfigurationTable); /*0xe77*/
DebugAssert("e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 0x36u, "!EFI_ERROR (Status)"); /*0xe8f*/
}
Table_ = Table_; /*0xe94*/
if ( !Table_ ) /*0xe9e*/
{
DebugAssert("e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 0x37u, "mHobList != ((void *) 0)"); /*0xeb1*/
return Table_; /*0xeb6*/
}
}
return Table_; /*0xebd*/
}
_WORD *GetNextHobByType(__int64 SystemTable, _WORD *a2)
{
_WORD *Result; // rbx Result = a2; /*0xeca*/
if ( !a2 ) /*0xed0*/
DebugAssert("e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 0x6Cu, "HobStart != ((void *) 0)"); /*0xee3*/
while ( 1 ) /*0xefc*/
{
if ( *Result == 0xFFFF ) /*0xf02*/
return 0; /*0xf0b*/
if ( *Result == 4 ) /*0xef3*/
break; /*0xef3*/
Result = (_WORD *)((char *)Result + (unsigned __int16)Result[1]); /*0xef9*/
}
return Result; /*0xf06*/
}
__int64 PciExpressLibGetPciExpressAddress(__int64 n1024064)
{
if ( (n1024064 & 0xFFFFFFFFF0000000uLL) != 0 ) /*0xf24*/
DebugAssert("e:\\hs\\MdePkg\\Library\\SmmPciExpressLib\\PciExpressLib.c", 0x76u, "((Address) & ~0xfffffff) == 0"); /*0xf39*/
return n1024064 + qword_1988; /*0xf48*/
}
__int64 PciExpressLibWrite16(_WORD *PciExpressAddress)
{
if ( ((unsigned __int8)PciExpressAddress & 1) != 0 ) /*0xf5c*/
DebugAssert("e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c", 0xB7u, "(Address & 1) == 0"); /*0xf71*/
*PciExpressAddress = 1280; /*0xf7b*/
return 1280; /*0xf7e*/
}
UINT32 IoRead32(UINTN Port)
{
unsigned __int16 Port_1; // bx Port_1 = Port; /*0xf8a*/
if ( (Port & 3) != 0 ) /*0xf90*/
DebugAssert("e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLibMsc.c", 0xC1u, "(Port & 3) == 0"); /*0xfa5*/
return __indword(Port_1); /*0xfae*/
}