Datasheet

Semihosting
ARM DUI0058D Copyright © 1999-2001 ARM Limited. All rights reserved. 5-27
5.5 Debug agent interaction SWIs
In addition to the C library semihosted functions described in Semihosting SWIs on
page 5-11, the following SWIs support interaction with the debug agent:
The ReportException SWI. This SWI is used by the semihosting support code as
a way to report an exception to the debugger.
The EnterSVC SWI. This SWI sets the processor to Supervisor mode.
The reason_LateStartup SWI. This SWI is obsolete and no longer supported.
These are described below.
5.5.1 angel_SWIreason_EnterSVC (0x17)
Sets the processor to Supervisor (SVC) mode and disables all interrupts by setting both
interrupt mask bits in the new CPSR. With RealMonitor, Angel, or Multi-ICE, the User
stack pointer (r13_USR) is copied to the Supervisor stack pointer (r13_SVC) and the I
and F bits in the current CPSR are set, disabling normal and fast interrupts.
Note
If debugging with ARMulator:
r0 is set to zero indicating that no function is available for returning to User mode
the User mode stack pointer is not copied to the Supervisor stack pointer.
Entry
Register r1 is not used. The CPSR can specify User or Supervisor mode.
Return
On exit, r0 contains the address of a function to be called to return to User mode. The
function has the following prototype:
void ReturnToUSR(void)
If EnterSVC is called in User mode, this routine returns the caller to User mode and
restores the interrupt flags. Otherwise, the action of this routine is undefined.
If entered in User mode, the Supervisor stack is lost as a result of copying the user stack
pointer. The return to User routine restores r13_SVC to the Angel Supervisor mode
stack value, but this stack must not be used by applications.