1 /* $NetBSD: __sigtramp2.S,v 1.4 2009/11/03 05:07:25 snj Exp $ */
4 * Copyright (c) 1998-2001 Michael Shalayeff
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26 * THE POSSIBILITY OF SUCH DAMAGE.
28 * Portitions of this file are derived from other sources, see
29 * the copyrights and acknowledgements below.
32 * Copyright (c) 1990,1991,1992,1994 The University of Utah and
33 * the Computer Systems Laboratory (CSL). All rights reserved.
35 * THE UNIVERSITY OF UTAH AND CSL PROVIDE THIS SOFTWARE IN ITS "AS IS"
36 * CONDITION, AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
37 * WHATSOEVER RESULTING FROM ITS USE.
39 * CSL requests users of this software to return to csl-dist@cs.utah.edu any
40 * improvements that they make and grant CSL redistribution rights.
42 * Utah $Hdr: locore.s 1.62 94/12/15$
45 * (c) Copyright 1988 HEWLETT-PACKARD COMPANY
47 * To anyone who acknowledges that this file is provided "AS IS"
48 * without any express or implied warranty:
49 * permission to use, copy, modify, and distribute this file
50 * for any purpose is hereby granted without fee, provided that
51 * the above copyright notice and this notice appears in all
52 * copies, and that the name of Hewlett-Packard Company not be
53 * used in advertising or publicity pertaining to distribution
54 * of the software without specific, written prior permission.
55 * Hewlett-Packard Company makes no representations about the
56 * suitability of this software for any purpose.
62 * The hppa signal trampoline is required to call the handler
63 * possibily via a PLABEL.
65 * On entry, stack looks like:
68 * r3,arg2-> ucontext structure
69 * arg1-> siginfo structure [0]
72 * x = HPPA_FRAME_ROUND(sizeof(sigframe_siginfo))
75 * struct sigframe_siginfo {
81 ENTRY_NOPROFILE(__sigtramp_siginfo_2, 0)
85 * Our sendsig() places the address of the signal handler in %arg3.
86 * It may actually be a PLABEL.
88 bb,>=,n %arg3, 30, L$sigcode_bounce ; branch if not a PLABEL
89 depi 0, 31, 2, %arg3 ; zero L bit in PLABEL pointer
90 ldw 4(%arg3), %r19 ; load shared library linkage
91 ldw 0(%arg3), %arg3 ; load real catcher address
96 * This blr puts the address of the following nop in rp.
97 * It also schedules the nop for execution, which is why
98 * that instruction has to be a nop, or, rather, not any
99 * instruction only meant to execute once the signal handler
105 * This bv schedules the instruction pointed to by arg3
106 * for execution. So, arg3 is the address of the signal
113 * The signal handler has returned. Since r3 is on the list
114 * of callee-saved registers, it's whatever the sendsig
115 * code wanted it set to. Since we copy it into arg0,
116 * it looks like sendsig leaves r3 holding the desired
117 * single argument to sys_setcontext, i.e., the ucontext_t *.
120 /* Make a SYS_setcontext system call. */
122 ldil L%SYSCALLGATE, %r1
125 ldi SYS_setcontext, %t1
127 /* Make a SYS_exit system call. */
129 ldil L%SYSCALLGATE, %r1
133 EXIT(__sigtramp_siginfo_2)