Showing changes from revision #3 to #4:
Added | Removed | Changed
Entry | |
---|---|
R12 | Workspace pointer |
R13 | SVC/IRQ stack |
Other registers: Undefined | |
SVC or IRQ mode, IRQs disabled, FIQs undefined |
The CallBack handler is used for handling non-transient CallBacks. After calling OS_SetCallBack, the handler will be called the next time that RISC OS is threaded out (i.e. execution is returning to a user mode task with the supervisor stack empty).
The handler will be called in supervisor mode, or with R12 pointing to the handler workspace. The handler buffer (as specified toIRQ mode, with R12 pointing to the handler workspace. The handler buffer (as specified to OS_ChangeEnvironment / OS_CallBack) will have been filled with the ARM register dump. The buffer has the same size and format as the Exception Registers Block . The register dump reflects the context that would have been restored had the CallBack not been triggered. The typical method used to return from a CallBack handler is to restore the registers from that block, performing an exception “exception return return” into user mode. mode However using a the popular stored use PC/ of CallBack handlers is to implement threading schemes, where you may want to restore a register dump that corresponds to a different thread.PSR. However a popular use of CallBack handlers is to implement threading schemes, where you may want to restore a register dump that corresponds to a different thread.
On ARMv6 and above, non-transient CallBack handlers will typically need to reset the local exclusive monitor to the open state, as described in the ARMv7 compatibility primer. Failure to do this may result in foreground tasks which use the load/store exclusive instructions to malfunction.
There are two types of CallBack, Transient and Non-transient:
If both transient and non-transient callbacks are scheduled, the transient callbacks will be called first.
Prior to RISC OS 3.10, non-transient callbacks were called even if the supervisor stack was non-empty.