HalpDmaUseEmergencyLogicalAddressResources

char __fastcall HalpDmaUseEmergencyLogicalAddressResources(__int64 a1, _QWORD *a2, char a3){
  UINT64 *v3; 
  unsigned __int64 v7; 
  char v8; 
  _QWORD *v9; 

  v3 = (UINT64 *)(a1 + 560);
  v7 = (unsigned __int8)KeAcquireSpinLockRaiseToDpc((UINT64 *)(a1 + 560));
  if( *(_BYTE *)(a1 + 584) )
  {
    v8 = 0;
    if( a3 )
    {
      v9 = *(_QWORD **)(a1 + 576);
      if( *v9 != a1 + 568 )
        __fastfail(3u);
      *a2 = a1 + 568;
      a2[1] = v9;
      *v9 = a2;
      *(_QWORD *)(a1 + 576) = a2;
    }
  }
  else
  {
    *(_BYTE *)(a1 + 584) = 1;
    v8 = 1;
  }
  KxReleaseSpinLock(v3);
  __writecr8(v7);
  return v8;
}

Referenced by:

HalpConstructScatterGatherListThin
HalpDmaAllocateAndPremapLa