xref: /titanic_51/usr/src/ucblib/libucb/sparc/sys/setjmp.s (revision b6917abefc343244b784f0cc34bc65b01469c3bf)
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#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29	.file	"%M%"
30
31/*
32 * The UCB setjmp(env) is the same as SYSV's sigsetjmp(env, 1)
33 * while _setjmp(env) is the same as SYSV's sigsetjmp(env, 0)
34 * Both longjmp(env, val) and _longjmp(env, val) are the same
35 * as SYSV's siglongjmp(env, val).
36 *
37 * These are #defined as such in /usr/ucbinclude/setjmp.h
38 * but setjmp/longjmp and _setjmp/_longjmp have historically
39 * been entry points in libucb, so for binary compatibility
40 * we implement them as tail calls into libc in order to make
41 * them appear as direct calls to sigsetjmp/siglongjmp, which
42 * is essential for the correct operation of sigsetjmp.
43 */
44
45#include <sys/asm_linkage.h>
46
47	ANSI_PRAGMA_WEAK(longjmp,function)
48
49	ENTRY_NP(setjmp)
50	mov	%o7, %g1
51	mov	1, %o1
52	call	_sigsetjmp
53	mov	%g1, %o7
54	SET_SIZE(setjmp)
55
56	ENTRY_NP(_setjmp)
57	mov	%o7, %g1
58	clr	%o1
59	call	_sigsetjmp
60	mov	%g1, %o7
61	SET_SIZE(_setjmp)
62
63	ENTRY_NP(longjmp)
64	mov	%o7, %g1
65	call	_siglongjmp
66	mov	%g1, %o7
67	SET_SIZE(longjmp)
68