/*-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#include <machine/asm.h>33/*34* C library -- _setjmp, _longjmp35*36* longjmp(a,v)37* will generate a "return(v)" from the last call to38* setjmp(a)39* by restoring registers from the environment 'a'.40* The previous signal state is restored.41*/4243#include "SYS.h"4445ENTRY(setjmp)46movl 4(%esp),%ecx47leal 28(%ecx), %eax48pushl %eax /* (sigset_t*)oset */49pushl $0 /* (sigset_t*)set */50pushl $1 /* SIG_BLOCK */51call __libc_sigprocmask52addl $12,%esp53movl 4(%esp),%ecx54movl 0(%esp),%edx55movl %edx, 0(%ecx)56movl %ebx, 4(%ecx)57movl %esp, 8(%ecx)58movl %ebp,12(%ecx)59movl %esi,16(%ecx)60movl %edi,20(%ecx)61fnstcw 24(%ecx)62xorl %eax,%eax63ret64END(setjmp)6566WEAK_REFERENCE(__longjmp, longjmp)67ENTRY(__longjmp)68movl 4(%esp),%edx69pushl $0 /* (sigset_t*)oset */70leal 28(%edx), %eax71pushl %eax /* (sigset_t*)set */72pushl $3 /* SIG_SETMASK */73call __libc_sigprocmask74addl $12,%esp75movl 4(%esp),%edx76movl 8(%esp),%eax77movl 0(%edx),%ecx78movl 4(%edx),%ebx79movl 8(%edx),%esp80movl 12(%edx),%ebp81movl 16(%edx),%esi82movl 20(%edx),%edi83fldcw 24(%edx)84testl %eax,%eax85jnz 1f86incl %eax871: movl %ecx,0(%esp)88ret89END(__longjmp)9091.section .note.GNU-stack,"",%progbits929394