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