SmFpAllocate

VOID *__stdcall SmFpAllocate(
        _SM_FORWARD_PROGRESS_CTX *FpContext,
        _SM_FP_RESOURCE_TYPE ResourceType,
        VOID *Context,
        _MDL *Mdl,
        UINT64 DontFail){
  void *MdlForLock; 
  VOID *MappedSystemVa; 
  VOID *v12; 
  UINT64 v13; 
  UINT64 Priority; 
  unsigned int Tag; 

  if( ResourceType >= SmFpResourceMapping )
  {
    if( (Mdl->MdlFlags & 5) == 0 )
    {
      LODWORD(Priority) = 1073741840;
      LODWORD(v13) = 0;
      MdlForLock = MmMapLockedPagesSpecifyCache(Mdl, 0, MmCached, 0i64, v13, Priority);
      goto LABEL_6;
    }
    MappedSystemVa = Mdl->MappedSystemVa;
LABEL_7:
    if( MappedSystemVa )
      return MappedSystemVa;
    goto LABEL_15;
  }
  if( ResourceType == SmFpResourceLockMdl )
  {
    MdlForLock = SmKmAllocateMdlForLock((unsigned __int64)*((unsigned __int16 *)FpContext + 46) << 12);
    goto LABEL_6;
  }
  if( ResourceType == SmFpResourceCommit )
  {
    MappedSystemVa = (VOID *)(-(__int64)((unsigned int)SmAcquireReleaseCharges(
                                                         (unsigned __int64)*((unsigned __int16 *)FpContext + 47) << 12,
                                                         1ui64,
                                                         0i64) != 0) & 0xFFFFFFFFFFFFFFF8ui64);
    goto LABEL_7;
  }
  if( ResourceType != SmFpResourceReserveMmPages )
  {
    Tag = 810708339;
    HIBYTE(Tag) = ResourceType + 48;
    MdlForLock = ExAllocatePoolWithTag(0x200ui64, *((unsigned __int16 *)FpContext + ResourceType + 44), Tag);
LABEL_6:
    MappedSystemVa = MdlForLock;
    goto LABEL_7;
  }
  MappedSystemVa = 0i64;
LABEL_15:
  if( (_DWORD)DontFail )
  {
    v12 = SmpFpWaitForResource(FpContext, ResourceType, Context);
    MappedSystemVa = v12;
    if( ResourceType >= SmFpResourceMapping )
      MmMapLockedPagesWithReservedMapping(v12, 0x6D526D73ui64, Mdl, MmCached);
  }
  return MappedSystemVa;
}

Referenced by:

SMKM_STORE::SmStMapPhysicalRegion
SMKM_STORE::SmStReadThread
SMKM_STORE_MGR::SmIoCtxPrepareToQueue
SMKM_STORE_MGR::SmPageRead
SMKM_STORE_MGR::SmpPageEvict
SmKmStoreHelperCommandProcess