summaryrefslogtreecommitdiffstats
path: root/libgloss/arm/_kill.c
blob: 8871d3c367c353c318210c4308837be94f375815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <_ansi.h>
#include <signal.h>
#include "swi.h"

int _kill _PARAMS ((int, int));

int
_kill (int pid, int sig)
{
  (void) pid; (void) sig;
#ifdef ARM_RDI_MONITOR
  /* Note: The pid argument is thrown away.  */
  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;
    }

  switch (sig)
    {
    case SIGABRT:
      {
	block[0] = ADP_Stopped_RunTimeError;
	break;
      }
    default:
      {
	block[0] = ADP_Stopped_ApplicationExit;
	break;
      }
    }

  return do_AngelSWI (insn, block);
#else
  asm ("swi %a0" :: "i" (SWI_Exit));
#endif
}