_setjmp.S revision 92999
1251875Speter/*- 2251875Speter * Copyright (c) 1990 The Regents of the University of California. 3251875Speter * All rights reserved. 4251875Speter * 5251875Speter * This code is derived from software contributed to Berkeley by 6251875Speter * William Jolitz. 7251875Speter * 8251875Speter * Redistribution and use in source and binary forms, with or without 9251875Speter * modification, are permitted provided that the following conditions 10251875Speter * are met: 11251875Speter * 1. Redistributions of source code must retain the above copyright 12251875Speter * notice, this list of conditions and the following disclaimer. 13251875Speter * 2. Redistributions in binary form must reproduce the above copyright 14251875Speter * notice, this list of conditions and the following disclaimer in the 15251875Speter * documentation and/or other materials provided with the distribution. 16251875Speter * 3. All advertising materials mentioning features or use of this software 17251875Speter * must display the following acknowledgement: 18251875Speter * This product includes software developed by the University of 19251875Speter * California, Berkeley and its contributors. 20251875Speter * 4. Neither the name of the University nor the names of its contributors 21251875Speter * may be used to endorse or promote products derived from this software 22251875Speter * without specific prior written permission. 23251875Speter * 24251875Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25251875Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26251875Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27251875Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28251875Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29251875Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30251875Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31251875Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32251875Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33251875Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34251875Speter * SUCH DAMAGE. 35251875Speter */ 36251875Speter 37251875Speter#if defined(LIBC_SCCS) && !defined(lint) 38251875Speter .asciz "@(#)_setjmp.s 5.1 (Berkeley) 4/23/90" 39251875Speter#endif /* LIBC_SCCS and not lint */ 40251875Speter#include <machine/asm.h> 41251875Speter__FBSDID("$FreeBSD: head/lib/libc/amd64/gen/_setjmp.S 92999 2002-03-23 02:10:28Z obrien $"); 42251875Speter 43251875Speter/* 44251875Speter * C library -- _setjmp, _longjmp 45251875Speter * 46251875Speter * _longjmp(a,v) 47251875Speter * will generate a "return(v)" from the last call to 48251875Speter * _setjmp(a) 49251875Speter * by restoring registers from the environment 'a'. 50251875Speter * The previous signal state is NOT restored. 51251875Speter */ 52251875Speter 53251875SpeterENTRY(_setjmp) 54251875Speter movl 4(%esp),%eax 55251875Speter movl 0(%esp),%edx 56251875Speter movl %edx, 0(%eax) /* rta */ 57251875Speter movl %ebx, 4(%eax) 58251875Speter movl %esp, 8(%eax) 59251875Speter movl %ebp,12(%eax) 60251875Speter movl %esi,16(%eax) 61251875Speter movl %edi,20(%eax) 62251875Speter fnstcw 24(%eax) 63251875Speter xorl %eax,%eax 64251875Speter ret 65251875Speter 66251875Speter .weak CNAME(_longjmp) 67251875Speter .set CNAME(_longjmp),CNAME(___longjmp) 68251875SpeterENTRY(___longjmp) 69251875Speter movl 4(%esp),%edx 70251875Speter movl 8(%esp),%eax 71251875Speter movl 0(%edx),%ecx 72251875Speter movl 4(%edx),%ebx 73251875Speter movl 8(%edx),%esp 74251875Speter movl 12(%edx),%ebp 75251875Speter movl 16(%edx),%esi 76251875Speter movl 20(%edx),%edi 77251875Speter fninit 78251875Speter fldcw 24(%edx) 79251875Speter testl %eax,%eax 80251875Speter jnz 1f 81251875Speter incl %eax 82251875Speter1: movl %ecx,0(%esp) 83251875Speter ret 84251875Speter