__sigtramp2.S revision 1.5 1 1.5 thorpej /* $NetBSD: __sigtramp2.S,v 1.5 2020/10/21 01:58:30 thorpej Exp $ */
2 1.1 skd
3 1.1 skd /*
4 1.1 skd * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
5 1.1 skd * All rights reserved.
6 1.1 skd *
7 1.1 skd * Author: Chris G. Demetriou
8 1.1 skd *
9 1.1 skd * Permission to use, copy, modify and distribute this software and
10 1.1 skd * its documentation is hereby granted, provided that both the copyright
11 1.1 skd * notice and this permission notice appear in all copies of the
12 1.1 skd * software, derivative works or modified versions, and any portions
13 1.1 skd * thereof, and that both notices appear in supporting documentation.
14 1.1 skd *
15 1.1 skd * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.1 skd * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.1 skd * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.1 skd *
19 1.1 skd * Carnegie Mellon requests users of this software to return to
20 1.1 skd *
21 1.1 skd * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.1 skd * School of Computer Science
23 1.1 skd * Carnegie Mellon University
24 1.1 skd * Pittsburgh PA 15213-3890
25 1.1 skd *
26 1.1 skd * any improvements or extensions that they make and grant Carnegie the
27 1.1 skd * rights to redistribute these changes.
28 1.1 skd */
29 1.1 skd
30 1.1 skd #include "SYS.h"
31 1.3 thorpej #include "assym.h"
32 1.1 skd
33 1.1 skd /*
34 1.1 skd * The Alpha signal trampoline is invoked only to return from
35 1.1 skd * the signal; the kernel calls the signal handler directly.
36 1.1 skd *
37 1.1 skd * On entry, the stack looks like:
38 1.1 skd *
39 1.1 skd * ucontext structure [128] == sp + sizeof(siginfo_t)]
40 1.1 skd * sp-> siginfo structure [0]
41 1.1 skd */
42 1.4 thorpej
43 1.4 thorpej #define CFI_OFFSET(r) .cfi_offset r, SIZEOF_SIGINFO + UC_GREGS + r*8
44 1.4 thorpej
45 1.4 thorpej .cfi_startproc simple
46 1.4 thorpej .cfi_signal_frame
47 1.4 thorpej .cfi_def_cfa _REG_SP, 0
48 1.4 thorpej CFI_OFFSET(_REG_V0)
49 1.4 thorpej CFI_OFFSET(_REG_T0)
50 1.4 thorpej CFI_OFFSET(_REG_T1)
51 1.4 thorpej CFI_OFFSET(_REG_T2)
52 1.4 thorpej CFI_OFFSET(_REG_T3)
53 1.4 thorpej CFI_OFFSET(_REG_T4)
54 1.4 thorpej CFI_OFFSET(_REG_T5)
55 1.4 thorpej CFI_OFFSET(_REG_T6)
56 1.4 thorpej CFI_OFFSET(_REG_T7)
57 1.4 thorpej CFI_OFFSET(_REG_S0)
58 1.4 thorpej CFI_OFFSET(_REG_S1)
59 1.4 thorpej CFI_OFFSET(_REG_S2)
60 1.4 thorpej CFI_OFFSET(_REG_S3)
61 1.4 thorpej CFI_OFFSET(_REG_S4)
62 1.4 thorpej CFI_OFFSET(_REG_S5)
63 1.4 thorpej CFI_OFFSET(_REG_S6)
64 1.4 thorpej CFI_OFFSET(_REG_A0)
65 1.4 thorpej CFI_OFFSET(_REG_A1)
66 1.4 thorpej CFI_OFFSET(_REG_A2)
67 1.4 thorpej CFI_OFFSET(_REG_A3)
68 1.4 thorpej CFI_OFFSET(_REG_A4)
69 1.4 thorpej CFI_OFFSET(_REG_A5)
70 1.4 thorpej CFI_OFFSET(_REG_T8)
71 1.4 thorpej CFI_OFFSET(_REG_T9)
72 1.4 thorpej CFI_OFFSET(_REG_T10)
73 1.4 thorpej CFI_OFFSET(_REG_T11)
74 1.4 thorpej CFI_OFFSET(_REG_RA)
75 1.4 thorpej CFI_OFFSET(_REG_T12) /* a.k.a. _REG_PV */
76 1.4 thorpej CFI_OFFSET(_REG_AT)
77 1.4 thorpej CFI_OFFSET(_REG_GP)
78 1.4 thorpej CFI_OFFSET(_REG_SP)
79 1.4 thorpej
80 1.4 thorpej /*
81 1.4 thorpej * The unwind entry includes one instruction slot prior to the trampoline
82 1.4 thorpej * because the unwinder will look up to (return PC - 1 insn) while unwinding.
83 1.4 thorpej * Normally this would be the jump / branch, but since there isn't one in
84 1.5 thorpej * this case, we place an explicit nop there instead.
85 1.4 thorpej */
86 1.4 thorpej nop
87 1.4 thorpej
88 1.1 skd NESTED_NOPROFILE(__sigtramp_siginfo_2,0,0,ra,0,0)
89 1.2 drochner ldgp gp,0(ra)
90 1.3 thorpej lda a0,(SIZEOF_SIGINFO)(sp) /* get pointer to ucontext */
91 1.1 skd CALLSYS_NOERROR(setcontext) /* and call setcontext() with it */
92 1.2 drochner ldiq a0,-1 /* if that failed, set an exit code */
93 1.2 drochner CALLSYS_NOERROR(exit) /* and call exit() */
94 1.4 thorpej .cfi_endproc
95 1.1 skd END(__sigtramp_siginfo_2)
96