Difference between revisions of "Services"
WulfyStylez (talk | contribs) |
Steveice10 (talk | contribs) (Add links.) |
||
Line 1: | Line 1: | ||
− | Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from [[SVC]] | + | Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from [[SVC|svcConnectToPort]], service handles are retrieved through the port ''srv:'' ("service manager"). |
When a service is registered, [[SVC|svcCreatePort]] is used without a port-name. This means that the port is inaccessible via the port SVCs outside of sm-module. See below for getting a session handle for sending commands to services. | When a service is registered, [[SVC|svcCreatePort]] is used without a port-name. This means that the port is inaccessible via the port SVCs outside of sm-module. See below for getting a session handle for sending commands to services. | ||
Line 5: | Line 5: | ||
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services. This value is obtained from [[SVC|svcGetSystemInfo]]. | Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services. This value is obtained from [[SVC|svcGetSystemInfo]]. | ||
− | Attempting to use | + | Attempting to use [[SRV:GetServiceSession|GetServiceSession]] with a service that the process has access to when that service isn't registered, results in [[SVC|svcSendSyncRequest]] never returning(the exact cause is unknown). |
==Service Manager Port "srv:"== | ==Service Manager Port "srv:"== | ||
Line 14: | Line 14: | ||
|- | |- | ||
| 0x00010002 | | 0x00010002 | ||
− | | Initialize | + | | [[SRV:Initialize|Initialize]] |
|- | |- | ||
| 0x00020000 | | 0x00020000 | ||
− | | | + | | [[SRV:GetNotificationSemaphore|GetNotificationSemaphore]] |
|- | |- | ||
| 0x00030100 | | 0x00030100 | ||
− | | RegisterService | + | | [[SRV:RegisterService|RegisterService]] |
|- | |- | ||
| 0x000400C0 | | 0x000400C0 | ||
− | | UnregisterService | + | | [[SRV:UnregisterService|UnregisterService]] |
|- | |- | ||
| 0x00050100 | | 0x00050100 | ||
− | | | + | | [[SRV:GetServiceSession|GetServiceSession]] |
− | |||
− | |||
|- | |- | ||
| 0x000600C2 | | 0x000600C2 | ||
− | | RegisterPort | + | | [[SRV:RegisterPort|RegisterPort]] |
|- | |- | ||
| 0x000700C0 | | 0x000700C0 | ||
− | | UnregisterPort | + | | [[SRV:UnregisterPort|UnregisterPort]] |
|- | |- | ||
| 0x00080100 | | 0x00080100 | ||
− | | GetPort | + | | [[SRV:GetPort|GetPort]] |
− | |||
− | |||
|- | |- | ||
| 0x00090040 | | 0x00090040 | ||
− | | Subscribe | + | | [[SRV:Subscribe|Subscribe]] |
|- | |- | ||
| 0x000A0040 | | 0x000A0040 | ||
− | | Unsubscribe | + | | [[SRV:Unsubscribe|Unsubscribe]] |
|- | |- | ||
| 0x000B0000 | | 0x000B0000 | ||
− | | ReceiveNotification | + | | [[SRV:ReceiveNotification|ReceiveNotification]] |
|- | |- | ||
| 0x000C0080 | | 0x000C0080 | ||
− | | PublishToSubscriber | + | | [[SRV:PublishToSubscriber|PublishToSubscriber]] |
|- | |- | ||
| 0x000D0040 | | 0x000D0040 | ||
Line 57: | Line 53: | ||
|- | |- | ||
| 0x000E00C0 | | 0x000E00C0 | ||
− | | HasAccessToService | + | | [[SRV:HasAccessToService|HasAccessToService]] |
|} | |} | ||
Line 67: | Line 63: | ||
|- | |- | ||
| 0x04030082 | | 0x04030082 | ||
− | | RegisterProcess | + | | [[SRVPM:RegisterProcess|RegisterProcess]] |
|- | |- | ||
| 0x04040040 | | 0x04040040 | ||
− | | UnregisterProcess | + | | [[SRVPM:UnregisterProcess|UnregisterProcess]] |
|} | |} | ||
− | |||
− | |||
Prior to to [[7.0.0-13]], the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with [[7.0.0-13]], the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with [[7.0.0-13]], see [[3DS_exploits|here]]. Originally any process could use "srv:pm", however starting with [[7.0.0-13]] only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the [[Process_Manager_Services|Process Manager]]. | Prior to to [[7.0.0-13]], the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with [[7.0.0-13]], the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with [[7.0.0-13]], see [[3DS_exploits|here]]. Originally any process could use "srv:pm", however starting with [[7.0.0-13]] only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the [[Process_Manager_Services|Process Manager]]. |
Revision as of 01:11, 10 October 2015
Services are an abstraction of ports and are the commonly used way of inter-process communication outside of the kernel. While handles of regular ports are retrieved from svcConnectToPort, service handles are retrieved through the port srv: ("service manager").
When a service is registered, svcCreatePort is used without a port-name. This means that the port is inaccessible via the port SVCs outside of sm-module. See below for getting a session handle for sending commands to services.
Processes with PID less than or equal to the number of NATIVE_FIRM built-in modules (fs, sm, pm, pxi, ldr) have access to all services. This value is obtained from svcGetSystemInfo.
Attempting to use GetServiceSession with a service that the process has access to when that service isn't registered, results in svcSendSyncRequest never returning(the exact cause is unknown).
Service Manager Port "srv:"
Command Header | Description |
---|---|
0x00010002 | Initialize |
0x00020000 | GetNotificationSemaphore |
0x00030100 | RegisterService |
0x000400C0 | UnregisterService |
0x00050100 | GetServiceSession |
0x000600C2 | RegisterPort |
0x000700C0 | UnregisterPort |
0x00080100 | GetPort |
0x00090040 | Subscribe |
0x000A0040 | Unsubscribe |
0x000B0000 | ReceiveNotification |
0x000C0080 | PublishToSubscriber |
0x000D0040 | This can fire notificationIDs and return the number of fired notificationID |
0x000E00C0 | HasAccessToService |
Service Manager Process-Manager Port "srv:pm"
Command Header, prior to 7.0.0-13 | Description |
---|---|
0x04030082 | RegisterProcess |
0x04040040 | UnregisterProcess |
Prior to to 7.0.0-13, the commands listed for "srv:" were also accessible under this port with the same command-headers. Starting with 7.0.0-13, the "srv:pm" port was changed to a service. With this change, commandIDs for these commands were changed. "srv:pm" was originally vulnerable, this was fixed with 7.0.0-13, see here. Originally any process could use "srv:pm", however starting with 7.0.0-13 only the built-in NATIVE_FIRM sysmodules have access to it. The only system title which uses "srv:pm" is the Process Manager.
Notifications
ID | Description |
---|---|
0x100 | This indicates that all processes must terminate: power-off, reboot, or FIRM-launch. |
0x104 | This indicates that the system is entering sleep mode. (PTM:NotifySleepPreparationComplete needed for this and the following?) |
0x105 | This indicates that the system has exited sleep mode. |
0x108 | error at boot? |
0x202 | POWER button pressed |
0x204 | This indicates that the HOME button was pressed. |
0x205 | HOME button pressed |
0x207 | SD card inserted |
0x208 | Game cartridge inserted |
0x209 | SD card removed |
0x20A | Game cartridge removed |
0x20B | Game cartridge inserted or removed |