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.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!"); } } return(NvResult.Success); }
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); NvGpuVmm Vmm = GetVmm(Context); if (!Vmm.Unmap(Args.Offset)) { Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!"); } return(NvResult.Success); }