sigsetjmp.S revision 5790
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 * 3. All advertising materials mentioning features or use of this software 171849Swollman * must display the following acknowledgement: 181849Swollman * This product includes software developed by the University of 191849Swollman * California, Berkeley and its contributors. 201849Swollman * 4. Neither the name of the University nor the names of its contributors 211849Swollman * may be used to endorse or promote products derived from this software 221849Swollman * without specific prior written permission. 231849Swollman * 241849Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251849Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261849Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271849Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281849Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291849Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301849Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311849Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321849Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331849Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341849Swollman * SUCH DAMAGE. 351849Swollman * 365790Sdg * $Id: sigsetjmp.S,v 1.3 1994/12/27 13:34:04 bde Exp $ 371849Swollman */ 381849Swollman 395790Sdg#if defined(LIBC_RCS) && !defined(lint) 405790Sdg .text 415790Sdg .asciz "$Id: sigsetjmp.S,v 1.3 1994/12/27 13:34:04 bde Exp $" 425790Sdg#endif /* LIBC_RCS and not lint */ 431849Swollman 441849Swollman#include "DEFS.h" 451849Swollman#include "SYS.h" 461849Swollman 473851Sbde/*- 483851Sbde * TODO: 493851Sbde * Rename sigsetjmp to __sigsetjmp and siglongjmp to __siglongjmp, 503851Sbde * remove the other *jmp functions and define everything in terms 513851Sbde * of the renamed functions. This requires compiler support for 523851Sbde * the renamed functions (introduced in gcc-2.5.3; previous versions 533851Sbde * only supported *jmp with 0 or 1 leading underscores). 543851Sbde * 553851Sbde * Use sigprocmask() instead of sigblock() and sigsetmask(), and 563851Sbde * check for and handle errors. 573851Sbde * 583851Sbde * Restore _all_ the registers and the signal mask atomically. Can 593851Sbde * use sigreturn() if sigreturn() works. 603851Sbde */ 613851Sbde 621849SwollmanENTRY(sigsetjmp) 631849Swollman movl 8(%esp),%eax 641849Swollman movl 4(%esp),%ecx 653851Sbde movl %eax,32(%ecx) 661849Swollman testl %eax,%eax 671849Swollman jz 1f 681849Swollman pushl $0 691849Swollman call PIC_PLT(_sigblock) 701849Swollman addl $4,%esp 711849Swollman movl 4(%esp),%ecx 723851Sbde movl %eax,24(%ecx) 731849Swollman1: movl 0(%esp),%edx 741849Swollman movl %edx, 0(%ecx) 751849Swollman movl %ebx, 4(%ecx) 761849Swollman movl %esp, 8(%ecx) 771849Swollman movl %ebp,12(%ecx) 781849Swollman movl %esi,16(%ecx) 791849Swollman movl %edi,20(%ecx) 803851Sbde fnstcw 28(%ecx) 811849Swollman xorl %eax,%eax 821849Swollman ret 831849Swollman 841849SwollmanENTRY(siglongjmp) 851849Swollman movl 4(%esp),%edx 863851Sbde cmpl $0,32(%edx) 871849Swollman jz 1f 883851Sbde pushl 24(%edx) 891849Swollman call PIC_PLT(_sigsetmask) 901849Swollman addl $4,%esp 911849Swollman1: movl 4(%esp),%edx 921849Swollman movl 8(%esp),%eax 931849Swollman movl 0(%edx),%ecx 941849Swollman movl 4(%edx),%ebx 951849Swollman movl 8(%edx),%esp 961849Swollman movl 12(%edx),%ebp 971849Swollman movl 16(%edx),%esi 981849Swollman movl 20(%edx),%edi 993851Sbde fninit 1003851Sbde fldcw 28(%edx) 1011849Swollman testl %eax,%eax 1021849Swollman jnz 2f 1031849Swollman incl %eax 1041849Swollman2: movl %ecx,0(%esp) 1051849Swollman ret 106