HsaUpdateRemappingTableEntry
CHAR __fastcall HsaUpdateRemappingTableEntry(INT64 a1, CHAR a2, UINT64 a3, _DWORD *a4){
CHAR v4;
__int64 v5;
INT64 v8;
__int64 v9;
UINT8 *v10;
RTL_BITMAP *v11;
ULONG_PTR v12;
int v13;
__int64 v15;
signed __int64 v16;
__int64 i;
ULONG_PTR v18;
signed __int64 v19;
__int128 v20;
__int128 v21;
unsigned __int8 v22;
ULONG_PTR BugCheckParameter3[2];
ULONG_PTR BugCheckParameter4[2];
v4 = 0;
v5 = (unsigned int)a3;
*(_OWORD *)BugCheckParameter4 = 0i64;
if( a2 )
{
HsaGetDeviceAperture((unsigned int)a3);
v5 &= 0x1FFu;
v10 = (UINT8 *)(v9 + 8);
if( !*(_QWORD *)(v9 + 16) )
ExtEnvCriticalFailure(v8, 0i64, 0i64, 0i64, 0i64);
}
else
{
v10 = &HsaSharedRemappingTable;
}
v11 = (RTL_BITMAP *)(v10 + 24);
if( a2 )
RtlSetBits(v11, (unsigned int)v5, 1ui64);
else
RtlClearBits(v11, (unsigned int)v5, 1ui64);
v12 = *((_QWORD *)v10 + 1) + 16 * v5;
if( (*(_BYTE *)v12 & 1) == 0 && (a4[3] & 0x10) == 0 )
return 0;
v13 = a4[3];
*(_OWORD *)BugCheckParameter3 = 0i64;
if( (v13 & 0x10) != 0 )
{
if( a4[5] != 1 )
return 0;
v15 = (unsigned __int8)(LOBYTE(BugCheckParameter3[1]) ^ a4[12]);
BugCheckParameter3[0] = (2i64 * (v13 & 2)) | 1;
BugCheckParameter3[1] ^= v15;
HsaUpdateInterruptDestination(BugCheckParameter3, a4 + 6);
}
v16 = BugCheckParameter3[0];
if( (*(_BYTE *)v12 & BugCheckParameter3[0] & 1) != 0 )
{
for( i = 0i64; i < 2; ++i )
BugCheckParameter4[i] = BugCheckParameter3[i] ^ *(ULONG_PTR *)((char *)&BugCheckParameter3[i]
+ v12
- (_QWORD)BugCheckParameter3);
v18 = BugCheckParameter4[1] & 0xFFFFFFFFFFFFFFi64;
BugCheckParameter4[0] &= 0xFFFFFFFF000000FFui64;
BugCheckParameter4[1] &= 0xFFFFFFFFFFFFFFui64;
if( BugCheckParameter4[0] || v18 )
KeBugCheckEx(0x5Cu, 0x7000ui64, 0x20ui64, v12, (ULONG_PTR)BugCheckParameter4);
}
v19 = BugCheckParameter3[1];
if( *(_QWORD *)v12 != v16 || *(_QWORD *)(v12 + 8) != BugCheckParameter3[1] )
{
v20 = *(_OWORD *)v12;
do
{
v21 = v20;
v22 = _InterlockedCompareExchange128((volatile signed __int64 *)v12, v19, v16, (signed __int64 *)&v21);
v20 = v21;
}
while( !v22 );
return 1;
}
return v4;
}Referenced by:
No references.