RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Error Handler

OS SWI Calls
» OS_ChangeEnvironment
» Error Handler

Error Handler

Entry
R0 Workspace pointer
Other registers: Undefined
User mode, IRQs+FIQs enabled

The error buffer (R3 from OS_ChangeEnvironment) will contain the following:

+0 PC at which the error occurred
+4 Error number
+8 Error message text

Use

This handler is called by the default claimant of ErrorV? when an error occurs. It should restore all handlers to their original values and then call the non-X form of OS_GenerateError to pass the error to the previous handler.

Notes

This handler is entered in USER mode with the workspace pointer in R0, as opposed to the conventional R12.

The block should be at least 260 bytes in size: 4 bytes for the erroring program counter plus 256 for a standard RISC OS error block. Note that the printed PRM is vague in specifying a “256 byte error buffer”, currently the kernel truncates any error message text to 252 bytes, totalling 4 + 4 + 252 = 260 in the worst case.

There is no guarantee that R13 will contain a valid stack pointer. Even if the foreground task was using R13 as a stack in the usual manner, there is no guarantee that the pointer is still valid – e.g. an RTSupport routine running in SYS mode, or a non-transient callback, may have been using R13 for some other purpose at the time the error was generated. Therefore if a stack is required, it’s recommended that you validate R13, or use a different stack private to the error handler.

It’s also possible that R1-R12 and R14 do not correspond to the values they had when the error was generated.

See also

  • OS_ChangeEnvironment
  • OS_GenerateError
  • ErrorV?
Revised on June 11, 2018 21:43:55 by Jeffrey Lee (213) (86.137.26.134)
Edit | Back in time (6 revisions) | See changes | History | Views: Print | Source | Linked from: System Control Handlers, Exit Handler, OS_ExitAndDie, OS_FSControl 2, OS_FSControl 19, Debugger Exception Dumps, OS_Exit

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys