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 NOT restored. 471849Swollman */ 481849Swollman 4956345SjasoneENTRY(_setjmp) 501849Swollman movl 4(%esp),%eax 511849Swollman movl 0(%esp),%edx 521849Swollman movl %edx, 0(%eax) /* rta */ 531849Swollman movl %ebx, 4(%eax) 541849Swollman movl %esp, 8(%eax) 551849Swollman movl %ebp,12(%eax) 561849Swollman movl %esi,16(%eax) 571849Swollman movl %edi,20(%eax) 5851794Smarcel fnstcw 24(%eax) 591849Swollman xorl %eax,%eax 601849Swollman ret 61184548SpeterEND(_setjmp) 621849Swollman 6371579Sdeischen .weak CNAME(_longjmp) 6471579Sdeischen .set CNAME(_longjmp),CNAME(___longjmp) 6556345SjasoneENTRY(___longjmp) 661849Swollman movl 4(%esp),%edx 671849Swollman movl 8(%esp),%eax 681849Swollman movl 0(%edx),%ecx 691849Swollman movl 4(%edx),%ebx 701849Swollman movl 8(%edx),%esp 711849Swollman movl 12(%edx),%ebp 721849Swollman movl 16(%edx),%esi 731849Swollman movl 20(%edx),%edi 7451794Smarcel fldcw 24(%edx) 751849Swollman testl %eax,%eax 761849Swollman jnz 1f 771849Swollman incl %eax 781849Swollman1: movl %ecx,0(%esp) 791849Swollman ret 80184548SpeterEND(___longjmp) 81217106Skib 82217106Skib .section .note.GNU-stack,"",%progbits 83