Dynamic Areas



Abort-Trapping dynamic areas

It is possible, with Kernel 8.19 and later, to mark dynamic areas as being 'abortable'. This means that aborts within their extent (up to their maximum size) will be reported through the Dynamic Area handler. The dynamic area handler may choose to handle the access or to return a failure. A returned failure will result in the access failing in a Data Abort, as normal.

The dynamic area handler will be called with the following parameters :

On entry
   R0 = DAHandler_Abort (5)
   R1 = flags:
          bits 0-3 = operation type :
                     0 = Load from memory
                     1 = Store to memory
          bit 4 = set if this is a privileged operation, clear if this
                  is an unprivileged operation
   R2 = pointer to data block for transfer
   R3 = pointer to start of accessed area within dynamic area
   R4 = size of access
   R5 = current end of allocated space within dynamic area (for sparse
        dynamic areas this has no meaning)
On exit
   R4 = amount of data processed
   VS if failed, R0 pointing to an error block

This handler reason is called when an abort occurs within a Dynamic Area region which is marked as aborting. The accessed region of the dynamic area is passed in R3, together with the amount of data which is being accessed. The size of the data access will be either 1, 2, 4 or a multiple of 4 for byte, half-word (not presently implemented), word, or multi-word accesses. In the case of word and multi-word accesses, clients need not concern themselves with alignment issues - the address supplied will always be aligned.

For load operations, clients should fill in the block supplied in R2 with the data at the location supplied in R3.

For store operations, clients should fill in the location supplied in R3 with the data at the block supplied in R2.

Unrecognised operations or flags should be returned with errors.

If the error block contains an error number for a hardware error (i.e. bit 31), it will be returned through the error generation mechanism rather than through the abort handler. In other words, it is similar to the instruction which faulted having been an error returning SWI. The exception registers and abort stack copies will still take place in this case. However, if the error is not claimed by ErrorV or the environment handler an explicit OS_Exit will be issued.

To create an Abortable dynamic area bit 16 on the Dynamic Area flags should be set.

A typical use of the Abortable dynamic areas would be to implement a virtual memory system (for the data within the dynamic area). Such a system would map in the page(s) containing the data requested and fill in the data blocks before returning.

Alternatively, such areas can be used to emulate hardware interfaces either where such interfaces are not present in physical hardware, or during development where hardware is not yet available.

Under current versions of the operating system prefetch aborts will not be handled by the Abort-trapping system. Code run from such dynamic areas will not be treated any differently than non-Abort trapping areas. Execution of code from such areas will cause pre-fetch aborts which cannot be fixed up by the dynamic area handler.

This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holders permission. RISC OS is subject to continuous development and improvement as such all information is reproduced by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version 1.03 3rd November 2015