_setjmp.S revision 5790
190792Sgshapiro/*- 2168515Sgshapiro * Copyright (c) 1990 The Regents of the University of California. 390792Sgshapiro * All rights reserved. 490792Sgshapiro * 590792Sgshapiro * This code is derived from software contributed to Berkeley by 690792Sgshapiro * William Jolitz. 790792Sgshapiro * 890792Sgshapiro * Redistribution and use in source and binary forms, with or without 990792Sgshapiro * modification, are permitted provided that the following conditions 1090792Sgshapiro * are met: 1190792Sgshapiro * 1. Redistributions of source code must retain the above copyright 12168515Sgshapiro * notice, this list of conditions and the following disclaimer. 1390792Sgshapiro * 2. Redistributions in binary form must reproduce the above copyright 1490792Sgshapiro * notice, this list of conditions and the following disclaimer in the 1590792Sgshapiro * documentation and/or other materials provided with the distribution. 1690792Sgshapiro * 3. All advertising materials mentioning features or use of this software 1790792Sgshapiro * must display the following acknowledgement: 1890792Sgshapiro * This product includes software developed by the University of 1990792Sgshapiro * California, Berkeley and its contributors. 2090792Sgshapiro * 4. Neither the name of the University nor the names of its contributors 2190792Sgshapiro * may be used to endorse or promote products derived from this software 2290792Sgshapiro * without specific prior written permission. 2390792Sgshapiro * 2490792Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2590792Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2690792Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2790792Sgshapiro * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2890792Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2990792Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3090792Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3190792Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3290792Sgshapiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3390792Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3490792Sgshapiro * SUCH DAMAGE. 3590792Sgshapiro * 3690792Sgshapiro * $Id$ 3790792Sgshapiro */ 3890792Sgshapiro 3990792Sgshapiro#if defined(LIBC_RCS) && !defined(lint) 4090792Sgshapiro .text 4190792Sgshapiro .asciz "$Id$" 4290792Sgshapiro#endif /* LIBC_RCS and not lint */ 4390792Sgshapiro 4490792Sgshapiro/* 4590792Sgshapiro * C library -- _setjmp, _longjmp 4690792Sgshapiro * 4790792Sgshapiro * _longjmp(a,v) 4890792Sgshapiro * will generate a "return(v)" from the last call to 4990792Sgshapiro * _setjmp(a) 5090792Sgshapiro * by restoring registers from the environment 'a'. 5190792Sgshapiro * The previous signal state is NOT restored. 5290792Sgshapiro */ 5390792Sgshapiro 5490792Sgshapiro#include "DEFS.h" 5590792Sgshapiro 5690792SgshapiroENTRY(_setjmp) 5790792Sgshapiro movl 4(%esp),%eax 5890792Sgshapiro movl 0(%esp),%edx 5990792Sgshapiro movl %edx, 0(%eax) /* rta */ 6090792Sgshapiro movl %ebx, 4(%eax) 6190792Sgshapiro movl %esp, 8(%eax) 6290792Sgshapiro movl %ebp,12(%eax) 6390792Sgshapiro movl %esi,16(%eax) 6490792Sgshapiro movl %edi,20(%eax) 6590792Sgshapiro fnstcw 28(%eax) 6690792Sgshapiro xorl %eax,%eax 6790792Sgshapiro ret 6890792Sgshapiro 6990792SgshapiroENTRY(_longjmp) 7090792Sgshapiro movl 4(%esp),%edx 7190792Sgshapiro movl 8(%esp),%eax 7290792Sgshapiro movl 0(%edx),%ecx 7390792Sgshapiro movl 4(%edx),%ebx 7490792Sgshapiro movl 8(%edx),%esp 7590792Sgshapiro movl 12(%edx),%ebp 7690792Sgshapiro movl 16(%edx),%esi 7790792Sgshapiro movl 20(%edx),%edi 7890792Sgshapiro fninit 7990792Sgshapiro fldcw 28(%edx) 8090792Sgshapiro testl %eax,%eax 8190792Sgshapiro jnz 1f 8290792Sgshapiro incl %eax 8390792Sgshapiro1: movl %ecx,0(%esp) 8490792Sgshapiro ret 8590792Sgshapiro