xref: /netbsd-src/lib/libc/arch/sparc/sys/__sigtramp2.S (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin/*	$NetBSD: __sigtramp2.S,v 1.2 2008/04/28 20:22:57 martin Exp $	*/
2f70031feSpk
3f70031feSpk/*-
4f70031feSpk * Copyright (c) 2003 The NetBSD Foundation, Inc.
5f70031feSpk * All rights reserved.
6f70031feSpk *
7f70031feSpk * This code is derived from software contributed to The NetBSD Foundation
8f70031feSpk * by Paul Kranenburg.
9f70031feSpk *
10f70031feSpk * Redistribution and use in source and binary forms, with or without
11f70031feSpk * modification, are permitted provided that the following conditions
12f70031feSpk * are met:
13f70031feSpk * 1. Redistributions of source code must retain the above copyright
14f70031feSpk *    notice, this list of conditions and the following disclaimer.
15f70031feSpk * 2. Redistributions in binary form must reproduce the above copyright
16f70031feSpk *    notice, this list of conditions and the following disclaimer in the
17f70031feSpk *    documentation and/or other materials provided with the distribution.
18f70031feSpk *
19f70031feSpk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20f70031feSpk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21f70031feSpk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22f70031feSpk * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23f70031feSpk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24f70031feSpk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25f70031feSpk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26f70031feSpk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27f70031feSpk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28f70031feSpk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29f70031feSpk * POSSIBILITY OF SUCH DAMAGE.
30f70031feSpk */
31f70031feSpk
32f70031feSpk#include <machine/asm.h>
33f70031feSpk#if defined(SYSLIBC_SCCS) && !defined(lint)
34*ce099b40Smartin	RCSID("$NetBSD: __sigtramp2.S,v 1.2 2008/04/28 20:22:57 martin Exp $")
35f70031feSpk#endif /* SYSLIBC_SCCS and not lint */
36f70031feSpk
37f70031feSpk#include "SYS.h"
38f70031feSpk
39f70031feSpk/*
40f70031feSpk * When this code is run, the stack looks like:
41f70031feSpk *	[%sp]			struct frame
42f70031feSpk *	[%sp + 96]		siginfo_t
43f70031feSpk *	[%sp + 96 + 128]	ucontext_t
44f70031feSpk *	    .
45f70031feSpk *	    .
46f70031feSpk */
47f70031feSpkENTRY_NOPROFILE(__sigtramp_siginfo_2)
48f70031feSpk	add	%sp, 96 + 128, %o0	/* get pointer to ucontext */
49f70031feSpk	mov	SYS_setcontext, %g1
50f70031feSpk	t	ST_SYSCALL		/* call setcontext */
51f70031feSpk	mov	SYS_exit, %g1		/* exit with errno */
52f70031feSpk	t	ST_SYSCALL		/* if sigreturn fails */
53