If you are compiling for the ARMv6-M or ARMv7-M, the Thumb
is used instead of the Thumb
an 8-bit immediate value. In all other respects, semihosting is
the same for all supported ARM processors.
The system SVC handler can decode the SVC number. Semihosting operations are requested
using a single SVC number, leaving the other numbers available for use by the application or
operating system. The SVC number used for semihosting depends on the target architecture or
In ARM state for all architectures.
In ARM state and Thumb state, excluding ARMv6-M
and ARMv7-M. This behavior is not guaranteed on all debug
targets from ARM or from third parties.
For ARMv6-M and ARMv7-M, Thumb state only.
The SVC number indicates to the debug agent that the
is a semihosting request. To distinguish between operations, the
operation type is passed in
R0. All other parameters
are passed in a block that is pointed to by
The result is returned in
R0, either as
an explicit return value or as a pointer to a data block. Even if
no result is returned, assume that
R0 is corrupted.
The available semihosting operation numbers passed in
allocated as follows:
Used by ARM.
Reserved for future use by ARM.
Reserved for user applications. These are not used
If you are writing your own SVC operations, however, you are
advised to use a different SVC number rather than using the semihosted
SVC number and these operation type numbers.
Undefined and currently unused. It is recommended
that you do not use these.
In the following sections, the number in parentheses after
the operation name is the value placed into
If you are calling SVCs from assembly language code ARM recommends
that you define the semihosting operation names, to their respective
operation numbers, with the
SYS_OPEN EQU 0x01
SYS_CLOSE EQU 0x02