/*-1* Copyright (c) 1990 The Regents of the University of California.2* All rights reserved.3*4* This code is derived from software contributed to Berkeley by5* William Jolitz.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15* 3. Neither the name of the University nor the names of its contributors16* may be used to endorse or promote products derived from this software17* without specific prior written permission.18*19* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND20* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE21* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE22* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE23* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL24* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS25* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT27* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY28* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF29* SUCH DAMAGE.30*/3132#if defined(LIBC_SCCS) && !defined(lint)33.text34.asciz "$Id: sigsetjmp.S,v 1.1 1993/12/05 13:01:05 ats Exp $"35#endif /* LIBC_SCCS and not lint */36#include <machine/asm.h>37#include "SYS.h"3839/*-40* TODO:41* Rename sigsetjmp to __sigsetjmp and siglongjmp to __siglongjmp,42* remove the other *jmp functions and define everything in terms43* of the renamed functions. This requires compiler support for44* the renamed functions (introduced in gcc-2.5.3; previous versions45* only supported *jmp with 0 or 1 leading underscores).46*47* Restore _all_ the registers and the signal mask atomically. Can48* use sigreturn() if sigreturn() works.49*/5051ENTRY(sigsetjmp)52movl 8(%esp),%eax53movl 4(%esp),%ecx54movl %eax,44(%ecx)55testl %eax,%eax56jz 2f57leal 28(%ecx), %eax58pushl %eax /* (sigset_t*)oset */59pushl $0 /* (sigset_t*)set */60pushl $1 /* SIG_BLOCK */61call __libc_sigprocmask62addl $12,%esp63movl 4(%esp),%ecx642: movl 0(%esp),%edx65movl %edx, 0(%ecx)66movl %ebx, 4(%ecx)67movl %esp, 8(%ecx)68movl %ebp,12(%ecx)69movl %esi,16(%ecx)70movl %edi,20(%ecx)71fnstcw 24(%ecx)72xorl %eax,%eax73ret74END(sigsetjmp)7576WEAK_REFERENCE(__siglongjmp, siglongjmp)77ENTRY(__siglongjmp)78movl 4(%esp),%edx79cmpl $0,44(%edx)80jz 2f81pushl $0 /* (sigset_t*)oset */82leal 28(%edx), %eax83pushl %eax /* (sigset_t*)set */84pushl $3 /* SIG_SETMASK */85call __libc_sigprocmask86addl $12,%esp87movl 4(%esp),%edx882: movl 8(%esp),%eax89movl 0(%edx),%ecx90movl 4(%edx),%ebx91movl 8(%edx),%esp92movl 12(%edx),%ebp93movl 16(%edx),%esi94movl 20(%edx),%edi95fldcw 24(%edx)96testl %eax,%eax97jnz 1f98incl %eax991: movl %ecx,0(%esp)100ret101END(__siglongjmp)102103.section .note.GNU-stack,"",%progbits104105106