1/*	$NetBSD: sunos_sigcode.s,v 1.1 2001/06/08 04:49:46 mrg Exp $	*/
2
3/*
4 * Copyright (c) 1996 Paul Kranenburg
5 * Copyright (c) 1996
6 * 	The President and Fellows of Harvard College. All rights reserved.
7 * Copyright (c) 1992, 1993
8 *	The Regents of the University of California.  All rights reserved.
9 *
10 * This software was developed by the Computer Systems Engineering group
11 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
12 * contributed to Berkeley.
13 *
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 *	This product includes software developed by the University of
17 *	California, Lawrence Berkeley Laboratory.
18 *	This product includes software developed by Harvard University.
19 *
20 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions
22 * are met:
23 * 1. Redistributions of source code must retain the above copyright
24 *    notice, this list of conditions and the following disclaimer.
25 * 2. Redistributions in binary form must reproduce the above copyright
26 *    notice, this list of conditions and the following disclaimer in the
27 *    documentation and/or other materials provided with the distribution.
28 * 3. All advertising materials mentioning features or use of this software
29 *    must display the following acknowledgement:
30 *	This product includes software developed by the University of
31 *	California, Berkeley and its contributors.
32 *	This product includes software developed by Harvard University.
33 *	This product includes software developed by Paul Kranenburg.
34 * 4. Neither the name of the University nor the names of its contributors
35 *    may be used to endorse or promote products derived from this software
36 *    without specific prior written permission.
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
39 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
42 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * SUCH DAMAGE.
49 *
50 *	@(#)locore.s	8.4 (Berkeley) 12/10/93
51 * from: NetBSD: locore.s,v 1.140 2001/05/26 10:22:32 pk Exp
52 */
53
54#include <machine/asm.h>
55#include <machine/trap.h>
56#include <machine/psl.h>
57#include <machine/signal.h>
58#include <sys/syscall.h>
59#include <compat/sunos/sunos_syscall.h>
60
61#include "sigcode_state.s"
62
63	.globl	_C_LABEL(sunos_sigcode)
64	.globl	_C_LABEL(sunos_esigcode)
65_C_LABEL(sunos_sigcode):
66
67	SAVE_STATE
68
69	ldd	[%fp + 64], %o0		! sig, code
70	ld	[%fp + 76], %o3		! arg3
71	call	%g1			! (*sa->sa_handler)(sig,code,scp,arg3)
72	 add	%fp, 64 + 16, %o2	! scp
73
74	RESTORE_STATE
75
76	! get registers back & set syscall #
77	restore	%g0, SUNOS_SYS_sigreturn, %g1
78	add	%sp, 64 + 16, %o0	! compute scp
79	t	ST_SYSCALL		! sigreturn(scp)
80	! sigreturn does not return unless it fails
81	mov	SUNOS_SYS_exit, %g1		! exit(errno)
82	t	ST_SYSCALL
83_C_LABEL(sunos_esigcode):
84