#include "SmmAccess.h"
// Function at 0x2c0 char *InternalCopyMem(char *dst, char *src, unsigned __int64 count)
{
char *dst_2; // rax unsigned __int64 count_1; // rcx char *dst_1; // rdi char *src_1; // rsi dst_2 = dst; /*0x2d0*/
if ( src < dst && &src[count - 1] >= dst ) /*0x2d8*/
{
src_1 = &src[count - 1]; /*0x2f0*/
dst_1 = &dst[count - 1]; /*0x2f3*/
}
else
{
count_1 = count; /*0x2da*/
count &= 7u; /*0x2dd*/
count_1 >>= 3; /*0x2e4*/
qmemcpy(dst, src, 8 *count_1); /*0x2e8*/
src_1 = &src[8 *count_1]; /*0x2e8*/
dst_1 = &dst[8 *count_1]; /*0x2e8*/
}
qmemcpy(dst_1, src_1, count); /*0x2fc*/
return dst_2; /*0x2ff*/
}
// Function at 0x310 char *InternalZeroMem(char *buf, unsigned __int64 a2)
{
memset(buf, 0, 8 * (a2 >> 3)); /*0x326*/
memset(&buf[8 * (a2 >> 3)], 0, a2 & 7); /*0x32b*/
return buf; /*0x32e*/
}
// Function at 0x390 void CpuPause()
{
_mm_pause(); /*0x390*/
}
// Function at 0x3a0 unsigned __int64 ReadTsc()
{
return __rdtsc(); /*0x3a9*/
}
// Function at 0x3b0 void EnableInterrupts()
{
_enable(); /*0x3b0*/
}
// Function at 0x3c0 void DisableInterrupts()
{
_disable(); /*0x3c0*/
}
// Function at 0x3d0 unsigned __int64 GetCallerEflags()
{
return __getcallerseflags(); /*0x3d2*/
}
// Function at 0x3d4 EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
signed __int64 Result; // rbx UefiBootServicesTableLibConstructor(ImageHandle, SystemTable); /*0x3da*/
Result = SmmAccessDriverEntry(); /*0x3e4*/
if ( Result < 0 ) /*0x3ea*/
ModuleDestruct(); /*0x3ec*/
return Result; /*0x3f4*/
}
// Function at 0x3fc __int64 UefiBootServicesTableLibConstructor(__int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
unsigned __int8 v3; // al unsigned int n115200; // ecx unsigned int v5; // r11d unsigned __int16 n1016; // r9 unsigned __int8 n33; // al unsigned __int16 v8; // r10 unsigned __int8 v9; // al unsigned __int8 v10; // cl unsigned __int8 v11; // al unsigned __int8 v12; // al int v13; // r8d unsigned __int8 v14; // al int v15; // r8d unsigned __int8 v16; // al bool v17; // cl unsigned __int8 v18; // al __int64 v19; // rax __int64 v20; // rax _BYTE *v21; // rax __int16 callerseflags_w; // bx bool v23; // bl __int64 v24; // rdi __int64 result; // rax
::ImageHandle = ImageHandle; /*0x412*/
if ( !ImageHandle ) /*0x426*/
DebugAssert( /*0x435*/
"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c",
51,
"gImageHandle != ((void *) 0)");
::SystemTable = (__int64)SystemTable; /*0x43a*/
if ( !SystemTable ) /*0x444*/
DebugAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); /*0x453*/
BootServices = (__int64)SystemTable->BootServices; /*0x45c*/
if ( !BootServices ) /*0x466*/
DebugAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); /*0x475*/
RuntimeServices = (__int64)SystemTable->RuntimeServices; /*0x47e*/
if ( !RuntimeServices ) /*0x488*/
DebugAssert( /*0x49b*/
"e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c",
47,
"gRT != ((void *) 0)");
__outbyte(0x72u, 0x5Cu); /*0x4b1*/
__inbyte(0x73u); /*0x4b8*/
__outbyte(0x72u, 0x6Cu); /*0x4be*/
v3 = __inbyte(0x73u); /*0x4c1*/
switch ( v3 ) /*0x4c4*/
{
case 0xA7: /*0x4c4*/
n115200 = 115200; /*0x4c6*/
break;
case 0xA6: /*0x4c4*/
n115200 = 57600; /*0x4cf*/
break;
case 0xA5: /*0x4c4*/
n115200 = 38400; /*0x4da*/
break;
case 0xA4: /*0x4c4*/
n115200 = 19200; /*0x4e5*/
break;
default:
n115200 = 115200; /*0x4ee*/
if ( v3 == 0xA3 ) /*0x4f7*/
n115200 = 9600; /*0x4f7*/
break;
}
v5 = 0x1C200 / n115200; /*0x50a*/
n1016 = 1016; /*0x50d*/
__outbyte(0x72u, 0x5Cu); /*0x515*/
n33 = __inbyte(0x73u); /*0x518*/
if ( n33 == 33 ) /*0x51b*/
n1016 = 760; /*0x51b*/
v8 = n1016 + 3; /*0x51f*/
v9 = __inbyte(n1016 + 3); /*0x527*/
v10 = v9; /*0x528*/
v11 = __inbyte(n1016 + 3); /*0x52a*/
__outbyte(n1016 + 3, v11 | 0x80); /*0x52d*/
v12 = __inbyte(n1016 + 1); /*0x535*/
v13 = v12 << 8; /*0x53a*/
v14 = __inbyte(n1016); /*0x542*/
v15 = v14 | v13; /*0x546*/
v16 = __inbyte(n1016 + 3); /*0x54d*/
__outbyte(n1016 + 3, v16 & 0x7F); /*0x550*/
v17 = (v10 & 0x3F) == 3; /*0x562*/
if ( v15 != v5 ) /*0x565*/
v17 = 0; /*0x565*/
if ( !v17 ) /*0x56a*/
{
do /*0x575*/
v18 = __inbyte(n1016 + 5); /*0x570*/
while ( (v18 & 0x60) != 0x60 ); /*0x575*/
__outbyte(v8, 0x80u); /*0x57d*/
__outbyte(n1016 + 1, BYTE1(v5)); /*0x587*/
__outbyte(n1016, v5); /*0x58f*/
__outbyte(v8, 3u); /*0x596*/
__outbyte(n1016 + 2, 0); /*0x59d*/
__outbyte(n1016 + 2, 1u); /*0x5a0*/
__outbyte(n1016 + 4, 0); /*0x5a7*/
}
v19 = GetPcdDb(); /*0x5a8*/
qword_4DB0 = (*(__int64 ( **)(__int64))(v19 + 32))(5); /*0x5b3*/
GetHobList(); /*0x5ba*/
if ( *(char *)PciExpressBaseAddress(1024068) >= 0 ) /*0x5cf*/
{
v20 = PciExpressBaseAddress(1024064); /*0x5d9*/
IoWrite16(v20, 1280); /*0x5e4*/
v21 = (_BYTE *)PciExpressBaseAddress(1024068); /*0x5eb*/
*v21 |= 0x80u; /*0x5f5*/
}
callerseflags_w = _getcallerseflags_w(); /*0x5fc*/
disable_w(); /*0x5ff*/
v23 = (callerseflags_w & 0x200) != 0; /*0x60e*/
v24 = IoRead32(1288) & 0xFFFFFF; /*0x618*/
_rdtsc_w(); /*0x61e*/
while ( (((_DWORD)v24 + 357 - (unsigned int)IoRead32(1288)) & 0x800000) == 0 ) /*0x63e*/
mm_pause_w(); /*0x625*/
_rdtsc_w(); /*0x640*/
if ( v23 ) /*0x647*/
enable_w(); /*0x649*/
else disable_w(); /*0x650*/
result = S3BootScriptLibInit(); /*0x655*/
if ( result < 0 ) /*0x65d*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", result); /*0x66e*/
return DebugAssert( /*0x686*/
"e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Access\\SmmAccess\\DEBUG\\AutoGen.c",
506,
"!EFI_ERROR (Status)");
}
return result; /*0x69a*/
}
// Function at 0x6a0 __int64 ModuleDestruct()
{
__int64 result; // rax result = S3BootScriptLibDestruct(); /*0x6a4*/
if ( result < 0 ) /*0x6ac*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", result); /*0x6bd*/
return DebugAssert( /*0x6d5*/
"e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Access\\SmmAccess\\DEBUG\\AutoGen.c",
529,
"!EFI_ERROR (Status)");
}
return result; /*0x6da*/
}
// Function at 0x6e0 unsigned __int64 SmmAccessDriverEntry(__int64 a1, __int64 a2)
{
__int64 Status; // rax __int64 v3; // rax __int64 v4; // rcx __int64 v5; // rbx __int64 v6; // rcx _DWORD *v7; // rbx __int64 Status; // rax unsigned __int64 Size; // rsi __int64 *v10; // rdi __int64 Size; // r9 __int64 Size; // rcx __int64 Status; // rax int v15; // edi int Size; // esi int Size; // ebx __int64 v18; // [rsp+68h] [rbp+10h] BYREF v18 = a2; /*0x6ef*/
ZeroMemS((char *)buf, 0xE0u); /*0x70f*/
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_4C80, 0, &v18); /*0x729*/
if ( Status < 0 ) /*0x742*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x751*/
DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 82, "!EFI_ERROR (Status)"); /*0x764*/
}
qword_4E58 = v18; /*0x76e*/
buf[0] = 1634562921; /*0x775*/
qword_4E28 = 0; /*0x780*/
v3 = GetHobList(); /*0x787*/
v5 = GetNextHob(v4, v3); /*0x794*/
if ( !v5 ) /*0x79a*/
goto LABEL_21; /*0x79a*/
do /*0x7c6*/
{
if ( (unsigned __int8)CompareGuid(&unk_4C60, v5 + 8) ) /*0x7ab*/
break; /*0x7b2*/
v5 = GetNextHob(v6, v5 + *(unsigned __int16 *)(v5 + 2)); /*0x7c0*/
}
while ( v5 ); /*0x7c6*/
if ( v5 )
{
v7 = (_DWORD *)(v5 + 24); /*0x7e8*/
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_4CB0, 0, &qword_4F00); /*0x7ec*/
if ( Status < 0 ) /*0x7f5*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x804*/
DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 109, "!EFI_ERROR (Status)"); /*0x818*/
}
if ( *v7 > 4u ) /*0x820*/
DebugAssert( /*0x831*/
"e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c",
114,
"DescriptorBlock->NumberOfSmmReservedRegions <= 4");
Size = 0; /*0x836*/
if ( *v7 ) /*0x839*/
{
v10 = (__int64 *)(v7 + 4); /*0x870*/
do /*0x8b6*/
{
*(__int64 *)((char *)v10 + (char *)&qword_4E58 - (char *)v7) = *(v10 - 1); /*0x87f*/
Size = *v10; /*0x886*/
*(__int64 *)((char *)v10 + (char *)&qword_4E60 - (char *)v7) = *v10; /*0x889*/
Size = v10[1]; /*0x88d*/
*(__int64 *)((char *)v10 + &unk_4E68 - (_UNKNOWN *)v7) = Size; /*0x891*/
*(__int64 *)((char *)v10 + &unk_4E70 - (_UNKNOWN *)v7) = v10[2]; /*0x8a1*/
DebugPrint(0x80000000LL, "SM RAM index[%d] startaddr:%08X Size :%08X\n", Size, Size, Size); /*0x8a5*/
v10 += 4; /*0x8ac*/
++Size; /*0x8b0*/
}
while ( Size < (unsigned int)*v7 ); /*0x8b6*/
}
word_4E50 = 0; /*0x8cc*/
pSmmAccessOpen = (__int64)SmmAccessOpen; /*0x8db*/
qword_4E60 = Size; /*0x8f0*/
pSmmAccessClose = (__int64)SmmAccessClose; /*0x8f7*/
n2 = 2; /*0x90c*/
pSmmAccessLock = (__int64)SmmAccessLock; /*0x917*/
pSmmAccessGetCapabilities = (__int64)SmmAccessGetCapabilities; /*0x92f*/
Status = (*(__int64 ( **)(__int64 *, void *, __int64 *, _QWORD))(BootServices + 328))( /*0x93d*/
&qword_4E28,
&unk_4D40,
&pSmmAccessOpen,
0);
if ( Status < 0 ) /*0x946*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x955*/
DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 142, "!EFI_ERROR (Status)"); /*0x969*/
}
if ( qword_4E60 )
{
v15 = buf[4 *qword_4E60 + 5]; /*0x994*/
Size = *(_DWORD *)(*(_QWORD *)qword_4F00 + 272LL); /*0x9a6*/
DebugPrint(0x80000000LL, "TSEG Base: %08X\n", v15);
DebugPrint(0x80000000LL, "TSEG Size: %08X\n", Size);
Size = *(_DWORD *)(*(_QWORD *)qword_4F00 + 276LL); /*0x9e2*/
DebugPrint(0x80000000LL, "IED Base: %08X\n", v15 + LODWORD(buf[4 *qword_4E60 + 7]));
DebugPrint(0x80000000LL, "IED Size: %08X\n", Size);
DebugPrint(0x80000000LL, "SMM Base: %08X\n", LODWORD(buf[4 *qword_4E60 + 5]));
DebugPrint(0x80000000LL, "SMM Size: %08X\n", LODWORD(buf[4 *qword_4E60 + 7]));
byte_4EE8 = Size; /*0xa48*/
if ( EfiCreateEventReadyToBoot() < 0 ) /*0xa57*/
DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 179, "!(((INTN)(RETURN_STATUS)(Status)) < 0)"); /*0xa68*/
return 0; /*0xa6d*/
}
else
{
return 0x8000000000000003uLL; /*0x97a*/
}
}
else
{
LABEL_21:
DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 95, "GuidHob != ((void *) 0)"); /*0xa80*/
return 0x800000000000000EuLL; /*0xa85*/
}
}
// Function at 0xaac unsigned __int64 SmmAccessOpen(__int64 a1)
{
__int64 v1; // rbx __int64 v3; // rdx unsigned __int64 n2; // rax unsigned int Index; // ecx unsigned int Index; // r8d __int64 Ptr; // rax __int64 Ptr; // rax v1 = a1; /*0xaba*/
if ( *(_QWORD *)(a1 - 16) == 1634562921 ) /*0xabd*/
v1 = a1 - 16; /*0xad9*/
else DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 210, "CR has Bad Signature"); /*0xad2*/
if ( (n2 & 4) != 0 ) /*0xae6*/
{
DebugPrint(0x80000000LL, "Cannot open a locked SMRAM region\n"); /*0xaf4*/
return 0x8000000000000007uLL; /*0xaf9*/
}
else
{
v3 = qword_4E60; /*0xb05*/
n2 = n2 & 0xFFFFFFFFFFFFFFEDuLL; /*0xb13*/
Index = 0; /*0xb17*/
n2 &= 0xFFFFFFFFFFFFFFEDuLL; /*0xb19*/
Index = 0; /*0xb20*/
if ( qword_4E60 ) /*0xb26*/
{
Ptr = 0; /*0xb28*/
do /*0xb44*/
{
++Index; /*0xb2e*/
buf[4 *Ptr + 12] &= 0xFFFFFFFFFFFFFFEDuLL; /*0xb31*/
v3 = qword_4E60; /*0xb37*/
Ptr = Index; /*0xb3e*/
}
while ( Index < (unsigned __int64)qword_4E60 ); /*0xb44*/
n2 = n2; /*0xb46*/
}
n2 = n2 | 1; /*0xb51*/
if ( v3 ) /*0xb5b*/
{
Ptr = 0; /*0xb5d*/
do /*0xb75*/
{
++Index; /*0xb64*/
buf[4 *Ptr + 12] |= 1uLL; /*0xb66*/
Ptr = Index; /*0xb6c*/
}
while ( Index < (unsigned __int64)qword_4E60 ); /*0xb75*/
}
*(_BYTE *)(v1 + 49) = 1; /*0xb77*/
return 0; /*0xb7b*/
}
}
// Function at 0xb84 unsigned __int64 SmmAccessClose(__int64 a1)
{
__int64 v1; // rbx __int64 v3; // rcx char v4; // al _BYTE *v5; // rdx bool v6; // zf v1 = a1; /*0xb92*/
if ( *(_QWORD *)(a1 - 16) == 1634562921 ) /*0xb95*/
v1 = a1 - 16; /*0xbb1*/
else DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 252, "CR has Bad Signature"); /*0xbaa*/
if ( (n2 & 4) != 0 ) /*0xbbe*/
{
DebugPrint(2, "Cannot close the locked SMRAM Region\n"); /*0xbcc*/
return 0x8000000000000007uLL; /*0xbdb*/
}
if ( (n2 & 2) != 0 ) /*0xbdf*/
return 0x8000000000000007uLL; /*0xbdf*/
v3 = qword_4E60; /*0xbe1*/
v4 = 0; /*0xbe8*/
if ( qword_4E60 ) /*0xbed*/
{
v5 = (_BYTE *)(v1 + 96); /*0xbef*/
do /*0xc08*/
{
v6 = (*v5 & 1) == 0; /*0xbf7*/
v5 += 32; /*0xbfa*/
if ( !v6 ) /*0xc01*/
v4 = 1; /*0xc01*/
--v3; /*0xc05*/
}
while ( v3 ); /*0xc08*/
}
*(_BYTE *)(v1 + 49) = v4; /*0xc0a*/
return 0; /*0xc0f*/
}
// Function at 0xc18 unsigned __int64 SmmAccessLock(__int64 a1)
{
__int64 v1; // rbx unsigned int Index; // eax __int64 Ptr; // rcx v1 = a1; /*0xc26*/
if ( *(_QWORD *)(a1 - 16) == 1634562921 ) /*0xc29*/
v1 = a1 - 16; /*0xc45*/
else DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 304, "CR has Bad Signature"); /*0xc3e*/
Index = 0; /*0xc49*/
if ( *(_BYTE *)(v1 + 49) ) /*0xc4b*/
return 0x8000000000000007uLL; /*0xc50*/
n2 |= 4uLL; /*0xc5c*/
if ( qword_4E60 ) /*0xc6b*/
{
Ptr = 0; /*0xc6d*/
do /*0xc8b*/
{
++Index; /*0xc7b*/
qword_4E80[4 *Ptr] |= 4uLL; /*0xc7d*/
Ptr = Index; /*0xc82*/
}
while ( Index < (unsigned __int64)qword_4E60 ); /*0xc8b*/
}
*(_BYTE *)(v1 + 48) = 1; /*0xc8d*/
return 0; /*0xc93*/
}
// Function at 0xc9c unsigned __int64 SmmAccessGetCapabilities(__int64 a1, unsigned __int64 *p_count, char *dst)
{
__int64 v5; // rdi unsigned __int64 v6; // rbx unsigned __int64 result; // rax v5 = a1; /*0xcbe*/
if ( *(_QWORD *)(a1 - 16) == 1634562921 ) /*0xcc1*/
v5 = a1 - 16; /*0xcdd*/
else DebugAssert("e:\\hs\\PurleySktPkg\\Smm\\Access\\SmmAccessDriver.c", 344, "CR has Bad Signature"); /*0xcd6*/
v6 = 32LL * *(_QWORD *)(v5 + 64); /*0xce5*/
if ( *p_count >= v6 ) /*0xcec*/
{
CopyMemS(dst, (char *)(v5 + 72), *p_count); /*0xd04*/
result = 0; /*0xd09*/
}
else
{
result = 0x8000000000000005uLL; /*0xcee*/
}
*p_count = v6; /*0xd10*/
return result; /*0xd1d*/
}
// Function at 0xd30 char *CopyMemS(char *dst, char *src, unsigned __int64 count)
{
char *dst_1; // rax unsigned __int64 Size; // rbp dst_1 = dst; /*0xd4d*/
if ( count ) /*0xd53*/
{
Size = count - 1; /*0xd55*/
if ( count - 1 > ~(unsigned __int64)dst ) /*0xd5f*/
DebugAssert( /*0xd74*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
56,
"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)DestinationBuffer)");
if ( Size > ~(unsigned __int64)src ) /*0xd82*/
DebugAssert( /*0xd97*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
57,
"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)");
if ( dst == src ) /*0xd9f*/
return dst; /*0xda1*/
else return InternalCopyMem(dst, src, count); /*0xdaf*/
}
return dst_1; /*0xdc3*/
}
// Function at 0xdcc char *ZeroMemS(char *buf, unsigned __int64 n0xE0)
{
if ( !buf ) /*0xddf*/
DebugAssert("e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c", 53, "Buffer != ((void *) 0)"); /*0xdf2*/
if ( n0xE0 > -(__int64)buf ) /*0xe00*/
DebugAssert( /*0xe15*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c",
54,
"Length <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer + 1)");
return InternalZeroMem(buf, n0xE0); /*0xe25*/
}
// Function at 0xe30 char DebugPrint(__int64 a1, const char *a2, ...)
{
__int64 v2; // rbx int v3; // edi unsigned __int8 v5; // al char n3; // al char n3_1; // cl char Result; // al __int64 v9; // rax _BYTE v10[280]; // [rsp+30h] [rbp-118h] BYREF int v11; // [rsp+158h] [rbp+10h]
va_list va; // [rsp+160h] [rbp+18h] BYREF va_start(va, a2);
v11 = (int)a2; /*0xe30*/
v2 = 0; /*0xe49*/
v3 = (int)a2; /*0xe4b*/
if ( !a2 ) /*0xe54*/
DebugAssert("e:\\hs\\MdePkg\\Library\\BaseDebugLibSerialPort\\DebugLib.c", 79, "Format != ((void *) 0)"); /*0xe67*/
v5 = __inbyte(0x70u); /*0xe71*/
__outbyte(0x70u, v5 & 0x80 | 0x4B); /*0xe76*/
n3 = __inbyte(0x71u); /*0xe7c*/
n3_1 = n3; /*0xe7d*/
if ( (unsigned __int8)n3 > 3u ) /*0xe83*/
{
n3_1 = n3; /*0xe85*/
if ( !n3 ) /*0xe8d*/
{
v3 = v11; /*0xe96*/
n3_1 = MEMORY[0xFDAF0490] & 2 | 1; /*0xea1*/
}
}
Result = n3_1 - 1; /*0xea5*/
if ( (unsigned __int8)(n3_1 - 1) <= 0xFDu ) /*0xea9*/
{
v2 = 2147483718LL; /*0xead*/
Result = 4; /*0xeb2*/
if ( n3_1 == 1 ) /*0xeb7*/
v2 = 2147483652LL; /*0xeb7*/
}
if ( (v2 & a1) != 0 ) /*0xebd*/
{
AsciiVSPrint((unsigned int)v10, 256, 0, v3, (__int64)va); /*0xedc*/
v9 = AsciiStrLen(v10); /*0xee6*/
return SerialPortWrite(v10, v9); /*0xef3*/
}
return Result; /*0xef8*/
}
// Function at 0xf04 __int64 DebugAssert(__int64 a1, int a2, __int64 a3, double a4)
{
__int64 v4; // rax _BYTE ErrorLevel[264]; // [rsp+40h] [rbp-108h] BYREF DebugAssertFormat(ErrorLevel, 256, "ASSERT [%a] %a(%d): %a\n", a4, *(double *)&a1, a2, *(double *)&a3);
v4 = AsciiStrLen(ErrorLevel); /*0xf3c*/
return SerialPortWrite(ErrorLevel, v4); /*0xf4e*/
}
// Function at 0xf58 __int64 PciExpressBaseAddress(__int64 n1024064, __int64 a2, __int64 a3, double a4)
{
if ( (n1024064 & 0xFFFFFFFFF0000000uLL) != 0 ) /*0xf68*/
DebugAssert( /*0xf7d*/
(__int64)"e:\\hs\\MdePkg\\Library\\SmmPciExpressLib\\PciExpressLib.c",
118,
(__int64)"((Address) & ~0xfffffff) == 0",
a4);
return n1024064 + qword_4DB0; /*0xf8c*/
}
// Function at 0xf94 unsigned __int64 EfiGetSystemConfigurationTable(__int64 a1, _QWORD *a2, __int64 a3, double a4)
{
__int64 SystemTable; // rdi __int64 Index; // rbx __int64 i; // r14 if ( !a1 ) /*0xfb6*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 97, (__int64)"TableGuid != ((void *) 0)", a4); /*0xfc9*/
if ( !a2 ) /*0xfd1*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 98, (__int64)"Table != ((void *) 0)", a4); /*0xfe4*/
SystemTable = SystemTable; /*0xfe9*/
Index = 0; /*0xff0*/
*a2 = 0; /*0xff2*/
if ( !*(_QWORD *)(SystemTable + 104) ) /*0xff6*/
return 0x800000000000000EuLL; /*0x101f*/
for ( i = 0; !(unsigned __int8)CompareGuid(a1, i + *(_QWORD *)(SystemTable + 112)); i += 24 ) /*0xffc*/
{
if ( (unsigned __int64)++Index >= *(_QWORD *)(SystemTable + 104) ) /*0x101d*/
return 0x800000000000000EuLL; /*0x101d*/
}
*a2 = *(_QWORD *)(*(_QWORD *)(SystemTable + 112) + 24 *Index + 16); /*0x1053*/
return 0; /*0x103d*/
}
// Function at 0x1058 __int64 EfiCreateProtocolNotifyEvent(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
double Status; // xmm3_8 __int64 Status; // rax __int64 Status; // rax if ( !a5 ) /*0x1068*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 154, (__int64)"Registration != ((void *) 0)", Status); /*0x107d*/
Status = (*(__int64 ( **)(__int64, __int64, __int64 ( *)()))(BootServices + 80))(512, 8, S3BootScriptNotify); /*0x10a6*/
if ( Status < 0 ) /*0x10b1*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x10bf*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 167, (__int64)"!EFI_ERROR (Status)", Status); /*0x10d7*/
}
Status = (*(__int64 ( **)(void *, __int64, __int64))(BootServices + 168))(&unk_4CE0, a4, a5); /*0x10f4*/
if ( Status < 0 ) /*0x10fd*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x110c*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 179, (__int64)"!EFI_ERROR (Status)", Status); /*0x1124*/
}
(*(void ( **)(__int64))(BootServices + 104))(a4); /*0x1135*/
return a4; /*0x113d*/
}
// Function at 0x1144 __int64 EfiCreateEventReadyToBoot(__int64 a1, __int64 a2, __int64 a3, double a4)
{
if ( *(_DWORD *)(SystemTable + 8) >= 0x20000u ) /*0x1156*/
return (*(__int64 ( **)(__int64, __int64, __int64 ( *)()))(BootServices + 368))( /*0x11bf*/
512,
16,
sub_D24);
DebugPrint(0x80000000LL, "EFI1.1 can't support ReadyToBootEvent!"); /*0x1164*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiNotTiano.c", 185, (__int64)"((BOOLEAN)(0==1))", a4); /*0x117c*/
return 0x8000000000000003uLL; /*0x11c5*/
}
// Function at 0x11cc __int64 GetHobList(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 result; // rax signed __int64 Status; // rax result = qword_4DB8; /*0x11d0*/
if ( !qword_4DB8 ) /*0x11da*/
{
Status = EfiGetSystemConfigurationTable((__int64)&unk_4D20, &qword_4DB8, a3, a4); /*0x11ea*/
if ( Status < 0 ) /*0x11f2*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1203*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 54, (__int64)"!EFI_ERROR (Status)", a4); /*0x121b*/
}
result = qword_4DB8; /*0x1220*/
if ( !qword_4DB8 ) /*0x122a*/
{
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 55, (__int64)"mHobList != ((void *) 0)", a4); /*0x123d*/
return qword_4DB8; /*0x1242*/
}
}
return result; /*0x1249*/
}
// Function at 0x1250 _WORD *GetNextHob(__int64 a1, _WORD *a2, __int64 a3, double a4)
{
_WORD *Result; // rbx Result = a2; /*0x1256*/
if ( !a2 ) /*0x125c*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 108, (__int64)"HobStart != ((void *) 0)", a4); /*0x126f*/
while ( 1 ) /*0x1288*/
{
if ( *Result == 0xFFFF ) /*0x128e*/
return 0; /*0x1297*/
if ( *Result == 4 ) /*0x127f*/
break; /*0x127f*/
Result = (_WORD *)((char *)Result + (unsigned __int16)Result[1]); /*0x1285*/
}
return Result; /*0x1292*/
}
// Function at 0x12a0 __int64 BootScriptWrite()
{
__int64 Result; // rbx __int16 n255; // [rsp+30h] [rbp+8h] BYREF char n3; // [rsp+32h] [rbp+Ah]
Result = *(_QWORD *)qword_4F10; /*0x12ad*/
if ( !*(_QWORD *)qword_4F10 ) /*0x12ad*/
return 0; /*0x12b5*/
n3 = 3; /*0x12be*/
n255 = 255; /*0x12c3*/
CopyMemS((char *)(Result + *(unsigned int *)(qword_4F10 + 8)), (char *)&n255, 3u); /*0x12d9*/
*(_DWORD *)(*(_QWORD *)qword_4F10 + 5LL) = *(_DWORD *)(qword_4F10 + 8) + 3; /*0x12f1*/
return Result; /*0x12f4*/
}
// Function at 0x181c __int64 S3BootScriptNotify(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 result; // rax __int64 v5; // rdx __int64 v6; // rcx __int64 v7; // r8 char v8; // [rsp+40h] [rbp+18h] BYREF result = (*(__int64 ( **)(void *, _QWORD, char *))(BootServices + 320))(&unk_4CE0, 0, &v8); /*0x1835*/
if ( result >= 0 ) /*0x183e*/
{
result = qword_4F10; /*0x1840*/
if ( !*(_BYTE *)(qword_4F10 + 20) ) /*0x1847*/
{
BootScriptWrite(); /*0x184d*/
*(_BYTE *)(qword_4F10 + 20) = 1; /*0x1859*/
return sub_12FC(v6, v5, v7, a4); /*0x185d*/
}
}
return result; /*0x1862*/
}
// Function at 0x1868 __int64 S3BootScriptWrite(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 dst; // rax if ( src != dst ) /*0x187a*/
{
S3BootScriptNotify(0, 0, a3, a4); /*0x1880*/
dst = dst; /*0x1885*/
if ( !*(_QWORD *)dst ) /*0x188c*/
{
CopyMemS((char *)dst, (char *)src, 0x20u); /*0x18a2*/
dst = dst; /*0x18a7*/
*(_BYTE *)(dst + 14) = 1; /*0x18ae*/
}
src = dst; /*0x18b2*/
}
return 0; /*0x18bb*/
}
// Function at 0x18c0 __int64 S3BootScriptClose(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 src; // rdx __int64 Status; // rax __int64 Status; // rax __int64 src_1; // rax src = src; /*0x18c6*/
*(_BYTE *)(src + 21) = 1; /*0x18da*/
Status = SaveLockBox(&unk_4D50, src, 32); /*0x18de*/
if ( Status < 0 ) /*0x18eb*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x18f9*/
DebugAssert( /*0x1911*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
508,
(__int64)"!EFI_ERROR (Status)",
a4);
}
Status = SetLockBoxAttributes(&unk_4D50); /*0x191d*/
if ( Status < 0 ) /*0x1925*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1934*/
DebugAssert( /*0x194c*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
511,
(__int64)"!EFI_ERROR (Status)",
a4);
}
src_1 = src; /*0x1951*/
*(_BYTE *)(src + 21) = 0; /*0x1958*/
return src_1; /*0x195c*/
}
// Function at 0x1964 __int64 S3BootScriptSave(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 Status; // rax __int64 Status; // rax __int64 v6; // rdx __int64 v7; // rcx __int64 v8; // r8 if ( !*(_BYTE *)(src + 15) ) /*0x1971*/
{
*(_DWORD *)(src + 16) = *(_DWORD *)(src + 8) + 3; /*0x1981*/
Status = RestoreLockBox(); /*0x1984*/
if ( Status < 0 ) /*0x1991*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x199f*/
DebugAssert( /*0x19b7*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
473,
(__int64)"!EFI_ERROR (Status)",
a4);
}
Status = SaveLockBox(&unk_4D60, *(_QWORD *)src, *(unsigned int *)(src + 16)); /*0x19d1*/
if ( Status < 0 ) /*0x19d9*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x19e8*/
DebugAssert( /*0x1a00*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
484,
(__int64)"!EFI_ERROR (Status)",
a4);
}
*(_BYTE *)(src + 15) = 1; /*0x1a0c*/
S3BootScriptClose(v7, v6, v8, a4); /*0x1a10*/
}
return 0; /*0x1a17*/
}
// Function at 0x1a20 __int64 S3BootScriptLibInit(char *buf_4, __int64 a2, __int64 a3, double a4)
{
__int64 v4; // rax char *buf_1; // rbx __int64 Status; // rax __int64 v7; // rax __int64 Status; // rax __int64 v9; // rdx __int64 v10; // rcx __int64 v11; // r8 __int64 v12; // r9 __int64 v13; // rax char *buf_3; // rax __int64 Status; // rax char *buf_5; // rbx __int64 v17; // rax __int64 Status; // rax __int64 Status; // rax __int64 Status; // rax __int64 Status; // rax _BYTE v23[16]; // [rsp+30h] [rbp-10h] BYREF char *buf_2; // [rsp+80h] [rbp+40h] BYREF __int64 v25; // [rsp+88h] [rbp+48h] BYREF char *buf; // [rsp+90h] [rbp+50h] BYREF __int64 ( **v27)(_QWORD, __int64 *); // [rsp+98h] [rbp+58h] BYREF v25 = a2; /*0x1a20*/
buf_2 = buf_4; /*0x1a25*/
v4 = GetPcdDb(); /*0x1a3b*/
buf_1 = (char *)(*(__int64 ( **)(__int64))(v4 + 32))(137); /*0x1a60*/
if ( !buf_1 ) /*0x1a6d*/
{
buf = (char *)0xFFFFFFFFLL; /*0x1a7b*/
Status = (*(__int64 ( **)(__int64, _QWORD, __int64, char **))(BootServices + 40))(1, 0, 1, &buf); /*0x1a8f*/
if ( Status < 0 ) /*0x1a95*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1aa0*/
DebugAssert( /*0x1ab0*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
586,
(__int64)"!EFI_ERROR (Status)",
a4);
}
buf_1 = buf; /*0x1ab5*/
byte_4DC8 = 1; /*0x1ab9*/
v7 = GetPcdDb(); /*0x1ac0*/
Status = (*(__int64 ( **)(__int64, char *))(v7 + 144))(137, buf_1); /*0x1acb*/
if ( Status < 0 ) /*0x1ad4*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1adf*/
DebugAssert( /*0x1aef*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
591,
(__int64)"!EFI_ERROR (Status)",
a4);
}
ZeroMemS(buf_1, 0x20u); /*0x1afc*/
qword_4DD0 = EfiCreateProtocolNotifyEvent(v10, v9, v11, v12, (__int64)v23); /*0x1b0f*/
if ( !qword_4DD0 ) /*0x1b19*/
DebugAssert( /*0x1b2a*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
603,
(__int64)"mEventDxeSmmReadyToLock != ((void *) 0)",
a4);
}
src = (__int64)buf_1; /*0x1b3c*/
if ( (*(__int64 ( **)(void *, _QWORD, __int64 ( ***)(_QWORD, __int64 *)))(BootServices + 320))( /*0x1b8d*/
&unk_4D30,
0,
&v27) >= 0
&& (*v27)(v27, &v25) >= 0
&& (_BYTE)v25
&& v27[1](v27, &qword_4DD8) >= 0 )
{
v13 = GetPcdDb(); /*0x1b93*/
buf_3 = (char *)(*(__int64 ( **)(__int64))(v13 + 32))(138); /*0x1ba1*/
buf_2 = buf_3; /*0x1ba4*/
if ( !buf_3 ) /*0x1bab*/
{
Status = (*(__int64 ( **)(__int64, __int64, char **))(qword_4DD8 + 80))(6, 32, &buf_2); /*0x1bc2*/
if ( Status < 0 ) /*0x1bc8*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1bd3*/
DebugAssert( /*0x1be3*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
639,
(__int64)"!EFI_ERROR (Status)",
a4);
}
buf_5 = buf_2; /*0x1be8*/
byte_4DF0 = 1; /*0x1bec*/
v17 = GetPcdDb(); /*0x1bf3*/
Status = (*(__int64 ( **)(__int64, char *))(v17 + 144))(138, buf_5); /*0x1bfe*/
if ( Status < 0 ) /*0x1c07*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1c12*/
DebugAssert( /*0x1c22*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
643,
(__int64)"!EFI_ERROR (Status)",
a4);
}
ZeroMemS(buf_2, 0x20u); /*0x1c30*/
Status = (*(__int64 ( **)(void *, __int64 ( *)(__int64, __int64, __int64, double), __int64 *))(qword_4DD8 + 192))( /*0x1c51*/
&unk_4CF0,
S3BootScriptSave,
&qword_4DE0);
if ( Status < 0 ) /*0x1c5a*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1c65*/
DebugAssert( /*0x1c75*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
654,
(__int64)"!EFI_ERROR (Status)",
a4);
}
Status = (*(__int64 ( **)(void *, __int64 ( *)(__int64, __int64, __int64, double), __int64 *))(qword_4DD8 + 192))( /*0x1c96*/
&unk_4CC0,
S3BootScriptSave,
&qword_4DC0);
if ( Status < 0 ) /*0x1c9f*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1caa*/
DebugAssert( /*0x1cba*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
661,
(__int64)"!EFI_ERROR (Status)",
a4);
}
buf_3 = buf_2; /*0x1cbf*/
}
dst = (__int64)buf_3; /*0x1cc3*/
Status = (*(__int64 ( **)(void *, __int64 ( *)(__int64, __int64, __int64, double), __int64 *))(qword_4DD8 + 192))( /*0x1ce6*/
&unk_4D10,
S3BootScriptWrite,
&qword_4DE8);
if ( Status < 0 ) /*0x1cef*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1cfa*/
DebugAssert( /*0x1d0a*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
673,
(__int64)"!EFI_ERROR (Status)",
a4);
}
}
return 0; /*0x1d11*/
}
// Function at 0x1d20 __int64 S3BootScriptLibDestruct(__int64 a1, __int64 a2, double a3, double a4)
{
__int64 Status; // rax __int64 v5; // rax __int64 Status; // rax __int64 Status; // rax __int64 Status; // rax __int64 Status; // rax __int64 v10; // rax __int64 Status; // rax __int64 Status; // rax __int64 v13; // rax __int64 Status; // rax DebugPrint(64, "%a() in %a module\n", a3, a4); /*0x1d4f*/
if ( qword_4DD0 ) /*0x1d78*/
{
Status = (*(__int64 (**)(void))(BootServices + 112))(); /*0x1d81*/
if ( Status < 0 ) /*0x1d87*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1d91*/
DebugAssert( /*0x1da1*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
707,
(__int64)"!EFI_ERROR (Status)",
a4);
}
}
v5 = qword_4DD8; /*0x1da6*/
if ( qword_4DD8 ) /*0x1db0*/
{
if ( qword_4DE0 ) /*0x1dbe*/
{
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(qword_4DD8 + 192))(&unk_4CF0, 0, &qword_4DE0); /*0x1dd0*/
if ( Status < 0 ) /*0x1dd9*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1de4*/
DebugAssert( /*0x1df4*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
720,
(__int64)"!EFI_ERROR (Status)",
a4);
}
v5 = qword_4DD8; /*0x1df9*/
}
if ( qword_4DC0 ) /*0x1e08*/
{
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(v5 + 192))(&unk_4CC0, 0, &qword_4DC0); /*0x1e1a*/
if ( Status < 0 ) /*0x1e23*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1e2e*/
DebugAssert( /*0x1e3e*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
731,
(__int64)"!EFI_ERROR (Status)",
a4);
}
v5 = qword_4DD8; /*0x1e43*/
}
if ( qword_4DE8 ) /*0x1e52*/
{
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(v5 + 192))(&unk_4D10, 0, &qword_4DE8); /*0x1e64*/
if ( Status < 0 ) /*0x1e6d*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1e78*/
DebugAssert( /*0x1e88*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
742,
(__int64)"!EFI_ERROR (Status)",
a4);
}
v5 = qword_4DD8; /*0x1e8d*/
}
}
if ( byte_4DC8 ) /*0x1e9b*/
{
Status = (*(__int64 ( **)(__int64, __int64))(BootServices + 48))(src, 1); /*0x1eb0*/
if ( Status < 0 ) /*0x1eb6*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1ec1*/
DebugAssert( /*0x1ed1*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
751,
(__int64)"!EFI_ERROR (Status)",
a4);
}
v10 = GetPcdDb(); /*0x1ed6*/
Status = (*(__int64 ( **)(__int64, _QWORD))(v10 + 144))(137, 0); /*0x1ee2*/
if ( Status < 0 ) /*0x1eeb*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1ef6*/
DebugAssert( /*0x1f06*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
753,
(__int64)"!EFI_ERROR (Status)",
a4);
}
v5 = qword_4DD8; /*0x1f0b*/
}
if ( v5 && byte_4DF0 ) /*0x1f1e*/
{
Status = (*(__int64 ( **)(__int64))(v5 + 88))(dst); /*0x1f27*/
if ( Status < 0 ) /*0x1f2d*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1f38*/
DebugAssert( /*0x1f48*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
757,
(__int64)"!EFI_ERROR (Status)",
a4);
}
v13 = GetPcdDb(); /*0x1f4d*/
Status = (*(__int64 ( **)(__int64, _QWORD))(v13 + 144))(138, 0); /*0x1f59*/
if ( Status < 0 ) /*0x1f62*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1f6d*/
DebugAssert( /*0x1f7d*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c",
759,
(__int64)"!EFI_ERROR (Status)",
a4);
}
}
return 0; /*0x1f93*/
}
// Function at 0x1f9c __int64 GetPcdDb(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 result; // rax __int64 Status; // rax result = qword_4DF8; /*0x1fa0*/
if ( !qword_4DF8 ) /*0x1faa*/
{
Status = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_4CD0, 0, &qword_4DF8); /*0x1fc3*/
if ( Status < 0 ) /*0x1fcc*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1fdd*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\DxePcdLib\\DxePcdLib.c", 78, (__int64)"!EFI_ERROR (Status)", a4); /*0x1ff5*/
}
result = qword_4DF8; /*0x1ffa*/
if ( !qword_4DF8 ) /*0x2004*/
{
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\DxePcdLib\\DxePcdLib.c", 79, (__int64)"mPcd != ((void *) 0)", a4); /*0x2017*/
return qword_4DF8; /*0x201c*/
}
}
return result; /*0x2023*/
}
// Function at 0x2028 bool CompareGuid(__int64 a1, __int64 a2)
{
__int64 Result; // rsi __int64 v5; // rbx __int64 v6; // rdi __int64 v7; // rax Result = ((__int64 (*)(void))ReadUnaligned64)(); /*0x204a*/
v5 = ReadUnaligned64(a2); /*0x2056*/
v6 = ReadUnaligned64(a1 + 8); /*0x2062*/
v7 = ReadUnaligned64(a2 + 8); /*0x2065*/
return Result == v5 && v6 == v7; /*0x2089*/
}
// Function at 0x2090 unsigned __int64 AsciiStrLen(_BYTE *a1, __int64 a2, __int64 a3, double a4)
{
_BYTE *v4; // rbx unsigned __int64 i; // rdi v4 = a1; /*0x209a*/
if ( !a1 ) /*0x20a0*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\String.c", 1082, (__int64)"String != ((void *) 0)", a4); /*0x20b5*/
for ( i = 0; *v4; ++i ) /*0x20bc*/
{
if ( i >= 0xF4240 ) /*0x20c8*/
DebugAssert( /*0x20dd*/
(__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\String.c",
1090,
(__int64)"Length < _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength",
a4);
++v4; /*0x20e2*/
}
return i; /*0x20f5*/
}
// Function at 0x20fc __int64 ReadUnaligned16(unsigned __int16 *a1, __int64 a2, __int64 a3, double a4)
{
if ( !a1 ) /*0x2108*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c", 38, (__int64)"Buffer != ((void *) 0)", a4); /*0x211b*/
return *a1; /*0x2123*/
}
// Function at 0x212c __int64 ReadUnaligned64(__int64 a1, __int64 a2, __int64 a3, double a4)
{
if ( !a1 ) /*0x2138*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c", 192, (__int64)"Buffer != ((void *) 0)", a4); /*0x214d*/
return *(_QWORD *)a1; /*0x2155*/
}
// Function at 0x215c unsigned __int64 StrLen(_WORD *a1, __int64 a2, __int64 a3, double a4)
{
unsigned __int64 n0xF4240; // rax if ( ((unsigned __int8)a1 & 1) != 0 ) /*0x2168*/
DebugAssert( /*0x217d*/
(__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
128,
(__int64)"((UINTN) String & 0x00000001) == 0",
a4);
if ( !a1 ) /*0x2187*/
return 0; /*0x21aa*/
n0xF4240 = 0; /*0x2189*/
if ( *a1 ) /*0x218b*/
{
while ( n0xF4240 < 0xF4240 ) /*0x2196*/
{
if ( !a1[++n0xF4240] ) /*0x219b*/
return n0xF4240; /*0x219f*/
}
return 1000001; /*0x21a3*/
}
return n0xF4240; /*0x21ac*/
}
// Function at 0x21b4 unsigned __int64 AsciiStrLenSimple(_BYTE *a1)
{
unsigned __int64 n0xF4240; // rax n0xF4240 = 0; /*0x21b4*/
if ( a1 && *a1 ) /*0x21bb*/
{
while ( n0xF4240 < 0xF4240 ) /*0x21c5*/
{
if ( !a1[++n0xF4240] ) /*0x21ca*/
return n0xF4240; /*0x21ce*/
}
return 1000001; /*0x21d1*/
}
return n0xF4240; /*0x21d0*/
}
// Function at 0x21d8 __int64 IoWrite16(unsigned __int16 *a1, unsigned __int16 n1280, __int64 a3, double a4)
{
if ( ((unsigned __int8)a1 & 1) != 0 ) /*0x21eb*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c", 183, (__int64)"(Address & 1) == 0", a4); /*0x2200*/
*a1 = n1280; /*0x2205*/
return n1280; /*0x2210*/
}
// Function at 0x2218 unsigned __int32 IoRead32(unsigned __int16 n1288, __int64 a2, __int64 a3, double a4)
{
if ( (n1288 & 3) != 0 ) /*0x2224*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLibMsc.c", 193, (__int64)"(Port & 3) == 0", a4); /*0x2239*/
return __indword(n1288); /*0x2242*/
}
// Function at 0x2248 __int64 SerialPortWrite(unsigned __int8 *a1, __int64 a2)
{
int n0xFFFF; // r8d __int64 v3; // r10 unsigned __int16 n1016; // r9 unsigned __int8 n33; // al unsigned __int16 v7; // r9 unsigned __int8 v8; // al int Index; // ecx unsigned __int8 v11; // al unsigned __int64 n0x10; // rcx n0xFFFF = 0; /*0x2252*/
v3 = a2; /*0x2255*/
n1016 = 1016; /*0x2262*/
__outbyte(0x72u, 0x5Cu); /*0x226c*/
n33 = __inbyte(0x73u); /*0x2271*/
if ( n33 == 33 ) /*0x2274*/
n1016 = 760; /*0x2274*/
if ( a2 ) /*0x227b*/
{
LABEL_8:
Index = 0; /*0x22a4*/
while ( 1 ) /*0x22ab*/
{
v11 = __inbyte(n1016 + 5); /*0x22ab*/
if ( (v11 & 0x40) != 0 ) /*0x22ae*/
break; /*0x22ae*/
if ( ++Index == 0xFFFF ) /*0x22b8*/
return 0; /*0x22b8*/
}
n0x10 = 0; /*0x22bc*/
while ( v3 ) /*0x22c2*/
{
__outbyte(n1016, *a1); /*0x22ca*/
++n0x10; /*0x22cb*/
--v3; /*0x22ce*/
++a1; /*0x22d1*/
if ( n0x10 >= 0x10 ) /*0x22d8*/
{
if ( v3 ) /*0x22dd*/
goto LABEL_8; /*0x22dd*/
return a2; /*0x22dd*/
}
}
return a2; /*0x22df*/
}
else
{
v7 = n1016 + 5; /*0x227d*/
do /*0x2297*/
{
v8 = __inbyte(v7); /*0x2286*/
if ( (v8 & 0x60) == 0x60 ) /*0x228b*/
break; /*0x228b*/
++n0xFFFF; /*0x228d*/
}
while ( n0xFFFF != 0xFFFF ); /*0x2297*/
return 0; /*0x2299*/
}
}
// Function at 0x22f0 __int64 DebugAssertFormat(int a1, int n256, const char *ASSERT_[%a]_%a(%d):_%a_n, ...)
{
va_list va; // [rsp+58h] [rbp+20h] BYREF va_start(va, ASSERT_[%a]_%a(%d):_%a_n);
return AsciiVSPrint(a1, n256, 0, (_DWORD)ASSERT_[%a]_%a(%d):_%a_n, va); /*0x2312*/
}
// Function at 0x2318 _BYTE *SetMem16(_BYTE *a1, unsigned __int64 a2, __int64 i_1, __int16 a4, __int64 a5)
{
__int64 i; // r10 for ( i = 0; i < i_1; ++i ) /*0x231e*/
{
if ( (unsigned __int64)a1 >= a2 ) /*0x2323*/
break; /*0x2323*/
*a1 = a4; /*0x232b*/
if ( a5 != 1 ) /*0x232e*/
a1[1] = HIBYTE(a4); /*0x2337*/
a1 += a5; /*0x233a*/
}
return a1; /*0x234a*/
}
// Function at 0x234c _BYTE *ValueToHexStr(_BYTE *a1, unsigned __int64 a2, unsigned int a3, double a4)
{
unsigned __int64 v6; // rbp _BYTE *Index; // rbx unsigned __int64 v8; // rtt
*a1 = 0; /*0x2363*/
v6 = a3; /*0x2369*/
Index = a1; /*0x236c*/
do /*0x23a8*/
{
if ( !a3 ) /*0x2371*/
DebugAssert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\DivU64x32Remainder.c", 47, (__int64)"Divisor != 0", a4); /*0x2384*/
++Index; /*0x2395*/
v8 = a2; /*0x2398*/
a2 /= v6; /*0x239b*/
*Index = a0123456789abcd[(unsigned int)(v8 % v6)]; /*0x23a3*/
}
while ( a2 ); /*0x23a8*/
return Index; /*0x23bc*/
}
// Function at 0x31cc unsigned __int64 DebugPrintFormat(_BYTE *_r_n, unsigned __int64 n38, __int64 a3, char *%02d_%02d_%04d__%02d:%02d, ...)
{
va_list va; // [rsp+60h] [rbp+28h] BYREF va_start(va, %02d_%02d_%04d__%02d:%02d);
return AsciiVSPrint(_r_n, n38, a3, %02d_%02d_%04d__%02d:%02d, va); /*0x31e9*/
}
// Function at 0x31f0 __int64 GetSmmCommProtocol()
{
__int64 result; // rax __int64 v1; // rax __int64 Result; // rcx result = qword_4E08; /*0x31f6*/
if ( !qword_4E08 ) /*0x3202*/
{
v1 = (*(__int64 ( **)(void *, _QWORD, __int64 *))(BootServices + 320))(&unk_4C90, 0, &qword_4E08); /*0x321b*/
Result = qword_4E08; /*0x3221*/
if ( v1 < 0 ) /*0x322b*/
Result = 0; /*0x322b*/
qword_4E08 = Result; /*0x322f*/
return Result; /*0x3236*/
}
return result; /*0x3239*/
}
// Function at 0x3240 __int64 GetSmmLockBoxCommRegion(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 result; // rax __int64 Result; // rbx __int64 Index; // rdi unsigned int i_1; // r8d __int64 Index; // rcx unsigned int i; // edx __int64 v10; // [rsp+30h] [rbp+8h] BYREF result = qword_4E00; /*0x324a*/
Result = 0; /*0x3251*/
if ( !qword_4E00 ) /*0x3256*/
{
if ( (EfiGetSystemConfigurationTable((__int64)&unk_4C70, &v10, a3, a4) & 0x8000000000000000uLL) == 0LL ) /*0x326c*/
{
Index = v10; /*0x3272*/
if ( !v10 ) /*0x327a*/
DebugAssert( /*0x328d*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\SmmLockBoxLib\\SmmLockBoxDxeLib.c",
105,
(__int64)"PiSmmCommunicationRegionTable != ((void *) 0)",
a4);
i_1 = *(_DWORD *)(Index + 4); /*0x3292*/
Index = Index + 16; /*0x3296*/
for ( i = 0; i < i_1; Index += *(unsigned int *)(Index + 8) ) /*0x329f*/
{
if ( *(_DWORD *)Index == 7 && *(_QWORD *)(Index + 24) << 12 >= 0x50u ) /*0x32b2*/
break; /*0x32b2*/
++i; /*0x32b7*/
}
if ( i < i_1 ) /*0x32c4*/
Result = *(_QWORD *)(Index + 8); /*0x32c6*/
result = Result; /*0x32ca*/
}
else
{
result = 0; /*0x326e*/
}
qword_4E00 = Result; /*0x32cd*/
}
return result; /*0x32d9*/
}
// Function at 0x32e0 unsigned __int64 SaveLockBox(char *src, __int64 a2, __int64 a3, double a4)
{
__int64 v7; // rdx __int64 v8; // rcx __int64 ( **v9)(_QWORD, char *, __int64 *); // rdi __int64 v10; // r8 __int64 dst_1; // rax char *dst; // rbx __int64 Status; // rax __int64 Result; // rbx char v16; // [rsp+20h] [rbp-68h] BYREF __int64 n72; // [rsp+90h] [rbp+8h] BYREF DebugPrint(64, "SmmLockBoxDxeLib SaveLockBox - Enter\n"); /*0x3307*/
if ( !src || !a2 || !a3 ) /*0x3321*/
return 0x8000000000000002uLL; /*0x3403*/
v9 = (__int64 ( **)(_QWORD, char *, __int64 *))GetSmmCommProtocol(); /*0x332c*/
if ( !v9 ) /*0x3332*/
return 0x8000000000000013uLL; /*0x3334*/
dst_1 = GetSmmLockBoxCommRegion(v8, v7, v10, a4); /*0x3343*/
dst = &v16; /*0x334b*/
if ( dst_1 ) /*0x335d*/
dst = (char *)dst_1; /*0x335d*/
CopyMemS(dst, src_0, 0x10u); /*0x3364*/
*((_QWORD *)dst + 2) = 48; /*0x3372*/
*((_QWORD *)dst + 4) = -1; /*0x3379*/
*((_DWORD *)dst + 6) = 1; /*0x337e*/
*((_DWORD *)dst + 7) = 48; /*0x3389*/
CopyMemS(dst + 40, src, 0x10u); /*0x338c*/
*((_QWORD *)dst + 7) = a2; /*0x3391*/
*((_QWORD *)dst + 8) = a3; /*0x339d*/
n72 = 72; /*0x33a7*/
Status = (*v9)(v9, dst, &n72); /*0x33b3*/
if ( Status < 0 ) /*0x33b8*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x33c9*/
DebugAssert( /*0x33e1*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\SmmLockBoxLib\\SmmLockBoxDxeLib.c",
198,
(__int64)"!EFI_ERROR (Status)",
a4);
}
Result = *((_QWORD *)dst + 4); /*0x33e6*/
DebugPrint(64, "SmmLockBoxDxeLib SaveLockBox - Exit (%r)\n", Result); /*0x33f9*/
return Result; /*0x341a*/
}
// Function at 0x3424 unsigned __int64 SetLockBoxAttributes(char *src, __int64 n64_1, __int64 a3, double a4)
{
__int64 v5; // rdx __int64 v6; // rcx __int64 ( **v7)(_QWORD, char *, __int64 *); // rdi __int64 v8; // r8 __int64 dst_1; // rax char *dst; // rbx __int64 Status; // rax __int64 Result; // rbx char v14; // [rsp+20h] [rbp-48h] BYREF __int64 n64; // [rsp+78h] [rbp+10h] BYREF n64 = n64_1; /*0x3433*/
DebugPrint(64, "SmmLockBoxDxeLib SetLockBoxAttributes - Enter\n"); /*0x3450*/
if ( !src ) /*0x3458*/
return 0x8000000000000002uLL; /*0x352e*/
v7 = (__int64 ( **)(_QWORD, char *, __int64 *))GetSmmCommProtocol(); /*0x3463*/
if ( !v7 ) /*0x3469*/
return 0x8000000000000013uLL; /*0x346b*/
dst_1 = GetSmmLockBoxCommRegion(v6, v5, v8, a4); /*0x347a*/
dst = &v14; /*0x3482*/
if ( dst_1 ) /*0x3494*/
dst = (char *)dst_1; /*0x3494*/
CopyMemS(dst, src_0, 0x10u); /*0x349b*/
*((_QWORD *)dst + 2) = 40; /*0x34a9*/
*((_QWORD *)dst + 4) = -1; /*0x34b0*/
*((_DWORD *)dst + 6) = 4; /*0x34b5*/
*((_DWORD *)dst + 7) = 40; /*0x34c0*/
CopyMemS(dst + 40, src, 0x10u); /*0x34c3*/
*((_QWORD *)dst + 7) = 1; /*0x34c8*/
n64 = 64; /*0x34d8*/
Status = (*v7)(v7, dst, &n64); /*0x34e0*/
if ( Status < 0 ) /*0x34e5*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x34f6*/
DebugAssert( /*0x350e*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\SmmLockBoxLib\\SmmLockBoxDxeLib.c",
280,
(__int64)"!EFI_ERROR (Status)",
a4);
}
Result = *((_QWORD *)dst + 4); /*0x3513*/
DebugPrint(64, "SmmLockBoxDxeLib SetLockBoxAttributes - Exit (%r)\n", Result); /*0x3524*/
return Result; /*0x3549*/
}
// Function at 0x3550 unsigned __int64 RestoreLockBox(__int64 a1, __int64 a2, __int64 n72_1, double a4)
{
__int64 v4; // rdx __int64 v5; // rcx __int64 ( **v6)(_QWORD, char *, __int64 *); // rdi __int64 v7; // r8 __int64 dst_1; // rax char *dst; // rbx __int64 Status; // rax __int64 Result; // rbx char v13; // [rsp+20h] [rbp-58h] BYREF __int64 n72; // [rsp+90h] [rbp+18h] BYREF n72 = n72_1; /*0x3555*/
DebugPrint(64, "SmmLockBoxDxeLib RestoreLockBox - Enter\n"); /*0x356b*/
v6 = (__int64 ( **)(_QWORD, char *, __int64 *))GetSmmCommProtocol(); /*0x3575*/
if ( !v6 ) /*0x357b*/
return 0x8000000000000013uLL; /*0x357d*/
dst_1 = GetSmmLockBoxCommRegion(v5, v4, v7, a4); /*0x358c*/
dst = &v13; /*0x3594*/
if ( dst_1 ) /*0x35a6*/
dst = (char *)dst_1; /*0x35a6*/
CopyMemS(dst, src_0, 0x10u); /*0x35ad*/
*((_QWORD *)dst + 2) = 48; /*0x35bb*/
*((_QWORD *)dst + 4) = -1; /*0x35c6*/
*((_DWORD *)dst + 6) = 3; /*0x35cb*/
*((_DWORD *)dst + 7) = 48; /*0x35d6*/
CopyMemS( /*0x35d9*/
dst + 40,
aE, // "e"
0x10u);
*((_QWORD *)dst + 7) = 0; /*0x35de*/
*((_QWORD *)dst + 8) = 0; /*0x35eb*/
n72 = 72; /*0x35f6*/
Status = (*v6)(v6, dst, &n72); /*0x3602*/
if ( Status < 0 ) /*0x3607*/
{
DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x3618*/
DebugAssert( /*0x3630*/
(__int64)"e:\\hs\\MdeModulePkg\\Library\\SmmLockBoxLib\\SmmLockBoxDxeLib.c",
462,
(__int64)"!EFI_ERROR (Status)",
a4);
}
Result = *((_QWORD *)dst + 4); /*0x3635*/
DebugPrint(64, "SmmLockBoxDxeLib RestoreLockBox - Exit (%r)\n", Result); /*0x3648*/
return Result; /*0x3658*/
}