1/* $OpenBSD: sigprocmask.S,v 1.4 2020/10/16 23:42:16 deraadt 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 33SYSENTRY_HIDDEN(sigprocmask) 34 RETGUARD_SETUP(sigprocmask, %r11) 35 li %r0, SYS_sigprocmask 36 37 stdu %r1, -32(%r1) 38 std %r5, 16(%r1) 39 40 /* check set (new mask value) for null, in which case 41 fiddle arguments */ 42 cmpdi %r4, 0 43 bne+ .L_load_set 44 addi %r3, 0, 1 /* how = SIG_BLOCK, new mask already 0 */ 45 b .L_do_call 46.L_load_set: 47 lwz %r4, 0(%r4) /* get new mask */ 48.L_do_call: 49 50 sc 51 52 /* didnt work? */ 53 cmpwi %r0, 0 54 beq+ .L_sigprocmask_ok 55 stw %r0, R13_OFFSET_ERRNO(%r13) 56 li %r3, -1 57 b .L_end 58 59.L_sigprocmask_ok: 60 ld %r5, 16(%r1) 61 cmpdi %r5, 0 62 beq+ .L_sigprocmask_done 63 stw %r3, 0(%r5) 64.L_sigprocmask_done: 65 li %r3, 0 66 addi %r1, %r1, 32 67.L_end: 68 RETGUARD_CHECK(sigprocmask, %r11) 69 blr 70SYSCALL_END_HIDDEN(sigprocmask) 71