SVC: Difference between revisions

No edit summary
No edit summary
Line 660: Line 660:
|}
|}


=Exception Handling=
= Exception handling =
There appears to be userland code for handling exceptions, however this doesn't seem to be executed on retail.
There is userland code for handling exceptions, however this doesn't seem to be executed on retail mode.


On usermode exception, it jumps to main code binary entrypoint (main_binary_address+0) with X0=exception_info_ptr and X1=exception_info2_ptr.
When a usermode exception occurs, it jumps to the main code binary entrypoint (main_binary_address + 0 == '''_start''').
On boot, X0 is set to 0 triggering normal crt0 setup.
 
During normal boot '''_start''' is invoked with X0=0 and X1=main_thread_handle (triggering normal crt0 setup).
During an usermode exception '''_start''' is invoked with X0=exception_info0_ptr and X1=exception_info1_ptr instead.
 
The '''_start''' method determines whether to boot normally or handle an exception if X0 is set to 0 or not.