138032Speter/*	$NetBSD: sigprocmask.S,v 1.5 2003/08/07 16:42:26 agc Exp $	*/
290792Sgshapiro
364562Sgshapiro/*
438032Speter * Copyright (c) 1992, 1993
538032Speter *	The Regents of the University of California.  All rights reserved.
638032Speter *
738032Speter * This software was developed by the Computer Systems Engineering group
838032Speter * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
938032Speter * contributed to Berkeley.
1038032Speter *
1138032Speter * Redistribution and use in source and binary forms, with or without
1238032Speter * modification, are permitted provided that the following conditions
1338032Speter * are met:
1464562Sgshapiro * 1. Redistributions of source code must retain the above copyright
1538032Speter *    notice, this list of conditions and the following disclaimer.
1638032Speter * 2. Redistributions in binary form must reproduce the above copyright
1764562Sgshapiro *    notice, this list of conditions and the following disclaimer in the
1890792Sgshapiro *    documentation and/or other materials provided with the distribution.
1964562Sgshapiro * 3. Neither the name of the University nor the names of its contributors
2064562Sgshapiro *    may be used to endorse or promote products derived from this software
2138032Speter *    without specific prior written permission.
2264562Sgshapiro *
2338032Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2464562Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2538032Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2664562Sgshapiro * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2764562Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2864562Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2964562Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3064562Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3190792Sgshapiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3264562Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3364562Sgshapiro * SUCH DAMAGE.
3464562Sgshapiro *
3564562Sgshapiro * from: Header: sigprocmask.s,v 1.1 91/07/06 13:06:01 torek Exp
3638032Speter */
3738032Speter
3864562Sgshapiro#include <machine/asm.h>
3938032Speter#if defined(SYSLIBC_SCCS) && !defined(lint)
4064562Sgshapiro#if 0
4190792Sgshapiro	.asciz "@(#)sigprocmask.s	8.1 (Berkeley) 6/4/93"
4290792Sgshapiro#else
4390792Sgshapiro	RCSID("$NetBSD: sigprocmask.S,v 1.5 2003/08/07 16:42:26 agc Exp $")
4490792Sgshapiro#endif
4590792Sgshapiro#endif /* SYSLIBC_SCCS and not lint */
4690792Sgshapiro
4790792Sgshapiro#include "SYS.h"
4890792Sgshapiro
4990792SgshapiroWARN_REFERENCES(sigprocmask, \
5090792Sgshapiro    "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
51110560Sgshapiro
5290792Sgshapiro/*
5390792Sgshapiro * sigprocmask(int how, sigset_t *set, sigset_t *oset)
5490792Sgshapiro */
5564562SgshapiroENTRY(sigprocmask)
5664562Sgshapiro	tst	%o1		! set == NULL?
5790792Sgshapiro	bne,a	1f		! if not,
5890792Sgshapiro	 ld	[%o1], %o1	!    replace it in %o1 with *set
5990792Sgshapiro!	clr	%o1		! else block no signals ...
6090792Sgshapiro	mov	1, %o0		! ... using sigprocmask(SIG_BLOCK)
6190792Sgshapiro1:
6290792Sgshapiro	mov	SYS_compat_13_sigprocmask13, %g1
6390792Sgshapiro	t	ST_SYSCALL
6490792Sgshapiro	bcc	2f		! if success,
6590792Sgshapiro	 tst	%o2		!    check to see if oset requested
6690792Sgshapiro	ERROR()
6790792Sgshapiro2:
6890792Sgshapiro	bne,a	3f		! if oset != NULL,
6938032Speter	 st	%o0, [%o2]	!    *oset = oldmask
7064562Sgshapiro3:
7138032Speter	retl			! in any case, return 0
7264562Sgshapiro	 clr	%o0
7338032Speter