1*83762a71Sderaadt/* $OpenBSD: sigprocmask.S,v 1.5 2023/12/10 16:45:52 deraadt Exp $ */ 29674f442Sdrahn 39674f442Sdrahn/* 49674f442Sdrahn * Copyright (c) 1996 Dale Rahn 59674f442Sdrahn * 69674f442Sdrahn * Redistribution and use in source and binary forms, with or without 79674f442Sdrahn * modification, are permitted provided that the following conditions 89674f442Sdrahn * are met: 99674f442Sdrahn * 1. Redistributions of source code must retain the above copyright 109674f442Sdrahn * notice, this list of conditions and the following disclaimer. 119674f442Sdrahn * 2. Redistributions in binary form must reproduce the above copyright 129674f442Sdrahn * notice, this list of conditions and the following disclaimer in the 139674f442Sdrahn * documentation and/or other materials provided with the distribution. 149674f442Sdrahn * 159674f442Sdrahn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 169674f442Sdrahn * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 179674f442Sdrahn * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 189674f442Sdrahn * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 199674f442Sdrahn * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 209674f442Sdrahn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 219674f442Sdrahn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 229674f442Sdrahn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 239674f442Sdrahn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 249674f442Sdrahn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 259674f442Sdrahn * SUCH DAMAGE. 269674f442Sdrahn */ 279674f442Sdrahn 289674f442Sdrahn/* sigprocmask(int how, const sigset_t *set, sigset_t *oset); */ 299674f442Sdrahn 309674f442Sdrahn#include "SYS.h" 319674f442Sdrahn 329674f442Sdrahn .text 331a8dbaacSderaadtSYSENTRY_HIDDEN(sigprocmask) 341a8dbaacSderaadt RETGUARD_SETUP(sigprocmask, %r11) 351a8dbaacSderaadt li %r0, SYS_sigprocmask 361a8dbaacSderaadt 3743b3e2c9Skettenis stdu %r1, -32(%r1) 380d572986Skettenis std %r5, 16(%r1) 399674f442Sdrahn 409674f442Sdrahn /* check set (new mask value) for null, in which case 419674f442Sdrahn fiddle arguments */ 420d572986Skettenis cmpdi %r4, 0 439674f442Sdrahn bne+ .L_load_set 4443b3e2c9Skettenis addi %r3, 0, 1 /* how = SIG_BLOCK, new mask already 0 */ 459674f442Sdrahn b .L_do_call 469674f442Sdrahn.L_load_set: 4743b3e2c9Skettenis lwz %r4, 0(%r4) /* get new mask */ 489674f442Sdrahn.L_do_call: 499674f442Sdrahn 50*83762a71Sderaadt99: sc 51*83762a71Sderaadt PINSYSCALL(SYS_sigprocmask, 99b) 529674f442Sdrahn 539674f442Sdrahn /* didnt work? */ 5443b3e2c9Skettenis cmpwi %r0, 0 559674f442Sdrahn beq+ .L_sigprocmask_ok 5643b3e2c9Skettenis stw %r0, R13_OFFSET_ERRNO(%r13) 5743b3e2c9Skettenis li %r3, -1 581a8dbaacSderaadt b .L_end 599674f442Sdrahn 609674f442Sdrahn.L_sigprocmask_ok: 610d572986Skettenis ld %r5, 16(%r1) 620d572986Skettenis cmpdi %r5, 0 639674f442Sdrahn beq+ .L_sigprocmask_done 6443b3e2c9Skettenis stw %r3, 0(%r5) 659674f442Sdrahn.L_sigprocmask_done: 6643b3e2c9Skettenis li %r3, 0 6743b3e2c9Skettenis addi %r1, %r1, 32 681a8dbaacSderaadt.L_end: 691a8dbaacSderaadt RETGUARD_CHECK(sigprocmask, %r11) 709674f442Sdrahn blr 719674f442SdrahnSYSCALL_END_HIDDEN(sigprocmask) 72