Line 62:
Line 62:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result [[#CreateThread|CreateThread]](Handle* thread, func entrypoint, u32 arg, u32 stacktop, s32 threadpriority, s32 processorid)
+
| Result [[Multi-threading#CreateThread|CreateThread]](Handle* thread, func entrypoint, u32 arg, u32 stacktop, s32 threadpriority, s32 processorid)
|
|
|-
|-
Line 69:
Line 69:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| void ExitThread(void)
+
| void [[Multi-threading#ExitThread|ExitThread]](void)
|
|
|-
|-
Line 76:
Line 76:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| void SleepThread(s64 nanoseconds)
+
| void [[Multi-threading#SleepThread|SleepThread]](s64 nanoseconds)
|
|
|-
|-
Line 83:
Line 83:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result GetThreadPriority(s32* priority, Handle thread)
+
| Result [[Multi-threading#GetThreadPriority|GetThreadPriority]](s32* priority, Handle thread)
|
|
|-
|-
Line 90:
Line 90:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result SetThreadPriority(Handle thread, s32 priority)
+
| Result [[Multi-threading#SetThreadPriority|SetThreadPriority]](Handle thread, s32 priority)
|
|
|-
|-
Line 97:
Line 97:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result GetThreadAffinityMask(u8* affinitymask, Handle thread, s32 processorcount)
+
| Result [[Multi-threading#GetThreadAffinityMask|GetThreadAffinityMask]](u8* affinitymask, Handle thread, s32 processorcount)
|
|
|-
|-
Line 104:
Line 104:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result SetThreadAffinityMask(Handle thread, u8* affinitymask, s32 processorcount)
+
| Result [[Multi-threading#SetThreadAffinityMask|SetThreadAffinityMask]](Handle thread, u8* affinitymask, s32 processorcount)
| Replaced with a stub in ARM11 NATIVE_FIRM kernel beginning with [[8.0.0-18]].
| Replaced with a stub in ARM11 NATIVE_FIRM kernel beginning with [[8.0.0-18]].
|-
|-
Line 111:
Line 111:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result GetThreadIdealProcessor(s32* processorid, Handle thread)
+
| Result [[Multi-threading#GetThreadIdealProcessor|GetThreadIdealProcessor]](s32* processorid, Handle thread)
|
|
|-
|-
Line 118:
Line 118:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result SetThreadIdealProcessor(Handle thread, s32 processorid)
+
| Result [[Multi-threading#SetThreadIdealProcessor|SetThreadIdealProcessor]](Handle thread, s32 processorid)
| Replaced with a stub in ARM11 NATIVE_FIRM kernel beginning with [[8.0.0-18]].
| Replaced with a stub in ARM11 NATIVE_FIRM kernel beginning with [[8.0.0-18]].
|-
|-
Line 139:
Line 139:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result CreateMutex(Handle* mutex, bool initialLocked)
+
| Result [[Multi-threading#CreateMutex|CreateMutex]](Handle* mutex, bool initialLocked)
|
|
|-
|-
Line 146:
Line 146:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result ReleaseMutex(Handle mutex)
+
| Result [[Multi-threading#ReleaseMutex|ReleaseMutex]](Handle mutex)
|
|
|-
|-
Line 153:
Line 153:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result CreateSemaphore(Handle* semaphore, s32 initialCount, s32 maxCount)
+
| Result [[Multi-threading#CreateSemaphore|CreateSemaphore]](Handle* semaphore, s32 initialCount, s32 maxCount)
|
|
|-
|-
Line 160:
Line 160:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result ReleaseSemaphore(s32* count, Handle semaphore, s32 releaseCount)
+
| Result [[Multi-threading#ReleaseSemaphore|ReleaseSemaphore]](s32* count, Handle semaphore, s32 releaseCount)
|
|
|-
|-
Line 167:
Line 167:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result CreateEvent(Handle* event, ResetType resettype)
+
| Result [[Multi-threading#CreateEvent|CreateEvent]](Handle* event, ResetType resettype)
|
|
|-
|-
Line 174:
Line 174:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result SignalEvent(Handle event)
+
| Result [[Multi-threading#SignalEvent|SignalEvent]](Handle event)
|
|
|-
|-
Line 181:
Line 181:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result ClearEvent(Handle event)
+
| Result [[Multi-threading#ClearEvent|ClearEvent]](Handle event)
|
|
|-
|-
Line 314:
Line 314:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result GetThreadInfo(s64* out, Handle thread, ThreadInfoType type)
+
| Result [[Multi-threading#GetThreadInfo|GetThreadInfo]](s64* out, Handle thread, ThreadInfoType type)
|
|
|-
|-
Line 374:
Line 374:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result OpenThread(Handle* thread, Handle process, u32 threadId)
+
| Result [[Multi-threading#OpenThread|OpenThread]](Handle* thread, Handle process, u32 threadId)
|
|
|-
|-
Line 388:
Line 388:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result GetProcessIdOfThread(u32* processId, Handle thread)
+
| Result [[Multi-threading#GetProcessIdOfThread|GetProcessIdOfThread]](u32* processId, Handle thread)
|
|
|-
|-
Line 395:
Line 395:
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
| style="background: green" | Yes
−
| Result GetThreadId(u32* threadId, Handle thread)
+
| Result [[Multi-threading#GetThreadId|GetThreadId]](u32* threadId, Handle thread)
|
|
|-
|-
Line 423:
Line 423:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| Result GetThreadContext(ThreadContext* context, Handle thread)
+
| Result [[Multi-threading#GetThreadContext|GetThreadContext]](ThreadContext* context, Handle thread)
| Stubbed
| Stubbed
|-
|-
Line 668:
Line 668:
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
| style="background: red" | No
−
| GetDebugThreadParam(long long *, int *, nn::Handle, unsigned int, nn::dmnt::DebugThreadParam)
+
| [[Multi-threading#GetDebugThreadParam|GetDebugThreadParam]](long long *, int *, nn::Handle, unsigned int, nn::dmnt::DebugThreadParam)
| Disabled on regular kernel.
| Disabled on regular kernel.
|- style="border-top: double"
|- style="border-top: double"
Line 782:
Line 782:
<pre>ROM:FFF04D98 LDR R0, =0xF8C007F4
<pre>ROM:FFF04D98 LDR R0, =0xF8C007F4
ROM:FFF04D9C BX LR</pre>
ROM:FFF04D9C BX LR</pre>
−
−
== CreateThread ==
−
R0=s32 threadpriority
−
R1=func entrypoint
−
R2=u32 arg
−
R3=u32 stacktop
−
R4=s32 processorid
−
−
Result result=R0
−
Handle* thread=R1
−
−
The processorid parameter specifies which processor the thread can run on. Non-negative values correspond to a specific CPU. (e.g. 0 for the Appcore and 1 for the Syscore on Old3DS) Special value -1 means all CPUs, and -2 means the default CPU for the process (Read from the [[NCCH/Extended Header|Exheader]], usually 0 for applications, 1 for system services). Games usually create threads using -2.
−
−
With the Old3DS kernel, the s32 processorid must be <=2.
−
−
With the New3DS kernel: processorid must be <= <total cores(MPCore "SCU Configuration Register" CPU number value + 1)>. When processorid==0x2 and the process is not an APPLICATION mem-region process, exheader kernel-flags bitmask 0x2000 must be set otherwise error 0xD9001BEA is returned. When processorid==0x3 and the process is not an APPLICATION mem-region process, error 0xD9001BEA is returned. These are the only restriction checks done by the kernel for processorid.
−
−
The thread priority value must be in the following range: 0x0..0x3F.
−
−
The stacktop must be aligned to 0x8-bytes, otherwise when not aligned to 0x8-bytes the ARM11 kernel clears the low 3-bits of the stacktop address.
−
= Types and structures =
= Types and structures =