IommuDomainAttachDevice

INT64 __fastcall IommuDomainAttachDevice(LONGLONG a1, DEVICE_OBJECT *a2, INT64 a3, INT64 a4){
  int v6; 
  int v7; 
  int DeviceId; 
  __int64 v9; 
  __int64 v10; 
  _QWORD *v11; 
  unsigned __int8 CurrentIrql; 
  _QWORD *v14; 
  v6 = a4;
  v7 = a3;
  DeviceId = HalpIommuGetDeviceId(a2);
  if( DeviceId < 0 )
    return(unsigned int)DeviceId;
  if( !v7 && v6 == 1 )
  {
    DeviceId = HalpIommuCreateDevice(0i64);
    if( DeviceId >= 0 )
    {
      DeviceId = HalpIommuJoinDmaDomain(0i64, a1);
      if( DeviceId >= 0 )
      {
        v10 = HalpMmAllocCtxAlloc(v9, 56i64);
        v11 = (_QWORD *)v10;
        if( v10 )
        {
          *(_QWORD *)v10 = 0i64;
          *(_QWORD *)(v10 + 8) = 0i64;
          *(_DWORD *)(v10 + 24) = 0;
          *(_QWORD *)(v10 + 32) = 0i64;
          *(_QWORD *)(v10 + 16) = a2;
          *(_DWORD *)(v10 + 28) = 1;
          *(_QWORD *)(v10 + 40) = a1;
          *(_QWORD *)(v10 + 48) = 0i64;
          CurrentIrql = KeGetCurrentIrql();
          __writecr8(0xCui64);
          KxAcquireSpinLock(&HalpIommuParaVirtDeviceCacheLock);
          v14 = (_QWORD *)qword_140C48A48;
          if( *(__int64 **)qword_140C48A48 != &HalpIommuParaVirtDeviceCache )
            __fastfail(3u);
          *v11 = &HalpIommuParaVirtDeviceCache;
          v11[1] = v14;
          *v14 = v11;
          qword_140C48A48 = (__int64)v11;
          KxReleaseSpinLock(&HalpIommuParaVirtDeviceCacheLock);
          __writecr8(CurrentIrql);
        }
        else
        {
          return(unsigned int)-1073741670;
        }
      }
    }
    return(unsigned int)DeviceId;
  }
  return 3221225713i64;
}

Referenced by:

No references.