/// <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); }
/// <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); }
/// <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); }
/// <summary> /// allocate memory for an array. /// </summary> public static Addr AllocateArray(USize elements, USize size, GFP flags) { return(Allocate(elements * size, flags)); }
/// <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)); }