2007-01-03 17:55:25 +01:00
|
|
|
#include <_ansi.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include "swi.h"
|
|
|
|
|
2017-12-04 03:41:16 +01:00
|
|
|
int _kill (int, int);
|
2007-01-03 17:55:25 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
_kill (int pid, int sig)
|
|
|
|
{
|
|
|
|
(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;
|
|
|
|
int insn;
|
|
|
|
|
|
|
|
#if SEMIHOST_V2
|
|
|
|
if (_has_ext_exit_extended ())
|
|
|
|
{
|
|
|
|
insn = AngelSWI_Reason_ReportExceptionExtended;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
insn = AngelSWI_Reason_ReportException;
|
|
|
|
}
|
|
|
|
|
2007-01-03 17:55:25 +01:00
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case SIGABRT:
|
2017-07-05 14:04:07 +02:00
|
|
|
{
|
|
|
|
block[0] = ADP_Stopped_RunTimeError;
|
|
|
|
break;
|
|
|
|
}
|
2007-01-03 17:55:25 +01:00
|
|
|
default:
|
2017-07-05 14:04:07 +02:00
|
|
|
{
|
|
|
|
block[0] = ADP_Stopped_ApplicationExit;
|
|
|
|
break;
|
|
|
|
}
|
2007-01-03 17:55:25 +01:00
|
|
|
}
|
2017-07-05 14:04:07 +02:00
|
|
|
|
2018-07-11 14:26:16 +02:00
|
|
|
#if SEMIHOST_V2
|
|
|
|
if (_has_ext_exit_extended ())
|
2017-07-05 14:04:07 +02:00
|
|
|
return do_AngelSWI (insn, block);
|
2018-07-11 14:26:16 +02:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
return do_AngelSWI (insn, (void*)block[0]);
|
|
|
|
|
2007-01-03 17:55:25 +01:00
|
|
|
#else
|
|
|
|
asm ("swi %a0" :: "i" (SWI_Exit));
|
|
|
|
#endif
|
|
|
|
}
|