1*502c6211Suebayasi/* $NetBSD: compat_sigprocmask.S,v 1.3 2014/05/22 15:21:13 uebayasi Exp $ */ 2ccfab6beSchristos 3ccfab6beSchristos/*- 4ccfab6beSchristos * Copyright (c) 1990 The Regents of the University of California. 5ccfab6beSchristos * All rights reserved. 6ccfab6beSchristos * 7ccfab6beSchristos * This code is derived from software contributed to Berkeley by 8ccfab6beSchristos * William Jolitz. 9ccfab6beSchristos * 10ccfab6beSchristos * Redistribution and use in source and binary forms, with or without 11ccfab6beSchristos * modification, are permitted provided that the following conditions 12ccfab6beSchristos * are met: 13ccfab6beSchristos * 1. Redistributions of source code must retain the above copyright 14ccfab6beSchristos * notice, this list of conditions and the following disclaimer. 15ccfab6beSchristos * 2. Redistributions in binary form must reproduce the above copyright 16ccfab6beSchristos * notice, this list of conditions and the following disclaimer in the 17ccfab6beSchristos * documentation and/or other materials provided with the distribution. 18ccfab6beSchristos * 3. Neither the name of the University nor the names of its contributors 19ccfab6beSchristos * may be used to endorse or promote products derived from this software 20ccfab6beSchristos * without specific prior written permission. 21ccfab6beSchristos * 22ccfab6beSchristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23ccfab6beSchristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24ccfab6beSchristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25ccfab6beSchristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26ccfab6beSchristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27ccfab6beSchristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28ccfab6beSchristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29ccfab6beSchristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30ccfab6beSchristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31ccfab6beSchristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32ccfab6beSchristos * SUCH DAMAGE. 33ccfab6beSchristos * 34ccfab6beSchristos * from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90 35ccfab6beSchristos */ 36ccfab6beSchristos 37ccfab6beSchristos#include <machine/asm.h> 38ccfab6beSchristos#if defined(SYSLIBC_SCCS) && !defined(lint) 39*502c6211Suebayasi RCSID("$NetBSD: compat_sigprocmask.S,v 1.3 2014/05/22 15:21:13 uebayasi Exp $") 40ccfab6beSchristos#endif /* SYSLIBC_SCCS and not lint */ 41ccfab6beSchristos 42ccfab6beSchristos#include "SYS.h" 43ccfab6beSchristos 44ccfab6beSchristosWARN_REFERENCES(sigprocmask, \ 45ccfab6beSchristos "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference") 46ccfab6beSchristos 47ccfab6beSchristosENTRY(sigprocmask) 48ccfab6beSchristos testq %rsi,%rsi # check new sigset pointer 49ccfab6beSchristos jnz 1f # if not null, indirect 50ccfab6beSchristos movl $1,%edi # SIG_BLOCK 51ccfab6beSchristos jmp 2f 52ccfab6beSchristos1: movl (%rsi),%esi # fetch indirect ... 53ccfab6beSchristos2: SYSTRAP(compat_13_sigprocmask13) 54ccfab6beSchristos jc err 55ccfab6beSchristos testq %rdx,%rdx # test if old mask requested 56ccfab6beSchristos jz out 57ccfab6beSchristos movq %rax,(%rdx) # store old mask 58ccfab6beSchristosout: 59ccfab6beSchristos xorl %eax,%eax 60ccfab6beSchristos ret 61ccfab6beSchristoserr: 624d12bfcdSjoerg#ifdef __PIC__ 63ccfab6beSchristos movq PIC_GOT(CERROR), %rcx 64ccfab6beSchristos jmp *%rcx 65ccfab6beSchristos#else 66ccfab6beSchristos jmp CERROR 67ccfab6beSchristos#endif 68*502c6211SuebayasiEND(sigprocmask) 69