/*
* Module: AmiTcgPlatformPeiAfterMem.efi
* File: 0391_AmiTcgPlatformPeiAfterMem
* Arch: IA32 (32-bit)
* Base: 0xffc18f74
* Functions: 80 (all renamed)
* Description: TCG Platform PEI After Memory - handles TPM measurements,
* Boot Guard TCG2 event logging, firmware volume measurement.
* Source files: AmiTcgPlatformPeiAfterMem.c, BootGuardTCG2.c,
* AmiTcgPlatformPeiLib.c, IoLib.c, BaseLib, PeiHobLib
* Decompiled by: BIOS RE Agent
*/
#include <Uefi.h>
#include <Pi/PiPeiCis.h>
#include <Protocol/TcgService.h>
#include <Ppi/Tcg.h>
#include <Ppi/TpmDevice.h>
// Function: 0xffe19188
char *__cdecl SetMem(char *dst, char *src, unsigned int count)
{
unsigned int count_1; // edx
char *dst_1; // edi
char *src_1; // esi
count_1 = count; /*0xffe19192*/
if ( src < dst && &src[count - 1] >= dst ) /*0xffe191a0*/
{
src_1 = &src[count - 1]; /*0xffe191b4*/
dst_1 = &dst[count - 1]; /*0xffe191b6*/
}
else
{
count_1 = count & 3; /*0xffe191a4*/
qmemcpy(dst, src, 4 * (count >> 2)); /*0xffe191ad*/
src_1 = &src[4 * (count >> 2)]; /*0xffe191ad*/
dst_1 = &dst[4 * (count >> 2)]; /*0xffe191ad*/
}
qmemcpy(dst_1, src_1, count_1); /*0xffe191bd*/
return dst; /*0xffe191c4*/
}
// Function: 0xffe191c8
int __cdecl CompareMem(_BYTE *a1, _BYTE *a2, int a3)
{
bool v6; // zf
do /*0xffe191d6*/
{
if ( !a3 ) /*0xffe191d6*/
break; /*0xffe191d6*/
v6 = *a1++ == *a2++; /*0xffe191d6*/
--a3; /*0xffe191d6*/
}
while ( v6 ); /*0xffe191d6*/
return (unsigned __int8)*(a1 - 1) - (unsigned __int8)*(a2 - 1); /*0xffe191e2*/
}
// Function: 0xffe19268
void *__cdecl ZeroMem(void *buf, unsigned int count, char value)
{
memset(buf, value, count); /*0xffe19275*/
return buf; /*0xffe1927b*/
}
// Function: 0xffe192a8
int __cdecl CopyMemWrapper(int a1, int a2, int a3, int a4)
{
do /*0xffe192c1*/
{
*(_DWORD *)(a1 + 8 * a2 - 8) = a3; /*0xffe192b9*/
*(_DWORD *)(a1 + 8 * a2-- - 4) = a4; /*0xffe192bd*/
}
while ( a2 ); /*0xffe192c1*/
return a1; /*0xffe192c5*/
}
// Function: 0xffe192c8
void *__cdecl SetMemWrapper(void *buf, unsigned int count, int value)
{
memset32(buf, value, count); /*0xffe192d5*/
return buf; /*0xffe192db*/
}
// Function: 0xffe192e8
EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
int PcdPtr; // eax
if ( *(char *)(PeiGetPcdPtr() + 1024068) >= 0 ) /*0xffe192f8*/
{
PeiWriteIoPort(); /*0xffe192fa*/
PcdPtr = PeiGetPcdPtr(); /*0xffe192ff*/
*(_BYTE *)(PcdPtr + 1024068) |= 0x80u; /*0xffe1930a*/
}
return (*(int (__cdecl **)(EFI_SYSTEM_TABLE *, void *))(LODWORD(SystemTable->Hdr.Signature) + 24))( /*0xffe1931e*/
SystemTable,
&unk_FFE21718);
}
// Function: 0xffe19320
// String: Status = %r
int __fastcall TpmMeasureDigestIntoPCR(int a1, int *this, unsigned int a3, int a4)
{
int result; // eax
int v7; // esi
int v8; // eax
int v9; // esi
int v10; // [esp+Ch] [ebp-8h] BYREF
int v11; // [esp+10h] [ebp-4h] BYREF
result = (*(int (__cdecl **)(int *, int, int *))(*this + 76))(this, 34, &v10); /*0xffe19335*/
if ( result >= 0 ) /*0xffe1933d*/
{
result = (*(int (__cdecl **)(int *, int, int *))(*this + 76))(this, 34, &v11); /*0xffe1934c*/
if ( result >= 0 ) /*0xffe19354*/
{
(*(void (__cdecl **)(int, int, _DWORD))(*this + 84))(v10, 34, 0); /*0xffe19364*/
v7 = v10; /*0xffe19367*/
*(_WORD *)v10 = -16128; /*0xffe19372*/
v7 += 10; /*0xffe19375*/
*(_DWORD *)(v10 + 2) = 570425344; /*0xffe1937c*/
*(_DWORD *)(v10 + 6) = 335544320; /*0xffe19387*/
v8 = *this; /*0xffe193b9*/
a3 = (((a3 << 16) | a3 & 0xFF00) << 8) | ((HIWORD(a3) | a3 & 0xFF0000) >> 8); /*0xffe193bd*/
(*(void (__cdecl **)(int, unsigned int *, int))(v8 + 80))(v7, &a3, 4); /*0xffe193c1*/
(*(void (__cdecl **)(int, int, int))(*this + 80))(v7 + 4, a4, 20); /*0xffe193d0*/
v9 = (*(int (__cdecl **)(int, int *, int, int, int, int))(a1 + 8))(a1, this, 34, v10, 34, v11); /*0xffe193e2*/
DebugPrintWrapper(64, "Status = %r\n", v9); /*0xffe193ec*/
return v9; /*0xffe193f4*/
}
}
return result; /*0xffe193f7*/
}
// Function: 0xffe193fd
// String: [%d] Enter MeasureLogDxeFwVol
// String: FwVolHobCount = %x
// String: TpmFwVolHob[i].Size = %x
// String: TpmFwVolHob[i].baseAddress = %lx
// String: MeasureLogDxeFwVol - %r
int __fastcall MeasureLogDxeFwVol(int *this, int *a2, void (__cdecl **a3)(_DWORD, int), int a4)
{
int result; // eax
int *p_src; // esi
int v8; // ebx
unsigned int *v9; // ecx
unsigned int *v10; // ecx
int v11; // ebp
int v12; // esi
int n2; // ecx
unsigned int *v14; // [esp+10h] [ebp-7Ch] BYREF
_BYTE v15[4]; // [esp+14h] [ebp-78h] BYREF
_BYTE v16[20]; // [esp+18h] [ebp-74h] BYREF
_DWORD v17[24]; // [esp+2Ch] [ebp-60h] BYREF
v14 = 0; /*0xffe19400*/
DebugPrintWrapper(64, "[%d] Enter MeasureLogDxeFwVol\n", 212); /*0xffe19418*/
result = (*(int (__cdecl **)(int *, int, unsigned int **))(*this + 76))(this, 48, &v14); /*0xffe19427*/
if ( result >= 0 ) /*0xffe1942f*/
{
p_src = a2 + 3; /*0xffe19439*/
v8 = *a2; /*0xffe1943c*/
*v14 = 0; /*0xffe1943f*/
v14[1] = 1; /*0xffe19446*/
v14[7] = 16; /*0xffe19451*/
v9 = v14; /*0xffe19458*/
v14[8] = a2[3]; /*0xffe1945e*/
v9[9] = a2[4]; /*0xffe19464*/
v10 = v14; /*0xffe19467*/
v14[10] = a2[5]; /*0xffe1946e*/
v10[11] = 0; /*0xffe19471*/
InitHashContext(v17); /*0xffe19479*/
DebugPrintWrapper(64, "FwVolHobCount = %x \n", v8); /*0xffe19486*/
for ( ; v8; --v8 ) /*0xffe19490*/
{
DebugPrintWrapper(64, "TpmFwVolHob[i].Size = %x \n", p_src[2]); /*0xffe1949c*/
DebugPrintWrapper(64, "TpmFwVolHob[i].baseAddress = %lx \n", *p_src); /*0xffe194ad*/
AllocateAndMeasureFwVol((char *)v17, (char *)*p_src, p_src[2]); /*0xffe194bb*/
p_src += 6; /*0xffe194c3*/
}
HashFirmwareVolume((int)v16, (int)v17); /*0xffe194d3*/
(*(void (__cdecl **)(unsigned int *, _BYTE *, int))(*this + 80))(v14 + 2, v16, 20); /*0xffe194e9*/
(*a3)(a3, (int)this); /*0xffe194f5*/
v11 = TpmMeasureDigestIntoPCR(a4, this, *v14, (int)(v14 + 2)); /*0xffe19516*/
a3[1](a3, (int)this); /*0xffe19518*/
if ( v11 >= 0 ) /*0xffe19520*/
{
v12 = (*(int (__cdecl **)(int, int *, unsigned int *, _BYTE *))(a4 + 4))(a4, this, v14, v15); /*0xffe19534*/
DebugPrintWrapper(64, "MeasureLogDxeFwVol - %r\n", v12); /*0xffe1953e*/
if ( byte_FFE2177C ) /*0xffe19552*/
PeiPcdSetSku(1, 50563599, n2, (int)&unk_FFE216E8, 0); /*0xffe19561*/
DelayMicroseconds(1, 50563599); /*0xffe1956e*/
return v12; /*0xffe19573*/
}
else
{
return v11; /*0xffe19522*/
}
}
return result; /*0xffe19575*/
}
// Function: 0xffe1957d
int __fastcall PeiServicesGetBootMode(int p_FirmwareVolumeInfo, _DWORD *a2, char *FirmwareVolumeInfo)
{
unsigned int BootGuardPolicy; // eax
if ( !p_FirmwareVolumeInfo ) /*0xffe19585*/
return -2147483646; /*0xffe19587*/
if ( FirmwareVolumeInfo ) /*0xffe19594*/
BootGuardPolicy = GetBootGuardPolicy(FirmwareVolumeInfo); /*0xffe195a8*/
else
BootGuardPolicy = GetFirmwareVolumeInfo(); /*0xffe19596*/
*(_DWORD *)p_FirmwareVolumeInfo = BootGuardPolicy; /*0xffe1959b*/
if ( !BootGuardPolicy ) /*0xffe1959f*/
return -2147483634; /*0xffe195a1*/
*a2 = *(_DWORD *)(*(_DWORD *)p_FirmwareVolumeInfo + 28); /*0xffe195b4*/
return 0; /*0xffe195b8*/
}
// Function: 0xffe195bb
// String: RomArea->Address = %x
// String: RomArea->Size = %x
// String: Hob created
// String: Failed to create TCG/TPM Hob Status = %r
// String: TpmFwVolHob->Size = %x
int __thiscall TcgPlatformAfterMemInit(int *this)
{
unsigned int v1; // edi
int *this_1; // ebx
unsigned int v3; // ebp
int result; // eax
int FirmwareVolumeInfo; // eax
int FirmwareVolumeInfo_1; // esi
_DWORD *v7; // edi
int v8; // ecx
int v9; // eax
int v10; // eax
int v11; // esi
_DWORD *v12; // edi
int v13; // edx
unsigned int *v14; // esi
unsigned int v15; // ebx
unsigned int v16; // eax
int v17; // [esp-8h] [ebp-148h]
unsigned int v18; // [esp-4h] [ebp-144h]
int v19; // [esp+14h] [ebp-12Ch] BYREF
int v20; // [esp+18h] [ebp-128h] BYREF
int FirmwareVolumeInfo_2; // [esp+1Ch] [ebp-124h] BYREF
int v22; // [esp+20h] [ebp-120h] BYREF
int v23; // [esp+24h] [ebp-11Ch] BYREF
void (__cdecl **v24)(_DWORD, int); // [esp+28h] [ebp-118h] BYREF
int *this_2; // [esp+2Ch] [ebp-114h]
int v26; // [esp+3Ch] [ebp-104h]
unsigned int v27; // [esp+40h] [ebp-100h]
_QWORD v28[28]; // [esp+44h] [ebp-FCh] BYREF
char v29[28]; // [esp+124h] [ebp-1Ch] BYREF
v1 = 0; /*0xffe195cb*/
this_1 = this; /*0xffe195d1*/
v24 = 0; /*0xffe195d3*/
this_2 = this; /*0xffe195dc*/
v23 = 0; /*0xffe195e0*/
v3 = 0; /*0xffe195e4*/
v22 = 0; /*0xffe195e6*/
v19 = 0; /*0xffe195ea*/
if ( LocateTcgOrTpmPpi((int)this, (int)&v24, (int)&v23) >= 0 ) /*0xffe195f6*/
{
FirmwareVolumeInfo = GetFirmwareVolumeInfo(); /*0xffe19611*/
FirmwareVolumeInfo_1 = FirmwareVolumeInfo; /*0xffe19616*/
FirmwareVolumeInfo_2 = FirmwareVolumeInfo; /*0xffe19618*/
if ( FirmwareVolumeInfo ) /*0xffe1961e*/
{
v7 = v28; /*0xffe19623*/
v20 = *(_DWORD *)(FirmwareVolumeInfo + 28); /*0xffe19627*/
do /*0xffe19693*/
{
if ( (*(_DWORD *)(FirmwareVolumeInfo_1 + 36) & 0x8200) == 0x8200 /*0xffe19647*/
|| (*(_BYTE *)(FirmwareVolumeInfo_1 + 36) & 0xA) != 0 && (*(_DWORD *)(FirmwareVolumeInfo_1 + 36) & 0x400) == 0 )
{
v9 = *(_DWORD *)(FirmwareVolumeInfo_1 + 28); /*0xffe1964f*/
v8 = *(_DWORD *)(FirmwareVolumeInfo_1 + 20); /*0xffe19649*/
v17 = *(_DWORD *)(FirmwareVolumeInfo_1 + 16); /*0xffe19653*/
*(v7 - 2) = v17; /*0xffe1965b*/
*(v7 - 1) = v8; /*0xffe1965e*/
*v7 = v9; /*0xffe19661*/
DebugPrintWrapper(64, "RomArea->Address = %x \n", v17); /*0xffe19663*/
DebugPrintWrapper(64, "RomArea->Size = %x \n", *(_DWORD *)(FirmwareVolumeInfo_1 + 28)); /*0xffe19672*/
++v3; /*0xffe1967a*/
v7 += 6; /*0xffe1967b*/
}
PeiServicesGetBootMode((int)&FirmwareVolumeInfo_2, &v20, (char *)FirmwareVolumeInfo_1); /*0xffe19687*/
FirmwareVolumeInfo_1 = FirmwareVolumeInfo_2; /*0xffe1968c*/
}
while ( FirmwareVolumeInfo_2 ); /*0xffe19693*/
v1 = 0; /*0xffe19695*/
}
else
{
v26 = -15663104; /*0xffe1969b*/
v27 = 0; /*0xffe196a3*/
v3 = 1; /*0xffe196a7*/
LODWORD(v28[0]) = 11137024; /*0xffe196a8*/
}
v10 = (*(int (__cdecl **)(int *, int, unsigned int, int *))(*this_1 + 52))(this_1, 4, 24 * (v3 + 1), &v19); /*0xffe196c1*/
v11 = v10; /*0xffe196c4*/
if ( v10 >= 0 ) /*0xffe196cb*/
{
DebugPrintWrapper(64, "Hob created \n"); /*0xffe196e6*/
v12 = (_DWORD *)(v19 + 8); /*0xffe196f6*/
*(_DWORD *)(v19 + 8) = unk_FFE216D8; /*0xffe196f9*/
*++v12 = unk_FFE216DC; /*0xffe196fa*/
*++v12 = unk_FFE216E0; /*0xffe196fb*/
v12[1] = unk_FFE216E4; /*0xffe196fc*/
v1 = 0; /*0xffe196fd*/
v11 = 0; /*0xffe196ff*/
}
else
{
DebugPrintWrapper(64, "Failed to create TCG/TPM Hob Status = %r \n", v10); /*0xffe196d5*/
}
if ( v11 >= 0 ) /*0xffe19703*/
{
if ( (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int *))(*this_1 + 32))(this_1, &unk_FFE21638, 0, 0, &v22) >= 0 ) /*0xffe19723*/
{
result = (*(int (__cdecl **)(int *, char *))(v22 + 4))(this_1, v29); /*0xffe1973c*/
v20 = result; /*0xffe1973f*/
if ( result >= 0 ) /*0xffe19747*/
{
v13 = v19; /*0xffe1974d*/
v14 = (unsigned int *)(v19 + 24); /*0xffe19751*/
if ( v3 ) /*0xffe19756*/
{
v15 = v28[0]; /*0xffe1975c*/
do /*0xffe197e1*/
{
if ( v1 ) /*0xffe19762*/
{
*v14 = 0; /*0xffe19779*/
v14[5] = v28[3 * v1]; /*0xffe19780*/
v14[3] = *(&v26 + 6 * v1); /*0xffe19787*/
v16 = *(&v27 + 6 * v1); /*0xffe1978a*/
}
else
{
v14[3] = v26; /*0xffe19768*/
v16 = v27; /*0xffe1976b*/
v14[5] = v15; /*0xffe1976f*/
*v14 = v3; /*0xffe19772*/
}
v18 = v14[5]; /*0xffe1978e*/
v14[1] = 0; /*0xffe19791*/
v14[4] = v16; /*0xffe1979c*/
DebugPrintWrapper(64, "TpmFwVolHob->Size = %x \n", v18); /*0xffe1979f*/
DebugPrintWrapper(64, "TpmFwVolHob->baseAddress = %x \n", v14[3]); /*0xffe197b4*/
DebugPrintWrapper(64, "TpmFwVolHob->Tcg2SpecVersion = %x \n", v14[1]); /*0xffe197c3*/
DebugPrintWrapper(64, "TpmFwVolHob address = %x \n", v14); /*0xffe197d3*/
v14 += 6; /*0xffe197db*/
++v1; /*0xffe197de*/
}
while ( v1 < v3 ); /*0xffe197e1*/
v13 = v19; /*0xffe197e7*/
this_1 = this_2; /*0xffe197eb*/
}
MeasureLogDxeFwVol(this_1, (int *)(v13 + 24), v24, v23); /*0xffe197fc*/
return v20; /*0xffe19801*/
}
}
else
{
return -2147483634; /*0xffe19725*/
}
}
else
{
return v11; /*0xffe19705*/
}
}
else
{
DebugPrintWrapper(0x80000000, "\n LocateTcgPpi is failed \n"); /*0xffe19602*/
return -2147483634; /*0xffe19607*/
}
return result; /*0xffe19807*/
}
// Function: 0xffe1980f
int __cdecl PeiServicesInstallPpi(int a1)
{
int v1; // esi
v1 = a1; /*0xffe19813*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)a1 + 32))(a1, &unk_FFE216C8, 0, 0, &a1) < 0 ) /*0xffe1982e*/
return 0; /*0xffe19839*/
else
return (*(int (__cdecl **)(int))a1)(v1); /*0xffe19834*/
}
// Function: 0xffe1983e
int __cdecl PeiServicesRegisterPpiNotify(int (__cdecl **n17_1)(void *))
{
int (__cdecl **n17)(void *); // ebx
int (__cdecl *v2)(void *); // eax
int result; // eax
char dst_1[36]; // [esp+4h] [ebp-74h] BYREF
_DWORD dst[9]; // [esp+28h] [ebp-50h] BYREF
__int16 v6; // [esp+4Ch] [ebp-2Ch] BYREF
int n201326592; // [esp+4Eh] [ebp-2Ah]
int n167772224; // [esp+52h] [ebp-26h]
char dst_2[6]; // [esp+56h] [ebp-22h] BYREF
_BYTE v10[6]; // [esp+5Ch] [ebp-1Ch] BYREF
int v11; // [esp+62h] [ebp-16h]
int n0x2000; // [esp+68h] [ebp-10h] BYREF
int n2048; // [esp+6Ch] [ebp-Ch] BYREF
int v14; // [esp+70h] [ebp-8h] BYREF
int (__cdecl **v15)(_DWORD, int (__cdecl **)(void *)); // [esp+74h] [ebp-4h] BYREF
n17 = n17_1; /*0xffe19845*/
n0x2000 = 0x2000; /*0xffe1984d*/
v2 = *n17_1; /*0xffe19856*/
n2048 = 2048; /*0xffe1985f*/
v15 = 0; /*0xffe19866*/
v14 = 0; /*0xffe19869*/
if ( (*((int (__cdecl **)(int (__cdecl **)(void *), void *, _DWORD, _DWORD, int (__cdecl ***)(void *)))v2 + 8))( /*0xffe19874*/
n17_1,
&unk_FFE21618,
0,
0,
&n17_1) >= 0 )
return (*n17_1)(n17); /*0xffe1987d*/
if ( IsTpmPresent() ) /*0xffe19882*/
return 0; /*0xffe19889*/
n201326592 = 201326592; /*0xffe19894*/
v6 = -16128; /*0xffe1989b*/
n167772224 = 167772224; /*0xffe1989f*/
if ( !IsTpmPresent() ) /*0xffe198a6*/
TpmSelfTest(n17); /*0xffe198b1*/
if ( LocateTcgOrTpmPpi((int)n17, (int)&v15, (int)&v14) < 0 ) /*0xffe198c7*/
return -2147483634; /*0xffe198ce*/
qmemcpy(dst, TpmTcgGetCapability(dst_1), sizeof(dst)); /*0xffe198e9*/
if ( BYTE2(dst[5]) == 1 ) /*0xffe198fa*/
{
result = (*v15)(v15, n17); /*0xffe198fc*/
if ( result >= 0 ) /*0xffe19902*/
{
CopyMem(dst_2, (char *)&n2048, 2u); /*0xffe19910*/
(*(void (__cdecl **)(int, int (__cdecl **)(void *), int, __int16 *, int, _BYTE *))(v14 + 8))( /*0xffe19926*/
v14,
n17,
12,
&v6,
10,
v10);
result = v15[1](v15, n17); /*0xffe1992e*/
if ( result >= 0 ) /*0xffe19936*/
return 0; /*0xffe199d2*/
}
}
else
{
result = (*v15)(v15, n17); /*0xffe19941*/
if ( result >= 0 ) /*0xffe19947*/
{
CopyMem(dst_2, (char *)&n0x2000, 2u); /*0xffe19955*/
(*(void (__cdecl **)(int, int (__cdecl **)(void *), int, __int16 *, int, _BYTE *))(v14 + 8))( /*0xffe1996b*/
v14,
n17,
12,
&v6,
10,
v10);
CopyMem(dst_2, (char *)&n2048, 2u); /*0xffe19976*/
(*(void (__cdecl **)(int, int (__cdecl **)(void *), int, __int16 *, int, _BYTE *))(v14 + 8))( /*0xffe1998c*/
v14,
n17,
12,
&v6,
10,
v10);
result = v15[1](v15, n17); /*0xffe19994*/
if ( result >= 0 ) /*0xffe1999c*/
{
if ( v11 ) /*0xffe199a2*/
{
DelayMicroseconds(-2147483646, 50563590); /*0xffe199ae*/
return -2147483641; /*0xffe199b8*/
}
if ( (_WORD)n2048 == 1024 ) /*0xffe199c3*/
DelayMicroseconds(1, 50563590); /*0xffe199cd*/
return 0; /*0xffe199cd*/
}
}
}
return result; /*0xffe199d4*/
}
// Function: 0xffe199d9
// String:
ASSERT_EFI_ERROR (Status = %r)
// String: e:\hs\AmiModulePkg\TCG2\Common\AmiTcgPlatformPei\AmiTcgPlatformPeiAfterMem.c
// String: !EFI_ERROR (Status)
// String: Error: Failure %d %a Status = %r
// String: MemoryPresentEntry
int __cdecl TcgPlatformPeiEntry(int *n17)
{
int *n17_1; // ebx
int v2; // eax
int result; // eax
int v4; // eax
int v5; // eax
_DWORD *v6; // edi
int v7; // eax
_DWORD *v8; // edi
_DWORD *v9; // esi
int v10; // eax
int v11; // esi
int v12; // eax
int v13; // [esp+10h] [ebp-14h] BYREF
int v14; // [esp+14h] [ebp-10h] BYREF
int (__cdecl **v15)(int *); // [esp+18h] [ebp-Ch] BYREF
int v16; // [esp+1Ch] [ebp-8h] BYREF
int v17; // [esp+20h] [ebp-4h] BYREF
n17_1 = n17; /*0xffe199dd*/
v2 = *n17; /*0xffe199e8*/
v17 = 0; /*0xffe199f5*/
v16 = 0; /*0xffe199f9*/
if ( (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int (__cdecl ***)(int *)))(v2 + 32))( /*0xffe19a05*/
n17,
&unk_FFE21688,
0,
0,
&v15) >= 0 )
return (*v15)(n17_1); /*0xffe19a0c*/
v4 = (*(int (__cdecl **)(int *, int **))(*n17_1 + 40))(n17_1, &n17); /*0xffe19a1c*/
if ( v4 < 0 ) /*0xffe19a23*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0xffe19a30*/
v5 = AssertReport(); /*0xffe19a38*/
if ( v5 ) /*0xffe19a3f*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffe19a50*/
"e:\\hs\\AmiModulePkg\\TCG2\\Common\\AmiTcgPlatformPei\\AmiTcgPlatformPeiAfterMem.c",
1452,
"!EFI_ERROR (Status)");
}
result = TpmStartup(n17_1, (int)n17); /*0xffe19a5c*/
if ( result >= 0 )
{
if ( n17 == (int *)17 || n17 == (int *)32 )
{
return 0; /*0xffe19ba0*/
}
else
{
result = (*(int (__cdecl **)(int *, int, int, int *))(*n17_1 + 52))(n17_1, 4, 28, &v13); /*0xffe19a8b*/
if ( result >= 0 )
{
v6 = (_DWORD *)(v13 + 8); /*0xffe19aa4*/
*(_DWORD *)(v13 + 8) = unk_FFE21608; /*0xffe19aa7*/
*++v6 = unk_FFE2160C; /*0xffe19aa8*/
*++v6 = unk_FFE21610; /*0xffe19aa9*/
v6[1] = unk_FFE21614; /*0xffe19aaa*/
v7 = *n17_1; /*0xffe19abb*/
v13 += 24; /*0xffe19ac4*/
(*(void (__cdecl **)(int, int **, int))(v7 + 80))(v13, &n17, 4); /*0xffe19ac8*/
result = (*(int (__cdecl **)(int *, int, int, int *))(*n17_1 + 52))(n17_1, 4, 320, &v14); /*0xffe19ada*/
if ( result >= 0 )
{
v8 = (_DWORD *)(v14 + 8); /*0xffe19af3*/
*(_DWORD *)(v14 + 8) = unk_FFE216B8; /*0xffe19af6*/
*++v8 = unk_FFE216BC; /*0xffe19af7*/
*++v8 = unk_FFE216C0; /*0xffe19af8*/
v8[1] = unk_FFE216C4; /*0xffe19af9*/
v9 = (_DWORD *)(v14 + 24); /*0xffe19b08*/
(*(void (__cdecl **)(int, int, _DWORD))(*n17_1 + 84))(v14 + 24, 40, 0); /*0xffe19b0f*/
*v9 = 256; /*0xffe19b16*/
if ( LocateTcgOrTpmPpi((int)n17_1, (int)&v17, (int)&v16) >= 0 )
{
if ( !IsTpmPresent() )
{
v10 = BootGuardTcg2MeasureCRTMVersion(n17_1); /*0xffe19b40*/
v11 = v10; /*0xffe19b45*/
if ( v10 < 0 )
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v10); /*0xffe19b58*/
v12 = AssertReport(); /*0xffe19b60*/
if ( v12 ) /*0xffe19b67*/
(*(void (__cdecl **)(const char *, int, const char *))(v12 + 4))( /*0xffe19b78*/
"e:\\hs\\AmiModulePkg\\TCG2\\Common\\AmiTcgPlatformPei\\AmiTcgPlatformPeiAfterMem.c",
1504,
"!EFI_ERROR (Status)");
DebugPrintWrapper(0x80000000, "Error: Failure %d %a Status = %r\n", 1507, "MemoryPresentEntry", v11);
}
}
return TcgPlatformAfterMemInit(n17_1); /*0xffe19b99*/
}
else
{
return -2147483634; /*0xffe19b2f*/
}
}
}
}
}
return result; /*0xffe19ba2*/
}
// Function: 0xffe19baa
// String: e:\hs\MdePkg\Library\BaseMemoryLibRepStr\CopyMemWrapper.c
// String: (Length - 1) <= (0xFFFFFFFF - (UINTN)DestinationBuffer)
// String: (Length - 1) <= (0xFFFFFFFF - (UINTN)SourceBuffer)
char *__fastcall CopyMem(char *dst, char *src, unsigned int count)
{
int v5; // eax
int v6; // eax
if ( count - 1 > -1 - (int)dst ) /*0xffe19bc0*/
{
v5 = AssertReport(); /*0xffe19bc2*/
if ( v5 ) /*0xffe19bc9*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffe19bd7*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
56,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)DestinationBuffer)");
}
if ( count - 1 > -1 - (int)src ) /*0xffe19be1*/
{
v6 = AssertReport(); /*0xffe19be3*/
if ( v6 ) /*0xffe19bea*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffe19bf8*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
57,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)SourceBuffer)");
}
if ( dst == src ) /*0xffe19c00*/
return dst; /*0xffe19c02*/
else
return SetMem(dst, src, count); /*0xffe19c0c*/
}
// Function: 0xffe19c19
int AssertReport()
{
int Next; // eax
_BYTE v2[4]; // [esp+0h] [ebp-8h] BYREF
int v3; // [esp+4h] [ebp-4h] BYREF
Next = HobGetNext(); /*0xffe19c1e*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, _BYTE *, int *))(*(_DWORD *)Next + 32))(Next, &unk_FFE21648, 0, v2, &v3) >= 0 ) /*0xffe19c3d*/
return v3; /*0xffe19c43*/
else
return 0; /*0xffe19c3f*/
}
// Function: 0xffe19c4a
int DebugPrintWrapper(int a1, const char *a2, ...)
{
int result; // eax
int (__cdecl **v3)(int, const char *, char *); // esi
va_list va; // [esp+10h] [ebp+Ch] BYREF
va_start(va, a2);
result = AssertReport(); /*0xffe19c4b*/
v3 = (int (__cdecl **)(int, const char *, char *))result; /*0xffe19c50*/
if ( result ) /*0xffe19c54*/
{
result = HobGetBaseAddress(); /*0xffe19c56*/
if ( (result & a1) != 0 ) /*0xffe19c61*/
return (*v3)(a1, a2, (char *)va); /*0xffe19c6d*/
}
return result; /*0xffe19c72*/
}
// Function: 0xffe19c74
int __fastcall DebugVPrint(
int e:__hs__MdePkg__Library__PeiServicesTablePointerLibIdt__PeiServ,
int n48,
const char *Idtr____((void__)_0))
{
int result; // eax
result = AssertReport(); /*0xffe19c7a*/
if ( result ) /*0xffe19c81*/
return (*(int (__cdecl **)(int, int, const char *))(result + 4))( /*0xffe19c89*/
e:__hs__MdePkg__Library__PeiServicesTablePointerLibIdt__PeiServ,
n48,
Idtr____((void__)_0));
return result; /*0xffe19c8f*/
}
// Function: 0xffe19c92
int __fastcall DebugAssertPrint(int a1, char **p_src, int a3, int a4)
{
int v6; // edi
_DWORD v8[23]; // [esp+8h] [ebp-5Ch] BYREF
InitHashContext(v8); /*0xffe19ca1*/
if ( a1 ) /*0xffe19ca8*/
{
v6 = a3 - (_DWORD)p_src; /*0xffe19cae*/
do /*0xffe19cc4*/
{
AllocateAndMeasureFwVol((char *)v8, *p_src, *(unsigned int *)((char *)p_src + v6)); /*0xffe19cb8*/
++p_src; /*0xffe19cbd*/
--a1; /*0xffe19cc1*/
}
while ( a1 ); /*0xffe19cc4*/
}
return HashFirmwareVolume(a4, (int)v8); /*0xffe19cd2*/
}
// Function: 0xffe19cd8
int __fastcall TpmMeasureFwVolWithType(_DWORD *this, char *src)
{
int v3; // edi
int v4; // edx
int v5; // eax
int v6; // edx
int v7; // ebp
int v8; // ebx
int v9; // esi
int v10; // eax
int v11; // ebp
int v12; // edi
int v13; // eax
int v14; // esi
int v15; // edx
int v16; // eax
int v17; // edi
int v18; // ebx
int v19; // eax
int v20; // edx
int v21; // ebp
int v22; // eax
int v23; // ebx
int v24; // esi
int v25; // eax
int v26; // ebp
int v27; // edi
int v28; // eax
int v29; // esi
int v30; // edx
int v31; // ebx
int v32; // eax
int v33; // edx
int v34; // ebp
int v35; // edi
int v36; // ecx
int v37; // ebx
int v38; // ebp
int v39; // edi
int v40; // ebp
int v41; // edx
int v42; // ebx
int v43; // esi
int v44; // ebp
int v45; // eax
int v46; // edx
int v47; // edi
int v48; // eax
int v49; // esi
int v50; // ebx
int v51; // eax
int v52; // edi
int v53; // ebp
int v54; // eax
int... [26262 chars total]
// Function: 0xffe1af12
void __thiscall InitHashContext(_DWORD *this)
{
*(this + 6) = 0; /*0xffe1af12*/
*(this + 5) = 0; /*0xffe1af16*/
*this = 1732584193; /*0xffe1af1a*/
*(this + 1) = -271733879; /*0xffe1af20*/
*(this + 2) = -1732584194; /*0xffe1af27*/
*(this + 3) = 271733878; /*0xffe1af2e*/
*(this + 4) = -1009589776; /*0xffe1af35*/
}
// Function: 0xffe1af3d
char *__fastcall AllocateAndMeasureFwVol(char *a1, char *src, unsigned int n8)
{
int v4; // ebx
unsigned int v5; // ecx
char *result; // eax
int n8_1; // esi
unsigned int i; // ebx
char *src_1; // [esp+10h] [ebp-4h]
src_1 = src; /*0xffe1af48*/
v4 = (*((_DWORD *)a1 + 5) >> 3) & 0x3F; /*0xffe1af54*/
v5 = *((_DWORD *)a1 + 5) + 8 * n8; /*0xffe1af57*/
*((_DWORD *)a1 + 5) = v5; /*0xffe1af5f*/
if ( v5 < 8 * n8 ) /*0xffe1af64*/
++*((_DWORD *)a1 + 6); /*0xffe1af66*/
*((_DWORD *)a1 + 6) += n8 >> 29; /*0xffe1af6e*/
result = (char *)(v4 + n8); /*0xffe1af71*/
if ( v4 + n8 <= 0x3F ) /*0xffe1af77*/
{
n8_1 = 0; /*0xffe1afb9*/
}
else
{
n8_1 = 64 - v4; /*0xffe1af7c*/
CopyMem(&a1[v4 + 28], src, 64 - v4); /*0xffe1af86*/
result = (char *)TpmMeasureFwVolWithType(a1, a1 + 28); /*0xffe1af91*/
for ( i = n8_1 + 63; ; i += 64 ) /*0xffe1af96*/
{
src = src_1; /*0xffe1afad*/
if ( i >= n8 ) /*0xffe1afb3*/
break; /*0xffe1afb3*/
result = (char *)TpmMeasureFwVolWithType(a1, &src_1[i - 63]); /*0xffe1afa2*/
n8_1 += 64; /*0xffe1afa7*/
}
v4 = 0; /*0xffe1afb5*/
}
if ( n8 != n8_1 ) /*0xffe1afbb*/
return CopyMem(&a1[v4 + 28], &src[n8_1], n8 - n8_1); /*0xffe1afc7*/
return result; /*0xffe1afcd*/
}
// Function: 0xffe1afd3
int __fastcall HashFirmwareVolume(int a1, int a2)
{
unsigned int n0x14; // edi
unsigned int i; // edx
char src[8]; // [esp+10h] [ebp-8h] BYREF
n0x14 = 0; /*0xffe1afd9*/
for ( i = 0; i < 8; ++i )
src[i] = *(_DWORD *)((i < 4 ? 4 : 0) + a2 + 20) >> (8 * (3 - (i & 3)));
AllocateAndMeasureFwVol((char *)a2, src, 1u); /*0xffe1b00f*/
while ( (*(_DWORD *)(a2 + 20) & 0x1F8) != 0x1C0 ) /*0xffe1b034*/
AllocateAndMeasureFwVol((char *)a2, src_0, 1u); /*0xffe1b020*/
AllocateAndMeasureFwVol((char *)a2, src, 8u); /*0xffe1b03c*/
do /*0xffe1b060*/
{
*(_BYTE *)(n0x14 + a1) = *(_DWORD *)(a2 + 4 * (n0x14 >> 2)) >> (8 * (3 - (n0x14 & 3))); /*0xffe1b059*/
++n0x14; /*0xffe1b05c*/
}
while ( n0x14 < 0x14 ); /*0xffe1b060*/
GetEndOfHobList(a2 + 28, 64); /*0xffe1b068*/
GetEndOfHobList(a2, 20); /*0xffe1b072*/
GetEndOfHobList(a2 + 20, 8); /*0xffe1b07c*/
return GetEndOfHobList((int)src, 8); /*0xffe1b08d*/
}
// Function: 0xffe1b094
int __fastcall DelayMicroseconds(int n2, int n50563599)
{
if ( byte_FFE2177C ) /*0xffe1b09b*/
return PeiPcdSetSku(n2, n50563599, n2, (int)&unk_FFE216E8, 0); /*0xffe1b0a5*/
else
return -2147483645; /*0xffe1b0ae*/
}
// Function: 0xffe1b0b4
char IsTpmPresent()
{
unsigned int n6; // ecx
n6 = 0; /*0xffe1b0bb*/
while ( word_FFE21730[n6] != MEMORY[0xFED40F00] || word_FFE21732[n6] != MEMORY[0xFED40F02] ) /*0xffe1b0d6*/
{
n6 += 2; /*0xffe1b0d8*/
if ( n6 >= 6 ) /*0xffe1b0de*/
return 0; /*0xffe1b0e3*/
}
return 1; /*0xffe1b0e2*/
}
// Function: 0xffe1b0e8
// String: gTcgPpiguid NOT found %r
// String: gTpmDevicePpiguid NOT found %r
int __fastcall LocateTcgOrTpmPpi(int n17, int a2, int a3)
{
int v4; // eax
int v5; // esi
int result; // eax
v4 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int))(*(_DWORD *)n17 + 32))(n17, &unk_FFE21678, 0, 0, a2); /*0xffe1b0fa*/
v5 = v4; /*0xffe1b0fd*/
if ( v4 >= 0 ) /*0xffe1b104*/
{
result = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int))(*(_DWORD *)n17 + 32))(n17, &unk_FFE21628, 0, 0, a3); /*0xffe1b11c*/
v5 = result; /*0xffe1b11f*/
if ( result >= 0 ) /*0xffe1b126*/
return result; /*0xffe1b126*/
DebugPrintWrapper(0x80000000, "gTcgPpiguid NOT found %r \n", result); /*0xffe1b133*/
}
else
{
DebugPrintWrapper(0x80000000, "gTpmDevicePpiguid NOT found %r \n", v4); /*0xffe1b10c*/
}
return v5; /*0xffe1b13d*/
}
// Function: 0xffe1b141
// String: Tcg Startup Command Return Code: size: %x; retCode:%x; tag:%x; bytes %08x
// String: Tcg Startup: returning device error
// String: Error sending TPM Startup CMD
int __fastcall TpmStartupCommand(int *n17, int n32)
{
int v4; // eax
int result; // eax
__int16 n3; // bx
int v7; // [esp-18h] [ebp-64h]
_BYTE v8[28]; // [esp+Ch] [ebp-40h] BYREF
__int16 v9; // [esp+28h] [ebp-24h] BYREF
int n201326592; // [esp+2Ah] [ebp-22h]
int v11; // [esp+2Eh] [ebp-1Eh]
__int16 v12; // [esp+32h] [ebp-1Ah]
unsigned __int16 v13; // [esp+34h] [ebp-18h] BYREF
unsigned int v14; // [esp+36h] [ebp-16h]
unsigned int v15; // [esp+3Ah] [ebp-12h]
int v16; // [esp+40h] [ebp-Ch] BYREF
int v17; // [esp+44h] [ebp-8h] BYREF
int (__cdecl **v18)(_DWORD, int *); // [esp+48h] [ebp-4h] BYREF
v4 = *n17; /*0xffe1b155*/
v18 = 0; /*0xffe1b15e*/
v16 = 0; /*0xffe1b161*/
v17 = 0; /*0xffe1b164*/
result = (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int *))(v4 + 32))(n17, &unk_FFE21638, 0, 0, &v17); /*0xffe1b167*/
if ( result >= 0 )
{
if ( v17 )
{
result = (*(int (__cdecl **)(int *, _BYTE *))(v17 + 4))(n17, v8); /*0xffe1b185*/
if ( result >= 0 )
{
if ( v8[4] == 1 ) /*0xffe1b196*/
n32 = 32; /*0xffe1b19a*/
n3 = (n32 == 17) + 1; /*0xffe1b1a4*/
if ( n32 == 32 ) /*0xffe1b1aa*/
n3 = 3; /*0xffe1b1ae*/
if ( LocateTcgOrTpmPpi((int)n17, (int)&v18, (int)&v16) < 0 ) /*0xffe1b1c0*/
return -2147483634; /*0xffe1b1c7*/
result = (*v18)(v18, n17); /*0xffe1b1d1*/
if ( result >= 0 )
{
v9 = -16128; /*0xffe1b1e6*/
n201326592 = 201326592; /*0xffe1b1f3*/
v11 = -1728053248; /*0xffe1b202*/
v12 = __ROL2__(n3, 8); /*0xffe1b209*/
(*(void (__cdecl **)(int, int *, int, __int16 *, int, unsigned __int16 *))(v16 + 8))( /*0xffe1b20d*/
v16,
n17,
12,
&v9,
10,
&v13);
DebugPrintWrapper(
64,
"Tcg Startup Command Return Code: size: %x; retCode:%x; tag:%x; bytes %08x\n",
((v14 & 0xFF00 | (v14 << 16)) << 8) | ((HIWORD(v14) | v14 & 0xFF0000) >> 8),
((v15 & 0xFF00 | (v15 << 16)) << 8) | ((HIWORD(v15) | v15 & 0xFF0000) >> 8),
(v13 << 8) | HIBYTE(v13),
v7);
if ( !v14 )
{
DebugPrintWrapper(0x80000000, "Tcg Startup: returning device error\n");
return -2147483641; /*0xffe1b292*/
}
if ( v15 ) /*0xffe1b298*/
{
DebugPrintWrapper(0x80000000, "Error sending TPM Startup CMD\n"); /*0xffe1b29f*/
return -2147483641; /*0xffe1b29f*/
}
return v18[1](v18, n17); /*0xffe1b2a6*/
}
}
}
}
return result; /*0xffe1b2ab*/
}
// Function: 0xffe1b2b2
// String: Tcg TCM Startup Command Return Code: size: %x; retCode:%x; tag:%x; bytes %08x
unsigned int __fastcall TcmStartup(int n17, int n17_1)
{
__int16 n3; // si
int v4; // edi
int v5; // [esp-1Ch] [ebp-40h]
int v6; // [esp+8h] [ebp-1Ch] BYREF
unsigned __int16 v7; // [esp+Ch] [ebp-18h] BYREF
unsigned int v8; // [esp+Eh] [ebp-16h]
unsigned int v9; // [esp+12h] [ebp-12h]
__int16 v10; // [esp+18h] [ebp-Ch] BYREF
int n201326592; // [esp+1Ah] [ebp-Ah]
int v12; // [esp+1Eh] [ebp-6h]
__int16 v13; // [esp+22h] [ebp-2h]
v6 = 0; /*0xffe1b2be*/
n3 = (n17_1 == 17) + 1; /*0xffe1b2c6*/
if ( n17_1 == 32 ) /*0xffe1b2cc*/
n3 = 3; /*0xffe1b2d0*/
if ( (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)n17 + 32))(n17, &unk_FFE21698, 0, 0, &v6) < 0 ) /*0xffe1b2e8*/
return -2147483634; /*0xffe1b2ea*/
v10 = -16128; /*0xffe1b2ff*/
n201326592 = 201326592; /*0xffe1b311*/
v12 = -1719664640; /*0xffe1b323*/
v13 = __ROL2__(n3, 8); /*0xffe1b32b*/
v4 = (*(int (__cdecl **)(int, __int16 *, int, unsigned __int16 *, int))(v6 + 24))(-19660800, &v10, 12, &v7, 10); /*0xffe1b338*/
DebugPrintWrapper(
64,
"Tcg TCM Startup Command Return Code: size: %x; retCode:%x; tag:%x; bytes %08x\n",
((v8 & 0xFF00 | (v8 << 16)) << 8) | ((HIWORD(v8) | v8 & 0xFF0000) >> 8),
((v9 & 0xFF00 | (v9 << 16)) << 8) | ((HIWORD(v9) | v9 & 0xFF0000) >> 8),
(v7 << 8) | HIBYTE(v7),
v5);
if ( v8 ) /*0xffe1b3a5*/
return v4 | ((v9 & 0xFF00 | (v9 << 16)) << 8) | ((v9 & 0xFF0000 | HIWORD(v9)) >> 8); /*0xffe1b3ce*/
else
return -2147483641; /*0xffe1b3a7*/
}
// Function: 0xffe1b3d8
// String: TCG Pei: Self Test : status=%x; RetCode=%x
signed int __thiscall TpmSelfTest(void *this)
{
signed int result; // eax
int v3; // eax
_BYTE v4[6]; // [esp+4h] [ebp-20h] BYREF
unsigned int v5; // [esp+Ah] [ebp-1Ah]
__int16 v6; // [esp+10h] [ebp-14h] BYREF
int n167772160; // [esp+12h] [ebp-12h]
int n1392508928; // [esp+16h] [ebp-Eh]
int v9; // [esp+1Ch] [ebp-8h] BYREF
int (__cdecl **v10)(_DWORD, void *); // [esp+20h] [ebp-4h] BYREF
v10 = 0; /*0xffe1b3de*/
v9 = 0; /*0xffe1b3e5*/
if ( LocateTcgOrTpmPpi((int)this, (int)&v10, (int)&v9) < 0 ) /*0xffe1b3f8*/
return -2147483634; /*0xffe1b3fa*/
result = (*v10)(v10, this); /*0xffe1b409*/
if ( result >= 0 )
{
n167772160 = 167772160; /*0xffe1b417*/
v6 = -16128; /*0xffe1b41e*/
n1392508928 = 1392508928; /*0xffe1b42b*/
v3 = (*(int (__cdecl **)(int, void *, int, __int16 *, int, _BYTE *))(v9 + 8))(v9, this, 10, &v6, 10, v4); /*0xffe1b43a*/
DebugPrintWrapper(
64,
"TCG Pei: Self Test : status=%x; RetCode=%x\n",
v3,
(((v5 << 16) | v5 & 0xFF00) << 8) | ((HIWORD(v5) | v5 & 0xFF0000) >> 8));
result = v10[1](v10, this); /*0xffe1b477*/
if ( result >= 0 )
return v5 != 0 ? 0x80000007 : 0;
}
return result; /*0xffe1b48e*/
}
// Function: 0xffe1b493
// String: TCG TCM Pei: Self Test : status=%x; RetCode=%x
unsigned int __thiscall TcmSelfTest(int *this)
{
int v1; // eax
int v3; // eax
_BYTE v4[6]; // [esp+4h] [ebp-1Ch] BYREF
unsigned int v5; // [esp+Ah] [ebp-16h]
__int16 v6; // [esp+10h] [ebp-10h] BYREF
int n167772160; // [esp+12h] [ebp-Eh]
int n1400897536; // [esp+16h] [ebp-Ah]
int v9; // [esp+1Ch] [ebp-4h] BYREF
v1 = *this; /*0xffe1b499*/
v9 = 0; /*0xffe1b4aa*/
if ( (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int *))(v1 + 32))(this, &unk_FFE21698, 0, 0, &v9) < 0 ) /*0xffe1b4b5*/
return -2147483634; /*0xffe1b4b7*/
n167772160 = 167772160; /*0xffe1b4c3*/
v6 = -16128; /*0xffe1b4ca*/
n1400897536 = 1400897536; /*0xffe1b4d9*/
v3 = (*(int (__cdecl **)(int, __int16 *, int, _BYTE *, int))(v9 + 24))(-19660800, &v6, 10, v4, 10); /*0xffe1b4e9*/
DebugPrintWrapper(
64,
"TCG TCM Pei: Self Test : status=%x; RetCode=%x\n",
v3,
(((v5 << 16) | v5 & 0xFF00) << 8) | ((HIWORD(v5) | v5 & 0xFF0000) >> 8));
return v5 != 0 ? 0x80000007 : 0;
}
// Function: 0xffe1b535
signed int __fastcall TpmStartup(int *n17, int n17_1)
{
int v4; // eax
char v5; // bl
signed int result; // eax
unsigned int v7; // esi
_BYTE v8[28]; // [esp+Ch] [ebp-24h] BYREF
_BYTE v9[4]; // [esp+28h] [ebp-8h] BYREF
int v10; // [esp+2Ch] [ebp-4h] BYREF
v4 = *n17; /*0xffe1b549*/
v5 = 0; /*0xffe1b54b*/
v10 = 0; /*0xffe1b554*/
if ( (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, _BYTE *))(v4 + 32))(n17, &unk_FFE216F8, 0, 0, v9) >= 0 ) /*0xffe1b55f*/
{
v5 = 1; /*0xffe1b569*/
DelayMicroseconds(1, 50563587); /*0xffe1b56b*/
}
result = (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int *))(*n17 + 32))(n17, &unk_FFE21638, 0, 0, &v10); /*0xffe1b580*/
if ( result >= 0 )
{
if ( v10 )
{
result = (*(int (__cdecl **)(int *, _BYTE *))(v10 + 4))(n17, v8); /*0xffe1b59e*/
if ( result >= 0 )
{
if ( v8[4] == 1 )
{
if ( v5 )
return TpmSelfTest(n17) != 0 ? 0x80000007 : 0;
else
return TpmStartupCommand(n17, 32); /*0xffe1b5ba*/
}
if ( IsTpmPresent() ) /*0xffe1b5d4*/
{
if ( TcmStartup((int)n17, n17_1) ) /*0xffe1b62c*/
return -2147483641; /*0xffe1b62c*/
v7 = TcmSelfTest(n17); /*0xffe1b63c*/
if ( v7 ) /*0xffe1b640*/
return -2147483641; /*0xffe1b640*/
}
else
{
if ( !v5 ) /*0xffe1b5df*/
{
if ( TpmStartupCommand(n17, n17_1) ) /*0xffe1b5e5*/
{
DelayMicroseconds(-2147483646, 50563585); /*0xffe1b5f8*/
return -2147483641; /*0xffe1b602*/
}
DelayMicroseconds(1, 50563585); /*0xffe1b607*/
}
v7 = TpmSelfTest(n17); /*0xffe1b613*/
if ( v7 ) /*0xffe1b617*/
return -2147483641; /*0xffe1b617*/
DelayMicroseconds(1, 50563588); /*0xffe1b621*/
}
return v7; /*0xffe1b642*/
}
}
}
return result; /*0xffe1b644*/
}
// Function: 0xffe1b64b
// String:
ASSERT_EFI_ERROR (Status = %r)
// String: e:\hs\AmiModulePkg\TCG2\Common\AmiTcgPlatformPei\AmiTcgPlatformPeiLib.c
// String: !EFI_ERROR (Status)
// String: GetCapability: %r; size: %x; retCode:%x; tag:%x; bytes %08x
void *__cdecl TpmTcgGetCapability(void *dst)
{
_DWORD *v1; // ecx
_DWORD *v2; // ebp
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
int v10; // [esp+10h] [ebp-120h] BYREF
int v11; // [esp+14h] [ebp-11Ch] BYREF
__int16 v12; // [esp+18h] [ebp-118h] BYREF
int n369098752; // [esp+1Ah] [ebp-116h]
int n1694498816; // [esp+1Eh] [ebp-112h]
int n0x4000000; // [esp+22h] [ebp-10Eh]
int n0x4000000_1; // [esp+26h] [ebp-10Ah]
int n134283264; // [esp+2Ah] [ebp-106h]
_DWORD dst_1[64]; // [esp+30h] [ebp-100h] BYREF
v2 = v1; /*0xffe1b655*/
n369098752 = 369098752; /*0xffe1b657*/
n1694498816 = 1694498816; /*0xffe1b661*/
v10 = 0; /*0xffe1b66d*/
v11 = 0; /*0xffe1b677*/
v12 = -16128; /*0xffe1b67b*/
n0x4000000 = 0x4000000; /*0xffe1b686*/
n0x4000000_1 = 0x4000000; /*0xffe1b68a*/
v3 = *v1; /*0xffe1b68e*/
n134283264 = 134283264; /*0xffe1b698*/
v4 = (*(int (__cdecl **)(_DWORD *, void *, _DWORD, _DWORD, int *))(v3 + 32))(v1, &unk_FFE21678, 0, 0, &v10); /*0xffe1b6a0*/
if ( v4 < 0 ) /*0xffe1b6b2*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0xffe1b6bf*/
v5 = AssertReport(); /*0xffe1b6c7*/
if ( v5 ) /*0xffe1b6ce*/
(*(void (__cdecl **)(const char *, int, const char *))(v5 + 4))( /*0xffe1b6d7*/
"e:\\hs\\AmiModulePkg\\TCG2\\Common\\AmiTcgPlatformPei\\AmiTcgPlatformPeiLib.c",
1073,
"!EFI_ERROR (Status)");
}
if ( (*(int (__cdecl **)(int, _DWORD *))v10)(v10, v2) )
{
GetEndOfHobList((int)dst_1, 36); /*0xffe1b6f2*/
}
else
{
v6 = (*(int (__cdecl **)(_DWORD *, void *, _DWORD, _DWORD, int *))(*v2 + 32))(v2, &unk_FFE21628, 0, 0, &v11); /*0xffe1b70c*/
if ( v6 < 0 ) /*0xffe1b714*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v6); /*0xffe1b721*/
v7 = AssertReport(); /*0xffe1b729*/
if ( v7 ) /*0xffe1b730*/
(*(void (__cdecl **)(const char *, int, const char *))(v7 + 4))( /*0xffe1b739*/
"e:\\hs\\AmiModulePkg\\TCG2\\Common\\AmiTcgPlatformPei\\AmiTcgPlatformPeiLib.c",
1090,
"!EFI_ERROR (Status)");
}
v8 = (*(int (__cdecl **)(int, _DWORD *, int, __int16 *, int, _DWORD *))(v11 + 8))(v11, v2, 22, &v12, 256, dst_1); /*0xffe1b756*/
DebugPrintWrapper(
64,
"GetCapability: %r; size: %x; retCode:%x; tag:%x; bytes %08x\n",
v8,
((HIWORD(dst_1[0]) & 0xFF00 | (*(_DWORD *)((char *)dst_1 + 2) << 16)) << 8)
| ((HIWORD(*(_DWORD *)((char *)dst_1 + 2)) | *(_DWORD *)((char *)dst_1 + 2) & 0xFF0000u) >> 8),
((HIWORD(dst_1[1]) & 0xFF00 | (*(_DWORD *)((char *)&dst_1[1] + 2) << 16)) << 8)
| ((HIWORD(*(_DWORD *)((char *)&dst_1[1] + 2)) | *(_DWORD *)((char *)&dst_1[1] + 2) & 0xFF0000u) >> 8),
(HIWORD(dst_1[3]) << 8) | HIBYTE(HIWORD(dst_1[3])),
((dst_1[4] & 0xFF00 | (dst_1[4] << 16)) << 8) | ((HIWORD(dst_1[4]) | dst_1[4] & 0xFF0000u) >> 8));
(*(void (__cdecl **)(int, _DWORD *))(v10 + 4))(v10, v2); /*0xffe1b7f3*/
}
qmemcpy(dst, dst_1, 0x24u); /*0xffe1b809*/
return dst; /*0xffe1b80b*/
}
// Function: 0xffe1b816
_DWORD *GetBootGuardHobData()
{
int Next; // eax
int v1; // esi
int v2; // eax
int v3; // ecx
_DWORD *v4; // esi
_DWORD *v5; // eax
unsigned int src_1; // ecx
unsigned int count; // ebx
char *v8; // edi
int v9; // ebp
char *src; // [esp+8h] [ebp-Ch]
int v12; // [esp+Ch] [ebp-8h] BYREF
int v13; // [esp+10h] [ebp-4h] BYREF
v12 = 0; /*0xffe1b81d*/
v13 = 0; /*0xffe1b821*/
Next = HobGetNext(); /*0xffe1b825*/
if ( (*(int (__cdecl **)(int, _DWORD, int *))(*(_DWORD *)Next + 56))(Next, 0, &v12) < 0 ) /*0xffe1b83b*/
return 0; /*0xffe1b83b*/
v1 = v12; /*0xffe1b841*/
v2 = HobGetNext(); /*0xffe1b845*/
if ( (*(int (__cdecl **)(void *, int, int *))(*(_DWORD *)v2 + 104))(&unk_FFE21658, v1, &v13) < 0 ) /*0xffe1b85f*/
return 0; /*0xffe1b85f*/
v4 = (_DWORD *)(v13 + 44); /*0xffe1b869*/
if ( *(_DWORD *)(v13 + 44) != 1280134994 ) /*0xffe1b872*/
return 0; /*0xffe1b908*/
v5 = (_DWORD *)BuildGuidHob(v3, 48 * *(_DWORD *)(v13 + 56) + 16); /*0xffe1b882*/
if ( v5 ) /*0xffe1b88b*/
{
*v5 = v4[1]; /*0xffe1b890*/
v5[1] = v4[2]; /*0xffe1b895*/
src_1 = (unsigned int)(v4 + 4); /*0xffe1b898*/
v5[2] = 48; /*0xffe1b89b*/
v5[3] = 0; /*0xffe1b8a2*/
count = v4[2]; /*0xffe1b8a8*/
src = (char *)(v4 + 4); /*0xffe1b8af*/
v8 = (char *)(v5 + 4); /*0xffe1b8b3*/
if ( v4 + 4 < (_DWORD *)((char *)v4 + count * v4[3] + 16) ) /*0xffe1b8bc*/
{
v9 = 16 - (_DWORD)v5; /*0xffe1b8be*/
do /*0xffe1b900*/
{
if ( count ) /*0xffe1b8c2*/
{
CopyMem(v8 + 8, src, count); /*0xffe1b8cc*/
src_1 = (unsigned int)src; /*0xffe1b8d2*/
}
*((_DWORD *)v8 + 1) = 0; /*0xffe1b8d6*/
*(_DWORD *)v8 = &v8[v9 + 8]; /*0xffe1b8df*/
v8 += 48; /*0xffe1b8e1*/
count = v4[2]; /*0xffe1b8e4*/
src = (char *)(count + src_1); /*0xffe1b8e9*/
src_1 += count; /*0xffe1b8fc*/
}
while ( src_1 < (unsigned int)v4 + count * v4[3] + 16 ); /*0xffe1b900*/
}
}
return v4; /*0xffe1b90a*/
}
// Function: 0xffe1b910
unsigned int GetFirmwareVolumeInfo()
{
_WORD *SystemConfiguration; // ecx
SystemConfiguration = GetSystemConfiguration(); /*0xffe1b916*/
if ( !SystemConfiguration ) /*0xffe1b91a*/
{
GetBootGuardHobData(); /*0xffe1b91c*/
SystemConfiguration = GetSystemConfiguration(); /*0xffe1b926*/
}
return SystemConfiguration != 0 ? (unsigned int)(SystemConfiguration + 24) : 0;
}
// Function: 0xffe1b933
unsigned int __thiscall GetBootGuardPolicy(char *this)
{
char *v1; // esi
char *v2; // edi
unsigned int v3; // esi
if ( this /*0xffe1b967*/
&& (v1 = this - 8, v2 = &v1[-*(_DWORD *)v1], HobIsSuitable((int)(v2 + 8), (int)&unk_FFE21668))
&& (v3 = (unsigned int)&v1[*((_DWORD *)v2 + 8)], (unsigned int)(v2 + 40) <= v3)
&& (unsigned int)&v2[*((unsigned __int16 *)v2 + 1)] > v3 )
{
return v3 + 8; /*0xffe1b969*/
}
else
{
return 0; /*0xffe1b96e*/
}
}
// Function: 0xffe1b974
// String: [BootGuardTCG2.c] Bit 32 BootGuardCapability = 1 in MSR 0x13A
// String: [BootGuardTCG2.c] Processor supports Boot Guard.
// String: [BootGuardTCG2.c] Bit 32 BootGuardCapability = 0 in MSR 0x13A
// String: [BootGuardTCG2.c] Processor does not support Boot Guard.
char CheckBootGuardCapabilityMsr()
{
unsigned __int64 v0; // rax
v0 = __readmsr(0x13Au); /*0xffe1b97a*/
if ( (v0 & 0x100000000LL) != 0 ) /*0xffe1b983*/
{
DebugPrintWrapper(64, "[BootGuardTCG2.c] Bit 32 BootGuardCapability = 1 in MSR 0x13A\n"); /*0xffe1b98c*/
DebugPrintWrapper(64, "[BootGuardTCG2.c] Processor supports Boot Guard.\n"); /*0xffe1b998*/
return 1; /*0xffe1b9a0*/
}
else
{
DebugPrintWrapper(0x80000000, "[BootGuardTCG2.c] Bit 32 BootGuardCapability = 0 in MSR 0x13A\n"); /*0xffe1b9af*/
DebugPrintWrapper(0x80000000, "[BootGuardTCG2.c] Processor does not support Boot Guard.\n"); /*0xffe1b9ba*/
return 0; /*0xffe1b9c2*/
}
}
// Function: 0xffe1b9c6
// String:
// String: %02x
int __fastcall DebugPrintHexBytes(unsigned int i, int a2)
{
unsigned int j; // ebx
for ( j = 0; j < i; ++j ) /*0xffe1b9d7*/
{
if ( (j & 0xF) == 0 ) /*0xffe1b9dc*/
DebugPrintWrapper(64, "\n"); /*0xffe1b9e1*/
DebugPrintWrapper(64, " %02x", *(unsigned __int8 *)(j + a2)); /*0xffe1b9f4*/
}
return DebugPrintWrapper(64, "\n"); /*0xffe1ba0b*/
}
// Function: 0xffe1ba10
// String: StructureID:
// String: %c
// String:
StructVersion[%02x]
int __thiscall ParseBootGuardStructureId(unsigned __int8 *this)
{
unsigned int i; // esi
DebugPrintWrapper(64, "StructureID:"); /*0xffe1ba1b*/
for ( i = 0; i < 8; ++i ) /*0xffe1ba22*/
DebugPrintWrapper(64, "%c", *(this + i)); /*0xffe1ba30*/
return DebugPrintWrapper(64, "\nStructVersion[%02x]\n", *(this + 8)); /*0xffe1ba52*/
}
// Function: 0xffe1ba55
// String: [BootGuardTCG2.c] NEM enabled in MSR 0x13A
// String: [BootGuardTCG2.c] NEM disable in MSR 0x13A
// String: [BootGuardTCG2.c] Measure Boot enabled in MSR 0x13A
// String: [BootGuardTCG2.c] Measure Boot disable in MSR 0x13A
// String: [BootGuardTCG2.c] Tpm Success in MSR 0x13A
int CheckNemMeasureBootStatus()
{
unsigned __int64 v0; // rax
char v1; // bl
const char *[BootGuardTCG2.c]_NEM_enabled_in_MSR_0x13A_n; // [esp-4h] [ebp-14h]
v0 = __readmsr(0x13Au); /*0xffe1ba5e*/
v1 = v0; /*0xffe1ba60*/
if ( (v0 & 1) != 0 ) /*0xffe1ba65*/
[BootGuardTCG2.c]_NEM_enabled_in_MSR_0x13A_n = "[BootGuardTCG2.c] NEM enabled in MSR 0x13A\n"; /*0xffe1ba67*/
else
[BootGuardTCG2.c]_NEM_enabled_in_MSR_0x13A_n = "[BootGuardTCG2.c] NEM disable in MSR 0x13A\n"; /*0xffe1ba6e*/
DebugPrintWrapper(64, [BootGuardTCG2.c]_NEM_enabled_in_MSR_0x13A_n); /*0xffe1ba77*/
if ( (v1 & 0x20) != 0 ) /*0xffe1ba81*/
DebugPrintWrapper(64, "[BootGuardTCG2.c] Measure Boot enabled in MSR 0x13A\n"); /*0xffe1ba88*/
else
DebugPrintWrapper(64, "[BootGuardTCG2.c] Measure Boot disable in MSR 0x13A\n"); /*0xffe1ba90*/
if ( (v1 & 8) != 0 ) /*0xffe1ba9a*/
DebugPrintWrapper(64, "[BootGuardTCG2.c] Tpm Success in MSR 0x13A\n"); /*0xffe1baa1*/
else
DebugPrintWrapper(64, "[BootGuardTCG2.c] Tpm Fail in MSR 0x13A\n"); /*0xffe1baa9*/
if ( (v1 & 0x29) == 0x29 )
{
DebugPrintWrapper(64, "[BootGuardTCG2.c] : ACM_PostSuccess : EFI_SUCCESS\n");
return 0; /*0xffe1bac3*/
}
else
{
DebugPrintWrapper(64, "[BootGuardTCG2.c] : ACM_PostSuccess : EFI_UNSUPPORTED\n");
return -2147483645; /*0xffe1bad2*/
}
}
// Function: 0xffe1bade
unsigned __int64 ReadMsr()
{
unsigned __int64 result; // rax
result = __readmsr(0x13Au) >> 4; /*0xffe1bb2b*/
LOBYTE(result) = (2 /*0xffe1bb30*/
* (((MEMORY[0xFED3032C] & 0x20) != 0)
| (2
* (((MEMORY[0xFED3032C] & 0x40) != 0)
| (2 * (((MEMORY[0xFED3032C] & 0x80) != 0) | (2 * (MEMORY[0xFED3032D] & 1))))))))
| result & 1;
return result; /*0xffe1bb32*/
}
// Function: 0xffe1bb37
char IsBootGuardCapable()
{
unsigned __int64 v0; // rax
char v2; // [esp+4h] [ebp-4h]
v2 = MEMORY[0xFED3032C]; /*0xffe1bb43*/
v0 = __readmsr(0x13Au); /*0xffe1bb4b*/
return ((v0 & 0x20) != 0) | (2 * (((v0 & 0x40) != 0) | (2 * ((v2 & 0x10) != 0)))); /*0xffe1bb7d*/
}
// Function: 0xffe1bb82
// String: BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs
// String: BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs
int __cdecl LogBootGuardEventInternal(int a1, _BYTE *a2, const char *Boot_Guard_Measured_S_CRTM, int n27)
{
int v4; // ecx
int v5; // ebp
_WORD *HobFromAddress; // eax
_WORD *v8; // ebx
char *v9; // edi
_WORD *v10; // [esp+10h] [ebp-4h] BYREF
v5 = v4; /*0xffe1bb85*/
if ( (*(int (__cdecl **)(int, _WORD **))(*(_DWORD *)v4 + 48))(v4, &v10) < 0 )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs\n", 285);
return -2147483634; /*0xffe1bbb7*/
}
HobFromAddress = GetHobFromAddress((int)&unk_FFE2176C, v10); /*0xffe1bbc2*/
if ( !HobFromAddress )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 292);
return -2147483634; /*0xffe1bbd7*/
}
v8 = HobFromAddress + 12; /*0xffe1bbdc*/
v9 = (char *)HobFromAddress + *((_DWORD *)HobFromAddress + 7) + 24; /*0xffe1bbdf*/
*((_DWORD *)v9 + 10) = 0; /*0xffe1bbe7*/
*((_DWORD *)v9 + 11) = 7; /*0xffe1bbeb*/
v9 += 48; /*0xffe1bbf2*/
(*(void (__cdecl **)(char *, _BYTE *, int))(*(_DWORD *)v5 + 80))(v9, a2, 20); /*0xffe1bbf9*/
*((_DWORD *)v9 + 5) = n27; /*0xffe1bc03*/
v9 += 24; /*0xffe1bc06*/
(*(void (__cdecl **)(char *, const char *, int))(*(_DWORD *)v5 + 80))(v9, Boot_Guard_Measured_S_CRTM, n27); /*0xffe1bc12*/
++*((_DWORD *)v8 + 2); /*0xffe1bc1f*/
*((_DWORD *)v8 + 1) = v9 - (char *)v8 + n27 - 40; /*0xffe1bc22*/
return 0; /*0xffe1bc27*/
}
// Function: 0xffe1bc2d
// String: BootGuardTCG2.c[%d] : Enter CreateBootGuardTPM12Event(...)
// String: BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs
// String: BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs
// String: Boot Guard Measured S-CRTM
int __cdecl CreateBootGuardTPM12Event(int a1, char *src_1)
{
int v2; // ecx
int v3; // esi
int v5; // [esp-4h] [ebp-60h]
_BYTE v6[68]; // [esp+8h] [ebp-54h] BYREF
char *src; // [esp+4Ch] [ebp-10h] BYREF
int n804; // [esp+50h] [ebp-Ch] BYREF
_WORD *v9; // [esp+54h] [ebp-8h] BYREF
v3 = v2; /*0xffe1bc40*/
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : Enter CreateBootGuardTPM12Event(...)\n", 341);
(*(void (__cdecl **)(_BYTE *, int, _DWORD))(*(_DWORD *)v3 + 84))(v6, 64, 0); /*0xffe1bc54*/
if ( (*(int (__cdecl **)(int, _WORD **))(*(_DWORD *)v3 + 48))(v3, &v9) < 0 )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs\n", 349);
return -2147483634; /*0xffe1bc86*/
}
if ( !GetHobFromAddress((int)&unk_FFE2176C, v9) )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 356);
return -2147483634; /*0xffe1bca3*/
}
src = src_1; /*0xffe1bcab*/
n804 = 804; /*0xffe1bcb3*/
DebugAssertPrint(1, &src, (int)&n804, (int)v6); /*0xffe1bcc0*/
return LogBootGuardEventInternal(v5, v6, "Boot Guard Measured S-CRTM", 27); /*0xffe1bcdd*/
}
// Function: 0xffe1bce2
// String: BootGuardTCG2.c[%d] : Enter LogBootGuardTPM20Event(...)
// String: BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs
// String: BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs
// String: BootGuardTCG2.c[%d] : TcgLog Addr 0x%x
// String: BootGuardTCG2.c[%d] : For Invalid parameter
int __fastcall LogBootGuardTpm20EventWrapper(
int n17,
int n7,
int n7a,
_BYTE *a4,
_BYTE *a5,
const char *FIT_Type_0x02_Measured_S_CRTM,
int n30)
{
_WORD *HobFromAddress; // eax
_WORD *v11; // ebx
_DWORD *v12; // edi
_DWORD *v13; // edi
_DWORD *v14; // esi
char *v15; // edi
char *v16; // edi
_DWORD *v17; // edi
char *v18; // edi
char *v19; // ecx
int v20; // eax
_WORD *v21; // [esp+14h] [ebp-4h] BYREF
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : Enter LogBootGuardTPM20Event(...)\n", 394);
if ( (*(int (__cdecl **)(int, _WORD **))(*(_DWORD *)n17 + 48))(n17, &v21) < 0 )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs\n", 400);
return -2147483634; /*0xffe1bd2e*/
}
HobFromAddress = GetHobFromAddress((int)&unk_FFE2173C, v21); /*0xffe1bd3c*/
if ( !HobFromAddress )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 408);
return -2147483634; /*0xffe1bd51*/
}
v11 = HobFromAddress + 12; /*0xffe1bd53*/
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : TcgLog Addr 0x%x\n", 413, HobFromAddress + 12);
if ( (*((_DWORD *)v11 + 8) & 3) != 0 )
{
if ( !*((_DWORD *)v11 + 3) )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : For Invalid parameter\n", 424);
return -2147483634; /*0xffe1bda5*/
}
v12 = (_DWORD *)*((_DWORD *)v11 + 4); /*0xffe1bdaa*/
*v12++ = n7; /*0xffe1bdb4*/
*v12 = n7a; /*0xffe1bdb8*/
v13 = v12 + 1; /*0xffe1bdba*/
if ( *((_DWORD *)v11 + 3) == 1 ) /*0xffe1bdc0*/
{
(*(void (__cdecl **)(_DWORD *, _BYTE *, int))(*(_DWORD *)n17 + 80))(v13, a4, 20); /*0xffe1bdcc*/
v13 += 5; /*0xffe1bdd2*/
}
else if ( *((_DWORD *)v11 + 3) == 2 ) /*0xffe1bddb*/
{
*v13 = 0; /*0xffe1bddd*/
v14 = v13++; /*0xffe1bde0*/
if ( (v11[16] & 1) != 0 ) /*0xffe1bde8*/
{
*(_WORD *)v13 = 4; /*0xffe1bdea*/
v15 = (char *)v13 + 2; /*0xffe1bded*/
++*v14; /*0xffe1bdf0*/
(*(void (__cdecl **)(char *, _BYTE *, int))(*(_DWORD *)n17 + 80))(v15, a4, 20); /*0xffe1bdfc*/
v13 = v15 + 20; /*0xffe1be02*/
}
if ( (v11[16] & 2) != 0 ) /*0xffe1be09*/
{
*(_WORD *)v13 = 11; /*0xffe1be0e*/
v16 = (char *)v13 + 2; /*0xffe1be11*/
++*v14; /*0xffe1be14*/
(*(void (__cdecl **)(char *, _BYTE *, int))(*(_DWORD *)n17 + 80))(v16, a5, 32); /*0xffe1be20*/
v13 = v16 + 32; /*0xffe1be26*/
}
}
*v13 = n30; /*0xffe1be2d*/
v17 = v13 + 1; /*0xffe1be2f*/
(*(void (__cdecl **)(_DWORD *, const char *, int))(*(_DWORD *)n17 + 80))(v17, FIT_Type_0x02_Measured_S_CRTM, n30); /*0xffe1be3b*/
v18 = (char *)v17 + n30; /*0xffe1be41*/
*((_DWORD *)v11 + 6) = *((_DWORD *)v11 + 4); /*0xffe1be45*/
v19 = &v18[-*((_DWORD *)v11 + 4)]; /*0xffe1be48*/
v20 = *((_DWORD *)v11 + 5); /*0xffe1be4e*/
*((_DWORD *)v11 + 5) = 0; /*0xffe1be51*/
*((_DWORD *)v11 + 1) += v19; /*0xffe1be55*/
++*((_DWORD *)v11 + 2); /*0xffe1be58*/
*((_DWORD *)v11 + 7) = v20; /*0xffe1be5b*/
*((_DWORD *)v11 + 4) = v18; /*0xffe1be60*/
return 0; /*0xffe1be5e*/
}
else
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Err ActPcrBanks, No SHA1/SHA256 banks\n", 417);
return -2147483646; /*0xffe1bd8b*/
}
}
// Function: 0xffe1be6a
// String: BootGuardTCG2.c[%d] : Enter CreateBootGuardTPM20Event(...)
// String: BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs
// String: BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs
// String: BootGuardTCG2.c[%d] : TcgLog Addr 0x%x
int __fastcall CreateBootGuardTPM20Event(
int n17,
int n7,
int n7a,
char *src_1,
int n100,
const char *Boot_Guard_Measured_S_CRTM,
int n54)
{
_WORD *HobFromAddress; // eax
_WORD *v11; // esi
unsigned int n2; // eax
int n100_1; // [esp+10h] [ebp-40h] BYREF
char *src; // [esp+14h] [ebp-3Ch] BYREF
_WORD *v15; // [esp+18h] [ebp-38h] BYREF
_BYTE v16[20]; // [esp+1Ch] [ebp-34h] BYREF
char v17[32]; // [esp+30h] [ebp-20h] BYREF
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : Enter CreateBootGuardTPM20Event(...)\n", 503);
(*(void (__cdecl **)(_BYTE *, int, _DWORD))(*(_DWORD *)n17 + 84))(v16, 20, 0); /*0xffe1be94*/
(*(void (__cdecl **)(char *, int, _DWORD))(*(_DWORD *)n17 + 84))(v17, 32, 0); /*0xffe1bea5*/
if ( (*(int (__cdecl **)(int, _WORD **))(*(_DWORD *)n17 + 48))(n17, &v15) < 0 )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs\n", 513);
return -2147483634; /*0xffe1bed8*/
}
HobFromAddress = GetHobFromAddress((int)&unk_FFE2173C, v15); /*0xffe1bee6*/
if ( !HobFromAddress )
{
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 521);
return -2147483634; /*0xffe1befb*/
}
v11 = HobFromAddress + 12; /*0xffe1befd*/
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : TcgLog Addr 0x%x\n", 526, HobFromAddress + 12);
src = src_1; /*0xffe1bf1d*/
n2 = *((_DWORD *)v11 + 3); /*0xffe1bf21*/
n100_1 = n100; /*0xffe1bf24*/
if ( n2 < 2 ) /*0xffe1bf2b*/
{
DebugAssertPrint(1, &src, (int)&n100_1, (int)v16); /*0xffe1bf8b*/
}
else if ( n2 == 2 ) /*0xffe1bf34*/
{
if ( (v11[16] & 1) != 0 && n100 ) /*0xffe1bf3e*/
DebugAssertPrint(1, &src, (int)&n100_1, (int)v16); /*0xffe1bf51*/
if ( (v11[16] & 2) != 0 ) /*0xffe1bf5c*/
{
if ( n100 ) /*0xffe1bf60*/
GetFirstGuidHob(1, (int *)&src, &n100_1, v17); /*0xffe1bf73*/
}
}
return LogBootGuardTpm20EventWrapper(n17, n7, n7a, v16, v17, Boot_Guard_Measured_S_CRTM, n54); /*0xffe1bfb4*/
}
// Function: 0xffe1bfbc
int __fastcall LogBootGuardTpm20Event(int *n17, int a2)
{
int v4; // eax
_DWORD v5[2]; // [esp+8h] [ebp-110h] BYREF
__int16 v6; // [esp+10h] [ebp-108h]
int v7; // [esp+12h] [ebp-106h]
int n8; // [esp+16h] [ebp-102h]
_BYTE v9[238]; // [esp+1Ah] [ebp-FEh] BYREF
_DWORD v10[4]; // [esp+108h] [ebp-10h] BYREF
v10[0] = 1416362782; /*0xffe1bfc8*/
v10[1] = 1079319820; /*0xffe1bfcf*/
v10[2] = -196170332; /*0xffe1bfd6*/
v10[3] = 985143231; /*0xffe1bfdd*/
if ( !a2 ) /*0xffe1bfe7*/
return -2147483634; /*0xffe1bfe9*/
v5[0] = 34; /*0xffe1bff2*/
n8 = 8; /*0xffe1bffd*/
v6 = 1; /*0xffe1c007*/
v4 = *n17; /*0xffe1c010*/
v5[1] = 14; /*0xffe1c01e*/
v7 = 0; /*0xffe1c029*/
(*(void (__cdecl **)(_BYTE *, _DWORD *, int))(v4 + 80))(v9, v10, 16); /*0xffe1c02f*/
return (*(int (__cdecl **)(int, _DWORD, _DWORD, _BYTE *, _DWORD, int, _DWORD, _DWORD *))(a2 + 8))( /*0xffe1c04d*/
a2,
0,
0,
v9,
0,
16,
0,
v5);
}
// Function: 0xffe1c053
// String: [%d]: gTcgPpiguid NOT found %r
int __thiscall LocateTcgPpi(int *this)
{
int v2; // eax
int v3; // eax
int v4; // esi
_DWORD v6[8]; // [esp+10h] [ebp-128h] BYREF
_BYTE v7[224]; // [esp+30h] [ebp-108h] BYREF
_BYTE v8[4]; // [esp+110h] [ebp-28h] BYREF
_DWORD v9[4]; // [esp+114h] [ebp-24h] BYREF
int (__cdecl **v10)(_DWORD, int *, _DWORD *, int, _DWORD *, _BYTE *); // [esp+124h] [ebp-14h] BYREF
_DWORD v11[4]; // [esp+128h] [ebp-10h] BYREF
v11[0] = 1416362782; /*0xffe1c063*/
v11[1] = 1079319820; /*0xffe1c06f*/
v2 = *this; /*0xffe1c076*/
v11[2] = -196170332; /*0xffe1c081*/
v11[3] = 985143231; /*0xffe1c089*/
v10 = 0; /*0xffe1c090*/
v9[0] = 394082770; /*0xffe1c093*/
v9[1] = 1086866360; /*0xffe1c09a*/
v9[2] = 1362944410; /*0xffe1c0a1*/
v9[3] = 513070744; /*0xffe1c0a8*/
v6[0] = 0; /*0xffe1c0af*/
v6[1] = 8; /*0xffe1c0b5*/
v6[7] = 16; /*0xffe1c0bf*/
(*(void (__cdecl **)(_BYTE *, _DWORD *, int))(v2 + 80))(v7, v11, 16); /*0xffe1c0c5*/
v3 = (*(int (__cdecl **)(int *, _DWORD *, _DWORD, _DWORD, int (__cdecl ***)(_DWORD, int *, _DWORD *, int, _DWORD *, _BYTE *)))(*this + 32))( /*0xffe1c0d5*/
this,
v9,
0,
0,
&v10);
v4 = v3; /*0xffe1c0d8*/
if ( v3 >= 0 ) /*0xffe1c0df*/
return (*v10)(v10, this, v11, 16, v6, v8); /*0xffe1c112*/
DebugPrintWrapper(0x80000000, "[%d]: gTcgPpiguid NOT found %r \n", 645, v3);
return v4; /*0xffe1c117*/
}
// Function: 0xffe1c11e
// String: BootGuardTCG2.c[%d] : Can not locate Ami Tree Ppi, It may TPM 1.2 Device
// String: BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs, It may TPM 1.2 Device
// String: BootGuardTCG2.c[%d] : TrEEDeviceHob->Tpm20DeviceState = 0, It may TPM 1.2 Device
// String: BootGuardTCG2.c[%d]: TPM 1.2 found
// String: BootGuardTCG2.c[%d]: gTcgPpiguid NOT found %r
int __thiscall DetectTpmDeviceType(int *this)
{
int v2; // eax
_WORD *HobFromAddress; // eax
int v5; // eax
_DWORD v7[4]; // [esp+Ch] [ebp-1Ch] BYREF
int v8; // [esp+1Ch] [ebp-Ch] BYREF
_WORD *v9; // [esp+20h] [ebp-8h] BYREF
int v10; // [esp+24h] [ebp-4h] BYREF
v7[0] = 394082770; /*0xffe1c128*/
v7[1] = 1086866360; /*0xffe1c131*/
v10 = 0; /*0xffe1c13b*/
v2 = *this; /*0xffe1c13f*/
v8 = 0; /*0xffe1c149*/
v7[2] = 1362944410; /*0xffe1c14c*/
v7[3] = 513070744; /*0xffe1c153*/
if ( (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int *))(v2 + 32))(this, &unk_FFE2175C, 0, 0, &v10) < 0 )
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : Can not locate Ami Tree Ppi, It may TPM 1.2 Device\n", 702);
goto LABEL_11; /*0xffe1c16e*/
}
if ( (*(int (__cdecl **)(int *, _WORD **))(*this + 48))(this, &v9) < 0 )
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : Can not locate PEI HOB Logs, It may TPM 1.2 Device\n", 710);
goto LABEL_11; /*0xffe1c18a*/
}
HobFromAddress = GetHobFromAddress((int)&unk_FFE2174C, v9); /*0xffe1c194*/
if ( *((_BYTE *)HobFromAddress + 24) != 1 )
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : TrEEDeviceHob->Tpm20DeviceState = 0, It may TPM 1.2 Device\n", 725);
LABEL_11:
v5 = (*(int (__cdecl **)(int *, _DWORD *, _DWORD, _DWORD, int *))(*this + 32))(this, v7, 0, 0, &v8); /*0xffe1c1ea*/
if ( v5 >= 0 )
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TPM 1.2 found\n", 743);
return 1; /*0xffe1c244*/
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: gTcgPpiguid NOT found %r\n", 738, v5);
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: No TPM\n", 739);
return 0; /*0xffe1c22a*/
}
}
if ( *((_BYTE *)HobFromAddress + 25) == 1 )
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TPM 2.0 found\n", 718);
return 2; /*0xffe1c1b9*/
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: PTT found\n", 721);
return 3; /*0xffe1c1d5*/
}
}
// Function: 0xffe1c24b
// String: [BootGuardTCG2.c] : FindEntryInFit(%lx) is Invalid
// String: [BootGuardTCG2.c] : Error, Did not find Tbl type = %x
int __fastcall LogBootGuardTpm12Event(unsigned __int8 a1, _DWORD *a2)
{
int v2; // esi
unsigned int v5; // edx
unsigned int v6; // ecx
int v7; // eax
int n64; // [esp-Ch] [ebp-18h]
const char *[BootGuardTCG2.c]_:_FindEntryInFit(%lx)_is_Invalid_n; // [esp-8h] [ebp-14h]
int v11; // [esp-4h] [ebp-10h]
v2 = 0; /*0xffe1c251*/
if ( MEMORY[0xFFFFFFC0] == -1 || !MEMORY[0xFFFFFFC0] )
{
v11 = MEMORY[0xFFFFFFC0]; /*0xffe1c28f*/
[BootGuardTCG2.c]_:_FindEntryInFit(%lx)_is_Invalid_n = "[BootGuardTCG2.c] : FindEntryInFit(%lx) is Invalid\n";
n64 = 0x80000000; /*0xffe1c295*/
goto LABEL_10; /*0xffe1c295*/
}
v5 = *(_DWORD *)(MEMORY[0xFFFFFFC0] + 8); /*0xffe1c262*/
v6 = 1; /*0xffe1c267*/
if ( v5 <= 1 )
{
LABEL_7:
v11 = a1; /*0xffe1c27c*/
[BootGuardTCG2.c]_:_FindEntryInFit(%lx)_is_Invalid_n = "[BootGuardTCG2.c] : Error, Did not find Tbl type = %x\n";
n64 = 64; /*0xffe1c285*/
LABEL_10:
v2 = -2147483634; /*0xffe1c29a*/
DebugPrintWrapper(n64, [BootGuardTCG2.c]_:_FindEntryInFit(%lx)_is_Invalid_n, v11); /*0xffe1c29f*/
return v2; /*0xffe1c29f*/
}
v7 = MEMORY[0xFFFFFFC0] + 16; /*0xffe1c26c*/
while ( *(_BYTE *)(v7 + 14) != a1 ) /*0xffe1c272*/
{
++v6; /*0xffe1c274*/
v7 += 16; /*0xffe1c275*/
if ( v6 >= v5 ) /*0xffe1c27a*/
goto LABEL_7; /*0xffe1c27a*/
}
*a2 = *(_DWORD *)v7; /*0xffe1c28b*/
return v2; /*0xffe1c2a7*/
}
// Function: 0xffe1c2ad
// String: BootGuardTCG2.c[%d] : Enter LogTpm20LocalityStartupEvent(...)
// String: StartupLocality
int __fastcall LogTpm20LocalityStartupEvent(int n17, char n2)
{
char Boot_Guard_Measured_S_CRTM[20]; // [esp+Ch] [ebp-14h] BYREF
DebugPrintWrapper(64, "BootGuardTCG2.c[%d] : Enter LogTpm20LocalityStartupEvent(...)\n", 842);
if ( n2 ) /*0xffe1c2cf*/
{
(*(void (__cdecl **)(char *, int, _DWORD))(*(_DWORD *)n17 + 84))(Boot_Guard_Measured_S_CRTM, 16, 0); /*0xffe1c2db*/
(*(void (__cdecl **)(char *, const char *, int))(*(_DWORD *)n17 + 80))( /*0xffe1c2ee*/
Boot_Guard_Measured_S_CRTM,
"StartupLocality",
16);
Boot_Guard_Measured_S_CRTM[16] = 3; /*0xffe1c2f4*/
CreateBootGuardTPM20Event(n17, 0, 3, 0, 0, Boot_Guard_Measured_S_CRTM, 17); /*0xffe1c308*/
}
return 0; /*0xffe1c310*/
}
// Function: 0xffe1c318
// String: BootGuardTCG2.c[%d]: Skip Log Authority Event
// String: BootGuardTCG2.c[%d]: TRACE ERROR - %r
int __fastcall SkipLogAuthorityEvent(int n17, char n2)
{
int v4; // eax
int v6; // [esp+Ch] [ebp-4h] BYREF
v6 = 0; /*0xffe1c31d*/
v4 = LogBootGuardTpm12Event(0xCu, &v6); /*0xffe1c32c*/
if ( v4 >= 0 )
{
if ( (*(_DWORD *)(v6 + 28) & 2) != 0 )
{
if ( n2 != 1 && (n2 == 2 || n2 == 3) ) /*0xffe1c37b*/
LogTpm20LocalityStartupEvent(n17, n2); /*0xffe1c381*/
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Skip Log Authority Event\n", 893);
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 884, v4);
}
return 0; /*0xffe1c386*/
}
// Function: 0xffe1c38e
// String: [BootGuardTCG2.c] : Enter LogAuthorityPCREvent(...)
// String: BP->RSTR:[%x]
// String: BP->TYPE:[%x]
// String: BP->ACM_SVN = [%x]
// String: BP Hash Structure, Size[%x]
int __fastcall LogAuthorityPCREvent(int n17, char n2)
{
int v4; // eax
int v5; // edi
int v6; // eax
int v7; // eax
int n256_1; // esi
int v10; // [esp+10h] [ebp-74h] BYREF
int src; // [esp+14h] [ebp-70h] BYREF
int n256; // [esp+18h] [ebp-6Ch] BYREF
unsigned __int8 Msr; // [esp+1Ch] [ebp-68h] BYREF
unsigned __int8 v14; // [esp+1Dh] [ebp-67h]
unsigned __int16 v15; // [esp+1Eh] [ebp-66h]
char v16[32]; // [esp+20h] [ebp-64h] BYREF
char v17[32]; // [esp+40h] [ebp-44h] BYREF
char v18[36]; // [esp+60h] [ebp-24h] BYREF
n256 = 0; /*0xffe1c3a4*/
v10 = 0; /*0xffe1c3a8*/
src = 0; /*0xffe1c3ac*/
DebugPrintWrapper(64, "[BootGuardTCG2.c] : Enter LogAuthorityPCREvent(...)\n");
v4 = LogBootGuardTpm12Event(0xCu, &v10); /*0xffe1c3bd*/
v5 = v4; /*0xffe1c3c2*/
if ( v4 >= 0 )
{
if ( (*(_DWORD *)(v10 + 28) & 4) != 0 )
{
Msr = ReadMsr(); /*0xffe1c40d*/
DebugPrintWrapper(64, "BP->RSTR:[%x]\n", Msr); /*0xffe1c41b*/
v14 = IsBootGuardCapable(); /*0xffe1c428*/
DebugPrintWrapper(64, "BP->TYPE:[%x]\n", v14); /*0xffe1c436*/
v6 = LogBootGuardTpm12Event(2u, &src); /*0xffe1c444*/
v5 = v6; /*0xffe1c449*/
if ( v6 >= 0 )
{
v15 = IoWrite16((unsigned __int16 *)(src + 28)); /*0xffe1c466*/
DebugPrintWrapper(64, "BP->ACM_SVN = [%x]\n", v15); /*0xffe1c475*/
(*(void (__cdecl **)(char *, int, int))(*(_DWORD *)n17 + 80))(v16, -19725312, 32); /*0xffe1c48c*/
v7 = LogBootGuardTpm12Event(0xBu, &n256); /*0xffe1c498*/
v5 = v7; /*0xffe1c49d*/
if ( v7 >= 0 )
{
n256_1 = n256; /*0xffe1c4ae*/
n256 = 256; /*0xffe1c4b8*/
src = n256_1 + 58; /*0xffe1c4c4*/
GetFirstGuidHob(1, &src, &n256, v17); /*0xffe1c4d2*/
(*(void (__cdecl **)(char *, int, int))(*(_DWORD *)n17 + 80))(v18, n256_1 + 16, 32); /*0xffe1c4e5*/
DebugPrintWrapper(64, "BP Hash Structure, Size[%x]", 100); /*0xffe1c4f4*/
DebugPrintHexBytes(0x64u, (int)&Msr); /*0xffe1c503*/
if ( n2 != 1 && (n2 == 2 || n2 == 3) ) /*0xffe1c515*/
return CreateBootGuardTPM20Event( /*0xffe1c537*/
n17,
7,
-2147483647,
(char *)&Msr,
100,
(const char *)L"Boot Guard Measured S-CRTM",
54);
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 989, v7);
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 976, v6);
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Skip Log Authority Event\n", 959);
return 0; /*0xffe1c401*/
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 951, v4);
}
return v5; /*0xffe1c53b*/
}
// Function: 0xffe1c543
// String: [BootGuardTCG2.c] : Enter LogDetailPCREvent(...)
// String: MSR[0x%x]:[%08x]
// String: ACM_STATUS:[%08x]
// String: BP->RSTR:[%x]
// String: BP->TYPE:[%x]
int __fastcall LogDetailPCREvent(int n17, char n2)
{
int v4; // eax
int v5; // esi
__int16 v6; // ax
int v7; // eax
unsigned __int8 *v8; // esi
int v9; // eax
int v10; // edi
int v11; // esi
int v12; // ecx
char *src; // [esp+14h] [ebp-10h] BYREF
int v15; // [esp+18h] [ebp-Ch] BYREF
unsigned __int8 *v16; // [esp+1Ch] [ebp-8h] BYREF
int v17; // [esp+20h] [ebp-4h] BYREF
src = 0; /*0xffe1c55b*/
v16 = 0; /*0xffe1c55f*/
v17 = 0; /*0xffe1c563*/
v15 = 0; /*0xffe1c567*/
DebugPrintWrapper(64, "[BootGuardTCG2.c] : Enter LogDetailPCREvent(...)\n");
if ( (*(int (__cdecl **)(int, int, char **))(*(_DWORD *)n17 + 76))(n17, 804, &src) < 0 ) /*0xffe1c585*/
return -2147483639; /*0xffe1c587*/
DebugPrintWrapper(64, "MSR[0x%x]:[%08x]\n", 314, (unsigned int)__readmsr(0x13Au)); /*0xffe1c5a5*/
DebugPrintWrapper(64, "ACM_STATUS:[%08x]\n", MEMORY[0xFED30328]); /*0xffe1c5b9*/
*src = ReadMsr(); /*0xffe1c5ca*/
DebugPrintWrapper(64, "BP->RSTR:[%x]\n", (unsigned __int8)*src); /*0xffe1c5da*/
src[1] = IsBootGuardCapable(); /*0xffe1c5eb*/
DebugPrintWrapper(64, "BP->TYPE:[%x]\n", (unsigned __int8)src[1]); /*0xffe1c5fd*/
v4 = LogBootGuardTpm12Event(2u, &v15); /*0xffe1c60b*/
if ( v4 >= 0 )
{
v5 = v15; /*0xffe1c62d*/
v6 = IoWrite16((unsigned __int16 *)(v15 + 28)); /*0xffe1c634*/
*((_WORD *)src + 1) = v6; /*0xffe1c63d*/
DebugPrintWrapper(64, "BP->ACM_SVN = [%x]\n", *((unsigned __int16 *)src + 1)); /*0xffe1c650*/
(*(void (__cdecl **)(char *, int, int))(*(_DWORD *)n17 + 80))(src + 4, v5 + 388, 256); /*0xffe1c66f*/
DebugPrintHexBytes(0x100u, (int)(src + 4)); /*0xffe1c67e*/
v7 = LogBootGuardTpm12Event(0xBu, &v16); /*0xffe1c689*/
if ( v7 >= 0 )
{
v8 = v16; /*0xffe1c69a*/
DebugPrintWrapper(64, "\nKmStructure: Addr[%lx]\n", v16);
ParseBootGuardStructureId(v8); /*0xffe1c6af*/
(*(void (__cdecl **)(char *, unsigned __int8 *, int))(*(_DWORD *)n17 + 80))(src + 260, v8 + 321, 256); /*0xffe1c6c8*/
DebugPrintHexBytes(0x100u, (int)(src + 260)); /*0xffe1c6da*/
v9 = LogBootGuardTpm12Event(0xCu, &v17); /*0xffe1c6e5*/
if ( v9 >= 0 )
{
v10 = v17; /*0xffe1c6f9*/
DebugPrintWrapper(64, "\nBpmStructure: Addr[%lx]\n", v17);
ParseBootGuardStructureId((unsigned __int8 *)v10); /*0xffe1c70e*/
DebugPrintWrapper(64, "BpmStructure->Ibb_Element.EntryPoint[%x]\n", *(_DWORD *)(v10 + 108)); /*0xffe1c71c*/
DebugPrintWrapper(64, "BpmStructure->Ibb_Element.SegmentCount[%x]\n", *(unsigned __int8 *)(v10 + 148)); /*0xffe1c732*/
v11 = 12 * *(unsigned __int8 *)(v10 + 148); /*0xffe1c741*/
DebugPrintWrapper(64, "\nBpmStructure->Bpm_Signature_Element.KeySignaturee"); /*0xffe1c74a*/
(*(void (__cdecl **)(char *, int, int))(*(_DWORD *)n17 + 80))(src + 516, v11 + v10 + 431, 256); /*0xffe1c769*/
DebugPrintHexBytes(0x100u, (int)(src + 516)); /*0xffe1c77e*/
DebugPrintWrapper(64, "\n\nBpmStructure->Digest_of_Hashed_IBB_Segment:"); /*0xffe1c789*/
(*(void (__cdecl **)(char *, int, int))(*(_DWORD *)n17 + 80))(src + 772, v10 + 116, 32); /*0xffe1c7a0*/
DebugPrintHexBytes(0x20u, (int)(src + 772)); /*0xffe1c7b3*/
DebugPrintWrapper(64, "BP Hash Structure, Size[%x]", 804); /*0xffe1c7c4*/
DebugPrintHexBytes(0x324u, (int)src); /*0xffe1c7d2*/
if ( n2 == 1 ) /*0xffe1c7dd*/
{
CreateBootGuardTPM12Event(v12, src); /*0xffe1c7e9*/
}
else if ( n2 == 2 || n2 == 3 ) /*0xffe1c7f6*/
{
CreateBootGuardTPM20Event(n17, 0, 7, src, 804, "Boot Guard Measured S-CRTM", 27); /*0xffe1c80a*/
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 1099, v9);
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 1087, v7);
}
}
else
{
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: TRACE ERROR - %r\n", 1075, v4);
}
return 0; /*0xffe1c814*/
}
// Function: 0xffe1c81c
// String: BootGuardTCG2.c[%d]: Enter LogTxtTpm12CRTMEvent
// String: [%d] : FitEntryPointer(%lx) is empty
// String: FIT Type 0x02 Measured S-CRTM
// String: BootGuardTCG2.c[%d]: Error LogBootGuardTPM12Event(...)
// String: BootGuardTCG2.c[%d]: Error TRACE CODE
int __thiscall LogTxtTpm12CRTMEvent(void *this)
{
int v1; // esi
int v2; // edi
unsigned int v3; // ebx
unsigned int v4; // eax
_BYTE *v5; // ebp
int v6; // ecx
int v7; // ebp
int v8; // ecx
unsigned int v9; // edx
int v10; // ecx
int *i; // eax
int v13; // [esp-4h] [ebp-90h]
int v14; // [esp-4h] [ebp-90h]
int v16; // [esp+18h] [ebp-74h] BYREF
unsigned int v17; // [esp+1Ch] [ebp-70h]
int v18; // [esp+20h] [ebp-6Ch]
_DWORD v19[5]; // [esp+24h] [ebp-68h] BYREF
_DWORD v20[10]; // [esp+38h] [ebp-54h] BYREF
char *p_src[11]; // [esp+60h] [ebp-2Ch] BYREF
v1 = 0; /*0xffe1c833*/
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Enter LogTxtTpm12CRTMEvent\n", 1175);
v2 = MEMORY[0xFFFFFFC0]; /*0xffe1c840*/
v18 = MEMORY[0xFFFFFFC0]; /*0xffe1c842*/
if ( MEMORY[0xFFFFFFC0] == -1 )
{
v1 = -2147483642; /*0xffe1c858*/
DebugPrintWrapper(64, "[%d] : FitEntryPointer(%lx) is empty\n", 1183, -1);
}
else if ( *MEMORY[0xFFFFFFC0] == 1414088287 && *(_DWORD *)(MEMORY[0xFFFFFFC0] + 4) == 538976351 )
{
v3 = *(_DWORD *)(MEMORY[0xFFFFFFC0] + 8); /*0xffe1c883*/
if ( v3 > 1 )
{
v4 = v3 - 1; /*0xffe1c88f*/
v5 = (_BYTE *)(MEMORY[0xFFFFFFC0] + 16); /*0xffe1c892*/
v17 = v3 - 1; /*0xffe1c895*/
do
{
if ( v5[14] == 2 )
{
v16 = *(_DWORD *)(*(_DWORD *)v5 + 20); /*0xffe1c8b2*/
(*(void (__cdecl **)(_DWORD *, int, _DWORD))(*(_DWORD *)this + 84))(v19, 20, 0); /*0xffe1c8b8*/
v19[0] = v16; /*0xffe1c8c2*/
v1 = LogBootGuardEventInternal(v6, v19, "FIT Type 0x02 Measured S-CRTM", 30); /*0xffe1c8da*/
if ( v1 < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error LogBootGuardTPM12Event(...)\n", 1219);
v4 = v17; /*0xffe1c8f7*/
}
v5 += 16; /*0xffe1c8fb*/
v17 = --v4; /*0xffe1c901*/
}
while ( v4 );
v2 = v18; /*0xffe1c907*/
if ( v1 < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error TRACE CODE\n", 1227);
}
v7 = 0; /*0xffe1c923*/
if ( v3 > 1 )
{
v8 = v2 + 24; /*0xffe1c92a*/
v9 = v3 - 1; /*0xffe1c92d*/
do /*0xffe1c94d*/
{
if ( *(_BYTE *)(v8 + 6) == 7 ) /*0xffe1c934*/
{
p_src[v7] = *(char **)(v8 - 8); /*0xffe1c939*/
v20[v7++] = 16 * *(_DWORD *)v8; /*0xffe1c942*/
}
v8 += 16; /*0xffe1c947*/
--v9; /*0xffe1c94a*/
}
while ( v9 ); /*0xffe1c94d*/
if ( v7 )
{
DebugAssertPrint(v7, p_src, (int)v20, (int)v19); /*0xffe1c963*/
v1 = LogBootGuardEventInternal(v13, v19, "FIT Type 0x07 Measured S-CRTM", 30); /*0xffe1c982*/
if ( v1 < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error LogBootGuardTPM12Event(...)\n", 1259);
}
}
v16 = 0; /*0xffe1c9a5*/
v10 = 1; /*0xffe1c9ac*/
if ( v3 > 1 )
{
for ( i = (int *)(v2 + 16); *((_BYTE *)i + 14) != 45; i += 4 ) /*0xffe1c9b5*/
{
if ( ++v10 >= v3 ) /*0xffe1c9c4*/
return v1; /*0xffe1c9c4*/
}
v16 = *i; /*0xffe1c9ce*/
v20[0] = 4; /*0xffe1c9d8*/
p_src[0] = (char *)&v16; /*0xffe1c9e0*/
DebugAssertPrint(1, p_src, (int)v20, (int)v19); /*0xffe1c9ef*/
v1 = LogBootGuardEventInternal(v14, v19, "FIT Type 0x2D Measured S-CRTM", 30); /*0xffe1ca0a*/
if ( v1 < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error LogBootGuardTPM12Event(...)\n", 1291);
}
}
else
{
v1 = -2147483642; /*0xffe1ca2c*/
DebugPrintWrapper(64, "[%d] : [Type 0] FitEntry->TblAddress(%lx) is error\n", 1191, *MEMORY[0xFFFFFFC0]);
}
return v1; /*0xffe1ca47*/
}
// Function: 0xffe1ca51
// String: BootGuardTCG2.c[%d]: Enter LogTxtTpm20CRTMEvent
// String: [%d] : FitEntryPointer(%lx) is empty
// String: FIT Type 0x02 Measured S-CRTM
// String: BootGuardTCG2.c[%d]: Error LogBootGuardTPM20Event(...)
// String: BootGuardTCG2.c[%d]: Error TRACE CODE
int __thiscall LogTxtTpm20CRTMEvent(void *this)
{
int this_1; // ebp
int v2; // esi
int v3; // esi
unsigned int v4; // ebx
int v5; // edi
int v6; // esi
unsigned int v7; // ebp
int v8; // ebx
int v9; // eax
bool v10; // sf
int v11; // edi
int v12; // ecx
unsigned int v13; // edx
unsigned int v14; // ecx
int *v15; // eax
int v17; // [esp+14h] [ebp-A0h] BYREF
int this_2; // [esp+18h] [ebp-9Ch]
int v19; // [esp+1Ch] [ebp-98h]
int v20; // [esp+20h] [ebp-94h]
int v21; // [esp+24h] [ebp-90h]
unsigned int v22; // [esp+28h] [ebp-8Ch]
_BYTE v23[20]; // [esp+2Ch] [ebp-88h] BYREF
int p_n256[10]; // [esp+40h] [ebp-74h] BYREF
char *p_src[10]; // [esp+68h] [ebp-4Ch] BYREF
char v26[36]; // [esp+90h] [ebp-24h] BYREF
v19 = 0; /*0xffe1ca57*/
this_1 = (int)this; /*0xffe1ca65*/
this_2 = (int)this; /*0xffe1ca6e*/
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Enter LogTxtTpm20CRTMEvent\n", 1317);
v2 = MEMORY[0xFFFFFFC0]; /*0xffe1ca7d*/
v21 = MEMORY[0xFFFFFFC0]; /*0xffe1ca7f*/
if ( MEMORY[0xFFFFFFC0] == -1 )
{
v3 = -2147483642; /*0xffe1ca96*/
DebugPrintWrapper(64, "[%d] : FitEntryPointer(%lx) is empty\n", 1325, -1);
}
else if ( *MEMORY[0xFFFFFFC0] == 1414088287 && *(_DWORD *)(MEMORY[0xFFFFFFC0] + 4) == 538976351 )
{
v4 = *(_DWORD *)(MEMORY[0xFFFFFFC0] + 8); /*0xffe1cac4*/
v20 = 0; /*0xffe1cac7*/
v22 = v4; /*0xffe1cacc*/
if ( v4 > 1 )
{
v5 = MEMORY[0xFFFFFFC0] + 16; /*0xffe1cad9*/
v6 = v19; /*0xffe1cadc*/
v7 = v4 - 1; /*0xffe1cae0*/
v8 = v20; /*0xffe1cae3*/
do
{
if ( *(_BYTE *)(v5 + 14) == 2 )
{
v9 = *(_DWORD *)v5; /*0xffe1caf1*/
p_n256[v8] = 4; /*0xffe1caf7*/
v17 = *(_DWORD *)(v9 + 20); /*0xffe1cb02*/
p_src[v8++] = (char *)&v17; /*0xffe1cb0a*/
GetFirstGuidHob(v8, (int *)p_src, p_n256, v26); /*0xffe1cb1e*/
DebugAssertPrint(v8, p_src, (int)p_n256, (int)v23); /*0xffe1cb33*/
v6 = LogBootGuardTpm20EventWrapper(this_2, 0, 7, v23, v26, "FIT Type 0x02 Measured S-CRTM", 30); /*0xffe1cb59*/
if ( v6 < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error LogBootGuardTPM20Event(...)\n", 1366);
}
v5 += 16; /*0xffe1cb76*/
--v7; /*0xffe1cb79*/
}
while ( v7 );
v4 = v22; /*0xffe1cb82*/
v10 = v6 < 0; /*0xffe1cb86*/
v2 = v21; /*0xffe1cb88*/
if ( v10 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error TRACE CODE\n", 1374);
this_1 = this_2; /*0xffe1cba2*/
}
v11 = 0; /*0xffe1cba6*/
if ( v4 > 1 )
{
v12 = v2 + 24; /*0xffe1cbb1*/
v13 = v4 - 1; /*0xffe1cbb4*/
do /*0xffe1cbd4*/
{
if ( *(_BYTE *)(v12 + 6) == 7 ) /*0xffe1cbbb*/
{
p_src[v11] = *(char **)(v12 - 8); /*0xffe1cbc0*/
p_n256[v11++] = 16 * *(_DWORD *)v12; /*0xffe1cbc9*/
}
v12 += 16; /*0xffe1cbce*/
--v13; /*0xffe1cbd1*/
}
while ( v13 ); /*0xffe1cbd4*/
if ( v11 )
{
GetFirstGuidHob(v11, (int *)p_src, p_n256, v26); /*0xffe1cbed*/
DebugAssertPrint(v11, p_src, (int)p_n256, (int)v23); /*0xffe1cc02*/
if ( LogBootGuardTpm20EventWrapper(this_1, 0, 7, v23, v26, "FIT Type 0x07 Measured S-CRTM", 30) < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error LogBootGuardTPM20Event(...)\n", 1408);
}
}
v17 = 0; /*0xffe1cc41*/
v14 = 1; /*0xffe1cc49*/
if ( v4 > 1 ) /*0xffe1cc4d*/
{
v15 = (int *)(v2 + 16); /*0xffe1cc4f*/
while ( *((_BYTE *)v15 + 14) != 45 ) /*0xffe1cc56*/
{
++v14; /*0xffe1cc58*/
v15 += 4; /*0xffe1cc59*/
if ( v14 >= v4 ) /*0xffe1cc5e*/
goto LABEL_28; /*0xffe1cc5e*/
}
v17 = *v15; /*0xffe1cc64*/
}
LABEL_28:
p_n256[0] = 4; /*0xffe1cc68*/
p_src[0] = (char *)&v17; /*0xffe1cc74*/
GetFirstGuidHob(1, (int *)p_src, p_n256, v26); /*0xffe1cc8b*/
DebugAssertPrint(1, p_src, (int)p_n256, (int)v23); /*0xffe1cca0*/
v3 = LogBootGuardTpm20EventWrapper(this_1, 0, 7, v23, v26, "FIT Type 0x2D Measured S-CRTM", 30); /*0xffe1ccc4*/
if ( v3 < 0 )
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Error LogBootGuardTPM20Event(...)\n", 1445);
}
else
{
v3 = -2147483642; /*0xffe1ccf1*/
DebugPrintWrapper(64, "[%d] : [Type 0] FitEntry->TblAddress(%lx) is error\n", 1333, *MEMORY[0xFFFFFFC0]);
}
return v3; /*0xffe1ccfe*/
}
// Function: 0xffe1cd0b
// String: BootGuardTCG2.c[%d]: Enter BootGuardTcg2MeasureCRTMVersion
// String: [BootGuardTCG2.c] Bit 63 success in 0xFED300A0
// String: [BootGuardTCG2.c] Start the LogDetailPCREvent
// String:
ASSERT_EFI_ERROR (Status = %r)
// String: e:\hs\PurleyPlatPkg\BootGuard\BootGuardTCG2\BootGuardTCG2.c
int __cdecl BootGuardTcg2MeasureCRTMVersion(int *n17)
{
char n2; // bl
unsigned __int64 v2; // rax
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
int v10[3]; // [esp+Ch] [ebp-Ch] BYREF
v10[0] = 0; /*0xffe1cd25*/
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: Enter BootGuardTcg2MeasureCRTMVersion\n", 1465);
n2 = DetectTpmDeviceType(n17); /*0xffe1cd3d*/
if ( (*(int (__cdecl **)(int *, void *, _DWORD, _DWORD, int *))(*n17 + 32))(n17, &unk_FFE2175C, 0, 0, v10) < 0 ) /*0xffe1cd54*/
v10[0] = 0; /*0xffe1cd56*/
if ( MEMORY[0xFED300A4] < 0 )
{
DebugPrintWrapper(64, "[BootGuardTCG2.c] Bit 63 success in 0xFED300A0\n"); /*0xffe1cd95*/
LABEL_7:
if ( CheckBootGuardCapabilityMsr() == 1 && CheckNemMeasureBootStatus() >= 0 ) /*0xffe1cdb0*/
{
DebugPrintWrapper(64, "[BootGuardTCG2.c] Start the LogDetailPCREvent\n"); /*0xffe1cdbd*/
v3 = SkipLogAuthorityEvent((int)n17, n2); /*0xffe1cdc8*/
if ( v3 < 0 ) /*0xffe1cdd4*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0xffe1cddd*/
v4 = AssertReport(); /*0xffe1cde5*/
if ( v4 ) /*0xffe1cdec*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffe1cdfd*/
"e:\\hs\\PurleyPlatPkg\\BootGuard\\BootGuardTCG2\\BootGuardTCG2.c",
1495,
"!EFI_ERROR (Status)");
}
v5 = LogDetailPCREvent((int)n17, n2); /*0xffe1ce07*/
if ( v5 < 0 ) /*0xffe1ce0e*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0xffe1ce17*/
v6 = AssertReport(); /*0xffe1ce1f*/
if ( v6 ) /*0xffe1ce26*/
(*(void (__cdecl **)(const char *, int, const char *))(v6 + 4))( /*0xffe1ce37*/
"e:\\hs\\PurleyPlatPkg\\BootGuard\\BootGuardTCG2\\BootGuardTCG2.c",
1497,
"!EFI_ERROR (Status)");
}
v7 = LogAuthorityPCREvent((int)n17, n2); /*0xffe1ce41*/
if ( v7 < 0 ) /*0xffe1ce48*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v7); /*0xffe1ce55*/
v8 = AssertReport(); /*0xffe1ce5d*/
if ( v8 ) /*0xffe1ce64*/
(*(void (__cdecl **)(const char *, int, const char *))(v8 + 4))( /*0xffe1ce79*/
"e:\\hs\\PurleyPlatPkg\\BootGuard\\BootGuardTCG2\\BootGuardTCG2.c",
1499,
"!EFI_ERROR (Status)");
}
goto LABEL_27; /*0xffe1ce7c*/
}
if ( LogTpm20LocalityStartupEvent((int)n17, n2) < 0 )
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 1507);
if ( n2 == 1 )
{
if ( LogTxtTpm12CRTMEvent(n17) >= 0 )
{
LABEL_27:
DebugPrintWrapper(64, "BootGuardTCG2.c[%d]: End of BootGuardTcg2MeasureCRTMVersion\n", 1524);
goto LABEL_28; /*0xffe1cefa*/
}
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 1513);
}
if ( (n2 == 2 || n2 == 3) && LogTxtTpm20CRTMEvent(n17) < 0 )
DebugPrintWrapper(0x80000000, "BootGuardTCG2.c[%d] : Can not Find TCG HOB Logs\n", 1520);
goto LABEL_27; /*0xffe1cee6*/
}
DebugPrintWrapper(64, "[BootGuardTCG2.c] Bit 63 fail in 0xFED300A0\n"); /*0xffe1cd73*/
v2 = __readmsr(0x13Au); /*0xffe1cd7f*/
if ( (v2 & 0x20) != 0 ) /*0xffe1cd86*/
goto LABEL_7; /*0xffe1cd86*/
LABEL_28:
if ( n2 != 1 && (n2 == 2 || n2 == 3) ) /*0xffe1cf18*/
LogBootGuardTpm20Event(n17, v10[0]); /*0xffe1cf20*/
else
LocateTcgPpi(n17); /*0xffe1cf09*/
return 0; /*0xffe1cf25*/
}
// Function: 0xffe1cf2e
int HobGetBaseAddress()
{
unsigned __int8 v0; // al
char n3; // al
char n3_1; // cl
v0 = __inbyte(0x70u); /*0xffe1cf34*/
__outbyte(0x70u, v0 & 0x80 | 0x4A); /*0xffe1cf39*/
n3 = __inbyte(0x71u); /*0xffe1cf40*/
n3_1 = n3; /*0xffe1cf41*/
if ( (unsigned __int8)n3 <= 3u ) /*0xffe1cf46*/
{
LABEL_4:
if ( !n3_1 ) /*0xffe1cf61*/
return 0; /*0xffe1cf61*/
goto LABEL_5; /*0xffe1cf61*/
}
n3_1 = n3; /*0xffe1cf48*/
if ( !n3 ) /*0xffe1cf50*/
{
n3_1 = MEMORY[0xFDAF0490] & 2 | 1; /*0xffe1cf5c*/
goto LABEL_4; /*0xffe1cf5c*/
}
LABEL_5:
if ( n3_1 != -1 )
return n3_1 != 1 ? -2147483578 : -2147483644;
return 0; /*0xffe1cf79*/
}
// Function: 0xffe1cf7d
// String: e:\hs\MdePkg\Library\PeiServicesTablePointerLibIdt\PeiServicesTablePointer.c
// String: PeiServices != ((void *) 0)
int HobGetNext()
{
int v0; // esi
_BYTE v2[2]; // [esp+4h] [ebp-8h] BYREF
int v3; // [esp+6h] [ebp-6h]
HobGetEnd(v2); /*0xffe1cf86*/
v0 = *(_DWORD *)(v3 - 4); /*0xffe1cf8e*/
if ( !v0 ) /*0xffe1cf93*/
DebugVPrint( /*0xffe1cfa2*/
(int)"e:\\hs\\MdePkg\\Library\\PeiServicesTablePointerLibIdt\\PeiServicesTablePointer.c",
48,
"PeiServices != ((void *) 0)");
return v0; /*0xffe1cfaa*/
}
// Function: 0xffe1cfaf
// String: e:\hs\MdePkg\Library\BaseLib\Unaligned.c
// String: Buffer != ((void *) 0)
__int64 __thiscall HobGetType(void *this)
{
int v2; // eax
if ( !this ) /*0xffe1cfb4*/
{
v2 = AssertReport(); /*0xffe1cfb6*/
if ( v2 ) /*0xffe1cfbd*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffe1cfce*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
192,
"Buffer != ((void *) 0)");
}
return *(_QWORD *)this; /*0xffe1cfd9*/
}
// Function: 0xffe1cfdb
// String: e:\hs\MdePkg\Library\BaseLib\Unaligned.c
// String: Buffer != ((void *) 0)
int __cdecl ReadUnaligned32(int Type, int a2)
{
_DWORD *v2; // ecx
_DWORD *v3; // esi
int v4; // eax
v3 = v2; /*0xffe1cfdc*/
if ( !v2 ) /*0xffe1cfe0*/
{
v4 = AssertReport(); /*0xffe1cfe2*/
if ( v4 ) /*0xffe1cfe9*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffe1cffa*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
219,
"Buffer != ((void *) 0)");
}
*v3 = Type; /*0xffe1d008*/
v3[1] = a2; /*0xffe1d00a*/
return Type; /*0xffe1d00d*/
}
// Function: 0xffe1d00f
// String: e:\hs\MdePkg\Library\BaseLib\X86ReadIdtr.c
// String: Idtr != ((void *) 0)
void *__thiscall HobGetEnd(void *this)
{
void *this_1; // eax
if ( !this ) /*0xffe1d015*/
DebugVPrint((int)"e:\\hs\\MdePkg\\Library\\BaseLib\\X86ReadIdtr.c", 37, "Idtr != ((void *) 0)"); /*0xffe1d024*/
this_1 = this; /*0xffe1d02a*/
__sidt(this); /*0xffe1d02d*/
return this_1; /*0xffe1d031*/
}
// Function: 0xffe1d04f
// String:
ASSERT_EFI_ERROR (Status = %r)
// String: e:\hs\MdePkg\Library\PeiHobLib\HobLib.c
// String: !EFI_ERROR (Status)
// String: HobList != ((void *) 0)
int PeiServicesLocateHob()
{
int Next; // eax
int v1; // eax
int v2; // eax
int v3; // eax
int v5; // [esp+4h] [ebp-4h] BYREF
Next = HobGetNext(); /*0xffe1d054*/
v1 = (*(int (__cdecl **)(int, int *))(*(_DWORD *)Next + 48))(Next, &v5); /*0xffe1d060*/
if ( v1 < 0 ) /*0xffe1d06c*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v1); /*0xffe1d079*/
v2 = AssertReport(); /*0xffe1d081*/
if ( v2 ) /*0xffe1d088*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffe1d092*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
50,
"!EFI_ERROR (Status)");
}
if ( !v5 ) /*0xffe1d09c*/
{
v3 = AssertReport(); /*0xffe1d09e*/
if ( v3 ) /*0xffe1d0a5*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffe1d0af*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
51,
"HobList != ((void *) 0)");
}
return v5; /*0xffe1d0b8*/
}
// Function: 0xffe1d0bd
// String: e:\hs\MdePkg\Library\PeiHobLib\HobLib.c
// String: HobStart != ((void *) 0)
_WORD *__fastcall GetHobList(int a1, _WORD *a2)
{
_WORD *v2; // esi
int v3; // eax
v2 = a2; /*0xffe1d0be*/
if ( !a2 ) /*0xffe1d0c2*/
{
v3 = AssertReport(); /*0xffe1d0c4*/
if ( v3 ) /*0xffe1d0cb*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffe1d0d9*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
82,
"HobStart != ((void *) 0)");
}
while ( 1 ) /*0xffe1d0f2*/
{
if ( *v2 == 0xFFFF ) /*0xffe1d0f8*/
return 0; /*0xffe1d0fd*/
if ( *v2 == 4 ) /*0xffe1d0ea*/
break; /*0xffe1d0ea*/
v2 = (_WORD *)((char *)v2 + (unsigned __int16)v2[1]); /*0xffe1d0f0*/
}
return v2; /*0xffe1d0fc*/
}
// Function: 0xffe1d102
_WORD *__fastcall GetHobFromAddress(int a1, _WORD *a2)
{
_WORD *HobList; // eax
_WORD *HobList_1; // esi
while ( 1 ) /*0xffe1d11d*/
{
HobList = GetHobList(a1, a2); /*0xffe1d11d*/
HobList_1 = HobList; /*0xffe1d122*/
if ( !HobList || HobIsSuitable(a1, (int)(HobList + 4)) ) /*0xffe1d10e*/
break; /*0xffe1d10e*/
a2 = (_WORD *)((char *)HobList_1 + (unsigned __int16)HobList_1[1]); /*0xffe1d11b*/
}
return HobList_1; /*0xffe1d128*/
}
// Function: 0xffe1d12e
_WORD *GetSystemConfiguration()
{
_WORD *Hob; // eax
Hob = (_WORD *)PeiServicesLocateHob(); /*0xffe1d12f*/
return GetHobFromAddress((int)&unk_FFE21668, Hob); /*0xffe1d141*/
}
// Function: 0xffe1d142
// String: e:\hs\MdePkg\Library\PeiHobLib\HobLib.c
// String: Hob != ((void *) 0)
int __fastcall GetNextHob(int a1, int a2)
{
int Next; // eax
int v4; // eax
int v6; // [esp+4h] [ebp-4h] BYREF
Next = HobGetNext(); /*0xffe1d149*/
if ( (*(int (__cdecl **)(int, int, int, int *))(*(_DWORD *)Next + 52))(Next, 4, a2, &v6) < 0 ) /*0xffe1d161*/
v6 = 0; /*0xffe1d163*/
if ( !v6 ) /*0xffe1d16b*/
{
v4 = AssertReport(); /*0xffe1d16d*/
if ( v4 ) /*0xffe1d174*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffe1d185*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
250,
"Hob != ((void *) 0)");
}
return v6; /*0xffe1d15e*/
}
// Function: 0xffe1d192
// String: e:\hs\MdePkg\Library\PeiHobLib\HobLib.c
// String: DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE))
int __fastcall BuildGuidHob(int a1, unsigned int n0xFFE0)
{
int v3; // eax
int result; // eax
int v5; // esi
if ( n0xFFE0 > 0xFFE0 ) /*0xffe1d19b*/
{
v3 = AssertReport(); /*0xffe1d19d*/
if ( v3 ) /*0xffe1d1a4*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffe1d1b5*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
421,
"DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE))");
}
result = GetNextHob(a1, n0xFFE0 + 24); /*0xffe1d1be*/
v5 = result; /*0xffe1d1c3*/
if ( result ) /*0xffe1d1c7*/
{
GetHobLength(result + 8, (int)&unk_FFE21668); /*0xffe1d1d3*/
return v5 + 24; /*0xffe1d1d8*/
}
return result; /*0xffe1d1c9*/
}
// Function: 0xffe1d1dd
// String: e:\hs\MdePkg\Library\BaseMemoryLibRepStr\SetMemWrapper.c
// String: (Length - 1) <= (0xFFFFFFFF - (UINTN)Buffer)
void *__fastcall GetEndOfHobList(void *buf, unsigned int count)
{
int v4; // eax
if ( count - 1 > -1 - (int)buf ) /*0xffe1d1ee*/
{
v4 = AssertReport(); /*0xffe1d1f0*/
if ( v4 ) /*0xffe1d1f7*/
(*(void (__cdecl **)(const char *, int, const char *))(v4 + 4))( /*0xffe1d205*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\SetMemWrapper.c",
54,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)Buffer)");
}
return ZeroMem(buf, count, 0); /*0xffe1d217*/
}
// Function: 0xffe1d21b
int __fastcall GetHobLength(int a1, int a2)
{
__int64 Type; // rax
__int64 Type_1; // rax
Type = HobGetType((void *)a2); /*0xffe1d223*/
ReadUnaligned32(Type, SHIDWORD(Type)); /*0xffe1d22c*/
Type_1 = HobGetType((void *)(a2 + 8)); /*0xffe1d234*/
ReadUnaligned32(Type_1, SHIDWORD(Type_1)); /*0xffe1d23e*/
return a1; /*0xffe1d248*/
}
// Function: 0xffe1d24b
bool __fastcall HobIsSuitable(int a1, int a2)
{
__int64 Type; // rax
int Type_1; // ebp
__int64 Type_3; // rax
int Type_2; // edi
__int64 v8; // kr00_8
__int64 v9; // rax
int v11; // [esp+10h] [ebp-Ch]
int v12; // [esp+14h] [ebp-8h]
Type = HobGetType((void *)a1); /*0xffe1d256*/
v12 = HIDWORD(Type); /*0xffe1d25d*/
Type_1 = Type; /*0xffe1d261*/
Type_3 = HobGetType((void *)a2); /*0xffe1d263*/
v11 = HIDWORD(Type_3); /*0xffe1d26b*/
Type_2 = Type_3; /*0xffe1d26f*/
v8 = HobGetType((void *)(a1 + 8)); /*0xffe1d27d*/
v9 = HobGetType((void *)(a2 + 8)); /*0xffe1d27f*/
return Type_1 == Type_2 && v12 == v11 && v8 == v9; /*0xffe1d2a2*/
}
// Function: 0xffe1d2aa
// String: e:\hs\MdePkg\Library\BaseIoLibIntrinsic\IoLib.c
// String: (Address & 1) == 0
int __fastcall IoWrite16(unsigned __int16 *a1)
{
int v2; // eax
if ( ((unsigned __int8)a1 & 1) != 0 ) /*0xffe1d2b0*/
{
v2 = AssertReport(); /*0xffe1d2b2*/
if ( v2 ) /*0xffe1d2b9*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffe1d2ca*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c",
151,
"(Address & 1) == 0");
}
return *a1; /*0xffe1d2d6*/
}
// Function: 0xffe1d308
void *__fastcall GetFirstGuidHob(int a1, char *p_src, int *p_n256, char *a4)
{
int v6; // edi
_DWORD buf[28]; // [esp+10h] [ebp-70h] BYREF
PeiPcdLocateProtocol(buf); /*0xffe1d318*/
if ( a1 ) /*0xffe1d31f*/
{
v6 = (char *)p_n256 - p_src; /*0xffe1d324*/
do /*0xffe1d33a*/
{
PeiPcdGetSize((int)buf, *(_DWORD *)p_src, *(_DWORD *)&p_src[v6]); /*0xffe1d32e*/
p_src += 4; /*0xffe1d333*/
--a1; /*0xffe1d337*/
}
while ( a1 ); /*0xffe1d33a*/
}
PeiPcdGetPtr((int)buf, a4); /*0xffe1d342*/
return GetEndOfHobList(buf, 0x70u); /*0xffe1d352*/
}
// Function: 0xffe1d359
int __fastcall GetNextGuidHob(_DWORD *buf, unsigned __int8 *src)
{
int v2; // ebx
int v3; // edi
int v4; // edx
int v5; // ebp
int v6; // edx
int v7; // edi
int v8; // edx
int v9; // ebx
int v10; // edx
int v11; // edx
int v12; // edx
int v13; // edx
int v14; // edx
int v15; // edx
int v16; // edx
int v17; // edx
int v18; // edx
int v19; // edx
int v20; // edx
int v21; // edx
int v22; // edx
int v23; // edx
int v24; // edx
int v25; // edx
int v26; // edx
int v27; // edx
int v28; // edx
int v29; // edx
int v30; // edx
int v31; // edx
int v32; // edx
int v33; // edx
int v34; // edx
int v35; // edx
int v36; // edx
int v37; // edx
int v38; // edx
int v39; // edx
int v40; // edx
int v41; // edx
int v42; // edx
int v43; // edx
int v44; // edx
int v45; // edx
int v46; // edx
int v47; // edx
int v48; // edx
int v49; // edx
int v50; // edi
int v51; // edx
int v52; // ebx
int v53; // edx
int... [39370 chars total]
// Function: 0xffe1fb6d
int __thiscall PeiPcdLocateProtocol(_DWORD *this)
{
*(this + 10) = 0; /*0xffe1fb6f*/
*this = 0; /*0xffe1fb72*/
*(this + 1) = 0; /*0xffe1fb74*/
*(this + 2) = 1779033703; /*0xffe1fb77*/
*(this + 3) = -1150833019; /*0xffe1fb7e*/
*(this + 4) = 1013904242; /*0xffe1fb85*/
*(this + 5) = -1521486534; /*0xffe1fb8c*/
*(this + 6) = 1359893119; /*0xffe1fb93*/
*(this + 7) = -1694144372; /*0xffe1fb9a*/
*(this + 8) = 528734635; /*0xffe1fba1*/
*(this + 9) = 1541459225; /*0xffe1fba8*/
return 0; /*0xffe1fbaf*/
}
// Function: 0xffe1fbb0
int __fastcall PeiPcdGetSize(int buf, unsigned __int8 *src, unsigned int n0x40)
{
unsigned int n0x40_1; // ebx
if ( *(_DWORD *)(buf + 40) > 0x40u ) /*0xffe1fbba*/
return -1; /*0xffe1fbbc*/
while ( 1 ) /*0xffe1fc22*/
{
do /*0xffe1fc22*/
{
while ( 1 ) /*0xffe1fc40*/
{
if ( !n0x40 ) /*0xffe1fc42*/
return 0; /*0xffe1fc44*/
if ( *(_DWORD *)(buf + 40) || n0x40 < 0x40 ) /*0xffe1fbd5*/
break; /*0xffe1fbd5*/
if ( GetNextGuidHob((_DWORD *)buf, src) < 0 ) /*0xffe1fbe2*/
return -1; /*0xffe1fbe2*/
*(_QWORD *)buf += 512LL; /*0xffe1fbe4*/
src += 64; /*0xffe1fbee*/
n0x40 -= 64; /*0xffe1fbf1*/
}
n0x40_1 = 64 - *(_DWORD *)(buf + 40); /*0xffe1fbf9*/
if ( n0x40 < n0x40_1 ) /*0xffe1fbfe*/
n0x40_1 = n0x40; /*0xffe1fc00*/
if ( n0x40_1 ) /*0xffe1fc04*/
CopyMem((char *)(buf + *(_DWORD *)(buf + 40) + 44), (char *)src, n0x40_1); /*0xffe1fc11*/
*(_DWORD *)(buf + 40) += n0x40_1; /*0xffe1fc17*/
src += n0x40_1; /*0xffe1fc1a*/
n0x40 -= n0x40_1; /*0xffe1fc1c*/
}
while ( *(_DWORD *)(buf + 40) != 64 ); /*0xffe1fc22*/
if ( GetNextGuidHob((_DWORD *)buf, (unsigned __int8 *)(buf + 44)) < 0 ) /*0xffe1fc30*/
break; /*0xffe1fc30*/
*(_QWORD *)buf += 512LL; /*0xffe1fc32*/
*(_DWORD *)(buf + 40) = 0; /*0xffe1fc3c*/
}
return -1; /*0xffe1fc48*/
}
// Function: 0xffe1fc50
// local variable allocation has failed, the output may be wrong!
int __usercall PeiPcdGetPtr@<eax>(_DWORD *buf@<ecx>, _BYTE *a2@<edx>, int a3@<ebx>)
{
unsigned int n0x40; // ecx
bool v7; // cf
unsigned int n0x40_1; // eax
__int64 v9; // rax
__int64 v10; // rax
_BYTE v11[12]; // [esp-4h] [ebp-Ch] OVERLAPPED
n0x40 = buf[10]; /*0xffe1fc56*/
if ( n0x40 >= 0x40 ) /*0xffe1fc5c*/
return -1; /*0xffe1fc5e*/
*(_DWORD *)v11 = a3; /*0xffe1fc66*/
v7 = __CFADD__(8 * n0x40, *buf); /*0xffe1fc6c*/
*buf += 8 * n0x40; /*0xffe1fc6c*/
buf[1] += v7; /*0xffe1fc71*/
*((_BYTE *)buf + n0x40 + 44) = 0x80; /*0xffe1fc74*/
n0x40_1 = ++buf[10]; /*0xffe1fc7c*/
if ( n0x40_1 > 0x38 ) /*0xffe1fc82*/
{
while ( n0x40_1 < 0x40 ) /*0xffe1fc93*/
{
*((_BYTE *)buf + n0x40_1 + 44) = 0; /*0xffe1fc86*/
n0x40_1 = ++buf[10]; /*0xffe1fc8d*/
}
GetNextGuidHob(buf, (unsigned __int8 *)buf + 44); /*0xffe1fc9a*/
buf[10] = 0; /*0xffe1fc9f*/
}
while ( buf[10] < 0x38u ) /*0xffe1fcb2*/
*((_BYTE *)buf + buf[10]++ + 44) = 0; /*0xffe1fca7*/
*((_BYTE *)buf + 100) = *((_BYTE *)buf + 7); /*0xffe1fcb9*/
*((_BYTE *)buf + 101) = *((_BYTE *)buf + 6); /*0xffe1fcbf*/
v9 = *(_QWORD *)v11 % *(_QWORD *)&v11[8]; /*0xffe1fcc7*/
*((_BYTE *)buf + 102) = v9; /*0xffe1fccc*/
v10 = *(_QWORD *)v11 % *(_QWORD *)&v11[8]; /*0xffe1fcd6*/
*((_BYTE *)buf + 103) = v10; /*0xffe1fcdb*/
*((_BYTE *)buf + 104) = HIBYTE(*buf); /*0xffe1fced*/
*((_BYTE *)buf + 105) = BYTE2(*buf); /*0xffe1fcfc*/
*((_BYTE *)buf + 106) = BYTE1(*(_QWORD *)buf); /*0xffe1fd0b*/
*((_BYTE *)buf + 107) = *(_BYTE *)buf; /*0xffe1fd12*/
GetNextGuidHob(buf, (unsigned __int8 *)buf + 44); /*0xffe1fd15*/
*a2 = *((_BYTE *)buf + 11); /*0xffe1fd1d*/
a2[1] = *((_BYTE *)buf + 10); /*0xffe1fd22*/
a2[2] = *((_BYTE *)buf + 9); /*0xffe1fd28*/
a2[3] = *((_BYTE *)buf + 8); /*0xffe1fd2e*/
a2[4] = *((_BYTE *)buf + 15); /*0xffe1fd34*/
a2[5] = *((_BYTE *)buf + 14); /*0xffe1fd3a*/
a2[6] = *((_BYTE *)buf + 13); /*0xffe1fd40*/
a2[7] = *((_BYTE *)buf + 12); /*0xffe1fd46*/
a2[8] = *((_BYTE *)buf + 19); /*0xffe1fd4c*/
a2[9] = *((_BYTE *)buf + 18); /*0xffe1fd52*/
a2[10] = *((_BYTE *)buf + 17); /*0xffe1fd58*/
a2[11] = *((_BYTE *)buf + 16); /*0xffe1fd5e*/
a2[12] = *((_BYTE *)buf + 23); /*0xffe1fd64*/
a2[13] = *((_BYTE *)buf + 22); /*0xffe1fd6a*/
a2[14] = *((_BYTE *)buf + 21); /*0xffe1fd70*/
a2[15] = *((_BYTE *)buf + 20); /*0xffe1fd76*/
a2[16] = *((_BYTE *)buf + 27); /*0xffe1fd7c*/
a2[17] = *((_BYTE *)buf + 26); /*0xffe1fd82*/
a2[18] = *((_BYTE *)buf + 25); /*0xffe1fd88*/
a2[19] = *((_BYTE *)buf + 24); /*0xffe1fd8e*/
a2[20] = *((_BYTE *)buf + 31); /*0xffe1fd94*/
a2[21] = *((_BYTE *)buf + 30); /*0xffe1fd9a*/
a2[22] = *((_BYTE *)buf + 29); /*0xffe1fda0*/
a2[23] = *((_BYTE *)buf + 28); /*0xffe1fda6*/
a2[24] = *((_BYTE *)buf + 35); /*0xffe1fdac*/
a2[25] = *((_BYTE *)buf + 34); /*0xffe1fdb2*/
a2[26] = *((_BYTE *)buf + 33); /*0xffe1fdb8*/
a2[27] = *((_BYTE *)buf + 32); /*0xffe1fdbe*/
a2[28] = *((_BYTE *)buf + 39); /*0xffe1fdc4*/
a2[29] = *((_BYTE *)buf + 38); /*0xffe1fdca*/
a2[30] = *((_BYTE *)buf + 37); /*0xffe1fdd0*/
a2[31] = *((_BYTE *)buf + 36); /*0xffe1fdd6*/
return 0; /*0xffe1fddc*/
}
// Function: 0xffe1fddf
int __fastcall PeiPcdSetSku(int n2, int n50563599, int n2a, int a4, int a5)
{
int Next; // eax
int v9; // eax
if ( (unsigned __int8)n2 != 2 && (unsigned __int8)n2 != 3 ) /*0xffe1fdf0*/
return -2147483645; /*0xffe1fdf2*/
Next = HobGetNext(); /*0xffe1fdf9*/
v9 = (*(int (__cdecl **)(int, int, int, _DWORD, int, int))(*(_DWORD *)Next + 88))(Next, n2, n50563599, 0, a4, a5); /*0xffe1fe0d*/
return v9 != -1610612734 ? v9 : 0;
}
// Function: 0xffe1fe24
int __thiscall PeiGetPcdPtr(void *this)
{
int (__cdecl **PcdProtocol)(int); // eax
PcdProtocol = (int (__cdecl **)(int))PeiPcdLibLocatePcdProtocol(this); /*0xffe1fe24*/
return PcdProtocol[4](5); /*0xffe1fe2f*/
}
// Function: 0xffe1fe30
// String: e:\hs\MdePkg\Library\BaseIoLibIntrinsic\IoLib.c
// String: (Address & 1) == 0
int __thiscall PeiWriteIoPort(void *this)
{
int v1; // ebx
int v2; // eax
v1 = PeiGetPcdPtr(this) + 1024064; /*0xffe1d2d9*/
if ( (v1 & 1) != 0 ) /*0xffe1d2de*/
{
v2 = AssertReport(); /*0xffe1d2e0*/
if ( v2 ) /*0xffe1d2e7*/
(*(void (__cdecl **)(const char *, int, const char *))(v2 + 4))( /*0xffe1d2f8*/
"e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c",
183,
"(Address & 1) == 0");
}
*(_WORD *)v1 = 1280; /*0xffe1d303*/
return 1280; /*0xffe1d307*/
}
// Function: 0xffe1fe41
// String:
ASSERT_EFI_ERROR (Status = %r)
// String: e:\hs\MdePkg\Library\PeiPcdLib\PeiPcdLib.c
// String: !EFI_ERROR (Status)
void *__thiscall PeiPcdLibLocatePcdProtocol(void *this)
{
int Next; // eax
int v2; // eax
int v3; // eax
void *this_1; // [esp+0h] [ebp-4h]
this_1 = this; /*0xffe1fe44*/
Next = HobGetNext(); /*0xffe1fe45*/
v2 = (*(int (__stdcall **)(int))(*(_DWORD *)Next + 32))(Next); /*0xffe1fe5a*/
if ( v2 < 0 ) /*0xffe1fe62*/
{
DebugPrintWrapper(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0xffe1fe6f*/
v3 = AssertReport(); /*0xffe1fe77*/
if ( v3 ) /*0xffe1fe7e*/
(*(void (__cdecl **)(const char *, int, const char *))(v3 + 4))( /*0xffe1fe8c*/
"e:\\hs\\MdePkg\\Library\\PeiPcdLib\\PeiPcdLib.c",
49,
"!EFI_ERROR (Status)");
}
return this_1; /*0xffe1fe97*/
}
// Function: 0xffe2000c
unsigned __int64 __usercall _umoddi3@<edx:eax>(unsigned __int8 n0x40@<cl>, unsigned __int64 a2@<edx:eax>)
{
if ( n0x40 >= 0x40u ) /*0xffe2000f*/
return 0; /*0xffe20026*/
else
return a2 >> n0x40; /*0xffe20019*/
}