Homebrew ABI: Difference between revisions

No edit summary
Added SyscallAvailableHint2
 
(2 intermediate revisions by the same user not shown)
Line 80: Line 80:


* 14: [[#RandomSeed]]
* 14: [[#RandomSeed]]
* 15: [[#UserIdStorage]]
* 16: [[#HosVersion]]
* 17: [[#SyscallAvailableHint2]]


==== EndOfList ====
==== EndOfList ====
EndOfList is the final entry in the LoaderConfig.
EndOfList is the final entry in the LoaderConfig. It also provides optional human readable information about the Homebrew loader.


* '''Key:''' 0
* '''Key:''' 0
* '''Value[0]:''' Ignored.
* '''Value[0]:''' Pointer to loader information string, or zero if not present.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Size in bytes of the information string, or zero if not present.


==== MainThreadHandle ====
==== MainThreadHandle ====
Line 93: Line 99:
* '''Key:''' 1
* '''Key:''' 1
* '''Value[0]:''' Handle to the main thread.
* '''Value[0]:''' Handle to the main thread.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.
* '''DefaultBehavior:''' Use main thread handle from entry function arguments.
* '''DefaultBehavior:''' Use main thread handle from entry function arguments.


Line 112: Line 118:


==== OverrideService ====
==== OverrideService ====
The NRO loader should be able to steal handles from more priliveged processes. In this case, the homebrew should use this handle instead of the normal one.
The NRO loader should be able to steal handles from more priliveged processes. In this case, homebrew should use this handle instead of the normal one.


Homebrew should allow up to 32 service overrides.
Homebrew should allow at least 32 service overrides.


Note: Overridden service handles should not be converted to domains or closed. If they are domain, they should be converted to sessions before passed to the homebrew application.
Note: Overridden service handles should not be converted to domains or closed. If they are domain, they should be converted to sessions before passed to the homebrew application.
Line 131: Line 137:


* '''Key:''' 5
* '''Key:''' 5
* '''Value[0]:''' Ignored.
* '''Value[0]:''' Reserved/should be zero.
* '''Value[1]:''' Argv string pointer.
* '''Value[1]:''' Argv string pointer.
* '''DefaultBehavior:''' Setting (argc == 1, argv[0] == "", argv[1] == NULL), or argv parsed in NSO0 fashion.
* '''DefaultBehavior:''' Setting (argc == 1, argv[0] == "", argv[1] == NULL), or argv parsed in NSO0 fashion.
Line 171: Line 177:
* '''Key:''' 8
* '''Key:''' 8
* '''Value[0]:''' AppletResourceUserId
* '''Value[0]:''' AppletResourceUserId
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.


==== Reserved9 ====
==== Reserved9 ====
This was originally stdiosockets which couldn't work long term in clean environments the way this was designed. Now reserved for future use.
This key has been deleted/reserved for future use.


==== ProcessHandle ====
==== ProcessHandle ====
Line 181: Line 187:
* '''Key:''' 10
* '''Key:''' 10
* '''Value[0]:''' Process handle.
* '''Value[0]:''' Process handle.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.


==== LastLoadResult ====
==== LastLoadResult ====
Line 188: Line 194:
* '''Key:''' 11
* '''Key:''' 11
* '''Value[0]:''' Result.
* '''Value[0]:''' Result.
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Reserved/should be zero.


==== AllocPages ====
==== AllocPages ====
Line 224: Line 230:
* '''Value[0]:''' Random data.
* '''Value[0]:''' Random data.
* '''Value[1]:''' More random data.
* '''Value[1]:''' More random data.
==== UserIdStorage ====
This key is used to provide persistent storage space for the preselected user id when launching homebrew under an application that has an account selection screen.
* '''Key''': 15
* '''Value[0]:''' Pointer to a buffer containing enough space (16 bytes) to store a user id.
* '''Value[1]:''' Reserved/should be zero.
==== HosVersion ====
This key provides information about the currently running version of Horizon OS. This is used in order to determine the compatible ABI/API (both kernel and userland) available to homebrew applications.
* '''Key''': 16
* '''Value[0]:''' HOS version, formatted using libnx's [https://github.com/switchbrew/libnx/blob/master/nx/include/switch/runtime/hosversion.h#L11 MAKEHOSVERSION macro].
* '''Value[1]:''' Magic value indicating the current implementation of Horizon OS.
==== SyscallAvailableHint2 ====
Supplement to [[#SyscallAvailableHint]] for the extended SVC range.
* '''Key:''' 17
* '''Value[0]:''' 64-bit mask for the 0x80-0xBF SVC range. n:th bit set means SVC is accessible.
* '''Value[1]:''' Reserved/should be zero.
* '''DefaultBehavior:''' See [[#SyscallAvailableHint]].
{| class="wikitable" border="1"
! Value
! Description
|-
| 0
| Unspecified implementation/official stock firmware by Nintendo.
|-
| 0x41544d4f53504852 (ATMOSPHR)
| [https://github.com/Atmosphere-NX/Atmosphere Atmosphère-NX customized firmware].
|}