HalpIommuDomainUnmapLogicalRange

NTSTATUS __stdcall HalpIommuDomainUnmapLogicalRange(PVOID BugCheckParameter3, PVOID BugCheckParameter4){
  INT64 *v2; 
  char v3; 
  INT64 *v4; 
  unsigned __int64 v8; 
  INT64 v9; 
  int v10; 
  NTSTATUS v11; 
  unsigned __int64 v12; 
  unsigned __int64 v13; 
  __int64 v14; 
  __int64 v15[5]; 
  __int64 v16; 
  v4 = v2;
  v15[0] = 0i64;
  if( HalpHvIommu )
  {
    if( !HalpHvIommuDeviceDomain )
      return -1073741637;
    v8 = *v2;
    v9 = *((unsigned int *)BugCheckParameter3 + 8);
    if( v3 )
    {
      v10 = IommupHvMapDeviceLogicalRange(v9, 0i64, 0i64, *v2, (INT64)BugCheckParameter4);
    }
    else
    {
      v16 = (unsigned int)v9;
      v15[0] = (v8 >> 12) + ((v8 & 0xFFF) != 0);
      v10 = ((__int64(__fastcall *)(__int64 *, PVOID, __int64 *))qword_140C4A2D8)(&v16, BugCheckParameter4, v15);
    }
    v11 = v10;
    if( v10 < 0 )
      KeBugCheckEx(0x1D9u, 1ui64, v10, (ULONG_PTR)BugCheckParameter3, (ULONG_PTR)BugCheckParameter4);
  }
  else
  {
    v11 = HalpIommuUnmapLogicalRange(*((_QWORD *)BugCheckParameter3 + 3), (UINT64 *)v2, (INT64)BugCheckParameter4);
    v12 = ((unsigned __int64)((unsigned __int16)BugCheckParameter4 & 0xFFF) + *v4 + 4095) >> 12;
    v13 = (unsigned __int64)BugCheckParameter4 & 0xFFFFFFFFFFFFF000ui64;
    while( v12 )
    {
      v14 = 1024i64;
      if( v12 < 0x400 )
        v14 = v12;
      HalpIommuFlushDmaDomain(BugCheckParameter3, v13 ^ ((unsigned __int16)v13 ^ (unsigned __int16)(v14 - 1)) & 0x3FF);
      v12 -= v14;
      v13 += v14 << 12;
    }
    if( v11 >= 0 )
      return 0;
  }
  return v11;
}

Referenced by:

HalDmaAllocateCrashDumpRegistersEx
HalDmaFreeCrashDumpRegistersEx
HalFreeCommonBufferThin
HalFreeCommonBufferV3
HalFreeCommonBufferVector
HalpDmaFreeLa
HalpLeaveDmaDomain
HalpPutScatterGatherListThin
IommuUnmapLogicalRange