xref: /onnv-gate/usr/src/ucblib/libucb/sparc/sys/setjmp.s (revision 7298:b69e27387f74)
10Sstevel@tonic-gate/*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
56812Sraf * Common Development and Distribution License (the "License").
66812Sraf * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
216812Sraf
220Sstevel@tonic-gate/*
236812Sraf * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate * Use is subject to license terms.
250Sstevel@tonic-gate */
260Sstevel@tonic-gate
27*7298SMark.J.Nelson@Sun.COM	.file	"setjmp.s"
286812Sraf
290Sstevel@tonic-gate/*
300Sstevel@tonic-gate * The UCB setjmp(env) is the same as SYSV's sigsetjmp(env, 1)
310Sstevel@tonic-gate * while _setjmp(env) is the same as SYSV's sigsetjmp(env, 0)
320Sstevel@tonic-gate * Both longjmp(env, val) and _longjmp(env, val) are the same
330Sstevel@tonic-gate * as SYSV's siglongjmp(env, val).
340Sstevel@tonic-gate *
350Sstevel@tonic-gate * These are #defined as such in /usr/ucbinclude/setjmp.h
360Sstevel@tonic-gate * but setjmp/longjmp and _setjmp/_longjmp have historically
370Sstevel@tonic-gate * been entry points in libucb, so for binary compatibility
380Sstevel@tonic-gate * we implement them as tail calls into libc in order to make
390Sstevel@tonic-gate * them appear as direct calls to sigsetjmp/siglongjmp, which
400Sstevel@tonic-gate * is essential for the correct operation of sigsetjmp.
410Sstevel@tonic-gate */
420Sstevel@tonic-gate
430Sstevel@tonic-gate#include <sys/asm_linkage.h>
440Sstevel@tonic-gate
450Sstevel@tonic-gate	ANSI_PRAGMA_WEAK(longjmp,function)
460Sstevel@tonic-gate
470Sstevel@tonic-gate	ENTRY_NP(setjmp)
480Sstevel@tonic-gate	mov	%o7, %g1
490Sstevel@tonic-gate	mov	1, %o1
500Sstevel@tonic-gate	call	_sigsetjmp
510Sstevel@tonic-gate	mov	%g1, %o7
520Sstevel@tonic-gate	SET_SIZE(setjmp)
530Sstevel@tonic-gate
540Sstevel@tonic-gate	ENTRY_NP(_setjmp)
550Sstevel@tonic-gate	mov	%o7, %g1
560Sstevel@tonic-gate	clr	%o1
570Sstevel@tonic-gate	call	_sigsetjmp
580Sstevel@tonic-gate	mov	%g1, %o7
590Sstevel@tonic-gate	SET_SIZE(_setjmp)
600Sstevel@tonic-gate
616812Sraf	ENTRY_NP(longjmp)
620Sstevel@tonic-gate	mov	%o7, %g1
630Sstevel@tonic-gate	call	_siglongjmp
640Sstevel@tonic-gate	mov	%g1, %o7
656812Sraf	SET_SIZE(longjmp)
66