Homebrew ABI: Difference between revisions
Misson20000 (talk | contribs) split "mandatory" field into "recognition-mandatory" and "presence-mandatory" |
|||
Line 33: | Line 33: | ||
enum LoaderConfigFlags { | enum LoaderConfigFlags { | ||
IsRecognitionMandatory = BIT(0), | |||
}; | }; | ||
=== Loader Config Keys === | === Loader Config Keys === | ||
A loader key can be mandatory or not mandatory. | A loader key can be marked as recognition-mandatory or not recognition-mandatory in its <code>Flags</code> field. | ||
The presence-mandatory field is part of the specification and does not go in the <code>Flags</code> field, but any complying loader must pass all fields specified to be presence-mandatory. | |||
If | If a key is marked as recognition-mandatory and is not recognized by the application, the program should jump to [[#LoaderReturnAddr]] with <code>result_code=346 | ((100 + key) << 9);</code>, as the default behaviour may be unsafe. | ||
If a key that is mandatory is not found (for example with an outdated loader), use <code>result_code=346 | ((200 + key) << 9);</code>. | If a key that is presence-mandatory is not found (for example with an outdated loader), use <code>result_code=346 | ((200 + key) << 9);</code>. | ||
* 0: [[#EndOfList]] [MANDATORY] | * 0: [[#EndOfList]] [RECOGNITION-MANDATORY] [PRESENCE-MANDATORY] | ||
* 1: [[#MainThreadHandle]] [MANDATORY] | * 1: [[#MainThreadHandle]] [RECOGNITION-MANDATORY] [PRESENCE-MANDATORY in some cases] | ||
* 2: [[#LoaderReturnAddr]] [MANDATORY] | * 2: [[#LoaderReturnAddr]] [RECOGNITION-MANDATORY] | ||
* 3: [[#OverrideHeap]] | * 3: [[#OverrideHeap]] [RECOGNITION-MANDATORY] | ||
* 4: [[#OverrideService]] | * 4: [[#OverrideService]] | ||
Line 57: | Line 58: | ||
* 6: [[#SyscallAvailableHint]] | * 6: [[#SyscallAvailableHint]] | ||
* 7: [[#AppletType]] [MANDATORY] | * 7: [[#AppletType]] [PRESENCE-MANDATORY in some cases] | ||
* 8: [[#AppletWorkaround]] | * 8: [[#AppletWorkaround]] [RECOGNITION-MANDATORY] | ||
==== EndOfList ==== | ==== EndOfList ==== | ||
Line 65: | Line 66: | ||
* '''Key:''' 0 | * '''Key:''' 0 | ||
* ''' | * '''IsRecognitionMandatory:''' True, because not recognizing this tag would send the loader off the end of the list. | ||
* '''IsPresenceMandatory:''' True, because the list must be terminated. | |||
* '''Value[0]:''' Ignored. | * '''Value[0]:''' Ignored. | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 73: | Line 75: | ||
* '''Key:''' 1 | * '''Key:''' 1 | ||
* ''' | * '''IsRecognitionMandatory:''' True. | ||
* '''IsPresenceMandatory:''' True if entry function was called with INVALID_HANDLE. | |||
* '''Value[0]:''' Handle to the main thread. | * '''Value[0]:''' Handle to the main thread. | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
* '''DefaultBehavior:''' Use main thread handle from entry function arguments. | |||
==== LoaderReturnAddr ==== | ==== LoaderReturnAddr ==== | ||
Line 81: | Line 85: | ||
* '''Key:''' 2 | * '''Key:''' 2 | ||
* ''' | * '''IsRecognitionMandatory:''' True, because the default behaviour may be unsafe if this key is not handled correctly. | ||
* '''IsPresenceMandatory:''' False. | |||
* '''Value[0]:''' Function pointer with type <code>void __noreturn (*)(int result_code);</code> | * '''Value[0]:''' Function pointer with type <code>void __noreturn (*)(int result_code);</code> | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 90: | Line 95: | ||
* '''Key:''' 3 | * '''Key:''' 3 | ||
* ''' | * '''IsRecognitionMandatory:''' True, because the default behaviour may be unsafe if this key is not handled correctly. | ||
* '''IsPresenceMandatory:''' False. | |||
* '''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 105: | Line 111: | ||
* '''Key:''' 4 | * '''Key:''' 4 | ||
* ''' | * '''IsRecognitionMandatory:''' False. | ||
* '''IsPresenceMandatory:''' False. | |||
* '''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 114: | Line 121: | ||
* '''Key:''' 5 | * '''Key:''' 5 | ||
* ''' | * '''IsRecognitionMandatory:''' False. | ||
* '''IsPresenceMandatory:''' False. | |||
* '''Value[0]:''' Argc. | * '''Value[0]:''' Argc. | ||
* '''Value[1]:''' Argv string pointer. | * '''Value[1]:''' Argv string pointer. | ||
Line 125: | Line 133: | ||
* '''Key:''' 6 | * '''Key:''' 6 | ||
* '''IsRecognitionMandatory:''' False. | |||
* '''IsPresenceMandatory:''' False. | |||
* '''IsMandatory:''' False | * '''IsMandatory:''' False | ||
* '''Value[0]:''' Each byte is a rare syscall number that the process has access to. <code>0xFF</code> means byte should be ignored. | * '''Value[0]:''' Each byte is a rare syscall number that the process has access to. <code>0xFF</code> means byte should be ignored. | ||
Line 134: | Line 144: | ||
* '''Key:''' 7 | * '''Key:''' 7 | ||
* ''' | * '''IsRecognitionMandatory:''' False. | ||
* '''IsPresenceMandatory:''' Application-defined. Depends on whether the application is using any applet services or not. | |||
* '''Value[0]:''' AppletType | * '''Value[0]:''' AppletType | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. | ||
Line 150: | Line 161: | ||
* '''Key:''' 8 | * '''Key:''' 8 | ||
* ''' | * '''IsRecognitionMandatory:''' True, because the default behaviour (using applet services) is unsafe if this tag is passed. | ||
* '''IsPresenceMandatory:''' False. | |||
* '''Value[0]:''' AppletResourceUserId | * '''Value[0]:''' AppletResourceUserId | ||
* '''Value[1]:''' Ignored. | * '''Value[1]:''' Ignored. |