aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs89
1 files changed, 89 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
index 237c1a54..a1e84935 100644
--- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
+++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
@@ -1918,6 +1918,95 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return KernelResult.Success;
}
+ public KernelResult GetResourceLimitLimitValue(int handle, LimitableResource resource, out long limitValue)
+ {
+ limitValue = 0;
+
+ if (resource >= LimitableResource.Count)
+ {
+ return KernelResult.InvalidEnumValue;
+ }
+
+ KResourceLimit resourceLimit = KernelStatic.GetCurrentProcess().HandleTable.GetObject<KResourceLimit>(handle);
+
+ if (resourceLimit == null)
+ {
+ return KernelResult.InvalidHandle;
+ }
+
+ limitValue = resourceLimit.GetLimitValue(resource);
+
+ return KernelResult.Success;
+ }
+
+ public KernelResult GetResourceLimitCurrentValue(int handle, LimitableResource resource, out long limitValue)
+ {
+ limitValue = 0;
+
+ if (resource >= LimitableResource.Count)
+ {
+ return KernelResult.InvalidEnumValue;
+ }
+
+ KResourceLimit resourceLimit = KernelStatic.GetCurrentProcess().HandleTable.GetObject<KResourceLimit>(handle);
+
+ if (resourceLimit == null)
+ {
+ return KernelResult.InvalidHandle;
+ }
+
+ limitValue = resourceLimit.GetCurrentValue(resource);
+
+ return KernelResult.Success;
+ }
+
+ public KernelResult GetResourceLimitPeakValue(int handle, LimitableResource resource, out long peak)
+ {
+ peak = 0;
+
+ if (resource >= LimitableResource.Count)
+ {
+ return KernelResult.InvalidEnumValue;
+ }
+
+ KResourceLimit resourceLimit = KernelStatic.GetCurrentProcess().HandleTable.GetObject<KResourceLimit>(handle);
+
+ if (resourceLimit == null)
+ {
+ return KernelResult.InvalidHandle;
+ }
+
+ peak = resourceLimit.GetPeakValue(resource);
+
+ return KernelResult.Success;
+ }
+
+ public KernelResult CreateResourceLimit(out int handle)
+ {
+ KResourceLimit limit = new KResourceLimit(_context);
+
+ KProcess process = KernelStatic.GetCurrentProcess();
+
+ return process.HandleTable.GenerateHandle(limit, out handle);
+ }
+
+ public KernelResult SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue)
+ {
+ if (resource >= LimitableResource.Count)
+ {
+ return KernelResult.InvalidEnumValue;
+ }
+
+ KResourceLimit resourceLimit = KernelStatic.GetCurrentProcess().HandleTable.GetObject<KResourceLimit>(handle);
+
+ if (resourceLimit == null)
+ {
+ return KernelResult.InvalidHandle;
+ }
+
+ return resourceLimit.SetLimitValue(resource, limitValue);
+ }
+
// Thread
public KernelResult CreateThread(