Showing changes from revision #2 to #3:
Added | Removed | Changed
Entry | |
---|---|
R12 | Workspace pointer |
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, 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 return into user mode. 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.