/*
*MemCacheInit.c
*MemCacheInit PEI module decompiled from IDA
*/
#include "MemCacheInit.h"
// SetMem32 @ 0xffdb4590 void *SetMem32(void *buf, unsigned int count)
{
memset(buf, 0, count); /*0xffdb45a7*/
return buf; /*0xffdb45ae*/
}
// CopyMemBackward @ 0xffdb45b0 char *CopyMemBackward(char *dst, char *src, unsigned int count)
{
unsigned int count_1; // edx char *dst_1; // edi char *src_1; // esi count_1 = count; /*0xffdb45ba*/
if ( src < dst && &src[count - 1] >= dst ) /*0xffdb45c8*/
{
src_1 = &src[count - 1]; /*0xffdb45dc*/
dst_1 = &dst[count - 1]; /*0xffdb45de*/
}
else
{
count_1 = count & 3; /*0xffdb45cc*/
qmemcpy(dst, src, 4 * (count >> 2)); /*0xffdb45d5*/
src_1 = &src[4 * (count >> 2)]; /*0xffdb45d5*/
dst_1 = &dst[4 * (count >> 2)]; /*0xffdb45d5*/
}
qmemcpy(dst_1, src_1, count_1); /*0xffdb45e5*/
return dst; /*0xffdb45ec*/
}
// SetMem @ 0xffdb45f0 void *SetMem(void *buf, unsigned int count, char value)
{
memset(buf, value, count); /*0xffdb45fd*/
return buf; /*0xffdb4603*/
}
// FillQwordTable @ 0xffdb4610 int FillQwordTable(int a1, int a2, int a3, int a4)
{
do /*0xffdb4629*/
{
*(_DWORD *)(a1 + 8 *a2 - 8) = a3; /*0xffdb4621*/
*(_DWORD *)(a1 + 8 *a2-- - 4) = a4; /*0xffdb4625*/
}
while ( a2 ); /*0xffdb4629*/
return a1; /*0xffdb462d*/
}
// SetMem64 @ 0xffdb4630 void *SetMem64(void *buf, unsigned int count, int value)
{
memset32(buf, value, count); /*0xffdb463d*/
return buf; /*0xffdb4643*/
}
// ModuleEntryPoint @ 0xffdb4645 EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
int PeiServicesTable; // eax int Status; // eax EFI_STATUS Status; // esi int DebugService; // eax PeiServicesTable = GetPeiServicesTable(); /*0xffdb4646*/
Status = (*(int ( **)(int, void *))(*(_DWORD *)PeiServicesTable + 36))(PeiServicesTable, &unk_FFDB7850); /*0xffdb4653*/
Status = Status; /*0xffdb4656*/
if ( Status < 0 ) /*0xffdb465c*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0xffdb4669*/
DebugService = GetDebugService(); /*0xffdb4671*/
if ( DebugService ) /*0xffdb4678*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4689*/
"e:\\hs\\PurleyPlatPkg\\Platform\\Pei\\MemCacheInit\\MemCacheInit.c",
570,
"!EFI_ERROR (Status)");
}
return Status; /*0xffdb4691*/
}
// CacheInitCallback @ 0xffdb4693 int CacheInitCallback(int a1)
{
return sub_FFDB6C75(a1);
}
// GetFvHob @ 0xffdb469c __int64 GetFvHob(__int64 a1)
{
unsigned __int8 Index; // bh __int64 Register; // rdi unsigned __int8 v3; // bl int Index; // ebp int v5; // edx unsigned __int8 Index; // [esp+16h] [ebp-6h]
char v8; // [esp+17h] [ebp-5h]
int n64; // [esp+18h] [ebp-4h]
Index = 0; /*0xffdb46a2*/
v8 = 0; /*0xffdb46a4*/
Register = 0; /*0xffdb46aa*/
Index = 0; /*0xffdb46ac*/
n64 = 64; /*0xffdb46b2*/
v3 = 0; /*0xffdb46ba*/
Index = 0; /*0xffdb46bc*/
do /*0xffdb4727*/
{
if ( (a1 & MtrrGetRegister(1)) != 0 ) /*0xffdb46d5*/
{
++Index; /*0xffdb46d7*/
v8 = 1; /*0xffdb46db*/
}
else
{
if ( (unsigned int)Index + 2 < Index && Index - Index - 2 > v3 ) /*0xffdb46fb*/
{
Register = MtrrGetRegister(1); /*0xffdb470d*/
v3 = Index - Index - 2; /*0xffdb4715*/
}
if ( v8 ) /*0xffdb471d*/
++Index; /*0xffdb471f*/
}
++Index; /*0xffdb4721*/
--n64; /*0xffdb4722*/
}
while ( n64 ); /*0xffdb4727*/
if ( (_DWORD)Register == GetPowerOfTwo(a1) && HIDWORD(Register) == v5 ) /*0xffdb473e*/
return 0; /*0xffdb4740*/
return Register; /*0xffdb4748*/
}
// MainInit @ 0xffdb4750 int MainInit(int *a1)
{
int PeiServicesTable; // eax int v2; // eax int DebugService; // eax _DWORD *GuidHob; // esi int v5; // eax int v7; // eax int v8; // ebx unsigned int v9; // ebx int v10; // edi unsigned int v11; // esi int v12; // eax _WORD *v13; // eax __int16 n3; // cx unsigned __int64 v15; // kr00_8 __int64 FvHob; // kr08_8 int v17; // edx __int64 v18; // rax int v19; // ecx bool v20; // cf int v21; // eax int v22; // eax unsigned __int64 v23; // rax int v24; // edi int v25; // esi int v26; // eax int v27; // eax unsigned int n0x100000_1; // edx int v29; // eax int v30; // eax int v31; // eax int v32; // eax int v33; // eax int v34; // eax int v35; // eax int v36; // eax int v37; // eax _BYTE buf[612]; // [esp+Ch] [ebp-2A0h] BYREF int v39; // [esp+270h] [ebp-3Ch]
int v40; // [esp+274h] [ebp-38h] BYREF int n17; // [esp+278h] [ebp-34h] BYREF int v42; // [esp+27Ch] [ebp-30h]
_WORD *v43; ... [11016 chars total]
// NotifyDxeEntry @ 0xffdb4c78 int NotifyDxeEntry()
{
int PeiServicesTable; // eax int Status; // eax int DebugService; // eax int ErrorLevel; // eax int Result; // [esp+4h] [ebp-4h] BYREF PeiServicesTable = GetPeiServicesTable(); /*0xffdb4c7d*/
Status = (*(int ( **)(int, int *))(*(_DWORD *)PeiServicesTable + 48))(PeiServicesTable, &Result); /*0xffdb4c89*/
if ( Status < 0 ) /*0xffdb4c95*/
{
DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0xffdb4ca2*/
DebugService = GetDebugService(); /*0xffdb4caa*/
if ( DebugService ) /*0xffdb4cb1*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4cbb*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
50,
"!EFI_ERROR (Status)");
}
if ( !Result ) /*0xffdb4cc5*/
{
ErrorLevel = GetDebugService(); /*0xffdb4cc7*/
if ( ErrorLevel ) /*0xffdb4cce*/
(*(void ( **)(const char *, int, const char *))(ErrorLevel + 4))( /*0xffdb4cd8*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
51,
"HobList != ((void *) 0)");
}
return Result; /*0xffdb4ce1*/
}
// GetNextHobByType @ 0xffdb4ce6 _WORD *GetNextHobByType(int a1, _WORD *a2)
{
_WORD *Result; // esi int DebugService; // eax Result = a2; /*0xffdb4ce7*/
if ( !a2 ) /*0xffdb4ceb*/
{
DebugService = GetDebugService(); /*0xffdb4ced*/
if ( DebugService ) /*0xffdb4cf4*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4d02*/
"e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c",
82,
"HobStart != ((void *) 0)");
}
while ( 1 ) /*0xffdb4d1b*/
{
if ( *Result == 0xFFFF ) /*0xffdb4d21*/
return 0; /*0xffdb4d26*/
if ( *Result == 4 ) /*0xffdb4d13*/
break; /*0xffdb4d13*/
Result = (_WORD *)((char *)Result + (unsigned __int16)Result[1]); /*0xffdb4d19*/
}
return Result; /*0xffdb4d25*/
}
// GetGuidHob @ 0xffdb4d2b _WORD *__thiscall GetGuidHob(char *this)
{
_WORD *i; // edx int v3; // ecx _WORD *NextHobByType; // eax _WORD *NextHobByType_1; // esi for ( i = (_WORD *)NotifyDxeEntry(); ; i = (_WORD *)((char *)NextHobByType_1 + (unsigned __int16)NextHobByType_1[1]) ) /*0xffdb4d35*/
{
NextHobByType = GetNextHobByType(v3, i); /*0xffdb4d4d*/
NextHobByType_1 = NextHobByType; /*0xffdb4d52*/
if ( !NextHobByType || IsMtrrAttributeValid(this, (int)(NextHobByType + 4)) ) /*0xffdb4d3e*/
break; /*0xffdb4d3e*/
}
return NextHobByType_1; /*0xffdb4d58*/
}
// GetDebugService @ 0xffdb4d5e int GetDebugService()
{
int PeiServicesTable; // eax int v2; // [esp+0h] [ebp-8h] BYREF int Result; // [esp+4h] [ebp-4h] BYREF PeiServicesTable = GetPeiServicesTable(); /*0xffdb4d63*/
if ( (*(int ( **)(int, void *, _DWORD, int *, int *))(*(_DWORD *)PeiServicesTable + 32))( /*0xffdb4d82*/
PeiServicesTable,
&unk_FFDB7810,
0,
&v2,
&Result) >= 0 )
return Result; /*0xffdb4d88*/
else return 0; /*0xffdb4d84*/
}
// DebugPrint @ 0xffdb4d8f int DebugPrint(int a1, const char *a2, ...)
{
int result; // eax int ( **v3)(int, const char *, char *); // esi va_list va; // [esp+10h] [ebp+Ch] BYREF va_start(va, a2);
result = GetDebugService(); /*0xffdb4d90*/
v3 = (int ( **)(int, const char *, char *))result; /*0xffdb4d95*/
if ( result ) /*0xffdb4d99*/
{
result = CmosWriteIndex(); /*0xffdb4d9b*/
if ( (result & a1) != 0 ) /*0xffdb4da6*/
return (*v3)(a1, a2, (char *)va); /*0xffdb4db2*/
}
return result; /*0xffdb4db7*/
}
// AssertReport @ 0xffdb4db9 int AssertReport(
int e:__hs__MdePkg__Library__BaseLib__X86ReadIdtr.c,
int n37,
const char *PeiServices____((void__)_0))
{
int result; // eax result = GetDebugService(); /*0xffdb4dbf*/
if ( result ) /*0xffdb4dc6*/
return (*(int ( **)(int, int, const char *))(result + 4))( /*0xffdb4dce*/
e:__hs__MdePkg__Library__BaseLib__X86ReadIdtr.c,
n37,
PeiServices____((void__)_0));
return result; /*0xffdb4dd4*/
}
// InitGenericVariable @ 0xffdb4dd7 void *InitGenericVariable(int buf, unsigned int n608)
{
int DebugService; // eax int ErrorLevel; // eax if ( !buf ) /*0xffdb4de5*/
{
DebugService = GetDebugService(); /*0xffdb4de7*/
if ( DebugService ) /*0xffdb4dee*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4df8*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c",
53,
"Buffer != ((void *) 0)");
}
if ( n608 > -buf ) /*0xffdb4e04*/
{
ErrorLevel = GetDebugService(); /*0xffdb4e06*/
if ( ErrorLevel ) /*0xffdb4e0d*/
(*(void ( **)(const char *, int, const char *))(ErrorLevel + 4))( /*0xffdb4e17*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c",
54,
"Length <= (0xFFFFFFFF - (UINTN)Buffer + 1)");
}
return SetMem32((void *)buf, n608); /*0xffdb4e26*/
}
// IsMtrrAttributeValid @ 0xffdb4e2a bool IsMtrrAttributeValid(char *this, int a2)
{
__int64 MemoryAttribute; // rax int MemoryAttribute_1; // ebp __int64 MemoryAttribute_3; // rax int MemoryAttribute_2; // edi __int64 v8; // kr00_8 __int64 v9; // rax int v11; // [esp+10h] [ebp-Ch]
int v12; // [esp+14h] [ebp-8h]
MemoryAttribute = MtrrGetMemoryAttribute(this); /*0xffdb4e35*/
v12 = HIDWORD(MemoryAttribute); /*0xffdb4e3c*/
MemoryAttribute_1 = MemoryAttribute; /*0xffdb4e40*/
MemoryAttribute_3 = MtrrGetMemoryAttribute((void *)a2); /*0xffdb4e42*/
v11 = HIDWORD(MemoryAttribute_3); /*0xffdb4e4a*/
MemoryAttribute_2 = MemoryAttribute_3; /*0xffdb4e4e*/
v8 = MtrrGetMemoryAttribute(this + 8); /*0xffdb4e5c*/
v9 = MtrrGetMemoryAttribute((void *)(a2 + 8)); /*0xffdb4e5e*/
return MemoryAttribute_1 == MemoryAttribute_2 && v12 == v11 && v8 == v9; /*0xffdb4e81*/
}
// SafeCopyMem @ 0xffdb4e89 char *SafeCopyMem(char *dst, char *src, unsigned int n512)
{
int DebugService; // eax int ErrorLevel; // eax if ( n512 - 1 > -1 - (int)dst ) /*0xffdb4e9f*/
{
DebugService = GetDebugService(); /*0xffdb4ea1*/
if ( DebugService ) /*0xffdb4ea8*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4eb6*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
56,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)DestinationBuffer)");
}
if ( n512 - 1 > -1 - (int)src ) /*0xffdb4ec0*/
{
ErrorLevel = GetDebugService(); /*0xffdb4ec2*/
if ( ErrorLevel ) /*0xffdb4ec9*/
(*(void ( **)(const char *, int, const char *))(ErrorLevel + 4))( /*0xffdb4ed7*/
"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c",
57,
"(Length - 1) <= (0xFFFFFFFF - (UINTN)SourceBuffer)");
}
if ( dst == src ) /*0xffdb4edf*/
return dst; /*0xffdb4ee1*/
else return CopyMemBackward(dst, src, n512); /*0xffdb4eeb*/
}
// MtrrGetRegister @ 0xffdb4ef8 __int64 MtrrGetRegister(__int64 a1)
{
unsigned int n0x40; // ecx int DebugService; // eax __int64 Result; // rax char n0x40_1; // [esp+0h] [ebp-4h]
n0x40_1 = n0x40; /*0xffdb4efc*/
if ( n0x40 >= 0x40 ) /*0xffdb4f02*/
{
DebugService = GetDebugService(); /*0xffdb4f04*/
if ( DebugService ) /*0xffdb4f0b*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4f19*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\LShiftU64.c",
39,
"Count < 64");
}
LODWORD(Result) = 0; /*0xffdb4f22*/
HIDWORD(Result) = a1; /*0xffdb4f24*/
if ( (n0x40_1 & 0x20) == 0 ) /*0xffdb4f2a*/
Result = a1; /*0xffdb4f2c*/
return Result << (n0x40_1 & 0x1F); /*0xffdb4f36*/
}
// GetPowerOfTwo @ 0xffdb4f3a int GetPowerOfTwo(__int64 n513)
{
int result; // eax result = HIDWORD(n513) | n513; /*0xffdb4f45*/
if ( n513 ) /*0xffdb4f47*/
{
if ( HIDWORD(n513) ) /*0xffdb4f4f*/
MtrrLibIsVarMsr(SHIDWORD(n513)); /*0xffdb4f5a*/
else MtrrLibIsVarMsr(n513); /*0xffdb4f51*/
return MtrrGetRegister(1); /*0xffdb4f68*/
}
return result; /*0xffdb4f4c*/
}
// MtrrGetMemoryAttribute @ 0xffdb4f71 __int64 __thiscall MtrrGetMemoryAttribute(void *this)
{
int DebugService; // eax if ( !this ) /*0xffdb4f76*/
{
DebugService = GetDebugService(); /*0xffdb4f78*/
if ( DebugService ) /*0xffdb4f7f*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4f90*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c",
192,
"Buffer != ((void *) 0)");
}
return *(_QWORD *)this; /*0xffdb4f9b*/
}
// CalcMtrrAlignment @ 0xffdb4f9d unsigned __int64 CalcMtrrAlignment(unsigned int n8, unsigned int n8_1, __int64 a3)
{
int DebugService; // eax __int64 Register; // rax if ( n8 > n8_1 ) /*0xffdb4fa6*/
{
DebugService = GetDebugService(); /*0xffdb4fa8*/
if ( DebugService ) /*0xffdb4faf*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb4fc0*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\BitField.c",
732,
"StartBit <= EndBit");
}
Register = MtrrGetRegister(-2); /*0xffdb4fcc*/
return MtrrLibGetMsrEx(a3 & ~Register); /*0xffdb4fe9*/
}
// MtrrLibProgramMsr @ 0xffdb4fed unsigned int MtrrLibProgramMsr(int a1, int a2, unsigned __int64 n3)
{
int v3; // esi int DebugService; // eax int Register; // esi v3 = MtrrLibGetMsrEx(n3) & 1; /*0xffdb500b*/
if ( MtrrLibGetMsrEx(n3) != v3 ) /*0xffdb501a*/
{
DebugService = GetDebugService(); /*0xffdb5020*/
if ( DebugService ) /*0xffdb5027*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb5038*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\BitField.c",
817,
"RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1)");
}
Register = MtrrGetRegister(n3); /*0xffdb5055*/
return a1 | Register & ~(unsigned int)MtrrGetRegister(-2); /*0xffdb506d*/
}
// MtrrLibProgramFixedMsr @ 0xffdb5071 unsigned int MtrrLibProgramFixedMsr(int a1)
{
__int64 v1; // rdi unsigned __int64 Msr; // rax int DebugService; // eax int Register; // esi HIDWORD(v1) = MtrrLibGetMsrEx(0) & 1; /*0xffdb5089*/
LODWORD(v1) = 0; /*0xffdb508c*/
Msr = MtrrLibGetMsrEx(0); /*0xffdb508e*/
if ( __PAIR64__(Msr, HIDWORD(Msr)) != v1 ) /*0xffdb5098*/
{
DebugService = GetDebugService(); /*0xffdb509e*/
if ( DebugService ) /*0xffdb50a5*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb50b6*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\BitField.c",
869,
"RShiftU64 (AndData, EndBit - StartBit) == (RShiftU64 (AndData, EndBit - StartBit) & 1)");
}
Register = MtrrGetRegister(-1); /*0xffdb50d1*/
return a1 & ~(Register & ~(unsigned int)MtrrGetRegister(-2)); /*0xffdb50ef*/
}
// MtrrLibProgramVariableMsrs @ 0xffdb50f3 unsigned int MtrrLibProgramVariableMsrs(int a1, int a2, int n767, int a4, unsigned __int64 n3)
{
unsigned int v5; // eax int v6; // edx v5 = MtrrLibProgramFixedMsr(a1); /*0xffdb5106*/
return MtrrLibProgramMsr(v5, v6, n3); /*0xffdb5119*/
}
// MtrrLibIsVarMsr @ 0xffdb511a int MtrrLibIsVarMsr(int n513)
{
int Result; // eax if ( !n513 ) /*0xffdb511c*/
return -1; /*0xffdb511e*/
Result = 31; /*0xffdb5124*/
while ( n513 > 0 ) /*0xffdb512c*/
{
--Result; /*0xffdb5127*/
n513 *= 2; /*0xffdb5128*/
}
return Result; /*0xffdb5121*/
}
// MtrrLibGetMsrEx @ 0xffdb512f unsigned __int64 MtrrLibGetMsrEx(unsigned __int64 a1)
{
unsigned int n0x40; // ecx int DebugService; // eax unsigned __int64 Result; // rax char n0x40_1; // [esp+0h] [ebp-4h]
n0x40_1 = n0x40; /*0xffdb5133*/
if ( n0x40 >= 0x40 ) /*0xffdb5139*/
{
DebugService = GetDebugService(); /*0xffdb513b*/
if ( DebugService ) /*0xffdb5142*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb5150*/
"e:\\hs\\MdePkg\\Library\\BaseLib\\RShiftU64.c",
39,
"Count < 64");
}
Result = HIDWORD(a1); /*0xffdb515b*/
if ( (n0x40_1 & 0x20) == 0 ) /*0xffdb5161*/
Result = a1; /*0xffdb5165*/
return Result >> (n0x40_1 & 0x1F); /*0xffdb516d*/
}
// MtrrLibGetVariableCount @ 0xffdb5171 int MtrrLibGetVariableCount()
{
unsigned __int64 n0x20; // rax int n0x20_1; // esi int DebugService; // eax n0x20 = __readmsr(0xFEu); /*0xffdb5179*/
n0x20_1 = (unsigned __int8)n0x20; /*0xffdb517b*/
if ( (unsigned __int8)n0x20 > 0x20u ) /*0xffdb5181*/
{
DebugService = GetDebugService(); /*0xffdb5183*/
if ( DebugService ) /*0xffdb518a*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb5198*/
"e:\\hs\\PurleySktPkg\\Override\\UefiCpuPkg\\Library\\MtrrLib\\MtrrLib.c",
126,
"VariableMtrrCount <= 32");
}
return n0x20_1; /*0xffdb51a0*/
}
// MtrrLibGetMsrIndex @ 0xffdb51a4 unsigned int MtrrLibGetMsrIndex()
{
unsigned int Result; // eax Result = MtrrLibGetVariableCount(); /*0xffdb51a4*/
if ( Result >= dword_FFDB785C ) /*0xffdb51b1*/
return Result - dword_FFDB785C; /*0xffdb51b6*/
else return 0; /*0xffdb51b3*/
}
// MtrrLibProgramFixedMtrr @ 0xffdb51b9 unsigned __int64 __thiscall MtrrLibProgramFixedMtrr(_BYTE *this)
{
__int16 v1; // kr00_2 unsigned __int32 v2; // eax unsigned __int32 v3; // eax _BYTE *this_1; // ecx unsigned __int32 v5; // eax v1 = __readeflags(); /*0xffdb51c3*/
_disable(); /*0xffdb51c5*/
*(this + 4) = (v1 & 0x200) != 0; /*0xffdb51cb*/
v2 = __readcr0(); /*0xffdb51ce*/
__writecr0(v2 & 0x9FFFFFFF | 0x40000000); /*0xffdb51d9*/
__wbinvd(); /*0xffdb51dc*/
v3 = __readcr4(); /*0xffdb51de*/
this_1 = this; /*0xffdb51e1*/
*(_DWORD *)this = v3; /*0xffdb51e4*/
__writecr4(v3 & 0xFFFFFF7F); /*0xffdb51f1*/
v5 = __readcr3(); /*0xffdb51f4*/
__writecr3(v5); /*0xffdb51f7*/
return MsrReadWrite(this_1, 0, 0); /*0xffdb5207*/
}
// WriteBackCache @ 0xffdb520e int __thiscall WriteBackCache(int this)
{
unsigned __int32 v1; // eax unsigned __int32 v2; // eax int this_1; // eax v1 = __readcr3(); /*0xffdb5219*/
__writecr3(v1); /*0xffdb521c*/
__wbinvd(); /*0xffdb521f*/
v2 = __readcr0(); /*0xffdb5221*/
__writecr0(v2 & 0x9FFFFFFF); /*0xffdb522c*/
__writecr4(*(_DWORD *)this); /*0xffdb5237*/
this_1 = this; /*0xffdb523a*/
if ( *(_BYTE *)(this + 4) ) /*0xffdb523d*/
_enable(); /*0xffdb5243*/
else _disable(); /*0xffdb5246*/
return this_1; /*0xffdb5247*/
}
// MtrrLibGetMsrPattern @ 0xffdb524e _QWORD *__thiscall MtrrLibGetMsrPattern(_QWORD *this)
{
unsigned int Index; // ebx _QWORD *this_1; // edi unsigned __int64 v3; // rax Index = 0; /*0xffdb5253*/
this_1 = this; /*0xffdb5256*/
do /*0xffdb5279*/
{
v3 = __readmsr(dword_FFDB7520[Index]); /*0xffdb5266*/
Index += 3; /*0xffdb5268*/
*this_1++ = v3; /*0xffdb526b*/
}
while ( Index < 33 ); /*0xffdb5279*/
return this; /*0xffdb527b*/
}
// MtrrLibCalcMsrValue @ 0xffdb5282 _DWORD *MtrrLibCalcMsrValue(int a1, unsigned int n0x20, _DWORD *a3)
{
unsigned int n0x20_1; // ebx int v4; // eax int DebugService; // eax _DWORD *v6; // esi unsigned int n513; // ebp _DWORD *v8; // edi n0x20_1 = n0x20; /*0xffdb5285*/
v4 = a1; /*0xffdb5287*/
if ( n0x20 > 0x20 ) /*0xffdb5290*/
{
DebugService = GetDebugService(); /*0xffdb5292*/
if ( DebugService ) /*0xffdb5299*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb52aa*/
"e:\\hs\\PurleySktPkg\\Override\\UefiCpuPkg\\Library\\MtrrLib\\MtrrLib.c",
399,
"VariableMtrrCount <= 32");
v4 = a1; /*0xffdb52b0*/
}
if ( n0x20_1 ) /*0xffdb52b6*/
{
v6 = a3; /*0xffdb52ba*/
n513 = 513; /*0xffdb52be*/
v8 = (_DWORD *)(v4 + 96); /*0xffdb52c4*/
do /*0xffdb5315*/
{
if ( v4 ) /*0xffdb52c9*/
{
*v6 = *(v8 - 2); /*0xffdb52f2*/
v6[1] = *(v8 - 1); /*0xffdb52f7*/
v6[2] = *v8; /*0xffdb52fc*/
v6[3] = v8[1]; /*0xffdb5302*/
}
else
{
*(_QWORD *)v6 = __readmsr(n513 - 1); /*0xffdb52d8*/
*((_QWORD *)v6 + 1) = __readmsr(n513); /*0xffdb52e7*/
}
v4 = a1; /*0xffdb5305*/
n513 += 2; /*0xffdb5309*/
v8 += 4; /*0xffdb530c*/
v6 += 4; /*0xffdb530f*/
--n0x20_1; /*0xffdb5312*/
}
while ( n0x20_1 ); /*0xffdb5315*/
}
return a3; /*0xffdb531e*/
}
// MtrrLibCalcMtrrPairEx @ 0xffdb5322 int MtrrLibCalcMtrrPairEx(unsigned int *p_n0x100000, int a2, __int64 a3, _DWORD *a4, _QWORD *a5, _QWORD *a6)
{
int Index; // ebx unsigned int Index; // ecx unsigned int v10; // ebp unsigned int v11; // edx unsigned int Index; // esi int Index; // ebp int v15; // eax unsigned int n0x40; // ebx unsigned int v17; // eax bool v18; // cf __int64 v19; // [esp+10h] [ebp-18h]
__int64 v20; // [esp+18h] [ebp-10h]
int n11_1; // [esp+24h] [ebp-4h]
v20 = 0; /*0xffdb5325*/
v19 = 0; /*0xffdb532f*/
Index = 0; /*0xffdb533d*/
Index = 0; /*0xffdb5346*/
v10 = p_n0x100000[1]; /*0xffdb5348*/
do /*0xffdb5378*/
{
v11 = dword_FFDB7524[Index]; /*0xffdb534b*/
if ( (v10 || *p_n0x100000 >= v11) && !v10 && *p_n0x100000 < v11 + 8 *dword_FFDB7528[Index] ) /*0xffdb536c*/
break; /*0xffdb536c*/
Index += 3; /*0xffdb536e*/
++Index; /*0xffdb5371*/
}
while ( Index < 33 ); /*0xffdb5378*/
n11_1 = Index; /*0xffdb537a*/
if ( Index == 11 ) /*0xffdb5381*/
return -2147483645; /*0xffdb5381*/
Index = 0; /*0xffdb5391*/
Index = 3 *Index; /*0xffdb5393*/
v15 = dword_FFDB7524[3 *Index]; /*0xffdb5396*/
do /*0xffdb53b0*/
{
if ( *p_n0x100000 == v15 && !p_n0x100000[1] ) /*0xffdb53a0*/
break; /*0xffdb53a4*/
v15 += dword_FFDB7528[3 *Index]; /*0xffdb53a6*/
++Index; /*0xffdb53ac*/
}
while ( Index < 8 ); /*0xffdb53b0*/
if ( Index == 8 ) /*0xffdb53b5*/
return -2147483645; /*0xffdb53b5*/
if ( Index < 8 ) /*0xffdb53b7*/
{
n0x40 = 8 *Index; /*0xffdb53bf*/
do /*0xffdb5427*/
{
if ( *(_QWORD *)a2 < (unsigned __int64)(unsigned int)dword_FFDB7528[Index] ) /*0xffdb53d2*/
break; /*0xffdb53d2*/
v20 |= MtrrGetRegister(a3); /*0xffdb53e3*/
v19 |= MtrrGetRegister(255); /*0xffdb53f9*/
v17 = dword_FFDB7528[Index]; /*0xffdb5400*/
v18 = *(_DWORD *)a2 < v17; /*0xffdb540a*/
*(_DWORD *)a2 -= v17; /*0xffdb540a*/
*(_DWORD *)(a2 + 4) -= v18; /*0xffdb5410*/
*(_QWORD *)p_n0x100000 += (unsigned int)dword_FFDB7528[Index]; /*0xffdb541a*/
n0x40 += 8; /*0xffdb5420*/
++Index; /*0xffdb5423*/
}
while ( n0x40 < 0x40 ); /*0xffdb5427*/
Index = n11_1; /*0xffdb5429*/
if ( Index < 8 ) /*0xffdb5430*/
{
if ( *(_QWORD *)a2 ) /*0xffdb5432*/
return -2147483645; /*0xffdb5383*/
}
}
*a4 = Index; /*0xffdb5445*/
*a5 = v19; /*0xffdb544b*/
*a6 = v20; /*0xffdb545c*/
return 0; /*0xffdb5467*/
}
// MtrrLibSetMemoryAttribute @ 0xffdb546f int MtrrLibSetMemoryAttribute(unsigned __int8 *a1, unsigned int a2, __int64 a3, __int64 a4, int buf)
{
int Index; // ebx unsigned int Index; // edi int v8; // edx int v9; // eax int v10; // eax InitGenericVariable(buf, 0x400u); /*0xffdb5485*/
Index = 0; /*0xffdb548a*/
Index = 0; /*0xffdb548c*/
if ( a2 ) /*0xffdb5492*/
{
v8 = buf + 8; /*0xffdb5494*/
do /*0xffdb54fb*/
{
if ( (*((_DWORD *)a1 + 2) & 0x800) != 0 ) /*0xffdb54a2*/
{
*(_DWORD *)(v8 + 16) = Index; /*0xffdb54a4*/
v9 = HIDWORD(a4) & *((_DWORD *)a1 + 1); /*0xffdb54ac*/
*(_DWORD *)(v8 - 8) = a4 & *(_DWORD *)a1; /*0xffdb54b4*/
*(_DWORD *)(v8 - 4) = v9; /*0xffdb54b7*/
*(_QWORD *)v8 = (a3 & ~(a4 & *((_QWORD *)a1 + 1))) + 1; /*0xffdb54d7*/
v10 = *a1; /*0xffdb54df*/
*(_DWORD *)(v8 + 12) = 0; /*0xffdb54e2*/
++Index; /*0xffdb54e6*/
*(_DWORD *)(v8 + 8) = v10; /*0xffdb54e7*/
*(_WORD *)(v8 + 20) = 257; /*0xffdb54ea*/
}
++Index; /*0xffdb54f0*/
a1 += 16; /*0xffdb54f1*/
v8 += 32; /*0xffdb54f4*/
}
while ( Index < a2 ); /*0xffdb54fb*/
}
return Index; /*0xffdb54fd*/
}
// MtrrLibVerifyMemoryAttribute @ 0xffdb5505 BOOL MtrrLibVerifyMemoryAttribute(
unsigned int a1,
int a2,
unsigned int n0x100000,
unsigned int a4,
unsigned __int64 a5,
unsigned int *buf,
int a7)
{
unsigned int v7; // eax unsigned int v9; // ecx unsigned int n0x100000_1; // edi unsigned int *buf_1; // esi unsigned __int64 v13; // kr08_8 unsigned int v14; // eax unsigned int v15; // edx unsigned __int64 n0x100000_2; // kr10_8 bool v17; // al double v19; // [esp-38h] [ebp-5Ch]
unsigned __int64 v20; // [esp-10h] [ebp-34h]
unsigned int v22; // [esp+14h] [ebp-10h]
unsigned int v23; // [esp+18h] [ebp-Ch]
v7 = a4; /*0xffdb5508*/
v9 = 0; /*0xffdb5514*/
v23 = a4; /*0xffdb551a*/
v22 = 0; /*0xffdb551e*/
if ( a4 ) /*0xffdb5526*/
{
n0x100000_1 = n0x100000; /*0xffdb5541*/
}
else
{
n0x100000_1 = n0x100000; /*0xffdb552f*/
if ( n0x100000 < 0x100000 ) /*0xffdb5535*/
{
v7 = 0; /*0xffdb5537*/
n0x100000_1 = 0x100000; /*0xffdb5539*/
v23 = 0; /*0xffdb553b*/
}
}
if ( !a1 ) /*0xffdb5547*/
{
LABEL_20:
v17 = a2 != MemAttrGetAlignment(__PAIR64__(v23, n0x100000_1)); /*0xffdb5699*/
return !v17; /*0xffdb56ad*/
}
buf_1 = buf; /*0xffdb554d*/
while ( 1 ) /*0xffdb5559*/
{
if ( *((_BYTE *)buf_1 + 28) ) /*0xffdb5559*/
{
v13 = *((_QWORD *)buf_1 + 1) + *(_QWORD *)buf_1 - 1LL; /*0xffdb5571*/
v9 = v22; /*0xffdb557e*/
if ( __PAIR64__(v7, n0x100000_1) <= v13 && a5 >= *(_QWORD *)buf_1 ) /*0xffdb55ab*/
break; /*0xffdb55ab*/
}
LABEL_17:
++v9; /*0xffdb567e*/
buf_1 += 8; /*0xffdb567f*/
v22 = v9; /*0xffdb5682*/
if ( v9 >= a1 ) /*0xffdb568a*/
goto LABEL_20; /*0xffdb568a*/
v7 = v23; /*0xffdb568c*/
}
HIDWORD(v19) = 668; /*0xffdb55ca*/
LODWORD(v19) = "CheckMemoryAttributeMapped"; /*0xffdb55cf*/
DebugPrint( /*0xffdb55de*/
0x200000,
"%a():%d MTRR[%d] %lx..%lx %x ?= %x %lx..%lx\n",
v19,
v22,
*buf_1,
buf_1[1],
(_DWORD)v13,
(_DWORD)((unsigned __int64)(*((_QWORD *)buf_1 + 1) + *(_QWORD *)buf_1 - 1LL) >> 32),
buf_1[4],
buf_1[5],
a2);
v14 = buf_1[1]; /*0xffdb55e3*/
v15 = *buf_1; /*0xffdb55ed*/
if ( __PAIR64__(v23, n0x100000_1) < *(_QWORD *)buf_1 ) /*0xffdb55f7*/
{
HIDWORD(v20) = (v15 != 0) + v14 - 1; /*0xffdb5607*/
LODWORD(v20) = v15 - 1; /*0xffdb5608*/
if ( !MtrrLibVerifyMemoryAttribute(a1, a2, n0x100000_1, v23, v20, buf, a7) ) /*0xffdb561d*/
goto LABEL_19; /*0xffdb561d*/
v15 = *buf_1; /*0xffdb561f*/
n0x100000_1 = *buf_1; /*0xffdb5621*/
v14 = buf_1[1]; /*0xffdb5623*/
v23 = v14; /*0xffdb5626*/
}
n0x100000_2 = *((_QWORD *)buf_1 + 1) + __PAIR64__(v14, v15); /*0xffdb562f*/
if ( a5 <= __PAIR64__((unsigned int)((_DWORD)n0x100000_2 != 0) + HIDWORD(n0x100000_2) - 1, (int)n0x100000_2 - 1) ) /*0xffdb5644*/
{
LABEL_16:
v9 = v22; /*0xffdb567a*/
goto LABEL_17; /*0xffdb567a*/
}
if ( MtrrLibVerifyMemoryAttribute(a1, a2, n0x100000_2, HIDWORD(n0x100000_2), a5, buf, a7) ) /*0xffdb565d*/
{
a5 = *(_QWORD *)buf_1 + *((_QWORD *)buf_1 + 1) - 1LL; /*0xffdb5677*/
goto LABEL_16; /*0xffdb5677*/
}
LABEL_19:
v17 = 1; /*0xffdb5695*/
return !v17; /*0xffdb56b0*/
}
// CacheAttrSetRegion @ 0xffdb56be char CacheAttrSetRegion(unsigned int a1, int buf, unsigned __int64 a3, unsigned __int64 a4)
{
unsigned int Index; // esi Index = 0; /*0xffdb56c1*/
if ( !a1 ) /*0xffdb56c6*/
return 0; /*0xffdb5708*/
while ( !*(_BYTE *)(buf + 28) || a3 > *(_QWORD *)buf + *(_QWORD *)(buf + 8) - 1LL || a4 < *(_QWORD *)buf ) /*0xffdb56fe*/
{
++Index; /*0xffdb5700*/
buf += 32; /*0xffdb5701*/
if ( Index >= a1 ) /*0xffdb5706*/
return 0; /*0xffdb5706*/
}
return 1; /*0xffdb570a*/
}
// CacheAttrApplyRegion @ 0xffdb5713 int CacheAttrApplyRegion(
unsigned int a1,
unsigned int *p_n0x100000,
__int64 n4,
_QWORD *a4,
int buf,
_DWORD *a6,
_BYTE *a7)
{
unsigned int n0x100000; // esi _DWORD *v8; // edi unsigned __int64 v9; // kr00_8 int *v10; // ecx unsigned int n0x100000_2; // ebp unsigned __int64 v12; // kr10_8 unsigned int v13; // edi bool v14; // cf bool v15; // cc int n6; // ecx int v17; // edi unsigned int v18; // edi char v19; // bl unsigned __int64 v20; // kr18_8 char v22; // [esp+13h] [ebp-19h]
int *v23; // [esp+14h] [ebp-18h]
unsigned int n0x100000_1; // [esp+18h] [ebp-14h]
unsigned int v25; // [esp+20h] [ebp-Ch]
unsigned int v26; // [esp+24h] [ebp-8h]
n0x100000 = *p_n0x100000; /*0xffdb5725*/
v8 = a4; /*0xffdb5728*/
*a7 = 0; /*0xffdb572c*/
v22 = 0; /*0xffdb5737*/
v26 = 0; /*0xffdb5741*/
v9 = *a4 + __PAIR64__(p_n0x100000[1], n0x100000) - 1; /*0xffdb573e*/
if ( !a1 ) /*0xffdb574a*/
return 0; /*0xffdb574a*/
v10 = (int *)(buf + 16); /*0xffdb5754*/
v23 = (int *)(buf + 16); /*0xffdb5757*/
do /*0xffdb58e1*/
{
n0x100000_2 = *(v10 - 4); /*0xffdb575e*/
v12 = *((_QWORD *)v10 - 2) + *((_QWORD *)v10 - 1) - 1LL; /*0xffdb576c*/
if ( *((_BYTE *)v10 + 12) ) /*0xffdb576f*/
{
v13 = p_n0x100000[1]; /*0xffdb577f*/
v14 = v13 < HIDWORD(v12); /*0xffdb5782*/
v15 = v13 <= HIDWORD(v12); /*0xffdb5782*/
v25 = v13; /*0xffdb5784*/
v8 = a4; /*0xffdb5788*/
n0x100000_1 = *p_n0x100000; /*0xffdb578c*/
if ( !v15 || !v14 && *p_n0x100000 > (unsigned int)v12 ) /*0xffdb579a*/
goto LABEL_36; /*0xffdb579a*/
v10 = v23; /*0xffdb57a0*/
if ( v9 >= __PAIR64__(*(v23 - 3), n0x100000_2) ) /*0xffdb57b1*/
{
n6 = *v23; /*0xffdb57bb*/
v17 = v23[1]; /*0xffdb57bd*/
if ( n4 == *(_QWORD *)v23 ) /*0xffdb57c4*/
{
v10 = v23; /*0xffdb57d0*/
v18 = p_n0x100000[1]; /*0xffdb57d4*/
if ( *(v23 - 3) <= v25 && (*(v23 - 3) < v25 || n0x100000_2 <= n0x100000_1) && v12 >= v9 ) /*0xffdb57ed*/
{
v8 = a4; /*0xffdb57ef*/
v19 = 1; /*0xffdb57f3*/
v22 = 1; /*0xffdb57f5*/
goto LABEL_38; /*0xffdb57f9*/
}
if ( v25 > *(v23 - 3) || v25 >= *(v23 - 3) && n0x100000_1 >= n0x100000_2 ) /*0xffdb5809*/
v18 = *(v23 - 3); /*0xffdb5811*/
else n0x100000_2 = *p_n0x100000; /*0xffdb580b*/
if ( v9 <= v12 ) /*0xffdb581c*/
v9 = v12; /*0xffdb5820*/
*((_BYTE *)v23 + 12) = 0; /*0xffdb5826*/
--*a6; /*0xffdb582c*/
p_n0x100000[1] = v18; /*0xffdb5834*/
*p_n0x100000 = n0x100000_2; /*0xffdb5837*/
v20 = v9 - __PAIR64__(v18, n0x100000_2); /*0xffdb582e*/
v8 = a4; /*0xffdb583d*/
*a4 = v20 + 1; /*0xffdb5847*/
goto LABEL_35; /*0xffdb584c*/
}
if ( n0x100000_2 != n0x100000_1 || (v17 = v23[1], *(v23 - 3) != v25) || v12 != v9 ) /*0xffdb5866*/
{
if ( (n4 != 4 || n6 != 6 || v17) && (n4 != 6 || n6 != 4 || v17) && n4 && v17 | n6 ) /*0xffdb58b6*/
return -2147483633; /*0xffdb58fc*/
v8 = a4; /*0xffdb58ba*/
LABEL_35:
*a7 = 1; /*0xffdb58be*/
LABEL_36:
v10 = v23; /*0xffdb58c5*/
goto LABEL_37; /*0xffdb58c5*/
}
v10 = v23; /*0xffdb5870*/
v8 = a4; /*0xffdb5872*/
--*a6; /*0xffdb5876*/
*((_BYTE *)v23 + 12) = 0; /*0xffdb5878*/
}
}
LABEL_37:
v19 = v22; /*0xffdb58c9*/
LABEL_38:
v10 += 8; /*0xffdb58cd*/
v23 = v10; /*0xffdb58d5*/
++v26; /*0xffdb58d9*/
}
while ( v26 < a1 ); /*0xffdb58e1*/
if ( v19 ) /*0xffdb58e9*/
{
*v8 = 0; /*0xffdb58eb*/
v8[1] = 0; /*0xffdb58ee*/
}
return 0; /*0xffdb58f4*/
}
// CacheAttrConvertToMsr @ 0xffdb5903 int CacheAttrConvertToMsr(int n513, int n513a)
{
if ( n513a ) /*0xffdb5922*/
{
MtrrLibIsVarMsr(n513a); /*0xffdb5949*/
return 0; /*0xffdb5971*/
}
else if ( n513 ) /*0xffdb597c*/
{
return 1 << MtrrLibIsVarMsr(n513); /*0xffdb598c*/
}
else
{
return 0; /*0xffdb597e*/
}
}
// MemAttrSetAttribute @ 0xffdb5995 char MemAttrSetAttribute(unsigned __int64 a1, unsigned __int64 Register_3)
{
_DWORD *v2; // ecx _DWORD *v3; // edi unsigned int Index; // ebx __int64 Register; // rax unsigned int v6; // ecx unsigned int Register_2; // esi unsigned int v8; // ecx unsigned __int64 Register_4; // kr00_8 int n513_3; // edx int n513; // ecx __int64 v13; // rax __int64 v14; // rax __int64 n513_2; // kr20_8 unsigned int Index; // esi __int64 v17; // rax _DWORD *v18; // [esp+10h] [ebp-10h]
unsigned int v19; // [esp+14h] [ebp-Ch]
__int64 v20; // [esp+18h] [ebp-8h]
unsigned int Register_1; // [esp+2Ch] [ebp+Ch]
int n513_1; // [esp+2Ch] [ebp+Ch]
v3 = v2; /*0xffdb59a1*/
v19 = HIDWORD(a1); /*0xffdb59a3*/
Index = 0; /*0xffdb59a9*/
v18 = v2; /*0xffdb59ad*/
LODWORD(v20) = a1; /*0xffdb59b2*/
*v2 = 0; /*0xffdb59b5*/
if ( a1 ) /*0xffdb59b7*/
{
InvalidateCache(a1); /*0xffdb59bb*/
Register = MtrrGetRegister(1); /*0xffdb59c5*/
v6 = HIDWORD(Register_3); /*0xffdb59ca*/
Register_2 = Register_3; /*0xffdb59d0*/
HIDWORD(v20) = HIDWORD(Register); /*0xffdb59d6*/
Register_1 = Register; /*0xffdb59d6*/
if ( HIDWORD(Register) <= HIDWORD(Register_3) ) /*0xffdb59db*/
{
if ( HIDWORD(Register) >= HIDWORD(Register_3) ) /*0xffdb59dd*/
goto LABEL_6; /*0xffdb59dd*/
do /*0xffdb5a1e*/
{
do /*0xffdb5a1e*/
{
++*v3; /*0xffdb59df*/
Register_4 = __PAIR64__(v6, Register_2) - __PAIR64__(HIDWORD(v20), Register_1); /*0xffdb59ed*/
v8 = (__PAIR64__(v6, Register_2) - __PAIR64__(HIDWORD(v20), Register_1)) >> 32; /*0xffdb59ed*/
Register_2 = Register_4; /*0xffdb59ed*/
v19 = (__PAIR64__(v19, Register_1) + v20) >> 32; /*0xffdb59f8*/
LODWORD(v20) = Register_1 + v20; /*0xffdb59f8*/
Register_3 = __PAIR64__(v8, Register_4); /*0xffdb59fb*/
InvalidateCache(__PAIR64__(v19, v20)); /*0xffdb5a01*/
Register = MtrrGetRegister(1); /*0xffdb5a0b*/
v6 = HIDWORD(Register_3); /*0xffdb5a10*/
HIDWORD(v20) = HIDWORD(Register); /*0xffdb5a19*/
Register_1 = Register; /*0xffdb5a19*/
}
while ( HIDWORD(Register) < HIDWORD(Register_3) ); /*0xffdb5a1e*/
if ( HIDWORD(Register) > HIDWORD(Register_3) ) /*0xffdb5a20*/
break; /*0xffdb5a20*/
LABEL_6:
; /*0xffdb5a24*/
}
while ( (unsigned int)Register <= Register_2 ); /*0xffdb5a1e*/
}
n513_3 = HIDWORD(Register_3); /*0xffdb5a26*/
if ( !(HIDWORD(Register_3) | Register_2) ) /*0xffdb5a2b*/
return 1; /*0xffdb5a2d*/
}
else
{
n513_3 = HIDWORD(Register_3); /*0xffdb5a36*/
Register_2 = Register_3; /*0xffdb5a36*/
}
n513 = n513_3; /*0xffdb5a39*/
n513_1 = n513_3; /*0xffdb5a3e*/
do /*0xffdb5a59*/
{
LODWORD(v13) = CacheAttrConvertToMsr(Register_2, n513); /*0xffdb5a43*/
n513 = (__PAIR64__(n513_1, Register_2) - v13) >> 32; /*0xffdb5a49*/
Register_2 -= v13; /*0xffdb5a49*/
++Index; /*0xffdb5a53*/
n513_1 = n513; /*0xffdb5a56*/
}
while ( __PAIR64__(n513, Register_2) ); /*0xffdb5a59*/
LODWORD(v14) = CacheAttrConvertToMsr(2 *Register_3, Register_3 >> 31); /*0xffdb5a76*/
n513_2 = v14 - Register_3; /*0xffdb5a7f*/
Index = 1; /*0xffdb5a89*/
do /*0xffdb5a9c*/
{
LODWORD(v17) = CacheAttrConvertToMsr(n513_2, SHIDWORD(n513_2)); /*0xffdb5a8c*/
++Index; /*0xffdb5a97*/
n513_2 -= v17; /*0xffdb5a9c*/
}
while ( n513_2 ); /*0xffdb5a9c*/
if ( Index <= Index ) /*0xffdb5aa6*/
{
*v18 += Index; /*0xffdb5aa8*/
return 1; /*0xffdb5a31*/
}
*v18 += Index; /*0xffdb5aac*/
return 0; /*0xffdb5ab0*/
}
// MemAttrGetProtectionAttr @ 0xffdb5ab7 void MemAttrGetProtectionAttr(_DWORD *a1, int n0x20, int buf)
{
_BYTE *v3; // eax if ( n0x20 ) /*0xffdb5ab9*/
{
v3 = (_BYTE *)(buf + 29); /*0xffdb5ac0*/
do /*0xffdb5ae4*/
{
if ( !*(v3 - 1) ) /*0xffdb5ac5*/
{
if ( *v3 ) /*0xffdb5aca*/
{
*a1 = 0; /*0xffdb5ace*/
a1[1] = 0; /*0xffdb5ad0*/
a1[2] = 0; /*0xffdb5ad3*/
a1[3] = 0; /*0xffdb5ad6*/
*v3 = 0; /*0xffdb5ad9*/
}
}
a1 += 4; /*0xffdb5adb*/
v3 += 32; /*0xffdb5ade*/
--n0x20; /*0xffdb5ae1*/
}
while ( n0x20 ); /*0xffdb5ae4*/
}
}
// MemAttrSetRegionAttribute @ 0xffdb5ae8 int MemAttrSetRegionAttribute(
int a1,
unsigned int n0x20,
unsigned int n0x100000,
int a4,
__int64 a5,
int a6,
int a7,
int a8,
int a9)
{
unsigned int v9; // edx int result; // eax v9 = 2 *n0x20; /*0xffdb5aee*/
*(_DWORD *)(a1 + 8 *v9 + 4) = a7 | a9 & a4; /*0xffdb5b0b*/
*(_DWORD *)(a1 + 8 *v9) = a6 | a8 & n0x100000; /*0xffdb5b15*/
result = a9 & ~(((_DWORD)a5 != 0) + HIDWORD(a5) - 1); /*0xffdb5b1d*/
*(_DWORD *)(a1 + 8 *v9 + 8) = a8 & ~(a5 - 1) | 0x800; /*0xffdb5b26*/
*(_DWORD *)(a1 + 8 *v9 + 12) = result; /*0xffdb5b2a*/
return result; /*0xffdb5b2e*/
}
// MemAttrGetCacheType @ 0xffdb5b32 int MemAttrGetCacheType(unsigned int n7, int a2)
{
int v2; // ecx int Result; // eax unsigned __int64 Result; // rax if ( !a2 ) /*0xffdb5b39*/
{
Result = 6; /*0xffdb5b40*/
if ( n7 <= 6 ) /*0xffdb5b45*/
{
switch ( n7 ) /*0xffdb5b4a*/
{
case 0u: /*0xffdb5b4a*/
return 0; /*0xffdb5b7e*/
case 1u: /*0xffdb5b4a*/
return 1; /*0xffdb5b7a*/
case 4u: /*0xffdb5b4a*/
return 4; /*0xffdb5b71*/
}
if ( n7 != 5 ) /*0xffdb5b59*/
{
if ( n7 == 6 ) /*0xffdb5b5e*/
return Result; /*0xffdb5b5e*/
goto LABEL_8; /*0xffdb5b5e*/
}
return 5; /*0xffdb5b75*/
}
}
LABEL_8:
if ( v2 ) /*0xffdb5b62*/
LODWORD(Result) = *(_DWORD *)(v2 + 600); /*0xffdb5b7f*/
else Result = __readmsr(0x2FFu); /*0xffdb5b69*/
return Result & 7; /*0xffdb5b74*/
}
// MemAttrGetDefaultAttribute @ 0xffdb5b8a int MemAttrGetDefaultAttribute(_DWORD *a1, _DWORD *a2)
{
__int64 v4; // rax int v5; // ecx int Result; // eax unsigned int v7; // [esp+Ch] [ebp-4h] BYREF Wbinvd(0x80000000, &v7, a1, a1, 0); /*0xffdb5ba1*/
if ( v7 < 0x80000008 ) /*0xffdb5bb1*/
{
*a1 = -1; /*0xffdb5bea*/
Result = 15; /*0xffdb5bef*/
a1[1] = 15; /*0xffdb5bf0*/
*a2 = -4096; /*0xffdb5bf3*/
}
else
{
Wbinvd(-2147483640, &v7, (void *)0x80000008, (void *)0x80000008, 0); /*0xffdb5bba*/
v4 = MtrrGetRegister(1) - 1; /*0xffdb5bcf*/
*(_QWORD *)a1 = v4; /*0xffdb5bd7*/
v5 = v4 & 0xFFFFF000; /*0xffdb5bde*/
Result = HIDWORD(v4); /*0xffdb5be4*/
*a2 = v5; /*0xffdb5be6*/
}
a2[1] = Result; /*0xffdb5bf9*/
return Result; /*0xffdb5bfc*/
}
// MemAttrGetSizeAttribute @ 0xffdb5c02 int MemAttrGetSizeAttribute(unsigned __int64 n7, __int64 n6)
{
int n7_1; // esi bool v3; // zf bool v4; // zf n7_1 = 7; /*0xffdb5c11*/
if ( n7 <= 7 ) /*0xffdb5c20*/
{
if ( (_DWORD)n7 ) /*0xffdb5c28*/
{
if ( (_DWORD)n7 == 1 ) /*0xffdb5c2d*/
{
v4 = (_DWORD)n6 == 1; /*0xffdb5c83*/
goto LABEL_19; /*0xffdb5c83*/
}
if ( (_DWORD)n7 != 4 ) /*0xffdb5c32*/
{
if ( (_DWORD)n7 != 5 ) /*0xffdb5c37*/
{
if ( (_DWORD)n7 != 6 ) /*0xffdb5c3c*/
{
v3 = (_DWORD)n7 == 7; /*0xffdb5c3e*/
goto LABEL_22; /*0xffdb5c41*/
}
if ( n6 && n6 != 4 ) /*0xffdb5c4c*/
{
if ( (_DWORD)n6 != 6 ) /*0xffdb5c55*/
goto LABEL_25; /*0xffdb5c55*/
v3 = HIDWORD(n6) == 0; /*0xffdb5c57*/
LABEL_22:
if ( !v3 ) /*0xffdb5c90*/
goto LABEL_25; /*0xffdb5c90*/
goto LABEL_23; /*0xffdb5c90*/
}
goto LABEL_23; /*0xffdb5c4c*/
}
v4 = (_DWORD)n6 == 5; /*0xffdb5c5b*/
LABEL_19:
if ( !v4 || HIDWORD(n6) ) /*0xffdb5c8a*/
{
v3 = n6 == 0; /*0xffdb5c8e*/
goto LABEL_22; /*0xffdb5c8e*/
}
LABEL_23:
n7_1 = n6; /*0xffdb5c92*/
goto LABEL_25; /*0xffdb5c96*/
}
if ( n6 == 4 || n6 == 6 ) /*0xffdb5c6c*/
{
n7_1 = 4; /*0xffdb5c74*/
}
else if ( !n6 ) /*0xffdb5c7b*/
{
return 0; /*0xffdb5c81*/
}
}
else
{
n7_1 = 0; /*0xffdb5c98*/
}
}
LABEL_25:
if ( n6 == 7 ) /*0xffdb5c9f*/
return n7; /*0xffdb5ca8*/
return n7_1; /*0xffdb5caf*/
}
// MemAttrGetAlignment @ 0xffdb5cb3 int MemAttrGetAlignment(unsigned __int64 n0x100000)
{
int v1; // ecx int v2; // edi unsigned __int64 Result; // rax unsigned __int64 n7_1; // rdi int Index; // ecx unsigned int Index; // edx unsigned int n0x100000_1; // ebx unsigned int VariableCount; // eax unsigned int MsrIndex; // eax unsigned int n0x20; // ebx int DebugService; // eax int v12; // eax int *buf_1; // ebx int v14; // edx unsigned __int64 v15; // rax unsigned __int8 Msr; // al __int64 v18; // [esp-14h] [ebp-648h]
__int64 v19; // [esp-Ch] [ebp-640h]
__int64 v20; // [esp+10h] [ebp-624h] BYREF unsigned int Size; // [esp+1Ch] [ebp-618h]
__int64 v22; // [esp+20h] [ebp-614h] BYREF int v23; // [esp+2Ch] [ebp-608h]
unsigned __int8 v24[512]; // [esp+30h] [ebp-604h] BYREF int buf[257]; // [esp+230h] [ebp-404h] BYREF v2 = v1; /*0xffdb5cbd*/
v23 = v1; /*0xffdb5cbf*/
if ( v1 ) /*0xffdb5cc5*/
{
HIDWORD(Result) = *(_DWORD *)(v1 + 600); /*0xffdb5cdc*/
HIDWORD(v22) = *(_DWORD *)(v1 + 604); /*0xffdb5ce2*/
}
else
{
Result = __readmsr(0x2FFu); /*0xffdb5ccc*/
HIDWORD(v22) = HIDWORD(Result); /*0xffdb5cce*/
WORD2(Result) = Result; /*0xffdb5cd2*/
}
Size = 7; /*0xffdb5ce8*/
HIDWORD(n7_1) = 0; /*0xffdb5cf0*/
LODWORD(Result) = WORD2(Result) & 0x800; /*0xffdb5cf7*/
if ( (Result & 0x80000000000LL) != 0 ) /*0xffdb5cf9*/
{
if ( n0x100000 < 0x100000 && (Result & 0x40000000000LL) != 0 ) /*0xffdb5d21*/
{
Index = 0; /*0xffdb5d23*/
Index = 0; /*0xffdb5d25*/
while ( 1 ) /*0xffdb5d27*/
{
n0x100000_1 = dword_FFDB7524[Index]; /*0xffdb5d27*/
if ( (unsigned int)n0x100000 >= n0x100000_1 && (unsigned int)n0x100000 < n0x100000_1 + 8 *dword_FFDB7528[Index] ) /*0xffdb5d56*/
break; /*0xffdb5d56*/
Index += 3; /*0xffdb5d5c*/
++Index; /*0xffdb5d5f*/
if ( Index >= 33 ) /*0xffdb5d66*/
goto LABEL_11; /*0xffdb5d66*/
}
if ( v2 ) /*0xffdb5e7f*/
v15 = *(_QWORD *)(v2 + 8 *Index); /*0xffdb5e93*/
else v15 = __readmsr(dword_FFDB7520[3 *Index]); /*0xffdb5e8f*/
Msr = MtrrLibGetMsrEx(v15); /*0xffdb5ea1*/
LODWORD(Result) = MemAttrGetCacheType(Msr, 0); /*0xffdb5eaf*/
}
else
{
LABEL_11:
MemAttrGetDefaultAttribute(&v22, &v20); /*0xffdb5d68*/
VariableCount = MtrrLibGetVariableCount(); /*0xffdb5d7a*/
MtrrLibCalcMsrValue(v2, VariableCount, v24); /*0xffdb5d83*/
v19 = v20; /*0xffdb5d95*/
v18 = v22; /*0xffdb5d9d*/
MsrIndex = MtrrLibGetMsrIndex(); /*0xffdb5da1*/
MtrrLibSetMemoryAttribute(v24, MsrIndex, v18, v19, (int)buf); /*0xffdb5dac*/
n0x20 = MtrrLibGetVariableCount(); /*0xffdb5db9*/
LODWORD(v20) = n0x20; /*0xffdb5dbb*/
if ( n0x20 > 0x20 ) /*0xffdb5dc2*/
{
DebugService = GetDebugService(); /*0xffdb5dc4*/
if ( DebugService ) /*0xffdb5dcb*/
(*(void ( **)(const char *, int, const char *))(DebugService + 4))( /*0xffdb5ddc*/
"e:\\hs\\PurleySktPkg\\Override\\UefiCpuPkg\\Library\\MtrrLib\\MtrrLib.c",
1317,
"VariableMtrrCount <= 32");
}
if ( n0x20 ) /*0xffdb5de4*/
{
v12 = v20; /*0xffdb5de6*/
buf_1 = buf; /*0xffdb5dea*/
LODWORD(n7_1) = 7; /*0xffdb5df3*/
do /*0xffdb5e45*/
{
if ( *((_BYTE *)buf_1 + 28) ) /*0xffdb5df4*/
{
if ( n0x100000 >= *(_QWORD *)buf_1 && n0x100000 < *((_QWORD *)buf_1 + 1) + *(_QWORD *)buf_1 ) /*0xffdb5e21*/
{
LODWORD(n7_1) = MemAttrGetSizeAttribute(n7_1, *((_QWORD *)buf_1 + 2)); /*0xffdb5e33*/
HIDWORD(n7_1) = v14; /*0xffdb5e35*/
}
v12 = v20; /*0xffdb5e37*/
}
buf_1 += 8; /*0xffdb5e3b*/
LODWORD(v20) = --v12; /*0xffdb5e41*/
}
while ( v12 ); /*0xffdb5e45*/
Size = n7_1; /*0xffdb5e47*/
}
LODWORD(Result) = MemAttrGetCacheType(Size, SHIDWORD(n7_1)); /*0xffdb5e56*/
}
}
return Result; /*0xffdb5e5d*/
}
// GcdMemorySpaceOperation @ 0xffdb5eb9 char __thiscall GcdMemorySpaceOperation(_QWORD *this)
{
_QWORD *this_1; // ebp char result; // al void *v3; // ecx unsigned int VariableCount; // eax unsigned int n0xB; // esi void *v6; // ecx unsigned int v7; // ebx unsigned int v8; // edi _DWORD *v9; // esi unsigned __int64 *this_4; // ecx int *v11; // ebp unsigned int v12; // esi unsigned int v13; // edi unsigned int Msr; // ebx unsigned int v15; // kr00_4 bool v16; // zf void *v17; // ecx void *v18; // ecx unsigned __int64 *this_6; // ebp unsigned __int64 n0x100000; // kr20_8 unsigned int Alignment; // ebx unsigned int n0x100000_10; // ebx unsigned int n0x100000_7; // ecx int v24; // eax unsigned __int64 n0x100000_6; // kr08_8 _DWORD *v26; // ebp __int64 v27; // rcx __int64 n0x100000_4; // rax unsigned __int64 n0x100000_3; // kr10_8 BOOL v30; // ett unsigned __int64 n0x100000_8; // kr18_8 double v32; // [esp-Ch] [ebp-2C8h]
double v33; // [esp-Ch] [ebp-2C8h]
char v3... [10009 chars total]
// MtrrLibGetDefaultType @ 0xffdb638a int MtrrLibGetDefaultType(int a1, int a2, unsigned __int64 n0x100000, unsigned __int64 n513_6)
{
void *v5; // ecx int n512_1; // ecx int n513_1; // ebx int v8; // eax unsigned int n513_3; // esi int v10; // edx unsigned int n0x100000_1; // edi bool v12; // zf int v13; // ebx unsigned int v14; // edx unsigned int v15; // eax int v16; // eax unsigned int v17; // esi unsigned __int64 v18; // rax unsigned int v19; // eax char *dst_1; // eax bool v21; // al int n513_2; // ebx unsigned int v23; // ecx int v24; // eax unsigned __int64 v25; // rax unsigned int n0x20_1; // ebx _DWORD *v27; // edx unsigned __int64 Register; // rax _DWORD *v29; // edx int v30; // ecx int n513_4; // eax int v32; // eax unsigned int v33; // edx unsigned int v34; // ecx _DWORD *v35; // ecx int v36; // edx int n512_2; // edx _DWORD *v38; // ecx unsigned int v39; // edx int v40; // ecx int v41; // eax int v42; // et0 char v43; // ... [17818 chars total]
// MtrrSetMemoryAttribute @ 0xffdb6b68 int MtrrSetMemoryAttribute(const void *a1, int a2, unsigned __int64 n0x100000, unsigned __int64 n513)
{
double v7; // [esp-14h] [ebp-1Ch]
HIDWORD(v7) = n0x100000; /*0xffdb6b7a*/
LODWORD(v7) = off_FFDB75B0[a2]; // "UC" /*0xffdb6b7d*/
DebugPrint( /*0xffdb6b8f*/
0x200000,
"MtrrSetMemoryAttributeMtrrSettings(%p) %a:%016lx-%016lx\n",
a1,
v7,
HIDWORD(n0x100000),
(_DWORD)n513);
return MtrrLibGetDefaultType((int)a1, a2, n0x100000, n513); /*0xffdb6bac*/
}
// MtrrLibProgramVariableMtrr @ 0xffdb6bb0 int __thiscall MtrrLibProgramVariableMtrr(unsigned __int64 *this)
{
unsigned __int64 n0x20; // rax int n0x20_1; // esi unsigned int n513; // ebx LODWORD(n0x20) = MtrrLibGetVariableCount(); /*0xffdb6bbb*/
n0x20_1 = n0x20; /*0xffdb6bc0*/
if ( (unsigned int)n0x20 > 0x20 ) /*0xffdb6bc5*/
{
LODWORD(n0x20) = GetDebugService(); /*0xffdb6bc7*/
if ( (_DWORD)n0x20 ) /*0xffdb6bce*/
LODWORD(n0x20) = (*(int ( **)(const char *, int, const char *))(n0x20 + 4))( /*0xffdb6bdf*/
"e:\\hs\\PurleySktPkg\\Override\\UefiCpuPkg\\Library\\MtrrLib\\MtrrLib.c",
2042,
"VariableMtrrCount <= 32");
}
if ( n0x20_1 ) /*0xffdb6be7*/
{
n513 = 513; /*0xffdb6be9*/
do /*0xffdb6c2d*/
{
__writemsr(n513 - 1, *this); /*0xffdb6c08*/
n0x20 = *(this + 1); /*0xffdb6c1c*/
__writemsr(n513, n0x20); /*0xffdb6c22*/
n513 += 2; /*0xffdb6c24*/
this += 2; /*0xffdb6c27*/
--n0x20_1; /*0xffdb6c2a*/
}
while ( n0x20_1 ); /*0xffdb6c2d*/
}
return n0x20; /*0xffdb6c2f*/
}
// MtrrLibProgramAllMtrrs @ 0xffdb6c36 unsigned __int64 __thiscall MtrrLibProgramAllMtrrs(unsigned __int64 *this)
{
unsigned int i; // edi unsigned __int64 result; // rax for ( i = 0; i < 33; i += 3 ) /*0xffdb6c40*/
{
result = *this; /*0xffdb6c59*/
__writemsr(dword_FFDB7520[i], *this++); /*0xffdb6c5f*/
}
return result; /*0xffdb6c6f*/
}
// MtrrLibGetActiveMtrrs @ 0xffdb6c75 unsigned __int64 *__thiscall MtrrLibGetActiveMtrrs(unsigned __int64 *this)
{
_BYTE v3[8]; // [esp+10h] [ebp-8h] BYREF if ( MtrrLibGetMemoryAttr(this) ) /*0xffdb6c81*/
{
MtrrLibProgramFixedMtrr(v3); /*0xffdb6c8e*/
MtrrLibProgramAllMtrrs(this); /*0xffdb6c95*/
MtrrLibProgramVariableMtrr(this + 11); /*0xffdb6c9d*/
__writemsr(0x2FFu, *(this + 75)); /*0xffdb6cc3*/
WriteBackCache((int)v3); /*0xffdb6cc9*/
GcdMemorySpaceOperation(0); /*0xffdb6cd0*/
}
return this; /*0xffdb6cd7*/
}
// MtrrLibGetMemoryAttr @ 0xffdb6cdc bool __thiscall MtrrLibGetMemoryAttr(void *this)
{
__int64 v1; // rax unsigned int v2; // edi unsigned int v3; // esi bool result; // al int v5; // [esp+Ch] [ebp-4h] BYREF Wbinvd(1, 0, this, this, &v5); /*0xffdb6cee*/
result = 0; /*0xffdb6d2e*/
if ( (v5 & 0x1000) != 0 ) /*0xffdb6cfd*/
{
v1 = __readmsr(0xFEu); /*0xffdb6d04*/
v2 = HIDWORD(v1); /*0xffdb6d06*/
v3 = v1; /*0xffdb6d0a*/
if ( CalcMtrrAlignment(0, 7u, v1) ) /*0xffdb6d11*/
{
if ( CalcMtrrAlignment(8u, 8u, __SPAIR64__(v2, v3)) ) /*0xffdb6d23*/
return 1; /*0xffdb6cfd*/
}
}
return result; /*0xffdb6d34*/
}
// CmosWriteIndex @ 0xffdb6d3a int CmosWriteIndex()
{
unsigned __int8 v0; // al char Result; // al char n3_1; // cl v0 = __inbyte(0x70u); /*0xffdb6d40*/
__outbyte(0x70u, v0 & 0x80 | 0x4A); /*0xffdb6d45*/
Result = __inbyte(0x71u); /*0xffdb6d4c*/
n3_1 = Result; /*0xffdb6d4d*/
if ( (unsigned __int8)Result <= 3u ) /*0xffdb6d52*/
{
LABEL_4:
if ( !n3_1 ) /*0xffdb6d6d*/
return 0; /*0xffdb6d6d*/
goto LABEL_5; /*0xffdb6d6d*/
}
n3_1 = Result; /*0xffdb6d54*/
if ( !Result ) /*0xffdb6d5c*/
{
n3_1 = MEMORY[0xFDAF0490] & 2 | 1; /*0xffdb6d68*/
goto LABEL_4; /*0xffdb6d68*/
}
LABEL_5:
if ( n3_1 != -1 )
return n3_1 != 1 ? -2147483578 : -2147483644;
return 0; /*0xffdb6d85*/
}
// GetPeiServicesTable @ 0xffdb6d89 int GetPeiServicesTable()
{
int Result; // esi _BYTE v2[2]; // [esp+4h] [ebp-8h] BYREF int v3; // [esp+6h] [ebp-6h]
GetIdtrBase(v2); /*0xffdb6d92*/
Result = *(_DWORD *)(v3 - 4); /*0xffdb6d9a*/
if ( !Result ) /*0xffdb6d9f*/
AssertReport( /*0xffdb6dae*/
(int)"e:\\hs\\MdePkg\\Library\\PeiServicesTablePointerLibIdt\\PeiServicesTablePointer.c",
48,
"PeiServices != ((void *) 0)");
return Result; /*0xffdb6db6*/
}
// MsrReadWrite @ 0xffdb6dbb int MsrReadWrite(_BYTE *this, unsigned __int64 n3)
{
unsigned __int64 Result; // rax unsigned __int64 v4; // [esp-18h] [ebp-2Ch]
v4 = __readmsr(0x2FFu); /*0xffdb6dd6*/
LODWORD(Result) = MtrrLibProgramVariableMsrs(v4, SHIDWORD(v4), 767, 767, n3); /*0xffdb6dd7*/
__writemsr(0x2FFu, Result); /*0xffdb6dee*/
return Result; /*0xffdb6df0*/
}
// Wbinvd @ 0xffdb6df4 int Wbinvd(int _EAX, _DWORD *a2, void *this, void *a4, int *a5)
{
_EAX = _EAX; /*0xffdb6e09*/
__asm { cpuid } /*0xffdb6e0c*/
if ( a2 ) /*0xffdb6e12*/
*a2 = _EAX; /*0xffdb6e14*/
if ( a5 ) /*0xffdb6e28*/
*a5 = _EDX; /*0xffdb6e2a*/
return _EAX; /*0xffdb6e2f*/
}
// InvalidateCache @ 0xffdb6e34 int InvalidateCache(unsigned __int64 a1)
{
int i; // esi if ( !a1 ) /*0xffdb6e40*/
return -1; /*0xffdb6e42*/
for ( i = 0; (a1 & 1) == 0; a1 >>= 1 ) /*0xffdb6e4e*/
++i; /*0xffdb6e50*/
return i; /*0xffdb6e77*/
}
// GetIdtrBase @ 0xffdb6e7a void *__thiscall GetIdtrBase(void *this)
{
void *this_1; // eax if ( !this ) /*0xffdb6e80*/
AssertReport((int)"e:\\hs\\MdePkg\\Library\\BaseLib\\X86ReadIdtr.c", 37, "Idtr != ((void *) 0)"); /*0xffdb6e8f*/
this_1 = this; /*0xffdb6e95*/
__sidt(this); /*0xffdb6e98*/
return this_1; /*0xffdb6e9c*/
}