IommuUnmapIdentityRange

NTSTATUS __stdcall IommuUnmapIdentityRange(PVOID BugCheckParameter3){
  INT64 v1; 
  NTSTATUS result; 
  __int64 v4; 
  unsigned __int64 v5; 
  __int64 v6; 
  __int64 v7; 
  bool i; 
  __int64 v9; 
  INT64 v10; 
  INT64 v11; 
  unsigned __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  UINT64 v15; 
  if( !*((_BYTE *)BugCheckParameter3 + 44) )
    return -1073741585;
  if( !IommupValidateMdl(v1) )
    return -1073741584;
  v5 = (unsigned __int64)*(unsigned int *)(v4 + 40) >> 12;
  v6 = v4 + 8 * ((unsigned __int64)*(unsigned int *)(v4 + 44) >> 12);
  if( HalpHvIommu )
  {
    result = IommupHvUnmapDeviceIdentityRange((INT64)BugCheckParameter3);
    if( result < 0 )
      KeBugCheckEx(0x1D9u, 1ui64, result, (ULONG_PTR)BugCheckParameter3, 0i64);
  }
  else
  {
    result = 0;
    v7 = 0i64;
    for( i = v5 == 0; ; i = v5 == 0 )
    {
      v14 = v7;
      if( i )
        break;
      v9 = *(_QWORD *)(v6 + 8 * v7 + 48);
      v10 = *((_QWORD *)BugCheckParameter3 + 3);
      v11 = v9 << 12;
      v15 = 4096i64;
      result = HalpIommuUnmapLogicalRange(v10, &v15, v11);
      if( result < 0 || v15 != 4096 )
        break;
      v12 = 1i64;
      do
      {
        v13 = 1024i64;
        if( v12 < 0x400 )
          v13 = v12;
        HalpIommuFlushDmaDomain(BugCheckParameter3, v11 ^ ((unsigned __int16)v11 ^ (unsigned __int16)(v13 - 1)) & 0x3FF);
        v12 -= v13;
        v11 += v13 << 12;
      }
      while( v12 );
      result = 0;
      v7 = v14 + 1;
      --v5;
    }
  }
  return result;
}

Referenced by:

No references.