1*4a5d661aSToomas Soome/* 2*4a5d661aSToomas Soome * Copyright (c) 1992, 1993 3*4a5d661aSToomas Soome * The Regents of the University of California. All rights reserved. 4*4a5d661aSToomas Soome * 5*4a5d661aSToomas Soome * This software was developed by the Computer Systems Engineering group 6*4a5d661aSToomas Soome * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7*4a5d661aSToomas Soome * contributed to Berkeley. 8*4a5d661aSToomas Soome * 9*4a5d661aSToomas Soome * Redistribution and use in source and binary forms, with or without 10*4a5d661aSToomas Soome * modification, are permitted provided that the following conditions 11*4a5d661aSToomas Soome * are met: 12*4a5d661aSToomas Soome * 1. Redistributions of source code must retain the above copyright 13*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer. 14*4a5d661aSToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 15*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer in the 16*4a5d661aSToomas Soome * documentation and/or other materials provided with the distribution. 17*4a5d661aSToomas Soome * 4. Neither the name of the University nor the names of its contributors 18*4a5d661aSToomas Soome * may be used to endorse or promote products derived from this software 19*4a5d661aSToomas Soome * without specific prior written permission. 20*4a5d661aSToomas Soome * 21*4a5d661aSToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22*4a5d661aSToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23*4a5d661aSToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24*4a5d661aSToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25*4a5d661aSToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26*4a5d661aSToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27*4a5d661aSToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28*4a5d661aSToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29*4a5d661aSToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30*4a5d661aSToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31*4a5d661aSToomas Soome * SUCH DAMAGE. 32*4a5d661aSToomas Soome * 33*4a5d661aSToomas Soome * $Header: _setjmp.s,v 1.1 91/07/06 16:45:53 torek Exp 34*4a5d661aSToomas Soome */ 35*4a5d661aSToomas Soome 36*4a5d661aSToomas Soome#if defined(LIBC_SCCS) && !defined(lint) 37*4a5d661aSToomas Soome#if 0 38*4a5d661aSToomas Soome .asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93" 39*4a5d661aSToomas Soome#else 40*4a5d661aSToomas Soome RCSID("$NetBSD: _setjmp.S,v 1.4 1998/10/08 02:27:59 eeh Exp $") 41*4a5d661aSToomas Soome#endif 42*4a5d661aSToomas Soome#endif /* LIBC_SCCS and not lint */ 43*4a5d661aSToomas Soome 44*4a5d661aSToomas Soome#include <machine/asm.h> 45*4a5d661aSToomas Soome__FBSDID("$FreeBSD$"); 46*4a5d661aSToomas Soome 47*4a5d661aSToomas Soome#define _JB_FP 0x0 48*4a5d661aSToomas Soome#define _JB_PC 0x8 49*4a5d661aSToomas Soome#define _JB_SP 0x10 50*4a5d661aSToomas Soome 51*4a5d661aSToomas Soome .register %g2,#ignore 52*4a5d661aSToomas Soome .register %g3,#ignore 53*4a5d661aSToomas Soome 54*4a5d661aSToomas Soome/* 55*4a5d661aSToomas Soome * C library -- setjmp, longjmp 56*4a5d661aSToomas Soome * 57*4a5d661aSToomas Soome * longjmp(a,v) 58*4a5d661aSToomas Soome * will generate a "return(v?v:1)" from 59*4a5d661aSToomas Soome * the last call to 60*4a5d661aSToomas Soome * setjmp(a) 61*4a5d661aSToomas Soome * by restoring the previous context. 62*4a5d661aSToomas Soome */ 63*4a5d661aSToomas Soome 64*4a5d661aSToomas SoomeENTRY(_setjmp) 65*4a5d661aSToomas Soome stx %sp, [%o0 + _JB_SP] 66*4a5d661aSToomas Soome stx %o7, [%o0 + _JB_PC] 67*4a5d661aSToomas Soome stx %fp, [%o0 + _JB_FP] 68*4a5d661aSToomas Soome retl 69*4a5d661aSToomas Soome clr %o0 70*4a5d661aSToomas SoomeEND(_setjmp) 71*4a5d661aSToomas Soome 72*4a5d661aSToomas SoomeENTRY(_longjmp) 73*4a5d661aSToomas Soome mov 1, %g1 74*4a5d661aSToomas Soome movrnz %o1, %o1, %g1 75*4a5d661aSToomas Soome mov %o0, %g2 76*4a5d661aSToomas Soome ldx [%g2 + _JB_FP], %g3 77*4a5d661aSToomas Soome1: cmp %fp, %g3 78*4a5d661aSToomas Soome bl,a 1b 79*4a5d661aSToomas Soome restore 80*4a5d661aSToomas Soome be,a 2f 81*4a5d661aSToomas Soome ldx [%g2 + _JB_SP], %o0 82*4a5d661aSToomas Soome 83*4a5d661aSToomas Soome.Lbotch: 84*4a5d661aSToomas Soome illtrap 85*4a5d661aSToomas Soome 86*4a5d661aSToomas Soome2: cmp %o0, %sp 87*4a5d661aSToomas Soome bge,a 3f 88*4a5d661aSToomas Soome mov %o0, %sp 89*4a5d661aSToomas Soome b,a .Lbotch 90*4a5d661aSToomas Soome nop 91*4a5d661aSToomas Soome3: ldx [%g2 + _JB_PC], %o7 92*4a5d661aSToomas Soome retl 93*4a5d661aSToomas Soome mov %g1, %o0 94*4a5d661aSToomas SoomeEND(_longjmp) 95