/*
* LnvPeiStatusCode - Decompiled LnvPeiStatusCode
* Source: Auto-generated from IDA Pro decompilation
*
* Decompiled from port 13410
*/
#include "LnvPeiStatusCode.h"
/*
* SetMem at 0xffe846a0
*/
void * SetMem(void *buf, unsigned int count, char value)
{
memset(buf, value, count); /*0xffe846ad*/
return buf; /*0xffe846b3*/
}
/*
* FillDwordArray at 0xffe846c0
*/
int FillDwordArray(int Result, int Ptr, int Temp, int Temp)
{
do /*0xffe846d9*/
{
*(_DWORD *)(Result + 8 * Ptr - 8) = Temp; /*0xffe846d1*/
*(_DWORD *)(Result + 8 * Ptr-- - 4) = Temp; /*0xffe846d5*/
}
while ( Ptr ); /*0xffe846d9*/
return Result; /*0xffe846dd*/
}
/*
* SetMem32 at 0xffe846e0
*/
void * SetMem32(void *buf, unsigned int count, int value)
{
memset32(buf, value, count); /*0xffe846ed*/
return buf; /*0xffe846f3*/
}
/*
* CopyMem at 0xffe84700
*/
char * CopyMem(char *dst, char *src, unsigned int count)
{
unsigned int RemainingBytes; // edx
char *SrcPtr_1; // edi
char *SrcPtr; // esi
RemainingBytes = count; /*0xffe8470a*/
if ( src < dst && &src[count - 1] >= dst ) /*0xffe84718*/
{
SrcPtr = &src[count - 1]; /*0xffe8472c*/
SrcPtr_1 = &dst[count - 1]; /*0xffe8472e*/
}
else
{
RemainingBytes = count & 3; /*0xffe8471c*/
qmemcpy(dst, src, 4 * (count >> 2)); /*0xffe84725*/
SrcPtr = &src[4 * (count >> 2)]; /*0xffe84725*/
SrcPtr_1 = &dst[4 * (count >> 2)]; /*0xffe84725*/
}
qmemcpy(SrcPtr_1, SrcPtr, RemainingBytes); /*0xffe84735*/
return dst; /*0xffe8473c*/
}
/*
* _ModuleEntryPoint at 0xffe84760
*/
EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
int PeiServices; // eax
if ( *(_DWORD *)(LODWORD(SystemTable->Hdr.Signature) + 8) < 0x1000Au ) /*0xffe8476d*/
{
PeiServices = GetPeiServicesPpi(); /*0xffe8476f*/
if ( PeiServices ) /*0xffe84776*/
(*(void ( **)(const char *, int, const char *))(PeiServices + 4))( /*0xffe84784*/
"e:\\hs\\MdePkg\\Library\\PeimEntryPoint\\PeimEntryPoint.c",
46,
"(*PeiServices)->Hdr.Revision >= _gPeimRevision");
}
CmcSendProgress(64, (int)"'FFDC_CHECKPOINT_PROGRESS_LOG' Disabled. No send PEI progress to BMC for FFDC \n"); /*0xffe84791*/
return 0; /*0xffe8479a*/
}
/*
* GetPeiServicesPpi at 0xffe8479b
*/
int GetPeiServicesPpi()
{
int PeiServices; // eax
int GuidPtr; // [esp+0h] [ebp-8h] BYREF
int PpiPtr; // [esp+4h] [ebp-4h] BYREF
PeiServices = GetPeiServicesTablePointer(); /*0xffe847a0*/
if ( (*(int ( **)(int, void *, _DWORD, int *, int *))(*(_DWORD *)PeiServices + 32))( /*0xffe847bf*/
PeiServices,
&unk_FFE84BA0,
0,
&GuidPtr,
&PpiPtr) >= 0 )
return PpiPtr; /*0xffe847c5*/
else
return 0; /*0xffe847c1*/
}
/*
* CmcSendProgress at 0xffe847cc
*/
int CmcSendProgress(int ProgressType, int ProgressString, ...)
{
int PpiDescriptor_1; // eax
int ( **PpiDescriptor)(int, int, char *); // esi
va_list va; // [esp+10h] [ebp+Ch] BYREF
va_start(va, ProgressString);
PpiDescriptor_1 = GetPeiServicesPpi(); /*0xffe847cd*/
PpiDescriptor = (int ( **)(int, int, char *))PpiDescriptor_1; /*0xffe847d2*/
if ( PpiDescriptor_1 ) /*0xffe847d6*/
{
PpiDescriptor_1 = CmosBmcCheck(); /*0xffe847d8*/
if ( (PpiDescriptor_1 & ProgressType) != 0 ) /*0xffe847e3*/
return (*PpiDescriptor)(ProgressType, ProgressString, (char *)va); /*0xffe847ef*/
}
return PpiDescriptor_1; /*0xffe847f4*/
}
/*
* CallPeiService at 0xffe847f6
*/
int CallPeiService(int FileName, int LineNumber, int AssertExpr)
{
int Status; // eax
Status = GetPeiServicesPpi(); /*0xffe847fc*/
if ( Status ) /*0xffe84803*/
return (*(int ( **)(int, int, int))(Status + 4))(FileName, LineNumber, AssertExpr); /*0xffe8480b*/
return Status; /*0xffe84811*/
}
/*
* CmosBmcCheck at 0xffe84814
*/
int CmosBmcCheck()
{
unsigned __int8 PrevCmosReg; // al
char CmosValue; // al
char CmosValue_1; // cl
PrevCmosReg = __inbyte(0x70u); /*0xffe8481a*/
__outbyte(0x70u, PrevCmosReg & 0x80 | 0x4A); /*0xffe8481f*/
CmosValue = __inbyte(0x71u); /*0xffe84826*/
CmosValue_1 = CmosValue; /*0xffe84827*/
if ( (unsigned __int8)CmosValue <= 3u ) /*0xffe8482c*/
{
LABEL_4:
if ( !CmosValue_1 ) /*0xffe84847*/
return 0; /*0xffe84847*/
goto LABEL_5; /*0xffe84847*/
}
CmosValue_1 = Temp; /*0xffe8482e*/
if ( !Temp ) /*0xffe84836*/
{
CmosValue_1 = MEMORY[0xFDAF0490] & 2 | 1; /*0xffe84842*/
goto LABEL_4; /*0xffe84842*/
}
LABEL_5:
if ( CmosValue_1 != -1 )
return CmosValue_1 != 1 ? -2147483578 : -2147483644;
return 0; /*0xffe8485f*/
}
/*
* GetPeiServicesTablePointer at 0xffe84863
*/
int GetPeiServicesTablePointer()
{
int PeiServices; // esi
_BYTE Idtr[8]; // [esp+4h] [ebp-8h] BYREF
X86ReadIdtr(Idtr); /*0xffe8486c*/
PeiServices = *(_DWORD *)(*(_DWORD *)&Idtr[2] - 4); /*0xffe84874*/
if ( !PeiServices ) /*0xffe84879*/
CallPeiService( /*0xffe84888*/
(int)"e:\\hs\\MdePkg\\Library\\PeiServicesTablePointerLibIdt\\PeiServicesTablePointer.c",
48,
(int)"PeiServices != ((void *) 0)");
return PeiServices; /*0xffe84890*/
}
/*
* X86ReadIdtr at 0xffe84895
*/
void *__thiscall X86ReadIdtr(void *this)
{
void *this_1; // eax
if ( !this ) /*0xffe8489b*/
CallPeiService((int)"e:\\hs\\MdePkg\\Library\\BaseLib\\X86ReadIdtr.c", 37, (int)"Idtr != ((void *) 0)"); /*0xffe848aa*/
this_1 = this; /*0xffe848b0*/
__sidt(this); /*0xffe848b3*/
return this_1; /*0xffe848b7*/
}