Home | History | Annotate | Line # | Download | only in sys
__sigtramp2.S revision 1.4
      1 /*	$NetBSD: __sigtramp2.S,v 1.4 2020/10/21 01:55:07 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 (at) 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 
     43 #define	CFI_OFFSET(r)	.cfi_offset r, SIZEOF_SIGINFO + UC_GREGS + r*8
     44 
     45 	.cfi_startproc simple
     46 	.cfi_signal_frame
     47 	.cfi_def_cfa _REG_SP, 0
     48 	CFI_OFFSET(_REG_V0)
     49 	CFI_OFFSET(_REG_T0)
     50 	CFI_OFFSET(_REG_T1)
     51 	CFI_OFFSET(_REG_T2)
     52 	CFI_OFFSET(_REG_T3)
     53 	CFI_OFFSET(_REG_T4)
     54 	CFI_OFFSET(_REG_T5)
     55 	CFI_OFFSET(_REG_T6)
     56 	CFI_OFFSET(_REG_T7)
     57 	CFI_OFFSET(_REG_S0)
     58 	CFI_OFFSET(_REG_S1)
     59 	CFI_OFFSET(_REG_S2)
     60 	CFI_OFFSET(_REG_S3)
     61 	CFI_OFFSET(_REG_S4)
     62 	CFI_OFFSET(_REG_S5)
     63 	CFI_OFFSET(_REG_S6)
     64 	CFI_OFFSET(_REG_A0)
     65 	CFI_OFFSET(_REG_A1)
     66 	CFI_OFFSET(_REG_A2)
     67 	CFI_OFFSET(_REG_A3)
     68 	CFI_OFFSET(_REG_A4)
     69 	CFI_OFFSET(_REG_A5)
     70 	CFI_OFFSET(_REG_T8)
     71 	CFI_OFFSET(_REG_T9)
     72 	CFI_OFFSET(_REG_T10)
     73 	CFI_OFFSET(_REG_T11)
     74 	CFI_OFFSET(_REG_RA)
     75 	CFI_OFFSET(_REG_T12)	/* a.k.a. _REG_PV */
     76 	CFI_OFFSET(_REG_AT)
     77 	CFI_OFFSET(_REG_GP)
     78 	CFI_OFFSET(_REG_SP)
     79 
     80 /*
     81  * The unwind entry includes one instruction slot prior to the trampoline
     82  * because the unwinder will look up to (return PC - 1 insn) while unwinding.
     83  * Normally this would be the jump / branch, but since there isn't one in
     84  * this case, we place an explcit nop there instead.
     85  */
     86 	nop
     87 
     88 NESTED_NOPROFILE(__sigtramp_siginfo_2,0,0,ra,0,0)
     89 	ldgp	gp,0(ra)
     90 	lda	a0,(SIZEOF_SIGINFO)(sp)	/* get pointer to ucontext */
     91 	CALLSYS_NOERROR(setcontext)	/* and call setcontext() with it */
     92 	ldiq	a0,-1			/* if that failed, set an exit code */
     93 	CALLSYS_NOERROR(exit)		/* and call exit() */
     94 	.cfi_endproc
     95 END(__sigtramp_siginfo_2)
     96