コード例 #1
0
ファイル: NvGpuASIoctl.cs プロジェクト: pinguicodes/Ryujinx
        private static int UnmapBuffer(ServiceCtx Context)
        {
            long InputPosition  = Context.Request.GetBufferType0x21().Position;
            long OutputPosition = Context.Request.GetBufferType0x22().Position;

            NvGpuASUnmapBuffer Args = AMemoryHelper.Read <NvGpuASUnmapBuffer>(Context.Memory, InputPosition);

            NvGpuASCtx ASCtx = GetASCtx(Context);

            lock (ASCtx)
            {
                if (ASCtx.RemoveMap(Args.Offset, out long Size))
                {
                    if (Size != 0)
                    {
                        ASCtx.Vmm.Free(Args.Offset, Size);
                    }
                }
                else
                {
                    Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!");
                }
            }

            return(NvResult.Success);
        }
コード例 #2
0
        private static int UnmapBuffer(ServiceCtx context)
        {
            long inputPosition  = context.Request.GetBufferType0x21().Position;
            long outputPosition = context.Request.GetBufferType0x22().Position;

            NvGpuASUnmapBuffer args = MemoryHelper.Read <NvGpuASUnmapBuffer>(context.Memory, inputPosition);

            NvGpuASCtx asCtx = GetASCtx(context);

            lock (asCtx)
            {
                if (asCtx.RemoveMap(args.Offset, out long size))
                {
                    if (size != 0)
                    {
                        asCtx.Vmm.Free(args.Offset, size);
                    }
                }
                else
                {
                    Logger.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {args.Offset:x16}!");
                }
            }

            return(NvResult.Success);
        }