SVC: Difference between revisions
Emufan4568 (talk | contribs) m Correct svc name from switchbrew |
|||
(14 intermediate revisions by 4 users not shown) | |||
Line 510: | Line 510: | ||
| style="background: red" | No | | style="background: red" | No | ||
| style="background: red" | No | | style="background: red" | No | ||
| Result [[IPC|ReplyAndReceive]](s32* index, Handle* handles, s32 handleCount, Handle replyTarget) | | Result [[IPC#svcReplyAndReceive|ReplyAndReceive]](s32* index, Handle* handles, s32 handleCount, Handle replyTarget) | ||
| | | | ||
|- | |- | ||
Line 586: | Line 586: | ||
| style="background: red" | No? | | style="background: red" | No? | ||
| style="background: red" | No | | style="background: red" | No | ||
| | | SetWifiEnabled(s0 input_flag). Implemented with [[11.4.0-37|11.4.0-X]], see below. | ||
|- style="border-top: double" | |- style="border-top: double" | ||
| 0x60 | | 0x60 | ||
Line 753: | Line 753: | ||
| style="background: red" | No | | style="background: red" | No | ||
| style="background: red" | No | | style="background: red" | No | ||
| Result | | Result SetResourceLimitLimitValues(Handle res_limit, LimitableResource* resource_type_list, s64* resource_list, u32 count) | ||
| | | | ||
|- | |- | ||
Line 872: | Line 872: | ||
|- | |- | ||
| u32 | | u32 | ||
| Flags. Bit0 means that svcContinueDebugEvent needs to be called for this event | | Flags. Bit0 means that svcContinueDebugEvent needs to be called for this event | ||
|- | |- | ||
| u8[4] | | u8[4] | ||
Line 894: | Line 894: | ||
| 2 | | 2 | ||
|- | |- | ||
| EXIT PROCESS | | EXIT PROCESS (1) | ||
| 3 | | 3 | ||
|- | |- | ||
Line 900: | Line 900: | ||
| 4 | | 4 | ||
|- | |- | ||
| DLL LOAD | | DLL LOAD (3) | ||
| 5 | | 5 | ||
|- | |- | ||
| DLL UNLOAD | | DLL UNLOAD (3) | ||
| 6 | | 6 | ||
|- | |- | ||
| SCHEDULE IN | | SCHEDULE IN (1) (2) | ||
| 7 | | 7 | ||
|- | |- | ||
| SCHEDULE OUT | | SCHEDULE OUT (1) (2) | ||
| 8 | | 8 | ||
|- | |- | ||
| SYSCALL IN | | SYSCALL IN (1) (2) | ||
| 9 | | 9 | ||
|- | |- | ||
| SYSCALL OUT | | SYSCALL OUT (1) (2) | ||
| 10 | | 10 | ||
|- | |- | ||
Line 921: | Line 921: | ||
| 11 | | 11 | ||
|- | |- | ||
| MAP | | MAP (1) (2) | ||
| 12 | | 12 | ||
|} | |} | ||
<nowiki> | <nowiki>(1)</nowiki> Non-blocking: all other events preempt and block all the threads of their process until they are continued. | ||
<nowiki>(2)</nowiki> There is handling code in the kernel but nothing signal those events. | |||
<nowiki> | <nowiki>(3)</nowiki> Completely removed from the kernel, but referenced in DMNT. Stubbed relocation code (e.g., in Process9 and in PXI sysmodule) and even whole libraries (e.g., in PXI sysmodule's .rodata section) seem to indicate that Nintendo used dynamic libraries early in system development. | ||
When calling svcDebugActiveProcess, an ATTACH PROCESS debug event is signaled, then ATTACH THREAD for each of its opened threads, then finally ATTACH BREAK. | When calling svcDebugActiveProcess, an ATTACH PROCESS debug event is signaled, then ATTACH THREAD for each of its opened threads, then finally ATTACH BREAK. | ||
Line 1,001: | Line 1,003: | ||
| 1 | | 1 | ||
|- | |- | ||
| | | DEBUG TERMINATE | ||
| 2 | | 2 | ||
|} | |} | ||
Line 1,309: | Line 1,311: | ||
| Yes | | Yes | ||
| Yes | | Yes | ||
| | | Power state change. Takes one u32 parameter. | ||
0: shutdown/reboot. hangs the Arm11. Used by kernelpanic and PTM. This makes all cores enter a WFI/B infinite loop. | |||
|- | |- | ||
| 6 | | 6 | ||
Line 1,319: | Line 1,319: | ||
| No | | No | ||
| Arguments: <code>u32 what, u64 val</code> | | Arguments: <code>u32 what, u64 val</code> | ||
UNITINFO needs to be non-zero. | UNITINFO needs to be non-zero for <code>what</code> 1 and 2. | ||
If <code>what</code> is 0 or any invalid value, nothing is done. | If <code>what</code> is 0 or any invalid value, nothing is done. | ||
If it is 1, <code>val != 0</code> is written to the global variable enabling ERR:F-format register dumps on user-mode CPU/VFP exceptions (the VFP exception handler acts as if this variable was always true and works on retail environments). The user handler, stack pointer to use for exception handling, and pointer to use for the exception info structure are contiguously located in either the thread's TLS, or if the handler is NULL, in the main thread's TLS, at offset 0x40. If the specified stack pointer is 1, sp_usr - 0x5c is used instead; if the specified exception info buffer is 1, sp_usr - 0x5c is used instead, and if it is 0, <specified stack> - 0x5c is used (0x5c is the size of the exception info structure that is being pushed). Configured by NS on startup on dev-units (default being 0 on non-debugger/jtag units). | If it is 1, <code>val != 0</code> is written to the global variable enabling ERR:F-format register dumps on user-mode CPU/VFP exceptions (the VFP exception handler acts as if this variable was always true and works on retail environments). The user handler, stack pointer to use for exception handling, and pointer to use for the exception info structure are contiguously located in either the thread's TLS, or if the handler is NULL, in the main thread's TLS, at offset 0x40. If the specified stack pointer is 1, sp_usr - 0x5c is used instead; if the specified exception info buffer is 1, sp_usr - 0x5c is used instead, and if it is 0, <specified stack> - 0x5c is used (0x5c is the size of the exception info structure that is being pushed). Configured by NS on startup on dev-units (default being 0 on non-debugger/jtag units) using the 0x000F0000 configuration block in the [[Config_Savegame|config savegame]]. | ||
If 2, kernelpanic will be called when svcBreak is used by a non-attached process. Configured by NS on startup on dev-units (default being 0 on non-debugger/jtag units). | If 2, kernelpanic will be called when svcBreak is used by a non-attached process. Configured by NS on startup on dev-units (default being 0 on non-debugger/jtag units) using the 0x000F0000 configuration block in the [[Config_Savegame|config savegame]]. | ||
If 3, this changes the scheduling/preemption mode (when no threads are being preempted, otherwise returns error 0xC8A01414), see [[KResourceLimit]] for more details. | If 3, this changes the scheduling/preemption mode (when no threads are being preempted, otherwise returns error 0xC8A01414), see [[KResourceLimit]] for more details. | ||
Line 1,338: | Line 1,338: | ||
| Yes | | Yes | ||
| No | | No | ||
| | | Hangs the Arm9, using a code path similar to the one used on firmlaunch. Used by PTM on shutdown/reboot. | ||
|- | |- | ||
| 9 | | 9 | ||
Line 1,407: | Line 1,407: | ||
| 0 | | 0 | ||
| | | | ||
| Returns the amount of | | Returns the amount of private (code, data, regular heap) and shared memory used by the process + total supervisor-mode stack size + page-rounded size of the external handle table. This is the amount of physical memory the process is using, minus TLS, main thread stack and linear memory. | ||
|- | |- | ||
| 1 | | 1 | ||
| | | | ||
| Returns the amount of < | | Returns the amount of <related unused field> + total supervisor-mode stack size + page-rounded size of the external handle table | ||
|- | |- | ||
| 2 | | 2 | ||
| | | | ||
| Returns the amount of | | Returns the amount of private (code, data, heap) memory used by the process + total supervisor-mode stack size + page-rounded size of the external handle table | ||
|- | |- | ||
| 3 | | 3 | ||
| | | | ||
| Returns the amount of < | | Returns the amount of <related unused field> + total supervisor-mode stack size + page-rounded size of the external handle table | ||
|- | |- | ||
| 4 | | 4 | ||
| | | | ||
| Returns the amount handles in use by the process. | | Returns the amount of handles in use by the process. | ||
|- | |- | ||
| 5 | | 5 | ||
Line 1,435: | Line 1,435: | ||
| 7 | | 7 | ||
| | | | ||
| Returns | | Returns the number of threads of the process | ||
|- | |- | ||
| 8 | | 8 | ||
Line 1,447: | Line 1,447: | ||
| 19 | | 19 | ||
| Stub: [[8.0.0-18]]. Implementation: [[11.3.0-36|11.3.0-X]]. | | Stub: [[8.0.0-18]]. Implementation: [[11.3.0-36|11.3.0-X]]. | ||
| Originally this only returned 0xD8E007ED. Now with v11.3 this returns the memregion for the process: out low u32 = [[KProcess]] "Kernel flags from the exheader kernel descriptors" & 0xF00. High out u32 = 0. | | Originally this only returned 0xD8E007ED. Now with v11.3 this returns the memregion for the process: out low u32 = [[KProcess]] "Kernel flags from the exheader kernel descriptors" & 0xF00 (memory region flag). High out u32 = 0. | ||
|- | |- | ||
| 20 | | 20 | ||
Line 1,455: | Line 1,455: | ||
| 21 | | 21 | ||
| [[8.0.0-18]]. N3DS only. | | [[8.0.0-18]]. N3DS only. | ||
| Returns the | | Returns the VA -> PA conversion offset for the QTM static mem block reserved in the exheader (0x800000), otherwise 0 (+ error 0xE0E01BF4) if it doesn't exist | ||
|- | |- | ||
| 22 | | 22 | ||
| [[8.0.0-18]]. N3DS only. | | [[8.0.0-18]]. N3DS only. | ||
| Returns the | | Returns the base VA of the QTM static mem block reserved in the exheader, otherwise 0 (+ error 0xE0E01BF4) if it doesn't exist | ||
|- | |- | ||
| 23 | | 23 | ||
| [[8.0.0-18]]. N3DS only. | | [[8.0.0-18]]. N3DS only. | ||
| Returns the | | Returns the size of the QTM static mem block reserved in the exheader, otherwise 0 (+ error 0xE0E01BF4) if it doesn't exist | ||
|} | |} | ||
Line 1,476: | Line 1,476: | ||
|- | |- | ||
| 1 | | 1 | ||
| Get internal refcount for kernel object (not counting the one this SVC adds internally to operate), | | Get internal refcount for kernel object (not counting the one this SVC adds internally to operate), sign-extended to 64 bits. | ||
|- | |||
| 2 | |||
| Unimplemented, returns an uninitialized u64 variable (corresponding to r5-r6, which were not altered outside of userland). | |||
|- | |- | ||
| 0x32107 | | 0x32107 | ||
Line 1,531: | Line 1,534: | ||
* Old3DS: 0x103 | * Old3DS: 0x103 | ||
* New3DS: 0x550 | * New3DS: 0x550 | ||
= svc 0x5A = | |||
Like what NWM did previously, this one does the following: | |||
if (in_flag) | |||
CFG11_WIFICNT |= 1; | |||
else | |||
CFG11_WIFICNT &= ~1; | |||
= Kernel error-codes = | = Kernel error-codes = |