186535Sjake/* 286535Sjake * Copyright (c) 1992, 1993 386535Sjake * The Regents of the University of California. All rights reserved. 486535Sjake * 586535Sjake * This software was developed by the Computer Systems Engineering group 686535Sjake * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 786535Sjake * contributed to Berkeley. 886535Sjake * 986535Sjake * Redistribution and use in source and binary forms, with or without 1086535Sjake * modification, are permitted provided that the following conditions 1186535Sjake * are met: 1286535Sjake * 1. Redistributions of source code must retain the above copyright 1386535Sjake * notice, this list of conditions and the following disclaimer. 1486535Sjake * 2. Redistributions in binary form must reproduce the above copyright 1586535Sjake * notice, this list of conditions and the following disclaimer in the 1686535Sjake * documentation and/or other materials provided with the distribution. 1786535Sjake * 4. Neither the name of the University nor the names of its contributors 1886535Sjake * may be used to endorse or promote products derived from this software 1986535Sjake * without specific prior written permission. 2086535Sjake * 2186535Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2286535Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2386535Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2486535Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2586535Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2686535Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2786535Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2886535Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2986535Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3086535Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3186535Sjake * SUCH DAMAGE. 3286535Sjake * 3386535Sjake * from: Header: _setjmp.s,v 1.1 91/07/06 16:45:53 torek Exp 3486535Sjake */ 3586535Sjake 3686535Sjake#if defined(LIBC_SCCS) && !defined(lint) 3799018Sobrien .asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93" 3886535Sjake#if 0 3986535Sjake RCSID("$NetBSD: _setjmp.S,v 1.4 1998/10/08 02:27:59 eeh Exp $") 4086535Sjake#endif 4186535Sjake#endif /* LIBC_SCCS and not lint */ 4286535Sjake#include <machine/asm.h> 4399018Sobrien__FBSDID("$FreeBSD$"); 4486535Sjake 4586535Sjake#include "assym.s" 4686535Sjake 4788612Sjake .register %g2,#ignore 4888612Sjake .register %g3,#ignore 4988612Sjake 5086535Sjake/* 5186535Sjake * C library -- setjmp, longjmp 5286535Sjake * 5386535Sjake * longjmp(a,v) 5486535Sjake * will generate a "return(v?v:1)" from 5586535Sjake * the last call to 5686535Sjake * setjmp(a) 5786535Sjake * by restoring the previous context. 5886535Sjake */ 5986535Sjake 6086535SjakeENTRY(setjmp) 6188612Sjake save %sp, -CCFSZ, %sp 6288612Sjake mov SIG_BLOCK, %o0 6386535Sjake clr %o1 6486535Sjake call CNAME(sigprocmask) 6588612Sjake add %i0, _JB_SIGMASK, %o2 6688612Sjake restore 6788612Sjake stx %sp, [%o0 + _JB_SP] 6888612Sjake stx %o7, [%o0 + _JB_PC] 6988612Sjake retl 7088612Sjake clr %o0 7186535SjakeEND(setjmp) 7286535Sjake 7386535Sjake .weak CNAME(longjmp) 7486535Sjake .set CNAME(longjmp),CNAME(__longjmp) 7586535SjakeENTRY(__longjmp) 7688612Sjake save %sp, -CCFSZ, %sp 77108738Stmm flushw 7888612Sjake mov SIG_SETMASK, %o0 7988612Sjake add %i0, _JB_SIGMASK, %o1 8088612Sjake call CNAME(sigprocmask) 8188612Sjake clr %o2 82108738Stmm ldx [%i0 + _JB_SP], %fp 83108738Stmm ldx [%i0 + _JB_PC], %i7 84108738Stmm mov 1, %i0 85108738Stmm movrnz %i1, %i1, %i0 86108738Stmm ret 8788612Sjake restore 8886535SjakeEND(__longjmp) 89