xref: /titanic_44/usr/src/ucblib/libucb/sparc/sys/setjmp.s (revision 2b4a78020b9c38d1b95e2f3fefa6d6e4be382d1f)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27	.file	"setjmp.s"
28
29/*
30 * The UCB setjmp(env) is the same as SYSV's sigsetjmp(env, 1)
31 * while _setjmp(env) is the same as SYSV's sigsetjmp(env, 0)
32 * Both longjmp(env, val) and _longjmp(env, val) are the same
33 * as SYSV's siglongjmp(env, val).
34 *
35 * These are #defined as such in /usr/ucbinclude/setjmp.h
36 * but setjmp/longjmp and _setjmp/_longjmp have historically
37 * been entry points in libucb, so for binary compatibility
38 * we implement them as tail calls into libc in order to make
39 * them appear as direct calls to sigsetjmp/siglongjmp, which
40 * is essential for the correct operation of sigsetjmp.
41 */
42
43#include <sys/asm_linkage.h>
44
45	ANSI_PRAGMA_WEAK(longjmp,function)
46
47	ENTRY_NP(setjmp)
48	mov	%o7, %g1
49	mov	1, %o1
50	call	_sigsetjmp
51	mov	%g1, %o7
52	SET_SIZE(setjmp)
53
54	ENTRY_NP(_setjmp)
55	mov	%o7, %g1
56	clr	%o1
57	call	_sigsetjmp
58	mov	%g1, %o7
59	SET_SIZE(_setjmp)
60
61	ENTRY_NP(longjmp)
62	mov	%o7, %g1
63	call	_siglongjmp
64	mov	%g1, %o7
65	SET_SIZE(longjmp)
66