xref: /netbsd/sys/arch/alpha/alpha/linux_sigcode.s (revision 6550d01e)
1/* $NetBSD: linux_sigcode.s,v 1.3 2008/04/28 20:23:10 martin Exp $ */
2
3/*-
4 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
35 * All rights reserved.
36 *
37 * Author: Chris G. Demetriou
38 *
39 * Permission to use, copy, modify and distribute this software and
40 * its documentation is hereby granted, provided that both the copyright
41 * notice and this permission notice appear in all copies of the
42 * software, derivative works or modified versions, and any portions
43 * thereof, and that both notices appear in supporting documentation.
44 *
45 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
46 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
47 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 *
49 * Carnegie Mellon requests users of this software to return to
50 *
51 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
52 *  School of Computer Science
53 *  Carnegie Mellon University
54 *  Pittsburgh PA 15213-3890
55 *
56 * any improvements or extensions that they make and grant Carnegie the
57 * rights to redistribute these changes.
58 */
59
60.stabs	__FILE__,100,0,0,kernel_text
61
62#include <compat/linux/linux_syscall.h>
63
64#include <machine/asm.h>
65
66__KERNEL_RCSID(0, "$NetBSD: linux_sigcode.s,v 1.3 2008/04/28 20:23:10 martin Exp $");
67
68#include "assym.h"
69
70.stabs	__FILE__,132,0,0,kernel_text
71
72/*
73 * Linux signal trampoline code.  Almost identical to the normal one.
74 */
75
76NESTED_NOPROFILE(linux_sigcode,0,0,ra,0,0)
77	lda	sp, -16(sp)		/* save the sigcontext pointer */
78	stq	a2, 0(sp)
79	jsr	ra, (t12)		/* call the signal handler */
80	ldq	a0, 0(sp)		/* get the sigcontext pointer */
81	lda	sp, 16(sp)
82	LINUX_CALLSYS_NOERROR(sigreturn)
83	mov	v0, a0
84	LINUX_CALLSYS_NOERROR(exit)
85XNESTED(linux_esigcode,0)
86	END(linux_sigcode)
87
88NESTED_NOPROFILE(linux_rt_sigcode,0,0,ra,0,0)
89	lda	sp, -16(sp)		/* save the sigcontext pointer */
90	stq	a2, 0(sp)
91	jsr	ra, (t12)		/* call the signal handler */
92	ldq	a0, 0(sp)		/* get the sigcontext pointer */
93	lda	sp, 16(sp)
94	LINUX_CALLSYS_NOERROR(rt_sigreturn)
95	mov	v0, a0
96	LINUX_CALLSYS_NOERROR(exit)
97XNESTED(linux_rt_esigcode,0)
98	END(linux_rt_sigcode)
99