Changes

668 bytes added ,  23:39, 5 January 2018
no edit summary
Line 32: Line 32:  
* 1: [[#MainThreadHandle]] [MANDATORY]
 
* 1: [[#MainThreadHandle]] [MANDATORY]
   −
* 2: [[#OverrideHeap]]
+
* 2: [[#LoaderReturnAddr]] [MANDATORY]
   −
* 3: [[#OverrideService]]
+
* 3: [[#OverrideHeap]]
 +
 
 +
* 4: [[#OverrideService]]
 +
 
 +
* 5: [[#Argv]]
    
==== EndOfList ====
 
==== EndOfList ====
Line 51: Line 55:  
* '''Value[0]:''' Handle to the main thread.
 
* '''Value[0]:''' Handle to the main thread.
 
* '''Value[1]:''' Ignored.
 
* '''Value[1]:''' Ignored.
 +
 +
==== LoaderReturnAddr ====
 +
When the homebrew has finished executing, it shall jump to this address to return to the homebrew menu.
 +
 +
* '''Key:''' 1
 +
* '''IsMandatory:''' True
 +
* '''Value[0]:''' Function pointer with type <code>void __noreturn (*)(int result_code);</code>
 +
* '''Value[1]:''' Ignored.
 +
* '''DefaultBehavior:''' Exits process using svcExitProcess.
    
==== OverrideHeap ====
 
==== OverrideHeap ====
 
If the NRO loader has reserved some space in the heap for itself, the application must not manipulate the heap.
 
If the NRO loader has reserved some space in the heap for itself, the application must not manipulate the heap.
   −
* '''Key:''' 2
+
* '''Key:''' 3
 
* '''IsMandatory:''' False
 
* '''IsMandatory:''' 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.
Line 66: Line 79:  
Note: For services that authenticate with pid, the app should not attempt re-authentication with an overridden handle.
 
Note: For services that authenticate with pid, the app should not attempt re-authentication with an overridden handle.
   −
* '''Key:''' 3
+
* '''Key:''' 4
 
* '''IsMandatory:''' False
 
* '''IsMandatory:''' 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.
 
* '''DefaultBehavior:''' Fetches service from "sm:" named port.
 
* '''DefaultBehavior:''' Fetches service from "sm:" named port.
 +
 +
==== Argv ====
 +
The NRO loader should be able to send argv.
 +
 +
* '''Key:''' 5
 +
* '''IsMandatory:''' False
 +
* '''Value[0]:''' Argc.
 +
* '''Value[1]:''' Argv pointer.
 +
* '''DefaultBehavior:''' Setting (argc == 0, argv[0] == NULL), or argv parsed in NSO0 fashion.