private NvInternalResult Create(ref NvMapCreate arguments) { if (arguments.Size == 0) { Logger.Warning?.Print(LogClass.ServiceNv, $"Invalid size 0x{arguments.Size:x8}!"); return(NvInternalResult.InvalidInput); } int size = BitUtils.AlignUp(arguments.Size, (int)MemoryManager.PageSize); arguments.Handle = CreateHandleFromMap(new NvMapHandle(size)); Logger.Info?.Print(LogClass.ServiceNv, $"Created map {arguments.Handle} with size 0x{size:x8}!"); return(NvInternalResult.Success); }
private static int Create(ServiceCtx context) { long inputPosition = context.Request.GetBufferType0x21().Position; long outputPosition = context.Request.GetBufferType0x22().Position; NvMapCreate args = MemoryHelper.Read <NvMapCreate>(context.Memory, inputPosition); if (args.Size == 0) { Logger.PrintWarning(LogClass.ServiceNv, $"Invalid size 0x{args.Size:x8}!"); return(NvResult.InvalidInput); } int size = BitUtils.AlignUp(args.Size, NvGpuVmm.PageSize); args.Handle = AddNvMap(context, new NvMapHandle(size)); Logger.PrintInfo(LogClass.ServiceNv, $"Created map {args.Handle} with size 0x{size:x8}!"); MemoryHelper.Write(context.Memory, outputPosition, args); return(NvResult.Success); }