xref: /netbsd-src/lib/libc/compat/arch/sh3/sys/compat_sigprocmask.S (revision dc6b340eff3ab633f199e2c19c05f790e4d8c6a9)
1*dc6b340eSuwe/*	$NetBSD: compat_sigprocmask.S,v 1.3 2006/01/06 04:08:47 uwe Exp $	*/
2bdfc6e2eSuwe
3bdfc6e2eSuwe/*-
4bdfc6e2eSuwe * Copyright (c) 1990 The Regents of the University of California.
5bdfc6e2eSuwe * All rights reserved.
6bdfc6e2eSuwe *
7bdfc6e2eSuwe * This code is derived from software contributed to Berkeley by
8bdfc6e2eSuwe * William Jolitz.
9bdfc6e2eSuwe *
10bdfc6e2eSuwe * Redistribution and use in source and binary forms, with or without
11bdfc6e2eSuwe * modification, are permitted provided that the following conditions
12bdfc6e2eSuwe * are met:
13bdfc6e2eSuwe * 1. Redistributions of source code must retain the above copyright
14bdfc6e2eSuwe *    notice, this list of conditions and the following disclaimer.
15bdfc6e2eSuwe * 2. Redistributions in binary form must reproduce the above copyright
16bdfc6e2eSuwe *    notice, this list of conditions and the following disclaimer in the
17bdfc6e2eSuwe *    documentation and/or other materials provided with the distribution.
18bdfc6e2eSuwe * 3. Neither the name of the University nor the names of its contributors
19bdfc6e2eSuwe *    may be used to endorse or promote products derived from this software
20bdfc6e2eSuwe *    without specific prior written permission.
21bdfc6e2eSuwe *
22bdfc6e2eSuwe * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23bdfc6e2eSuwe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24bdfc6e2eSuwe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25bdfc6e2eSuwe * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26bdfc6e2eSuwe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27bdfc6e2eSuwe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28bdfc6e2eSuwe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29bdfc6e2eSuwe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30bdfc6e2eSuwe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31bdfc6e2eSuwe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32bdfc6e2eSuwe * SUCH DAMAGE.
33bdfc6e2eSuwe *
34bdfc6e2eSuwe *	from: @(#)sigprocmask.s	5.2 (Berkeley) 12/17/90
35bdfc6e2eSuwe */
36bdfc6e2eSuwe
37bdfc6e2eSuwe#include <machine/asm.h>
38bdfc6e2eSuwe#if defined(SYSLIBC_SCCS) && !defined(lint)
39*dc6b340eSuwe	RCSID("$NetBSD: compat_sigprocmask.S,v 1.3 2006/01/06 04:08:47 uwe Exp $")
40bdfc6e2eSuwe#endif /* SYSLIBC_SCCS and not lint */
41bdfc6e2eSuwe
42bdfc6e2eSuwe#include "SYS.h"
43bdfc6e2eSuwe
44bdfc6e2eSuweWARN_REFERENCES(sigprocmask, \
45bdfc6e2eSuwe    "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
46bdfc6e2eSuwe
47*dc6b340eSuwe/*
48*dc6b340eSuwe * int
49*dc6b340eSuwe * sigprocmask(int how, const sigset_t * restrict set,
50*dc6b340eSuwe *     sigset_t * restrict oset);
51*dc6b340eSuwe */
52bdfc6e2eSuweENTRY(sigprocmask)
53*dc6b340eSuwe	tst	r5, r5			/* set == NULL? */
54*dc6b340eSuwe	bf	1f
55*dc6b340eSuwe
56*dc6b340eSuwe	bra	2f			/* r5 (new mask) is already zero */
57*dc6b340eSuwe	 mov	#1, r4			/* how = SIG_BLOCK */
58*dc6b340eSuwe
59*dc6b340eSuwe1:	mov.l	@r5, r5			/* fetch new mask */
60*dc6b340eSuwe
61*dc6b340eSuwe2:	mov	#SYS_compat_13_sigprocmask13, r0
62bdfc6e2eSuwe	trapa	#0x80
63bdfc6e2eSuwe	bf	err
64*dc6b340eSuwe
65*dc6b340eSuwe	tst	r6, r6			/* oset == NULL? */
66*dc6b340eSuwe	bt	3f
67*dc6b340eSuwe	mov.l	r0, @r6			/* store old mask */
68*dc6b340eSuwe3:	rts
69*dc6b340eSuwe	 mov	#0, r0
70*dc6b340eSuwe
71bdfc6e2eSuweerr:
72b46734f0Suwe	JUMP_CERROR
73bdfc6e2eSuwe
74b46734f0Suwe	SET_ENTRY_SIZE(sigprocmask)
75