From 23fdaff1a5c242f4500c42f5b46330c26f03aab7 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 3 Jul 2017 01:23:00 +0200 Subject: [PATCH] Implement the privileged resource limit SVCs --- libctru/include/3ds/svc.h | 22 ++++++++++++++++++++++ libctru/source/svc.s | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/libctru/include/3ds/svc.h b/libctru/include/3ds/svc.h index baed48a..172de36 100644 --- a/libctru/include/3ds/svc.h +++ b/libctru/include/3ds/svc.h @@ -776,6 +776,28 @@ Result svcGetResourceLimitLimitValues(s64* values, Handle resourceLimit, u32* na */ Result svcGetResourceLimitCurrentValues(s64* values, Handle resourceLimit, u32* names, s32 nameCount); +/** + * @brief Sets the resource limit set of a process. + * @param process Process to set the resource limit set to. + * @param resourceLimit Resource limit set handle. + */ +Result svcSetProcessResourceLimits(Handle process, Handle resourceLimit); + +/** + * @brief Creates a resource limit set. + * @param[out] resourceLimit Pointer to output the resource limit set handle to. + */ +Result svcCreateResourceLimit(Handle* resourceLimit); + +/** + * @brief Sets the value limits of a resource limit set. + * @param resourceLimit Resource limit set to use. + * @param names Resource limit names to set the limits of. + * @param values Value limits to set. + * @param nameCount Number of resource limit names. + */ +Result svcSetResourceLimitValues(Handle resourceLimit, const u32* names, const s64* values, s32 nameCount); + /** * @brief Gets the process ID of a thread. * @param[out] out Pointer to output the process ID of the thread @p handle to. diff --git a/libctru/source/svc.s b/libctru/source/svc.s index 7932ddd..e95eb43 100644 --- a/libctru/source/svc.s +++ b/libctru/source/svc.s @@ -637,6 +637,24 @@ SVC_BEGIN svcTerminateProcess bx lr SVC_END +SVC_BEGIN svcSetProcessResourceLimits + svc 0x77 + bx lr +SVC_END + +SVC_BEGIN svcCreateResourceLimits + push {r0} + svc 0x78 + pop {r2} + str r1, [r2] + bx lr +SVC_END + +SVC_BEGIN svcSetResourceLimitValues + svc 0x79 + bx lr +SVC_END + SVC_BEGIN svcBackdoor svc 0x7B bx lr