KeFlushIoBuffers

VOID __stdcall KeFlushIoBuffers(_MDL *Mdl, UINT8 ReadOperation, UINT8 DmaOperation){
  ULONG_PTR v5; 
  unsigned __int8 CurrentIrql; 
  UINT64 ByteCount; 
  char v8; 
  void *MappedSystemVa; 
  UINT64 DmaOperationa; 
  UINT64 Priority; 
  _LARGE_INTEGER TimeStamp[2]; 
  __int128 v13; 

  v5 = (unsigned int)Mdl;
  *(_OWORD *)&TimeStamp[0].anonymous_0.LowPart = 0i64;
  v13 = 0i64;
  if( !KiSystemFullyCoherent )
  {
    CurrentIrql = KeGetCurrentIrql();
    ByteCount = Mdl->ByteCount;
    if( DmaOperation || ReadOperation )
    {
      v8 = 1;
      if( (Mdl->MdlFlags & 5) != 0 )
      {
        MappedSystemVa = Mdl->MappedSystemVa;
      }
      else
      {
        LODWORD(Priority) = 1073741856;
        LODWORD(DmaOperationa) = 0;
        MappedSystemVa = MmMapLockedPagesSpecifyCache(Mdl, 0, MmCached, 0i64, DmaOperationa, Priority);
      }
      if( !MappedSystemVa && CurrentIrql == 15 )
        KeBugCheckEx(0x55u, (PVOID)0x86, (PVOID)0xBAD, 0i64, 0i64);
      if( (xmmword_140CFB490 & 0x4000000) != 0 )
        EtwGetKernelTraceTimestamp(TimeStamp, 0x84000000ui64);
      else
        v8 = 0;
      if( MappedSystemVa )
      {
        KiFlushRangeAllCaches(v5, MappedSystemVa, (unsigned int)ByteCount, ReadOperation, DmaOperation);
      }
      else if( DmaOperation )
      {
        KeInvalidateAllCaches();
      }
      if( v8 )
        EtwTraceCpuCacheFlush(
          (_ETW_KERNEL_TRACE_TIMESTAMP *)TimeStamp,
          MappedSystemVa,
          ByteCount,
          ReadOperation == 0,
          DmaOperationa,
          Priority);
    }
  }
}

Referenced by:

HalFlushDmaBuffer
HalpDmaFlushBuffer
HalpDmaFlushBufferWithEmergencyResources
HalpDmaFlushDriverMdl
HalpDmaSyncMapBuffersWithEmergencyResources
HalpFlushMapBuffers
ViMapDoubleBuffer