13.7. Angel C library support SWIs

Angel uses a SWI mechanism to enable user applications linked with an ARM C library to make semihosting requests. Semihosting requests are requests such as open a file on the host, that must be communicated to the host to be carried out.

Refer to The ANSI C library of the ARM Software Development Toolkit Reference Guide for more information on ARM C library support.

Angel uses a single SWI to request semihosting operations. By default, the Angel semihosting SWI is:

You can configure the Angel SWI to any SWI number if you are developing an operating system or application that uses these SWI numbers. Refer to the Configuring Angel for more information.

The semihosting operation type is passed in r0, rather than being encoded in the SWI number. All other parameters are passed in a block that is pointed to by r1. The result is returned in r0, either as an explicit return value or as a pointer to a data block. If no result is returned, r0 is corrupted. Registers r1-r3 are preserved by Angel when an Angel system call is made. See the description of each operation below.

In the following descriptions, the number in parentheses after the operation name (for example 0x01) is the value r0 must be set to for this operation. If you are calling Angel SWIs from assembly language code it is best to use the operation names that are defined in arm.h. You can define the operation names with an EQU directive. For example:

SYS_OPEN			EQU	0x01
SYS_CLOSE			EQU	0x02
Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential