Beispiel #1
0
 /// <summary>
 /// Alloc memory block, of a given size.
 /// </summary>
 /// <param name="aSize">A size of block to alloc, in bytes.</param>
 /// <returns>Byte pointer to the start of the block.</returns>
 public static byte *Alloc(Native aSize)
 {
     if (aSize <= HeapSmall.mMaxItemSize)
     {
         return(HeapSmall.Alloc(aSize));
     }
     else if (aSize <= HeapMedium.MaxItemSize)
     {
         return(HeapMedium.Alloc(aSize));
     }
     else
     {
         return(HeapLarge.Alloc(aSize));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Alloc memory block, of a given size.
        /// </summary>
        /// <param name="aSize">A size of block to alloc, in bytes.</param>
        /// <returns>Byte pointer to the start of the block.</returns>
        public static byte *Alloc(uint aSize)
        {
            CPU.DisableInterrupts();

            if (aSize <= HeapSmall.mMaxItemSize)
            {
                byte *ptr = HeapSmall.Alloc((ushort)aSize);
                CPU.EnableInterrupts();
                return(ptr);
            }
            else if (aSize <= HeapMedium.MaxItemSize)
            {
                byte *ptr = HeapMedium.Alloc(aSize);
                CPU.EnableInterrupts();
                return(ptr);
            }
            else
            {
                byte *ptr = HeapLarge.Alloc(aSize);
                CPU.EnableInterrupts();
                return(ptr);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Alloc memory block, of a given size.
 /// </summary>
 /// <param name="aSize">A size of block to alloc, in bytes.</param>
 /// <returns>Byte pointer to the start of the block.</returns>
 static public byte *Alloc(Native aSize)
 {
     return(HeapLarge.Alloc(aSize));
 }
Beispiel #4
0
 /// <summary>
 /// Alloc memory block, of a given size.
 /// </summary>
 /// <param name="aSize">A size of block to alloc, in bytes.</param>
 /// <returns>Byte pointer to the start of the block.</returns>
 static public byte *Alloc(uint aSize)
 {
     return(HeapLarge.Alloc(aSize, RAT.PageType.HeapMedium));
 }