From ba23d7224bcd9e5ee3916490987197f9f1414bc2 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Fri, 23 Dec 2016 15:22:31 +0100 Subject: [PATCH] Add svcGetThreadList --- libctru/include/3ds/svc.h | 9 +++++++++ libctru/source/svc.s | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/libctru/include/3ds/svc.h b/libctru/include/3ds/svc.h index 6d6e1dd..1cbb3ec 100644 --- a/libctru/include/3ds/svc.h +++ b/libctru/include/3ds/svc.h @@ -561,6 +561,15 @@ Result svcGetProcessId(u32 *out, Handle handle); */ Result svcGetProcessList(s32* processCount, u32* processIds, s32 processIdMaxCount); +/** + * @brief Gets a list of the threads of a process. + * @param[out] threadCount Pointer to output the thread count to. + * @param[out] threadIds Pointer to output the thread IDs to. + * @param threadIdMaxCount Maximum number of thread IDs. + * @param process Process handle to list the threads of. + */ +Result svcGetThreadList(s32* threadCount, u32* threadIds, s32 threadIdMaxCount, Handle process); + /** * @brief Creates a port. * @param[out] portServer Pointer to output the port server handle to. diff --git a/libctru/source/svc.s b/libctru/source/svc.s index a0513b2..1277594 100644 --- a/libctru/source/svc.s +++ b/libctru/source/svc.s @@ -427,6 +427,13 @@ SVC_BEGIN svcGetProcessList str r1, [r3] bx lr +SVC_BEGIN svcGetThreadList + str r0, [sp, #-0x4]! + svc 0x66 + ldr r3, [sp], #4 + str r1, [r3] + bx lr + SVC_BEGIN svcGetDebugThreadContext svc 0x67 bx lr