xref: /openbsd-src/lib/libc/arch/sh/sys/sigprocmask.S (revision fc31befaf105b97a112f7671f6f1ed3695619019)
1*fc31befaSmiod/*	$OpenBSD: sigprocmask.S,v 1.8 2024/03/27 20:03:29 miod Exp $	*/
2cf252584Smiod/*	$NetBSD: sigprocmask.S,v 1.6 2003/08/07 16:42:21 agc Exp $	*/
3cf252584Smiod
4cf252584Smiod/*-
5cf252584Smiod * Copyright (c) 1990 The Regents of the University of California.
6cf252584Smiod * All rights reserved.
7cf252584Smiod *
8cf252584Smiod * This code is derived from software contributed to Berkeley by
9cf252584Smiod * William Jolitz.
10cf252584Smiod *
11cf252584Smiod * Redistribution and use in source and binary forms, with or without
12cf252584Smiod * modification, are permitted provided that the following conditions
13cf252584Smiod * are met:
14cf252584Smiod * 1. Redistributions of source code must retain the above copyright
15cf252584Smiod *    notice, this list of conditions and the following disclaimer.
16cf252584Smiod * 2. Redistributions in binary form must reproduce the above copyright
17cf252584Smiod *    notice, this list of conditions and the following disclaimer in the
18cf252584Smiod *    documentation and/or other materials provided with the distribution.
19cf252584Smiod * 3. Neither the name of the University nor the names of its contributors
20cf252584Smiod *    may be used to endorse or promote products derived from this software
21cf252584Smiod *    without specific prior written permission.
22cf252584Smiod *
23cf252584Smiod * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24cf252584Smiod * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25cf252584Smiod * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26cf252584Smiod * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27cf252584Smiod * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28cf252584Smiod * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29cf252584Smiod * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30cf252584Smiod * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31cf252584Smiod * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32cf252584Smiod * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33cf252584Smiod * SUCH DAMAGE.
34cf252584Smiod *
35cf252584Smiod *	from: @(#)sigprocmask.s	5.2 (Berkeley) 12/17/90
36cf252584Smiod */
37cf252584Smiod
38cf252584Smiod#include "SYS.h"
39cf252584Smiod
405aed4d28SguentherSYSENTRY_HIDDEN(sigprocmask)
41cf252584Smiod	mov	r5, r2			/* fetch new sigset pointer */
42cf252584Smiod	tst	r2, r2			/* check new sigset pointer */
43cf252584Smiod	bf	1f			/* if not null, indirect */
44cf252584Smiod	mov	#1, r4			/* SIG_BLOCK */
45cf252584Smiod	bra	2f
46cf252584Smiod	nop
47cf252584Smiod1:	mov.l	@r2, r2			/* fetch indirect ... */
48cf252584Smiod	mov	r2, r5			/* to new mask arg */
493e492f6eSmiod2:
50*fc31befaSmiod	systrap SYS_sigprocmask
513f373d41Sguenther	bf	4f
52cf252584Smiod	mov	r6, r2			/* fetch old mask requested */
53cf252584Smiod	tst	r2, r2			/* test if old mask requested */
543f373d41Sguenther	bt	3f
55cf252584Smiod	mov.l	r0, @r2			/* store old mask */
563f373d41Sguenther3:
57cf252584Smiod	xor	r0, r0
58cf252584Smiod	rts
59cf252584Smiod	 nop
603f373d41Sguenther4:
61*fc31befaSmiod	SET_ERRNO_AND_RETURN(sigprocmask)
62*fc31befaSmiod	systrap_data(SYS_sigprocmask)
63874d10f9SmiodSYSCALL_END_HIDDEN(sigprocmask)
64