xref: /titanic_41/usr/src/ucblib/libucb/sparc/sys/setjmp.s (revision a2bb96e7d59f447f59bc306e53b7d00e38594667)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2004 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/*
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	.file	"%M%"
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