xref: /netbsd-src/lib/libc/compat/arch/sparc/sys/compat_sigprocmask.S (revision eb9395f8c7f1aefb189f8736538978a0a3909bbc)
1*eb9395f8Suwe/*	$NetBSD: compat_sigprocmask.S,v 1.1 2005/10/15 22:11:22 uwe Exp $	*/
2*eb9395f8Suwe
3*eb9395f8Suwe/*
4*eb9395f8Suwe * Copyright (c) 1992, 1993
5*eb9395f8Suwe *	The Regents of the University of California.  All rights reserved.
6*eb9395f8Suwe *
7*eb9395f8Suwe * This software was developed by the Computer Systems Engineering group
8*eb9395f8Suwe * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9*eb9395f8Suwe * contributed to Berkeley.
10*eb9395f8Suwe *
11*eb9395f8Suwe * Redistribution and use in source and binary forms, with or without
12*eb9395f8Suwe * modification, are permitted provided that the following conditions
13*eb9395f8Suwe * are met:
14*eb9395f8Suwe * 1. Redistributions of source code must retain the above copyright
15*eb9395f8Suwe *    notice, this list of conditions and the following disclaimer.
16*eb9395f8Suwe * 2. Redistributions in binary form must reproduce the above copyright
17*eb9395f8Suwe *    notice, this list of conditions and the following disclaimer in the
18*eb9395f8Suwe *    documentation and/or other materials provided with the distribution.
19*eb9395f8Suwe * 3. Neither the name of the University nor the names of its contributors
20*eb9395f8Suwe *    may be used to endorse or promote products derived from this software
21*eb9395f8Suwe *    without specific prior written permission.
22*eb9395f8Suwe *
23*eb9395f8Suwe * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24*eb9395f8Suwe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*eb9395f8Suwe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*eb9395f8Suwe * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27*eb9395f8Suwe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*eb9395f8Suwe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*eb9395f8Suwe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*eb9395f8Suwe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*eb9395f8Suwe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*eb9395f8Suwe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*eb9395f8Suwe * SUCH DAMAGE.
34*eb9395f8Suwe *
35*eb9395f8Suwe * from: Header: sigprocmask.s,v 1.1 91/07/06 13:06:01 torek Exp
36*eb9395f8Suwe */
37*eb9395f8Suwe
38*eb9395f8Suwe#include <machine/asm.h>
39*eb9395f8Suwe#if defined(SYSLIBC_SCCS) && !defined(lint)
40*eb9395f8Suwe#if 0
41*eb9395f8Suwe	.asciz "@(#)sigprocmask.s	8.1 (Berkeley) 6/4/93"
42*eb9395f8Suwe#else
43*eb9395f8Suwe	RCSID("$NetBSD: compat_sigprocmask.S,v 1.1 2005/10/15 22:11:22 uwe Exp $")
44*eb9395f8Suwe#endif
45*eb9395f8Suwe#endif /* SYSLIBC_SCCS and not lint */
46*eb9395f8Suwe
47*eb9395f8Suwe#include "SYS.h"
48*eb9395f8Suwe
49*eb9395f8SuweWARN_REFERENCES(sigprocmask, \
50*eb9395f8Suwe    "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
51*eb9395f8Suwe
52*eb9395f8Suwe/*
53*eb9395f8Suwe * sigprocmask(int how, sigset_t *set, sigset_t *oset)
54*eb9395f8Suwe */
55*eb9395f8SuweENTRY(sigprocmask)
56*eb9395f8Suwe	tst	%o1		! set == NULL?
57*eb9395f8Suwe	bne,a	1f		! if not,
58*eb9395f8Suwe	 ld	[%o1], %o1	!    replace it in %o1 with *set
59*eb9395f8Suwe!	clr	%o1		! else block no signals ...
60*eb9395f8Suwe	mov	1, %o0		! ... using sigprocmask(SIG_BLOCK)
61*eb9395f8Suwe1:
62*eb9395f8Suwe	mov	SYS_compat_13_sigprocmask13, %g1
63*eb9395f8Suwe	t	ST_SYSCALL
64*eb9395f8Suwe	bcc	2f		! if success,
65*eb9395f8Suwe	 tst	%o2		!    check to see if oset requested
66*eb9395f8Suwe	ERROR()
67*eb9395f8Suwe2:
68*eb9395f8Suwe	bne,a	3f		! if oset != NULL,
69*eb9395f8Suwe	 st	%o0, [%o2]	!    *oset = oldmask
70*eb9395f8Suwe3:
71*eb9395f8Suwe	retl			! in any case, return 0
72*eb9395f8Suwe	 clr	%o0
73