Example #1
0
        /// <summary>
        /// allocate memory. The memory is set to zero.
        /// </summary>
        public static Addr AllocateCleared(USize n, GFP flags)
        {
            var addr = Allocate(n, flags);

            MemoryOperation.Clear(addr, n);
            return(addr);
        }
Example #2
0
        /// <summary>
        /// allocate memory for an array. The memory is set to zero.
        /// </summary>
        public static Addr AllocateArrayCleared(USize elements, USize size, GFP flags)
        {
            var total = elements * size;
            var addr  = Allocate(total, flags);

            MemoryOperation.Clear(addr, total);
            return(addr);
        }
Example #3
0
        /// <summary>
        /// kmalloc is the normal method of allocating memory for objects smaller than page size in the kernel.
        /// </summary>
        public static Addr Allocate(USize n, GFP flags)
        {
            //if (VirtualPageManager.LockCount != 0)
            //{
            //    Serial.Write(Serial.COM1, (byte)'~');
            //}

            // var sb = new StringBuffer();
            // sb.Append("Alloc: Size: {0:X8}", (uint)n);
            var addr = kmallocAllocator.malloc(n);

            // sb.Append("Alloc: Addr: {0}", (uint)addr);
            // sb.WriteTo(Devices.Serial1);

            return(addr);
        }
Example #4
0
 /// <summary>
 /// allocate memory for an array.
 /// </summary>
 public static Addr AllocateArray(USize elements, USize size, GFP flags)
 {
     return(Allocate(elements * size, flags));
 }
Example #5
0
 /// <summary>
 /// kmalloc is the normal method of allocating memory for objects smaller than page size in the kernel.
 /// </summary>
 public unsafe static Addr Allocate(USize n, GFP flags)
 {
     return(kmallocAllocator.malloc(n));
 }