sigprocmask.S revision 1.2
1/* $OpenBSD: sigprocmask.S,v 1.2 2020/06/26 10:31:44 kettenis Exp $ */
2
3/*
4 * Copyright (c) 1996 Dale Rahn
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28/* sigprocmask(int how, const sigset_t *set, sigset_t *oset); */
29
30#include "SYS.h"
31
32	.text
33PREFIX_HIDDEN(sigprocmask)
34	stdu	%r1, -32(%r1)
35	stw	%r5, 16(%r1)
36
37	/* check set (new mask value) for null, in which case
38	   fiddle arguments */
39	cmpwi	%r4, 0
40	bne+	.L_load_set
41	addi	%r3, 0, 1	/* how = SIG_BLOCK, new mask already 0 */
42	b .L_do_call
43.L_load_set:
44	lwz	%r4, 0(%r4)	/* get new mask */
45.L_do_call:
46
47	sc
48
49	/* didnt work? */
50	cmpwi	%r0, 0
51	beq+	.L_sigprocmask_ok
52	stw	%r0, R13_OFFSET_ERRNO(%r13)
53	li	%r3, -1
54	blr
55
56.L_sigprocmask_ok:
57	lwz	%r5, 16(%r1)
58	cmpwi	%r5, 0
59	beq+	.L_sigprocmask_done
60	stw	%r3, 0(%r5)
61.L_sigprocmask_done:
62	li	%r3, 0
63	addi	%r1, %r1, 32
64	blr
65SYSCALL_END_HIDDEN(sigprocmask)
66