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. 311849Swollman */ 321849Swollman 3392999Sobrien#if defined(LIBC_SCCS) && !defined(lint) 3492999Sobrien .asciz "@(#)setjmp.s 5.1 (Berkeley) 4/23/90" 3592999Sobrien#endif /* LIBC_SCCS and not lint */ 3692999Sobrien#include <machine/asm.h> 3792999Sobrien__FBSDID("$FreeBSD$"); 381849Swollman 391849Swollman/* 401849Swollman * C library -- _setjmp, _longjmp 411849Swollman * 421849Swollman * longjmp(a,v) 431849Swollman * will generate a "return(v)" from the last call to 441849Swollman * setjmp(a) 451849Swollman * by restoring registers from the environment 'a'. 461849Swollman * The previous signal state is restored. 471849Swollman */ 481849Swollman 491849Swollman#include "SYS.h" 501849Swollman 5156345SjasoneENTRY(setjmp) 5252083Smarcel movl 4(%esp),%ecx 5315634Speter PIC_PROLOGUE 54229009Skib#ifdef PIC 55229009Skib subl $12,%esp /* make the stack 16-byte aligned */ 56229009Skib#endif 5751794Smarcel leal 28(%ecx), %eax 5851794Smarcel pushl %eax /* (sigset_t*)oset */ 5951794Smarcel pushl $0 /* (sigset_t*)set */ 6051794Smarcel pushl $1 /* SIG_BLOCK */ 6171579Sdeischen call PIC_PLT(CNAME(_sigprocmask)) 62229009Skib#ifdef PIC 63229009Skib addl $24,%esp 64229009Skib#else 6551794Smarcel addl $12,%esp 66229009Skib#endif 6715634Speter PIC_EPILOGUE 6851794Smarcel movl 4(%esp),%ecx 691849Swollman 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(setjmp) 801849Swollman 8171579Sdeischen .weak CNAME(longjmp) 8271579Sdeischen .set CNAME(longjmp),CNAME(__longjmp) 8356345SjasoneENTRY(__longjmp) 841849Swollman movl 4(%esp),%edx 8515634Speter PIC_PROLOGUE 86229009Skib#ifdef PIC 87229009Skib subl $12,%esp /* make the stack 16-byte aligned */ 88229009Skib#endif 8951794Smarcel pushl $0 /* (sigset_t*)oset */ 9051794Smarcel leal 28(%edx), %eax 9151794Smarcel pushl %eax /* (sigset_t*)set */ 9251794Smarcel pushl $3 /* SIG_SETMASK */ 9371579Sdeischen call PIC_PLT(CNAME(_sigprocmask)) 94229009Skib#ifdef PIC 95229009Skib addl $24,%esp 96229009Skib#else 9751794Smarcel addl $12,%esp 98229009Skib#endif 9915634Speter PIC_EPILOGUE 1001849Swollman movl 4(%esp),%edx 1011849Swollman movl 8(%esp),%eax 1021849Swollman movl 0(%edx),%ecx 1031849Swollman movl 4(%edx),%ebx 1041849Swollman movl 8(%edx),%esp 1051849Swollman movl 12(%edx),%ebp 1061849Swollman movl 16(%edx),%esi 1071849Swollman movl 20(%edx),%edi 10851794Smarcel fldcw 24(%edx) 1091849Swollman testl %eax,%eax 1101849Swollman jnz 1f 1111849Swollman incl %eax 1121849Swollman1: movl %ecx,0(%esp) 1131849Swollman ret 114184548SpeterEND(__longjmp) 115217106Skib 116217106Skib .section .note.GNU-stack,"",%progbits 117