5.4. Semihosting SWIs

The SWIs listed in Table 5.1 implement the semihosted operations. These operations are used by C library functions such as printf() and scanf(). They can be treated as ATPCS function calls. However, except for r0 that contains the return status, they restore the registers they are called with before returning.

Some targets provide additional semihosting calls. See the ARM Firmware Suite (AFS) documentation for details of SWIs provided by AFS.

Table 5.1. Semihosting SWIs

SYS_OPEN (0x01)Open a file on the host
SYS_CLOSE (0x02)Close a file on the host
SYS_WRITEC (0x03)Write a character to the console
SYS_WRITE0 (0x04)Write a null-terminated string to the console
SYS_WRITE (0x05)Write to a file on the host
SYS_READ (0x06)Read the contents of a file into a buffer
SYS_READC (0x07)Read a byte from the console
SYS_ISERROR (0x08)Determine if a return code is an error
SYS_ISTTY (0x09)Check whether a file is connected to an interactive device
SYS_SEEK (0x0A)Seek to a position in a file
SYS_FLEN (0x0C)Return the length of a file
SYS_TMPNAM (0x0D)Return a temporary name for a file
SYS_REMOVE (0x0E)Remove a file from the host
SYS_RENAME (0x0F)Rename a file on the host
SYS_CLOCK (0x10)Number of centiseconds since execution started
SYS_TIME (0x11)Number of seconds since January 1, 1970
SYS_SYSTEM (0x12)Pass a command to the host command-line interpreter
SYS_ERRNO (0x13)Get the value of the C library errno variable
SYS_GET_CMDLINE (0x15)Get the command-line used to call the executable
SYS_HEAPINFO (0x16)Get the system heap parameters
SYS_ELAPSED (0x30)Get the number of target ticks since execution started
SYS_TICKFREQ (0x31)Determine the tick frequency


When used with Angel, these SWIs use the serializer and the global register block, and they can take a significant length of time to process.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI0058D