#include "117828F1-DA7D-4BC1-8B58-9A954FED5121.h"
// EfiInit.c - Extracted from 117828F1-DA7D-4BC1-8B58-9A954FED5121.c
// Functions: 16
// Function: RstUefiDriverEntryPoint @ 0x4058 (0x7d bytes)
// Index: 74/906
EFI_STATUS __fastcall RstUefiDriverEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
__int64 v3; // rax
__int64 v4; // rbx
EfiDriverInit(ImageHandle, SystemTable); /*0x4065*/
GetSystemMemoryMap(0); /*0x406c*/
v3 = MemAlloc(744); /*0x407d*/
v4 = v3; /*0x4082*/
if ( v3 ) /*0x4088*/
{
RstPrivateDataInit(v3, ImageHandle); /*0x4090*/
*(_QWORD *)(v4 + 720) = 0; /*0x4095*/
*(_QWORD *)(v4 + 728) = 0; /*0x409d*/
*(_BYTE *)(v4 + 736) = 0; /*0x40ac*/
*(_QWORD *)v4 = &off_23120; /*0x40b3*/
}
else
{
v4 = 0; /*0x40b8*/
}
qword_35410 = v4; /*0x40ba*/
return (*(EFI_STATUS (__fastcall **)(__int64))(*(_QWORD *)v4 + 16LL))(v4);
}
// Function: RstCreateNewContext @ 0x4c3c (0x69 bytes)
// Index: 106/906
_QWORD *__fastcall RstCreateNewContext(_QWORD *a1, __int64 a2, RST_PRIVATE_DATA *Private)
{
CfgArrayAllocBlock(a1, (__int64)Private); /*0x4c4f*/
*a1 = off_231B0; /*0x4c6c*/
a1[23] = a2; /*0x4c6f*/
a1[24] = 0; /*0x4c76*/
a1[25] = 0; /*0x4c7d*/
a1[78] = 0; /*0x4c84*/
a1[45] = 0; /*0x4c8b*/
MemZero((_BYTE *)a1 + 368, 0, 256); /*0x4c92*/
return a1; /*0x4c9f*/
}
// Function: RstInstallMultipleProtocols @ 0x5818 (0x5 bytes)
// Index: 131/906
// attributes: thunk
__int64 __fastcall RstInstallMultipleProtocols(__int64 a1)
{
return RstInstallProtocols(a1);
}
// Function: RstInstallClass @ 0x5838 (0x64 bytes)
// Index: 134/906
RST_LIST_ENTRY *__fastcall RstInstallClass(RST_PRIVATE_DATA *Private, void *Context)
{
_QWORD *Vtable_1; // rax
void *Vtable; // r11
_QWORD *v7; // rax
Vtable_1 = (_QWORD *)MemAlloc(24); /*0x5854*/
Vtable = Vtable_1; /*0x5859*/
if ( !Vtable_1 ) /*0x585f*/
return (RST_LIST_ENTRY *)0xFFFFFFFFLL; /*0x5861*/
*Vtable_1 = 0; /*0x5866*/
Vtable_1[2] = Context; /*0x586a*/
Vtable_1[1] = *(_QWORD *)&Private->Version; /*0x5872*/
v7 = *(_QWORD **)&Private->Version; /*0x5876*/
if ( v7 ) /*0x587d*/
*v7 = Vtable; /*0x587f*/
if ( !Private->Vtable ) /*0x5882*/
Private->Vtable = Vtable; /*0x5888*/
*(_QWORD *)&Private->Version = Vtable; /*0x588b*/
return 0; /*0x5896*/
}
// Function: RstCreateClass @ 0x58b0 (0x77 bytes)
// Index: 137/906
__int64 __fastcall RstCreateClass(__int64 a1, __int64 a2, RST_PRIVATE_DATA *Private)
{
*(_QWORD *)(a1 + 8) = a2; /*0x58b6*/
*(_BYTE *)(a1 + 16) = 0; /*0x58ba*/
*(_QWORD *)a1 = off_232D0; /*0x58c5*/
*(_QWORD *)(a1 + 24) = 0; /*0x58c8*/
*(_QWORD *)(a1 + 32) = 0; /*0x58cd*/
*(_QWORD *)(a1 + 40) = 0; /*0x58d2*/
*(_QWORD *)(a1 + 48) = Private; /*0x58df*/
*(_WORD *)(a1 + 56) = 256; /*0x58e3*/
sub_7D30((_QWORD *)(a1 + 72), a1); /*0x58ee*/
*(_DWORD *)(a1 + 104) = 0; /*0x58f3*/
*(_DWORD *)(a1 + 108) = 0; /*0x58f7*/
*(_QWORD *)(a1 + 112) = 0; /*0x58fb*/
*(_QWORD *)(a1 + 120) = 0; /*0x5900*/
*(_QWORD *)(a1 + 128) = 0; /*0x5905*/
*(_BYTE *)(a1 + 136) = 0; /*0x5914*/
*(_QWORD *)a1 = off_23320; /*0x591e*/
return a1; /*0x5921*/
}
// Function: RstUefiProtocolInstall @ 0x5928 (0x73 bytes)
// Index: 138/906
EFI_STATUS __fastcall RstUefiProtocolInstall(RST_PRIVATE_DATA *Private)
{
void (__fastcall ***Class)(void *, _QWORD); // rbx
__int64 v3; // rax
Class = 0; /*0x593f*/
if ( !RstCheckAlreadyStarted((__int64)Private, 0, 0) ) /*0x593a*/
{
v3 = MemAlloc(144); /*0x5952*/
if ( v3 ) /*0x595a*/
Class = (void (__fastcall ***)(void *, _QWORD))RstCreateClass(v3, 0, (__int64)Private); /*0x5969*/
RstInstallClass((RST_PRIVATE_DATA *)&Private->Private_, Class); /*0x5976*/
(**Class)(Class, 0); /*0x5983*/
}
return 0x8000000000000003uLL; /*0x5995*/
}
// Function: RstUefiProtocolEntry @ 0x59ac (0x4f bytes)
// Index: 140/906
__int64 __fastcall RstUefiProtocolEntry(__int64 a1)
{
__int64 v2; // rbx
v2 = RstHiiPackageInstall(a1); /*0x59be*/
if ( v2 >= 0 ) /*0x59c4*/
HiiCreateEventEx((__int64)&dword_278C0, 8, (__int64)RstHelper_599c, a1, a1 + 728); /*0x59e8*/
return v2; /*0x59f5*/
}
// Function: RstInstallProtocols @ 0x5b28 (0x84 bytes)
// Index: 149/906
__int64 __fastcall RstInstallProtocols(__int64 a1)
{
return (*(__int64 (__fastcall **)(_QWORD, void *, __int64, void *, __int64, void *, __int64, void *, __int64, void *, __int64, _QWORD))(qword_58070 + 336))( /*0x5ba7*/
*(_QWORD *)(a1 + 624),
&unk_27740,
a1 + 520,
&unk_27770,
a1 + 568,
&unk_27760,
a1 + 592,
&unk_27820,
a1 + 616,
&unk_27900,
a1 + 8,
0);
}
// Function: RstHiiPackageInstall @ 0x5bac (0x84 bytes)
// Index: 150/906
__int64 __fastcall RstHiiPackageInstall(__int64 a1)
{
__int64 result; // rax
result = (*(__int64 (__fastcall **)(__int64, void *, __int64, void *, __int64, void *, __int64, void *, __int64, _QWORD))(qword_58070 + 328))( /*0x5c16*/
a1 + 624,
&unk_27740,
a1 + 520,
&unk_27770,
a1 + 568,
&unk_27760,
a1 + 592,
&unk_27820,
a1 + 616,
0);
if ( result >= 0 ) /*0x5c1f*/
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 56LL))(a1); /*0x5c27*/
return result; /*0x5c2a*/
}
// Function: RstInstallHiiConfigAccess @ 0x5f10 (0x35 bytes)
// Index: 154/906
__int64 __fastcall RstInstallHiiConfigAccess(RST_PRIVATE_DATA *Private, char *VROC)
{
Private->HiiLibFunctions[0] = VROC; /*0x5f1a*/
return (*(__int64 (__fastcall **)(void **, void *, uint32_t *, _QWORD, _QWORD))(qword_58070 + 328))( /*0x5f40*/
&Private->ImageHandle,
&unk_27900,
&Private->Version,
0,
0);
}
// Function: RstDriverBindingStart @ 0x5fe0 (0xf bytes)
// Index: 157/906
EFI_STATUS __fastcall RstDriverBindingStart(RST_PRIVATE_DATA *Private)
{
_BYTE *v1; // rdx
_QWORD *v2; // r8
return RstParseUnicodeString(v1, &i_, v2);
}
/* Orphan comments:
"en-US"
*/
// Function: RstMainDispatch @ 0x5ff0 (0x41 bytes)
// Index: 158/906
__int64 __fastcall RstMainDispatch(_QWORD *a1)
{
__int64 **i; // rbx
__int64 result; // rax
for ( i = (__int64 **)a1[88]; i; i = (__int64 **)*i ) /*0x5ffa*/
{
result = (*(__int64 (__fastcall **)(__int64 *))(*i[2] + 40))(i[2]); /*0x600d*/
if ( result < 0 ) /*0x6013*/
return result; /*0x6013*/
}
return (*(__int64 (__fastcall **)(_QWORD *))(*a1 + 24LL))(a1); /*0x602b*/
}
// Function: RstUefiProtocolGuid @ 0x60c8 (0xbd bytes)
// Index: 161/906
EFI_STATUS __fastcall RstUefiProtocolGuid(RST_PRIVATE_DATA *Private)
{
__int64 **i; // rbx
char v3; // di
__int64 **v4; // rbx
char v5; // al
EFI_STATUS result; // rax
__int64 **j; // rbx
MemZero(Private->GuidProtocolArea, 0, 48); /*0x60e2*/
for ( i = (__int64 **)qword_35418[88]; i; i = (__int64 **)*i ) /*0x60ee*/
(*(void (__fastcall **)(__int64 *))(*i[2] + 48))(i[2]); /*0x60fe*/
sub_A750(); /*0x6109*/
RstParseRaidVariable(Private); /*0x611f*/
v3 = 1; /*0x612b*/
v4 = (__int64 **)qword_35418[88]; /*0x612e*/
while ( v4 )
{
v5 = (*(__int64 (__fastcall **)(__int64 *))(*v4[2] + 56))(v4[2]); /*0x613e*/
v4 = (__int64 **)*v4; /*0x6141*/
v3 = v5 != 0 ? v3 : 0;
}
sub_A278(); /*0x6150*/
for ( j = (__int64 **)qword_35418[88]; j; j = (__int64 **)*j ) /*0x615c*/
result = (*(__int64 (__fastcall **)(__int64 *))(*j[2] + 64))(j[2]); /*0x616c*/
LOBYTE(result) = v3; /*0x6177*/
return result; /*0x617f*/
}
// Function: RstPrivateDataInit @ 0x639c (0x368 bytes)
// Index: 168/906
__int64 __fastcall RstPrivateDataInit(__int64 a1, EFI_HANDLE ImageHandle)
{
__int64 v4; // rax
char *_en_US_; // rax
*(_QWORD *)a1 = &off_23400; /*0x63b2*/
*(_QWORD *)(a1 + 704) = 0; /*0x63b5*/
*(_QWORD *)(a1 + 712) = 0; /*0x63bd*/
MemZero((_BYTE *)(a1 + 632), 0, 48); /*0x63d3*/
*(_QWORD *)(a1 + 624) = ImageHandle; /*0x63d8*/
qword_35418 = (_QWORD *)a1; /*0x63df*/
*(_QWORD *)(a1 + 696) = 0; /*0x63e6*/
*(_QWORD *)(a1 + 520) = RstProtocolEfiCall; /*0x63f9*/
*(_QWORD *)(a1 + 528) = RstComponentNameGetDriverName; /*0x6409*/
*(_QWORD *)(a1 + 536) = RstComponentNameGetControllerName; /*0x641d*/
v4 = *(_QWORD *)(a1 + 624); /*0x6424*/
*(_DWORD *)(a1 + 544) = 11; /*0x642b*/
*(_QWORD *)(a1 + 552) = v4; /*0x6435*/
*(_QWORD *)(a1 + 560) = v4; /*0x643c*/
*(_QWORD *)(a1 + 568) = RstProtocolEfiCall2; /*0x644a*/
*(_DWORD *)(a1 + 616) = 8; /*0x6458*/
*(_QWORD *)(a1 + 576) = RstGetLanguage; /*0x6462*/
_en_US_ = off_27138[0]; // "en-US" /*0x6469*/
*(_DWORD *)(a1 + 620) = (_DWORD)&loc_20009 + 1; /*0x6470*/
*(_QWORD *)(a1 + 584) = _en_US_; /*0x647a*/
*(_QWORD *)(a1 + 592) = RstProtocolEfiCall3; /*0x6488*/
*(_QWORD *)(a1 + 600) = RstSetLanguage; /*0x6496*/
*(char **)(a1 + 608) = off_27140[0]; // "eng" /*0x64a4*/
MemZero((_BYTE *)(a1 + 8), 0, 512); /*0x64ab*/
*(_QWORD *)(a1 + 24) = sub_A8AC; /*0x64b7*/
*(_DWORD *)(a1 + 8) = 16; /*0x64c2*/
*(_QWORD *)(a1 + 32) = Assert_121; /*0x64c9*/
*(_DWORD *)(a1 + 12) = 512; /*0x64d4*/
*(_QWORD *)(a1 + 40) = RstHelper_ce6c; /*0x64db*/
*(_QWORD *)(a1 + 48) = Assert_116; /*0x64e6*/
*(_QWORD *)(a1 + 56) = sub_B0D8; /*0x64f1*/
*(_QWORD *)(a1 + 64) = sub_AC48; /*0x64fc*/
*(_QWORD *)(a1 + 72) = RstHelper_c8a8; /*0x6507*/
*(_QWORD *)(a1 + 80) = sub_AA5C; /*0x6512*/
*(_QWORD *)(a1 + 88) = Assert_129; /*0x651d*/
*(_QWORD *)(a1 + 96) = sub_AF6C; /*0x6528*/
*(_QWORD *)(a1 + 104) = sub_AF44; /*0x6533*/
*(_QWORD *)(a1 + 112) = sub_AEC0; /*0x653e*/
*(_QWORD *)(a1 + 120) = sub_AC84; /*0x6549*/
*(_QWORD *)(a1 + 128) = Assert_24; /*0x6554*/
*(_QWORD *)(a1 + 136) = sub_D600; /*0x6562*/
*(_QWORD *)(a1 + 144) = sub_D6CC; /*0x6570*/
*(_QWORD *)(a1 + 152) = sub_D764; /*0x657e*/
*(_QWORD *)(a1 + 168) = RstHelper_be04; /*0x658c*/
*(_QWORD *)(a1 + 176) = sub_DAAC; /*0x659a*/
*(_QWORD *)(a1 + 184) = sub_DB88; /*0x65a8*/
*(_QWORD *)(a1 + 192) = sub_A898; /*0x65b6*/
*(_QWORD *)(a1 + 200) = sub_B0C4; /*0x65c4*/
*(_QWORD *)(a1 + 208) = sub_AAB8; /*0x65d2*/
*(_QWORD *)(a1 + 216) = sub_AE2C; /*0x65e0*/
*(_QWORD *)(a1 + 160) = DxeInstall_3; /*0x65ee*/
*(_QWORD *)(a1 + 224) = sub_B014; /*0x65fc*/
*(_QWORD *)(a1 + 232) = sub_B4E4; /*0x660a*/
*(_QWORD *)(a1 + 240) = sub_B5D8; /*0x6618*/
*(_QWORD *)(a1 + 248) = sub_B5E0; /*0x6626*/
*(_QWORD *)(a1 + 256) = sub_BBD4; /*0x6634*/
*(_QWORD *)(a1 + 488) = Assert_19; /*0x6642*/
*(_QWORD *)(a1 + 472) = Assert_107; /*0x6650*/
*(_QWORD *)(a1 + 480) = Assert_29; /*0x665e*/
*(_QWORD *)(a1 + 496) = sub_BC94; /*0x666c*/
*(_QWORD *)(a1 + 504) = sub_CAAC; /*0x667a*/
*(_QWORD *)(a1 + 336) = RstHelper_6390; /*0x6688*/
*(_QWORD *)(a1 + 424) = j_j_HiiLibGuidIsZero; /*0x6696*/
*(_QWORD *)(a1 + 432) = j_j_HiiBlockCompare; /*0x66a4*/
*(_QWORD *)(a1 + 440) = sub_BD68; /*0x66b2*/
*(_QWORD *)(a1 + 448) = sub_B93C; /*0x66c0*/
*(_QWORD *)(a1 + 456) = j_j_HiiLibGuidToStr; /*0x66ce*/
*(_QWORD *)(a1 + 464) = j_j_HiiBlockCompareConst; /*0x66dc*/
*(_QWORD *)(a1 + 512) = sub_BDB0; /*0x66ea*/
sub_9370(); /*0x66f1*/
return a1; /*0x66fe*/
}
// Function: EfiDriverInit @ 0x6704 (0xe6 bytes)
// Index: 169/906
__int64 __fastcall EfiDriverInit(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
char v4; // al
__int64 SystemTable_1; // r8
::SystemTable = SystemTable; /*0x6714*/
v4 = RstDebugEnabled(); /*0x671b*/
SystemTable_1 = ::SystemTable; /*0x6720*/
if ( v4 && !::SystemTable ) /*0x672e*/
{
DebugAssert("EfiInit.cpp", 0x1Au, "gST != 0"); /*0x6743*/
SystemTable_1 = ::SystemTable; /*0x6748*/
}
qword_58070 = *(_QWORD *)(SystemTable_1 + 96); /*0x6753*/
RuntimeServices = *(_QWORD *)(SystemTable_1 + 88); /*0x675e*/
if ( RstDebugEnabled() && !qword_58070 ) /*0x6776*/
DebugAssert("EfiInit.cpp", 0x1Du, "gBS != 0"); /*0x678b*/
if ( RstDebugEnabled() && !RuntimeServices ) /*0x67a1*/
DebugAssert("EfiInit.cpp", 0x1Eu, "gRT != 0"); /*0x67b6*/
if ( RstDebugEnabled2() )
DebugPrintSerial(64, "efiDxeInitialize: Started\n");
return RstDriverInit2(ImageHandle, SystemTable); /*0x67e0*/
}
// Function: RstInstallConfigAccess @ 0x67fc (0x34 bytes)
// Index: 171/906
__int64 __fastcall RstInstallConfigAccess(_QWORD *Private, _QWORD **p_i)
{
_QWORD *i; // r8
_QWORD *Private_1; // r9
__int64 v4; // rax
i = *p_i; /*0x67fc*/
Private_1 = Private; /*0x67ff*/
if ( (_QWORD *)*Private != *p_i ) /*0x6808*/
Private = (_QWORD *)i[1]; /*0x680a*/
*Private = **p_i; /*0x680e*/
v4 = i[1]; /*0x6811*/
if ( (_QWORD *)Private_1[1] == i ) /*0x6819*/
Private_1[1] = v4; /*0x681b*/
else
*(_QWORD *)(*i + 8LL) = v4; /*0x6824*/
return MemFree();
}