Esempio n. 1
0
 /// <summary>
 /// Init heap.
 /// </summary>
 /// <exception cref="Exception">Thrown on fatal error, contact support.</exception>
 public static unsafe void Init()
 {
     StackStart = (uint *)CPU.GetStackStart();
     HeapSmall.Init();
     HeapMedium.Init();
     HeapLarge.Init();
 }
Esempio n. 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(Native aSize)
 {
     if (aSize <= HeapSmall.mMaxItemSize)
     {
         return(HeapSmall.Alloc(aSize));
     }
     else if (aSize <= HeapMedium.MaxItemSize)
     {
         return(HeapMedium.Alloc(aSize));
     }
     else
     {
         return(HeapLarge.Alloc(aSize));
     }
 }
Esempio n. 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>
        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);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Init heap.
 /// </summary>
 /// <exception cref="Exception">Thrown on fatal error, contact support.</exception>
 public static void Init()
 {
     HeapSmall.Init();
     HeapMedium.Init();
     HeapLarge.Init();
 }