2007-01-03 17:55:25 +01:00
|
|
|
#include <_ansi.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include "swi.h"
|
|
|
|
|
2018-11-16 12:45:48 +01:00
|
|
|
int _kill_shared (int, int, int) __attribute__((__noreturn__));
|
|
|
|
int _kill (int, int);
|
2007-01-03 17:55:25 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
_kill (int pid, int sig)
|
2018-11-16 12:45:48 +01:00
|
|
|
{
|
|
|
|
if (sig == SIGABRT)
|
|
|
|
_kill_shared (pid, sig, ADP_Stopped_RunTimeError);
|
|
|
|
else
|
|
|
|
_kill_shared (pid, sig, ADP_Stopped_ApplicationExit);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_kill_shared (int pid, int sig, int reason)
|
2007-01-03 17:55:25 +01:00
|
|
|
{
|
|
|
|
(void) pid; (void) sig;
|
|
|
|
#ifdef ARM_RDI_MONITOR
|
|
|
|
/* Note: The pid argument is thrown away. */
|
2017-07-05 14:04:07 +02:00
|
|
|
int block[2];
|
|
|
|
block[1] = sig;
|
2018-11-16 12:45:48 +01:00
|
|
|
block[0] = reason;
|
2017-07-05 14:04:07 +02:00
|
|
|
int insn;
|
|
|
|
|
|
|
|
#if SEMIHOST_V2
|
|
|
|
if (_has_ext_exit_extended ())
|
|
|
|
{
|
|
|
|
insn = AngelSWI_Reason_ReportExceptionExtended;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
insn = AngelSWI_Reason_ReportException;
|
|
|
|
}
|
|
|
|
|
2018-07-11 14:26:16 +02:00
|
|
|
#if SEMIHOST_V2
|
|
|
|
if (_has_ext_exit_extended ())
|
2018-10-01 17:52:42 +02:00
|
|
|
do_AngelSWI (insn, block);
|
2018-07-11 14:26:16 +02:00
|
|
|
else
|
|
|
|
#endif
|
2018-10-01 17:52:42 +02:00
|
|
|
do_AngelSWI (insn, (void*)block[0]);
|
2018-07-11 14:26:16 +02:00
|
|
|
|
2007-01-03 17:55:25 +01:00
|
|
|
#else
|
|
|
|
asm ("swi %a0" :: "i" (SWI_Exit));
|
|
|
|
#endif
|
2018-10-01 17:52:42 +02:00
|
|
|
|
|
|
|
__builtin_unreachable();
|
2007-01-03 17:55:25 +01:00
|
|
|
}
|