HalpDmaAllocateScatterMemory

PMDL __fastcall HalpDmaAllocateScatterMemory(PHYSICAL_ADDRESS *a1, unsigned int a2, _QWORD *a3){
  PHYSICAL_ADDRESS v3; 
  char v4; 
  UINT64 v6; 
  _LARGE_INTEGER v7; 
  _MDL *PagesForMdl; 
  _MDL *v9; 
  PVOID MappedSystemVa; 
  v3 = a1[17];
  v4 = 0;
  v6 = (unsigned __int64)a2 << 12;
  while( 1 )
  {
    v7.QuadPart = 0i64;
    if( !v4 && v3.LowPart == -1 )
      v7.QuadPart = 0x1000000i64;
    PagesForMdl = MmAllocatePagesForMdl(v7, v3, 0i64, v6);
    v9 = PagesForMdl;
    if( PagesForMdl )
      break;
    if( v4 || !v7.QuadPart )
      return 0i64;
    v4 = 1;
  }
  if( (PagesForMdl->MdlFlags & 5) != 0 )
    MappedSystemVa = PagesForMdl->MappedSystemVa;
  else
    MappedSystemVa = MmMapLockedPagesSpecifyCache(PagesForMdl, 0, MmCached, 0i64, 0, 0x40000020u);
  *a3 = MappedSystemVa;
  return v9;
}

Referenced by:

HalpDmaAllocateLocalScatterPool
HalpDmaGrowScatterMapBuffers