Homebrew ABI: Difference between revisions

m Entrypoint Arguments: reorder NRO0 args to put x0 first and then x1 instead of x1 before x0
No edit summary
Line 50: Line 50:
* 1: [[#MainThreadHandle]] [RECOGNITION-MANDATORY] [PRESENCE-MANDATORY in some cases]
* 1: [[#MainThreadHandle]] [RECOGNITION-MANDATORY] [PRESENCE-MANDATORY in some cases]


* 2: [[#LoaderReturnAddr]] [RECOGNITION-MANDATORY]
* 2: [[#NextLoadPath]]


* 3: [[#OverrideHeap]] [RECOGNITION-MANDATORY]
* 3: [[#OverrideHeap]] [RECOGNITION-MANDATORY]
Line 87: Line 87:
* '''DefaultBehavior:''' Use main thread handle from entry function arguments.
* '''DefaultBehavior:''' Use main thread handle from entry function arguments.


==== LoaderReturnAddr ====
==== NextLoadPath ====
When the homebrew has finished executing, it shall jump to this address to return to the homebrew menu.
Homebrew menu uses this pointer to write the path of next NRO to load, before returning back to Homebrew loader.


* '''Key:''' 2
* '''Key:''' 2
* '''IsRecognitionMandatory:''' True, because the default behaviour may be unsafe if this key is not handled correctly.
* '''IsRecognitionMandatory:''' False.
* '''IsPresenceMandatory:''' False.
* '''IsPresenceMandatory:''' False.
* '''Value[0]:''' Function pointer with type <code>void __noreturn (*)(int result_code);</code>
* '''Value[0]:''' Pointer to buffer of size 300 of next NRO to load. Should start with "sdmc:/".
* '''Value[1]:''' Ignored.
* '''Value[1]:''' Ignored.
* '''DefaultBehavior:''' Returns back to where LR was when the program entered, or exits process using svcExitProcess if LR was NULL.
* '''DefaultBehavior:''' Returns back to where LR was when the program entered, or exits process using svcExitProcess if LR was NULL.