HvpViewMapMakeViewRangeValid
INT64 __fastcall HvpViewMapMakeViewRangeValid(UINT64 a1, _QWORD *a2, INT64 a3, INT64 a4, CHAR a5){
__int64 v5;
unsigned __int64 v6;
VOID *v7;
int v12;
UINT64 v13;
char v14;
UINT64 v15;
int v16;
INT64 i;
unsigned __int64 v18;
char v19;
__int64 v20;
char v22;
UINT64 NewAccessProtection;
UINT64 NewAccessProtectiona;
INT64 a6;
v5 = a2[7] - a2[3];
v6 = a4 - a3;
LODWORD(a6) = 0;
v7 = (VOID *)(a3 + v5);
LODWORD(NewAccessProtection) = 2;
v12 = CmSiProtectViewOfSection(a1, *(VOID ***)(a1 + 24), v7, a4 - a3, NewAccessProtection, (INT64)&a6);
if( v12 >= 0 )
{
CmSiPrefetchVirtualMemoryRange(*(VOID ***)(a1 + 24), v7, v6);
v14 = 0;
if( (*(_DWORD *)(a1 + 32) & 2) != 0 )
{
if( a5 )
{
CmSiLockViewOfSection(v13, *(VOID ***)(a1 + 24), v7, v6);
if( v16 >= 0 )
{
v14 = 1;
a2[8] += v6 >> 12;
*(_DWORD *)(a1 + 32) |= 4u;
goto LABEL_8;
}
}
LODWORD(NewAccessProtectiona) = 8;
v12 = CmSiProtectViewOfSection(v13, *(VOID ***)(a1 + 24), v7, v6, NewAccessProtectiona, (INT64)&a6);
if( v12 >= 0 )
{
v12 = HvpViewMapTouchPages((BYTE *)v7, v6, 1);
if( v12 >= 0 )
{
LODWORD(NewAccessProtectiona) = 2;
CmSiProtectViewOfSection(v15, *(VOID ***)(a1 + 24), v7, v6, NewAccessProtectiona, (INT64)&a6);
goto LABEL_8;
}
}
}
else
{
v12 = HvpViewMapTouchPages((BYTE *)v7, v6, 0);
if( v12 >= 0 )
{
LABEL_8:
for( i = a3; i < a4; i += 4096i64 )
{
v18 = (unsigned __int64)(i - a2[3]) >> 12;
v19 = *((_BYTE *)a2 + v18 + 72);
*((_BYTE *)a2 + v18 + 72) = v19 | 1;
if( (*(_DWORD *)(a1 + 32) & 2) != 0 )
{
if( v14 )
v22 = v19 | 0x11;
else
v22 = v19 | 5;
*((_BYTE *)a2 + v18 + 72) = v22;
}
}
v20 = a2[5];
if( v20 || a2[6] )
{
if( v20 == a4 )
{
a2[5] = a3;
return 0;
}
if( a2[6] != a3 )
return 0;
}
else
{
a2[5] = a3;
}
a2[6] = a4;
return 0;
}
}
LODWORD(NewAccessProtectiona) = -2147483647;
CmSiProtectViewOfSection(v15, *(VOID ***)(a1 + 24), v7, v6, NewAccessProtectiona, (INT64)&a6);
}
return(unsigned int)v12;
}Referenced by:
HvpViewMapCreateViewsForRegion
HvpViewMapExtendStorage
HvpViewMapPromoteRangeToMapping