11.2Smatt/*	$NetBSD: compat_sigprocmask.S,v 1.2 2009/12/14 03:04:33 matt Exp $	*/
21.1Stsutsui
31.1Stsutsui/*-
41.1Stsutsui * Copyright (c) 1991, 1993
51.1Stsutsui *	The Regents of the University of California.  All rights reserved.
61.1Stsutsui *
71.1Stsutsui * This code is derived from software contributed to Berkeley by
81.1Stsutsui * Ralph Campbell.
91.1Stsutsui *
101.1Stsutsui * Redistribution and use in source and binary forms, with or without
111.1Stsutsui * modification, are permitted provided that the following conditions
121.1Stsutsui * are met:
131.1Stsutsui * 1. Redistributions of source code must retain the above copyright
141.1Stsutsui *    notice, this list of conditions and the following disclaimer.
151.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
161.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
171.1Stsutsui *    documentation and/or other materials provided with the distribution.
181.1Stsutsui * 3. Neither the name of the University nor the names of its contributors
191.1Stsutsui *    may be used to endorse or promote products derived from this software
201.1Stsutsui *    without specific prior written permission.
211.1Stsutsui *
221.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.1Stsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.1Stsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.1Stsutsui * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.1Stsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Stsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Stsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Stsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Stsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Stsutsui * SUCH DAMAGE.
331.1Stsutsui */
341.1Stsutsui
351.1Stsutsui#include "SYS.h"
361.1Stsutsui
371.1Stsutsui#if defined(LIBC_SCCS) && !defined(lint)
381.2Smatt#if 0
391.2Smatt	RCSID("from: @(#)sigprocmask.s	8.1 (Berkeley) 6/4/93")
401.2Smatt#else
411.2Smatt	RCSID("$NetBSD: compat_sigprocmask.S,v 1.2 2009/12/14 03:04:33 matt Exp $")
421.2Smatt#endif
431.1Stsutsui#endif /* LIBC_SCCS and not lint */
441.1Stsutsui
451.1StsutsuiWARN_REFERENCES(sigprocmask, \
461.1Stsutsui    "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
471.1Stsutsui
481.1StsutsuiLEAF(sigprocmask)	# sigprocmask(how, new, old) sigset_t *new, *old;
491.2Smatt	PIC_PROLOGUE(sigprocmask)
501.1Stsutsui	bne	a1, zero, gotptr	# if new sigset pointer not null
511.1Stsutsui	li	a0, 1			# how = SIG_BLOCK
521.1Stsutsui	b	doit			# mask = zero
531.1Stsutsuigotptr:
541.2Smatt	INT_L	a1, 0(a1)		# indirect to new mask arg
551.1Stsutsuidoit:
561.2Smatt	SYSTRAP(compat_13_sigprocmask13)
571.2Smatt
581.1Stsutsui	bne	a3, zero, err
591.1Stsutsui	beq	a2, zero, out		# test if old mask requested
601.2Smatt	INT_S	v0, 0(a2)		# store old mask
611.1Stsutsuiout:
621.1Stsutsui	move	v0, zero
631.2Smatt	PIC_RETURN()
641.1Stsutsuierr:
651.2Smatt	PIC_TAILCALL(__cerror)
661.1StsutsuiEND(sigprocmask)
67