xref: /netbsd-src/lib/libc/compat/arch/i386/sys/compat_sigprocmask.S (revision 0d34bfa26d596b4f9bcb49175a92020d91572850)
1*0d34bfa2Suebayasi/*	$NetBSD: compat_sigprocmask.S,v 1.3 2014/05/23 02:34:33 uebayasi Exp $	*/
25b84b398Schristos
35b84b398Schristos/*-
45b84b398Schristos * Copyright (c) 1990 The Regents of the University of California.
55b84b398Schristos * All rights reserved.
65b84b398Schristos *
75b84b398Schristos * This code is derived from software contributed to Berkeley by
85b84b398Schristos * William Jolitz.
95b84b398Schristos *
105b84b398Schristos * Redistribution and use in source and binary forms, with or without
115b84b398Schristos * modification, are permitted provided that the following conditions
125b84b398Schristos * are met:
135b84b398Schristos * 1. Redistributions of source code must retain the above copyright
145b84b398Schristos *    notice, this list of conditions and the following disclaimer.
155b84b398Schristos * 2. Redistributions in binary form must reproduce the above copyright
165b84b398Schristos *    notice, this list of conditions and the following disclaimer in the
175b84b398Schristos *    documentation and/or other materials provided with the distribution.
185b84b398Schristos * 3. Neither the name of the University nor the names of its contributors
195b84b398Schristos *    may be used to endorse or promote products derived from this software
205b84b398Schristos *    without specific prior written permission.
215b84b398Schristos *
225b84b398Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
235b84b398Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
245b84b398Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
255b84b398Schristos * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
265b84b398Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
275b84b398Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
285b84b398Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
295b84b398Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
305b84b398Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
315b84b398Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
325b84b398Schristos * SUCH DAMAGE.
335b84b398Schristos *
345b84b398Schristos *	from: @(#)sigprocmask.s	5.2 (Berkeley) 12/17/90
355b84b398Schristos */
365b84b398Schristos
375b84b398Schristos#include <machine/asm.h>
385b84b398Schristos#if defined(SYSLIBC_SCCS) && !defined(lint)
39*0d34bfa2Suebayasi	RCSID("$NetBSD: compat_sigprocmask.S,v 1.3 2014/05/23 02:34:33 uebayasi Exp $")
405b84b398Schristos#endif /* SYSLIBC_SCCS and not lint */
415b84b398Schristos
425b84b398Schristos#include "SYS.h"
435b84b398Schristos
445b84b398SchristosWARN_REFERENCES(sigprocmask, \
455b84b398Schristos    "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
465b84b398Schristos
475b84b398SchristosENTRY(sigprocmask)
485b84b398Schristos	movl	8(%esp),%ecx		# fetch new sigset pointer
495b84b398Schristos	testl	%ecx,%ecx		# check new sigset pointer
505b84b398Schristos	jnz	1f			# if not null, indirect
515b84b398Schristos/*	movl	$0,8(%esp)		# null mask pointer: block empty set */
525b84b398Schristos	movl	$1,4(%esp)		# SIG_BLOCK
535b84b398Schristos	jmp	2f
545b84b398Schristos1:	movl	(%ecx),%ecx		# fetch indirect  ...
555b84b398Schristos	movl	%ecx,8(%esp)		# to new mask arg
565b84b398Schristos2:	SYSTRAP(compat_13_sigprocmask13)
575b84b398Schristos	jc	err
585b84b398Schristos	movl	12(%esp),%ecx		# fetch old mask requested
595b84b398Schristos	testl	%ecx,%ecx		# test if old mask requested
605b84b398Schristos	jz	out
615b84b398Schristos	movl	%eax,(%ecx)		# store old mask
625b84b398Schristosout:
635b84b398Schristos	xorl	%eax,%eax
645b84b398Schristos	ret
655b84b398Schristoserr:
664d12bfcdSjoerg#ifdef __PIC__
675b84b398Schristos	PIC_PROLOGUE
685b84b398Schristos	mov	PIC_GOT(CERROR), %ecx
695b84b398Schristos	PIC_EPILOGUE
705b84b398Schristos	jmp	*%ecx
715b84b398Schristos#else
725b84b398Schristos	jmp	CERROR
735b84b398Schristos#endif
74*0d34bfa2SuebayasiEND(sigprocmask)
75