_setjmp.S revision 43932
10SN/A/*- 20SN/A * Copyright (c) 1990 The Regents of the University of California. 30SN/A * All rights reserved. 40SN/A * 50SN/A * This code is derived from software contributed to Berkeley by 61113Sjoehw * William Jolitz. 71113Sjoehw * 81113Sjoehw * Redistribution and use in source and binary forms, with or without 91113Sjoehw * modification, are permitted provided that the following conditions 101113Sjoehw * are met: 111113Sjoehw * 1. Redistributions of source code must retain the above copyright 120SN/A * notice, this list of conditions and the following disclaimer. 131113Sjoehw * 2. Redistributions in binary form must reproduce the above copyright 140SN/A * notice, this list of conditions and the following disclaimer in the 150SN/A * documentation and/or other materials provided with the distribution. 160SN/A * 3. All advertising materials mentioning features or use of this software 170SN/A * must display the following acknowledgement: 180SN/A * This product includes software developed by the University of 190SN/A * California, Berkeley and its contributors. 200SN/A * 4. Neither the name of the University nor the names of its contributors 211113Sjoehw * may be used to endorse or promote products derived from this software 220SN/A * without specific prior written permission. 230SN/A * 240SN/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 250SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 260SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 270SN/A * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 280SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 290SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 300SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 310SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 320SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 330SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 340SN/A * SUCH DAMAGE. 350SN/A * 360SN/A * $Id: _setjmp.S,v 1.7 1998/04/29 09:14:35 jb Exp $ 370SN/A */ 380SN/A 390SN/A#if defined(LIBC_RCS) && !defined(lint) 400SN/A .text 410SN/A .asciz "$Id: _setjmp.S,v 1.7 1998/04/29 09:14:35 jb Exp $" 420SN/A#endif /* LIBC_RCS and not lint */ 430SN/A 440SN/A/* 450SN/A * C library -- _setjmp, _longjmp 460SN/A * 47 * _longjmp(a,v) 48 * will generate a "return(v)" from the last call to 49 * _setjmp(a) 50 * by restoring registers from the environment 'a'. 51 * The previous signal state is NOT restored. 52 */ 53 54#include "DEFS.h" 55 56ENTRY(_setjmp) 57 movl 4(%esp),%eax 58 movl 0(%esp),%edx 59 movl %edx, 0(%eax) /* rta */ 60 movl %ebx, 4(%eax) 61 movl %esp, 8(%eax) 62 movl %ebp,12(%eax) 63 movl %esi,16(%eax) 64 movl %edi,20(%eax) 65 fnstcw 28(%eax) 66 xorl %eax,%eax 67 ret 68 69ENTRY(_longjmp) 70 movl 4(%esp),%edx 71 movl 8(%esp),%eax 72 movl 0(%edx),%ecx 73 movl 4(%edx),%ebx 74 movl 8(%edx),%esp 75 movl 12(%edx),%ebp 76 movl 16(%edx),%esi 77 movl 20(%edx),%edi 78 fninit 79 fldcw 28(%edx) 80 testl %eax,%eax 81 jnz 1f 82 incl %eax 831: movl %ecx,0(%esp) 84 ret 85