HalpDmaInitMemory
NTSTATUS __stdcall HalpDmaInitMemory(INT64 a1){
INT64 v1;
INT64 v3;
INT64 v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
_LARGE_INTEGER v8;
unsigned int i;
_LARGE_INTEGER v10;
__int64 v11;
_LARGE_INTEGER MaxPhysicalAddress;
HalpDmaAdapterListLock = 0i64;
qword_140C4BCA8 = (__int64)&HalpDmaAdapterList;
HalpDmaAdapterList = (__int64)&HalpDmaAdapterList;
word_140C49B80 = 1;
LOBYTE(v1) = 1;
byte_140C49B82 = 6;
dword_140C49B84 = 1;
qword_140C49B90 = (__int64)&qword_140C49B88;
qword_140C49B88 = &qword_140C49B88;
MaxPhysicalAddress.QuadPart = 0x1000000i64;
MasterAdapter.MapBufferPhysicalAddress.QuadPart = HalpAllocPhysicalMemory(
(_LOADER_PARAMETER_BLOCK *)a1,
&MaxPhysicalAddress,
0x10ui64,
v1);
LOBYTE(v3) = 1;
MasterAdapter.MapBufferSize = MasterAdapter.MapBufferPhysicalAddress.QuadPart != 0 ? 0x10000 : 0;
stru_140C4BA20.MapBufferPhysicalAddress.QuadPart = HalpAllocPhysicalMemory(
(_LOADER_PARAMETER_BLOCK *)a1,
&MaxPhysicalAddress,
0x10ui64,
v3);
v5 = 32;
stru_140C4BA20.MapBufferSize = stru_140C4BA20.MapBufferPhysicalAddress.QuadPart != 0 ? 0x10000 : 0;
v6 = (unsigned __int64)qword_140C4BA18 < 0x100000000i64 ? 0x10000 : 196608;
v7 = v6 >> 12;
do
{
LOBYTE(v4) = 1;
MaxPhysicalAddress.QuadPart = (1i64 << v5) - 1;
v8.QuadPart = HalpAllocPhysicalMemory((_LOADER_PARAMETER_BLOCK *)a1, &MaxPhysicalAddress, v7, v4);
if( v8.QuadPart )
break;
++v5;
}
while( v5 <= 0x20 );
stru_140C4B940.MapBufferPhysicalAddress = v8;
stru_140C4B940.MapBufferSize = v8.QuadPart != 0 ? v6 : 0;
if( v5 >= 0x40 )
stru_140C4B940.AdapterObject.MaximumPhysicalAddress.QuadPart = -1i64;
else
stru_140C4B940.AdapterObject.MaximumPhysicalAddress.QuadPart = (1i64 << v5) - 1;
for( i = 32; i <= 0x20; ++i )
{
LOBYTE(v4) = 1;
MaxPhysicalAddress.QuadPart = (1i64 << i) - 1;
v10.QuadPart = HalpAllocPhysicalMemory((_LOADER_PARAMETER_BLOCK *)a1, &MaxPhysicalAddress, v7, v4);
if( v10.QuadPart )
break;
}
stru_140C4BB00.MapBufferPhysicalAddress = v10;
v11 = -v10.QuadPart;
stru_140C4BB00.MapBufferSize = v11 != 0 ? v6 : 0;
if( i >= 0x40 )
{
stru_140C4BB00.AdapterObject.MaximumPhysicalAddress.QuadPart = -1i64;
}
else
{
v11 = (1i64 << i) - 1;
stru_140C4BB00.AdapterObject.MaximumPhysicalAddress.QuadPart = v11;
}
return v11;
}Referenced by:
HalpDmaInitDiscard