MiCreateBootSlabEntries

INT64 __fastcall MiCreateBootSlabEntries(INT64 a1, UINT64 NumberOfPages, INT64 a3, INT64 a4){
  int v4; 
  INT64 v5; 
  UINT64 v6; 
  char *v8; 
  __int64 v9; 
  __int64 v10; 
  int v12; 
  UINT64 v13; 
  v4 = a4;
  v5 = a3;
  v6 = NumberOfPages;
  v8 = (char *)MmGetPfnDb() + 48 * NumberOfPages;
  if( !a3 )
    return 0i64;
  while( 1 )
  {
    LODWORD(v9) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
    v10 = v9;
    if( !v9 )
      break;
    *(_QWORD *)(v9 + 40) = a1;
    *(_DWORD *)(v9 + 48) = 512;
    *(_QWORD *)(v9 + 56) = v9 + 64;
    *(_QWORD *)(v9 + 32) = v6 + 511;
    *(_QWORD *)(v9 + 24) = v6;
    RtlSetAllBits((RTL_BITMAP *)(v9 + 48));
    if( v4 )
      *(_DWORD *)(v10 + 140) |= 1u;
    if( !*(_DWORD *)(a1 + 48) )
    {
      v12 = 512;
      do
      {
        if( !*((_QWORD *)v8 + 1) )
          --qword_140C4ECF8;
        v8 += 48;
        --v12;
      }
      while( v12 );
    }
    if( _bittest64((const signed __int64 *)qword_140C522C8, v6 >> 9) )
      KeBugCheckEx(0x1Au, 0x3030311ui64, *(_QWORD *)(v10 + 24), *(int *)(a1 + 48), 0i64);
    LODWORD(v13) = 0;
    _bittestandset64((signed __int64 *)qword_140C522C8, v6 >> 9);
    MiUpdateLargePageBitMap((UINT64)&MiSystemPartition, v6, 0x200ui64, 1ui64, v13);
    MiInsertSlabEntry((IRP *)&MiSystemPartition, (DEVICE_OBJECT *)a1);
    v6 += 512i64;
    v5 -= 512i64;
    if( !v5 )
      return 0i64;
  }
  return 3221225626i64;
}

Referenced by:

MiCreateKernelHalSlabRange
MiCreateSlabAllocationsFromLoaderBlock