VfFlushAdapterBuffers

UINT8 __stdcall VfFlushAdapterBuffers(
        ULONG_PTR DmaAdapter,
        ULONG_PTR Mdl,
        VOID *MapRegisterBase,
        VOID *CurrentVa,
        UINT64 Length,
        UINT8 WriteToDevice){
  _MDL *v6; 
  _DMA_ADAPTER *v9; 
  __int64(__fastcall *RealDmaOperation)(_DMA_ADAPTER *, _MDL *, VOID *, VOID *, _DWORD, UINT8); 
  INT64 v11; 
  __int64(__fastcall *v12)(_DMA_ADAPTER *, _MDL *, VOID *, VOID *, _DWORD, UINT8); 
  UINT8 v13; 
  _LIST_ENTRY *AdapterInformationInternal; 
  UINT8 result; 
  _MAP_REGISTER_FILE *MapRegisterFile; 
  UINT8 v17; 
  UINT64 v20; 
  VOID *CurrentVaa; 
  VOID *MapRegisterBasea; 
  _MDL *Mdla; 
  __int64(__fastcall *v24)(_DMA_ADAPTER *, _MDL *, VOID *, VOID *, _DWORD, UINT8); 

  v6 = *(_MDL **)&Mdl;
  v9 = *(_DMA_ADAPTER **)&DmaAdapter;
  RealDmaOperation = (__int64(__fastcall *)(_DMA_ADAPTER *, _MDL *, VOID *, VOID *, _DWORD, UINT8))ViGetRealDmaOperation(DmaAdapter, 0x28ui64);
  LOBYTE(v11) = 1;
  v24 = RealDmaOperation;
  v12 = RealDmaOperation;
  AdapterInformationInternal = ViGetAdapterInformationInternal(v9, v11);
  if( !AdapterInformationInternal )
    goto LABEL_4;
  VF_ASSERT_MAX_IRQL(v13);
  if( MapRegisterBase == (VOID *)-559026163i64 )
  {
    MapRegisterBase = 0i64;
    goto LABEL_4;
  }
  MapRegisterFile = ViGetMapRegisterFile(MapRegisterBase);
  if( !MapRegisterFile )
  {
LABEL_4:
    result = v12(v9, v6, MapRegisterBase, CurrentVa, Length, WriteToDevice);
    if( AdapterInformationInternal )
    {
      if( result )
        _InterlockedExchange((volatile __int32 *)&AdapterInformationInternal[11].Blink + 1, 0);
    }
    return result;
  }
  Mdla = v6;
  CurrentVaa = CurrentVa;
  MapRegisterBasea = MapRegisterBase;
  if( (unsigned int)ViSwap(&MapRegisterBasea, &Mdla, &CurrentVaa) )
  {
    v17 = v24(v9, Mdla, MapRegisterBasea, CurrentVaa, Length, WriteToDevice);
    ViFlushDoubleBuffer(MapRegisterFile, v6, CurrentVa, (unsigned int)Length, WriteToDevice);
    if( v17 )
      _InterlockedExchange((volatile __int32 *)&AdapterInformationInternal[11].Blink + 1, 0);
    return v17;
  }
  else
  {
    if( (_DWORD)Length )
    {
      ViHalPreprocessOptions(
        (UINT64 *)((char *)&qword_140C12D20 + 4),
        (PSTR)"Cannot flush map register that isn't mapped! (Map register base %p, flushing address %p, MDL %p)",
        0x20ui64,
        (UINT64)MapRegisterBase,
        (UINT64)CurrentVa,
        (UINT64)v6,
        v20);
      VfReportIssueWithOptions(
        0xE6ui64,
        0x20u,
        (ULONG_PTR)MapRegisterBase,
        (ULONG_PTR)CurrentVa,
        (ULONG_PTR)v6,
        (UINT64 *)((char *)&qword_140C12D20 + 4));
    }
    return 0;
  }
}

Referenced by:

No references.