Introduction and Overview
This chapter documents the changes to the program environment for Pyromaniac.
Technical details
Largely, the program environment in Pyromaniac is as documented within the Program Environment Chapter. However, certain interfaces are slightly different to make extensions to the system simpler.
Handler 13: Exception register area
On 26bit systems, the exception register area is 16 words (64 bytes) long. This area stores the registers at the time of an exception (Prefetch abort, data abort, or address exception).
On 32bit systems, the exception register area is 17 words (68 bytes) long. This is the same layout as the 26bit system, but with the value of the CSPR in the final word.
Handler 32: Branch through 0 handler
Under RISC OS Classic, the handling of a branch through 0 (calling address 0) was performed within the Kernel as an implicit part of abort handling. For RISC OS Select 3, the handling of branch through zero moved to the undefined instruction handler. In either case, the only action possible was for an error to be raised.
Under RISC OS Pyromaniac, the Branch through 0 handler is called when code is executed at address 0. This handler stores registers in the abort area, just as the abort handler would. The default action for this handler is to raise the 'Branch through 0' error.
Handler 33: Command line area
Under RISC OS Classic, the command line buffers were fixed in memory. When an SWI OS_WriteEnv is issued the command line supplied is copied into the Kernel command line buffer. The length of this buffer was extended in RISC OS 4, but there was no defined mechanism to read the length of the buffer used by the system.
The buffer length in RISC OS 4 and later is 1024 bytes. Prior to RISC OS 4, the length was 256 bytes.
Under RISC OS Pyromaniac, the area that the Kernel will use to store the command line is a part of the program environment, and the size of the buffer is able to be read or changed. The handler buffer, supplied in R3, reports the command line buffer location. The size of the buffer is reported in R2.
The default buffer length under RISC OS Pyromaniac is 1024 bytes but is configurable through the system configuration.
SWI calls
R0 | = | 32 (reason code) |
R1 | = | Pointer to new branch through 0 handler, or 0 to read the current handler |
R2 | = | Ignored |
R3 | = | Ignored |
R0 | preserved | |
R1 | preserved | |
R2 | = | Previous command line buffer length |
R3 | = | Previous command line buffer address |
This SWI is used to read or update the address of the handler used when a call is made to address 0.
The handler will be entered in SVC mode. The registers will be preserved from the time of call. This means that the banked SVC registers will be in the state they were when the call was made, even when called in USR mode. The registers and CPSR at the time of the call will be stored in the Exception registers area.
R0 | = | 33 (reason code) |
R1 | = | Ignored |
R2 | = | Size of the command line buffer, or 0 to read the current command line size |
R3 | = | Pointer to the command line buffer, or 0 to read the current command line buffer |
R0 | preserved | |
R1 | preserved | |
R2 | = | Previous command line buffer length |
R3 | = | Previous command line buffer address |
This SWI is used to read or update the address and size of the area of memory used to store the command line buffer.