11849Swollman/*- 21849Swollman * Copyright (c) 1990 The Regents of the University of California. 31849Swollman * All rights reserved. 41849Swollman * 51849Swollman * This code is derived from software contributed to Berkeley by 61849Swollman * William Jolitz. 71849Swollman * 81849Swollman * Redistribution and use in source and binary forms, with or without 91849Swollman * modification, are permitted provided that the following conditions 101849Swollman * are met: 111849Swollman * 1. Redistributions of source code must retain the above copyright 121849Swollman * notice, this list of conditions and the following disclaimer. 131849Swollman * 2. Redistributions in binary form must reproduce the above copyright 141849Swollman * notice, this list of conditions and the following disclaimer in the 151849Swollman * documentation and/or other materials provided with the distribution. 161849Swollman * 4. Neither the name of the University nor the names of its contributors 171849Swollman * may be used to endorse or promote products derived from this software 181849Swollman * without specific prior written permission. 191849Swollman * 201849Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211849Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221849Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231849Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241849Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251849Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261849Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271849Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281849Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291849Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301849Swollman * SUCH DAMAGE. 3192999Sobrien * 3292999Sobrien * @(#)setjmp.s 5.1 (Berkeley) 4/23/90" 331849Swollman */ 341849Swollman 3592999Sobrien#if defined(LIBC_SCCS) && !defined(lint) 365790Sdg .text 3792999Sobrien .asciz "$Id: sigsetjmp.S,v 1.1 1993/12/05 13:01:05 ats Exp $" 3892999Sobrien#endif /* LIBC_SCCS and not lint */ 3992999Sobrien#include <machine/asm.h> 4092999Sobrien__FBSDID("$FreeBSD$"); 411849Swollman 421849Swollman#include "SYS.h" 431849Swollman 443851Sbde/*- 453851Sbde * TODO: 463851Sbde * Rename sigsetjmp to __sigsetjmp and siglongjmp to __siglongjmp, 473851Sbde * remove the other *jmp functions and define everything in terms 483851Sbde * of the renamed functions. This requires compiler support for 493851Sbde * the renamed functions (introduced in gcc-2.5.3; previous versions 503851Sbde * only supported *jmp with 0 or 1 leading underscores). 513851Sbde * 523851Sbde * Restore _all_ the registers and the signal mask atomically. Can 533851Sbde * use sigreturn() if sigreturn() works. 543851Sbde */ 553851Sbde 5656345SjasoneENTRY(sigsetjmp) 571849Swollman movl 8(%esp),%eax 5851794Smarcel movl 4(%esp),%ecx 5951794Smarcel movl %eax,44(%ecx) 601849Swollman testl %eax,%eax 6115731Sjdp jz 2f 6251794Smarcel leal 28(%ecx), %eax 6351794Smarcel pushl %eax /* (sigset_t*)oset */ 6451794Smarcel pushl $0 /* (sigset_t*)set */ 6551794Smarcel pushl $1 /* SIG_BLOCK */ 66287480Skib call __libc_sigprocmask 6751794Smarcel addl $12,%esp 6851794Smarcel movl 4(%esp),%ecx 6915731Sjdp2: movl 0(%esp),%edx 701849Swollman movl %edx, 0(%ecx) 711849Swollman movl %ebx, 4(%ecx) 721849Swollman movl %esp, 8(%ecx) 731849Swollman movl %ebp,12(%ecx) 741849Swollman movl %esi,16(%ecx) 751849Swollman movl %edi,20(%ecx) 7651794Smarcel fnstcw 24(%ecx) 771849Swollman xorl %eax,%eax 781849Swollman ret 79184548SpeterEND(sigsetjmp) 801849Swollman 8171579Sdeischen .weak CNAME(siglongjmp); 82184548Speter .set CNAME(siglongjmp),CNAME(__siglongjmp) 83184548SpeterENTRY(__siglongjmp) 841849Swollman movl 4(%esp),%edx 8551794Smarcel cmpl $0,44(%edx) 8615731Sjdp jz 2f 8751794Smarcel pushl $0 /* (sigset_t*)oset */ 8851794Smarcel leal 28(%edx), %eax 8951794Smarcel pushl %eax /* (sigset_t*)set */ 9051794Smarcel pushl $3 /* SIG_SETMASK */ 91287480Skib call __libc_sigprocmask 9251794Smarcel addl $12,%esp 9351794Smarcel movl 4(%esp),%edx 9451794Smarcel2: movl 8(%esp),%eax 951849Swollman movl 0(%edx),%ecx 961849Swollman movl 4(%edx),%ebx 971849Swollman movl 8(%edx),%esp 981849Swollman movl 12(%edx),%ebp 991849Swollman movl 16(%edx),%esi 1001849Swollman movl 20(%edx),%edi 1013851Sbde fninit 10251794Smarcel fldcw 24(%edx) 1031849Swollman testl %eax,%eax 10415731Sjdp jnz 1f 1051849Swollman incl %eax 10615731Sjdp1: movl %ecx,0(%esp) 1071849Swollman ret 108184548SpeterEND(__siglongjmp) 109217106Skib 110217106Skib .section .note.GNU-stack,"",%progbits 111