HalpDmaAllocateEmergencyResources

NTSTATUS __stdcall HalpDmaAllocateEmergencyResources(PINTERRUPT_INITIALIZE_IO_UNIT *a1){
  _HALP_ALLOC_CONTEXT *v1; 
  INT64 v2; 
  INT64 v3; 
  _HALP_ALLOC_CONTEXT *v4; 
  _HALP_ALLOC_CONTEXT *v5; 
  _HALP_ALLOC_CONTEXT *v7; 
  VOID *v8; 

  Mdl = (INT64)HalpMmAllocCtxAlloc((_HALP_ALLOC_CONTEXT *)a1, 0x38ui64);
  if( !Mdl )
    return -1073741670;
  MemoryDescriptorList = (INT64)HalpMmAllocCtxAlloc(v1, 0x38ui64);
  v2 = MemoryDescriptorList;
  if( !MemoryDescriptorList )
  {
    v8 = (VOID *)Mdl;
LABEL_10:
    HalpMmAllocCtxFree((_HALP_ALLOC_CONTEXT *)v2, v8);
    return -1073741670;
  }
  v3 = Mdl;
  *(_DWORD *)(Mdl + 8) = 56;
  *(_QWORD *)v3 = 0i64;
  *(_QWORD *)(v3 + 32) = 0i64;
  *(_QWORD *)(v3 + 40) = 4096i64;
  *(_DWORD *)(v2 + 8) = 56;
  *(_QWORD *)v2 = 0i64;
  *(_QWORD *)(v2 + 32) = 0i64;
  *(_QWORD *)(v2 + 40) = 4096i64;
  *(_WORD *)(v3 + 10) |= 2u;
  *(_WORD *)(v2 + 10) |= 2u;
  MappingAddress = MmAllocateMappingAddress(0x1000ui64, 0x206C6148ui64);
  if( !MappingAddress )
  {
    HalpMmAllocCtxFree(v4, (VOID *)Mdl);
    v8 = (VOID *)MemoryDescriptorList;
    goto LABEL_10;
  }
  qword_140C53C50 = MmAllocateMappingAddress(0x1000ui64, 0x206C6148ui64);
  if( qword_140C53C50 )
  {
    qword_140CF2318 = 0i64;
    return 0;
  }
  HalpMmAllocCtxFree(v5, (VOID *)Mdl);
  HalpMmAllocCtxFree(v7, (VOID *)MemoryDescriptorList);
  MmFreeMappingAddress(MappingAddress, 0x206C6148u);
  return -1073741670;
}

Referenced by:

HalpDmaInit