From fd566668d3921d64f6d7765402e3e35040800267 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Thu, 14 Apr 2016 01:19:11 -0700 Subject: [PATCH] Add some resource limit SVCs. --- libctru/include/3ds/svc.h | 25 +++++++++++++++++++++++++ libctru/source/svc.s | 15 +++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/libctru/include/3ds/svc.h b/libctru/include/3ds/svc.h index 68f884e..25dcc9b 100644 --- a/libctru/include/3ds/svc.h +++ b/libctru/include/3ds/svc.h @@ -631,6 +631,31 @@ s32 svcGetProcessorID(void); */ Result svcGetThreadId(u32 *out, Handle handle); +/** + * @brief Gets the resource limit set of a process. + * @param[out] resourceLimit Pointer to output the resource limit set handle to. + * @param process Process to get the resource limits of. + */ +Result svcGetResourceLimit(Handle* resourceLimit, Handle process); + +/** + * @brief Gets the value limits of a resource limit set. + * @param[out] values Pointer to output the value limits to. + * @param resourceLimit Resource limit set to use. + * @param names Resource limit names to get the limits of. + * @param nameCount Number of resource limit names. + */ +Result svcGetResourceLimitLimitValues(s64* values, Handle resourceLimit, u32* names, s32 nameCount); + +/** + * @brief Gets the values of a resource limit set. + * @param[out] values Pointer to output the values to. + * @param resourceLimit Resource limit set to use. + * @param names Resource limit names to get the values of. + * @param nameCount Number of resource limit names. + */ +Result svcGetResourceLimitCurrentValues(s64* values, Handle resourceLimit, u32* names, 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 e69c558..59560e5 100644 --- a/libctru/source/svc.s +++ b/libctru/source/svc.s @@ -284,6 +284,21 @@ SVC_BEGIN svcGetThreadId str r1, [r3] bx lr +SVC_BEGIN svcGetResourceLimit + str r0, [sp, #-0x4]! + svc 0x38 + ldr r3, [sp], #4 + str r1, [r3] + bx lr + +SVC_BEGIN svcGetResourceLimitLimitValues + svc 0x39 + bx lr + +SVC_BEGIN svcGetResourceLimitCurrentValues + svc 0x3A + bx lr + SVC_BEGIN svcBreak svc 0x3C bx lr