HalpIommuGetDmarptRootAddress

NTSTATUS __stdcall HalpIommuGetDmarptRootAddress(INT64 a1, UINT64 a2, _LARGE_INTEGER *a3){
  unsigned int v3; 
  UINT64 v6; 
  unsigned int v7; 
  _DWORD *v8; 
  __int64 v9; 
  int v10; 
  LONGLONG v11; 

  v3 = *(_DWORD *)(a1 + 24);
  if( (unsigned int)a2 > v3 )
    return -1073741811;
  v6 = *(_QWORD *)(a1 + 16);
  v7 = v3 - a2;
  if( v7 )
  {
    v8 = (_DWORD *)(a1 + 36);
    v9 = v7;
    do
    {
      v10 = 1 << *v8++;
      v6 = *(_QWORD *)((v10 << *(_DWORD *)(a1 + 28)) + v6);
      --v9;
    }
    while( v9 );
  }
  LODWORD(v11) = MmGetPhysicalAddress(v6);
  a3->QuadPart = v11;
  return 0;
}

Referenced by:

HalpIommuConstructReservedPageTable
HalpIommuGetHardwareDomain