Homebrew ABI: Difference between revisions
No edit summary |
|||
Line 35: | Line 35: | ||
enum LoaderConfigFlags { | enum LoaderConfigFlags { | ||
IsMandatory = BIT(0), | |||
}; | }; | ||
=== Loader Config Keys === | === Loader Config Keys === | ||
A loader key can be marked as | A loader key can be marked as mandatory or not in its <code>Flags</code> field. | ||
If a key is marked as | If a key is marked as mandatory it means that the application cannot safely ignore it. | ||
If a key that is | Thus if said key is not recognized by the application, it should exit with <code>result_code=346 | ((100 + key) << 9);</code>, as the default behaviour may be unsafe. | ||
If a key that is required is not found (for example with an outdated loader), use <code>result_code=346 | ((200 + key) << 9);</code>. | |||
If there is some error encountered while validating an entry's values, use <code>result_code = 346 | ((300 + key) << 9);</code>. | If there is some error encountered while validating an entry's values, use <code>result_code = 346 | ((300 + key) << 9);</code>. | ||
* 0: [[#EndOfList]] | * 0: [[#EndOfList]]: Must be present | ||
* 1: [[#MainThreadHandle]] | * 1: [[#MainThreadHandle]]: Must be present | ||
* 2: [[#NextLoadPath]] | * 2: [[#NextLoadPath]] | ||
* 3: [[#OverrideHeap]] | * 3: [[#OverrideHeap]]: If present, must not be ignored | ||
* 4: [[#OverrideService]] | * 4: [[#OverrideService]] | ||
Line 62: | Line 63: | ||
* 6: [[#SyscallAvailableHint]] | * 6: [[#SyscallAvailableHint]] | ||
* 7: [[#AppletType]] | * 7: [[#AppletType]]: Must be present | ||
* 8: [[#AppletWorkaround]] | * 8: [[#AppletWorkaround]]: If present, must not be ignored | ||
* 9: [[#StdioSockets]] | * 9: [[#StdioSockets]] | ||
Line 74: | Line 75: | ||
* '''Key:''' 0 | * '''Key:''' 0 | ||
* '''Value[0]:''' Ignored. | * '''Value[0]:''' Ignored. | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 83: | Line 82: | ||
* '''Key:''' 1 | * '''Key:''' 1 | ||
* '''Value[0]:''' Handle to the main thread. | * '''Value[0]:''' Handle to the main thread. | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 93: | Line 90: | ||
* '''Key:''' 2 | * '''Key:''' 2 | ||
* '''Value[0]:''' Pointer to buffer of size 300 of next NRO to load. Should start with "sdmc:/". | * '''Value[0]:''' Pointer to buffer of size 300 of next NRO to load. Should start with "sdmc:/". | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 102: | Line 97: | ||
* '''Key:''' 3 | * '''Key:''' 3 | ||
* '''Value[0]:''' Base address of heap. Must be MemoryType 4, 5, or 9 with all reference counts being zero. | * '''Value[0]:''' Base address of heap. Must be MemoryType 4, 5, or 9 with all reference counts being zero. | ||
* '''Value[1]:''' Size of heap. | * '''Value[1]:''' Size of heap. | ||
Line 120: | Line 113: | ||
* '''Key:''' 4 | * '''Key:''' 4 | ||
* '''Value[0]:''' Name of service, same format as for sm. | * '''Value[0]:''' Name of service, same format as for sm. | ||
* '''Value[1]:''' Service handle. | * '''Value[1]:''' Service handle. | ||
Line 130: | Line 121: | ||
* '''Key:''' 5 | * '''Key:''' 5 | ||
* '''Value[0]:''' Argc. | * '''Value[0]:''' Argc. | ||
* '''Value[1]:''' Argv string pointer. | * '''Value[1]:''' Argv string pointer. | ||
* '''DefaultBehavior:''' Setting (argc == 1, argv[0] == " | * '''DefaultBehavior:''' Setting (argc == 1, argv[0] == "", argv[1] == NULL), or argv parsed in NSO0 fashion. | ||
==== SyscallAvailableHint ==== | ==== SyscallAvailableHint ==== | ||
Line 142: | Line 131: | ||
* '''Key:''' 6 | * '''Key:''' 6 | ||
* '''Value[0]:''' 64-bit mask for the 0-0x3F SVC range. n:th bit set means SVC is accessible. | * '''Value[0]:''' 64-bit mask for the 0-0x3F SVC range. n:th bit set means SVC is accessible. | ||
* '''Value[1]:''' 64-bit mask for the 0x40-0x7F SVC range. | * '''Value[1]:''' 64-bit mask for the 0x40-0x7F SVC range. | ||
Line 152: | Line 139: | ||
* '''Key:''' 7 | * '''Key:''' 7 | ||
* '''Value[0]:''' AppletType | * '''Value[0]:''' AppletType | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 169: | Line 154: | ||
* '''Key:''' 8 | * '''Key:''' 8 | ||
* '''Value[0]:''' AppletResourceUserId | * '''Value[0]:''' AppletResourceUserId | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 178: | Line 161: | ||
* '''Key:''' 9 | * '''Key:''' 9 | ||
* '''Value[0]:''' First word: stdout file descriptor, second word: stdin file descriptor | * '''Value[0]:''' First word: stdout file descriptor, second word: stdin file descriptor | ||
* '''Value[1]:''' Third word: stderr file descriptor, fourth word: SocketService | * '''Value[1]:''' Third word: stderr file descriptor, fourth word: SocketService | ||
Line 192: | Line 173: | ||
* '''Key:''' 10 | * '''Key:''' 10 | ||
* '''Value[0]:''' Process handle. | * '''Value[0]:''' Process handle. | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. |