xref: /netbsd/lib/libc/arch/sparc/gen/sigsetjmp.S (revision bf9ec67e)
1/*	$NetBSD: sigsetjmp.S,v 1.4 1998/09/29 05:55:49 christos Exp $	*/
2/*
3 * Copyright (c) 1995 Paul Kranenburg
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 *    must display the following acknowledgement:
16 *      This product includes software developed by Paul Kranenburg.
17 * 4. The name of the author may not be used to endorse or promote products
18 *    derived from this software without specific prior written permission
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33#include "SYS.h"
34
35#ifdef PIC
36
37ENTRY(sigsetjmp)
38	PIC_PROLOGUE(%g1,%g2)	! %g1 = _GLOBAL_OFFSET_TABLE
39	cmp %o1,0
40	st %o1,[%o0+40]		! jmpbuf[JBLEN]
41	bne,a 1f
42	ld [%g1+_C_LABEL(setjmp)], %g1	! if (%o1 != 0) goto _setjmp;
43	ld [%g1+_C_LABEL(_setjmp)], %g1	! else goto __setjmp;
441:
45	jmp %g1
46	nop
47
48ENTRY(siglongjmp)
49	PIC_PROLOGUE(%g1,%g2)	! %g1 = _GLOBAL_OFFSET_TABLE
50	ld [%o0+40],%g2		! jmpbuf[JBLEN]
51	cmp %g2,0
52	bne,a 1f
53	ld [%g1+_C_LABEL(longjmp)], %g1	 ! if (%g2 != 0) goto _longjmp;
54	ld [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
551:
56	jmp %g1
57	nop
58	unimp 0
59
60#else /* PIC */
61
62ENTRY(sigsetjmp)
63	cmp %o1,0
64	be _C_LABEL(_setjmp)
65	st %o1,[%o0+40]		! jmpbuf[JBLEN]
66	nop
67	ba,a _C_LABEL(setjmp)
68	unimp 0
69
70ENTRY(siglongjmp)
71	ld [%o0+40],%g1
72	cmp %g1,0
73	be _C_LABEL(_longjmp)
74	nop
75	ba,a _C_LABEL(longjmp)
76	unimp 0
77
78#endif /* PIC */
79