185518Sjake/*
285518Sjake * Copyright (c) 1992, 1993
385518Sjake *	The Regents of the University of California.  All rights reserved.
485518Sjake *
585518Sjake * This software was developed by the Computer Systems Engineering group
685518Sjake * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
785518Sjake * contributed to Berkeley.
885518Sjake *
985518Sjake * Redistribution and use in source and binary forms, with or without
1085518Sjake * modification, are permitted provided that the following conditions
1185518Sjake * are met:
1285518Sjake * 1. Redistributions of source code must retain the above copyright
1385518Sjake *    notice, this list of conditions and the following disclaimer.
1485518Sjake * 2. Redistributions in binary form must reproduce the above copyright
1585518Sjake *    notice, this list of conditions and the following disclaimer in the
1685518Sjake *    documentation and/or other materials provided with the distribution.
1785518Sjake * 4. Neither the name of the University nor the names of its contributors
1885518Sjake *    may be used to endorse or promote products derived from this software
1985518Sjake *    without specific prior written permission.
2085518Sjake *
2185518Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2285518Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2385518Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2485518Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2585518Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2685518Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2785518Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2885518Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2985518Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3085518Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3185518Sjake * SUCH DAMAGE.
3285518Sjake *
3385518Sjake *	from: Header: _setjmp.s,v 1.1 91/07/06 16:45:53 torek Exp
3485518Sjake */
3585518Sjake
3685518Sjake#if defined(LIBC_SCCS) && !defined(lint)
3799018Sobrien	.asciz "@(#)_setjmp.s	8.1 (Berkeley) 6/4/93"
3885518Sjake#if 0
3985518Sjake	RCSID("$NetBSD: _setjmp.S,v 1.4 1998/10/08 02:27:59 eeh Exp $")
4085518Sjake#endif
4185518Sjake#endif /* LIBC_SCCS and not lint */
4285518Sjake#include <machine/asm.h>
4399018Sobrien__FBSDID("$FreeBSD$");
4485518Sjake
4586534Sjake#include "assym.s"
4686534Sjake
4788609Sjake	.register %g2,#ignore
4888609Sjake	.register %g3,#ignore
4988609Sjake
5085518Sjake/*
5185518Sjake * C library -- _setjmp, _longjmp
5285518Sjake *
5385518Sjake *	_longjmp(a,v)
5485518Sjake * will generate a "return(v?v:1)" from
5585518Sjake * the last call to
5685518Sjake *	_setjmp(a)
57108738Stmm * by restoring the previous context.
5885518Sjake * The previous signal state is NOT restored.
5985518Sjake */
6085518Sjake
6185518SjakeENTRY(_setjmp)
6288609Sjake	stx	%sp, [%o0 + _JB_SP]
6388609Sjake	stx	%o7, [%o0 + _JB_PC]
6485518Sjake	retl
6586534Sjake	 clr	%o0
6686534SjakeEND(_setjmp)
6785518Sjake
68108738Stmm	.weak	CNAME(_longjmp)
69108738Stmm	.set	CNAME(_longjmp),CNAME(___longjmp)
70108738StmmENTRY(___longjmp)
71108738Stmm	save	%sp, -CCFSZ, %sp
72108738Stmm	flushw
73108738Stmm	ldx	[%i0 + _JB_SP], %fp
74108738Stmm	ldx	[%i0 + _JB_PC], %i7
75108738Stmm	mov	1, %i0
76108738Stmm	movrnz	%i1, %i1, %i0
77108738Stmm	ret
78108738Stmm	 restore
79108738StmmEND(___longjmp)
80