xref: /openbsd/lib/libc/arch/alpha/gen/sigsetjmp.S (revision 740d4530)
1/*	$OpenBSD: sigsetjmp.S,v 1.5 2016/05/09 16:33:48 guenther Exp $	*/
2/*	$NetBSD: sigsetjmp.S,v 1.2 1996/10/17 03:08:07 cgd Exp $	*/
3
4/*
5 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
6 * All rights reserved.
7 *
8 * Author: Chris G. Demetriou
9 *
10 * Permission to use, copy, modify and distribute this software and
11 * its documentation is hereby granted, provided that both the copyright
12 * notice and this permission notice appear in all copies of the
13 * software, derivative works or modified versions, and any portions
14 * thereof, and that both notices appear in supporting documentation.
15 *
16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23 *  School of Computer Science
24 *  Carnegie Mellon University
25 *  Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie the
28 * rights to redistribute these changes.
29 */
30
31#include "SYS.h"
32
33/*
34 * C library -- sigsetjmp, siglongjmp
35 *
36 *	siglongjmp(a,v)
37 * will generate a "return(v)" from
38 * the last call to
39 *	sigsetjmp(a, mask)
40 * by restoring registers from the stack.
41 * If `mask' is non-zero, the previous signal
42 * state will be restored.
43 */
44
45	.set	noreorder
46
47LEAF(sigsetjmp, 2)
48	LDGP(pv)
49	stq	a1, (81 * 8)(a0)		/* save the mask */
50	bne	a1, Lsavesig			/* if !zero, save signals */
51	jmp	zero, _HIDDEN(_setjmp)		/* else don't. */
52Lsavesig:
53	jmp	zero, _HIDDEN(setjmp)
54END_WEAK(sigsetjmp)
55
56LEAF(siglongjmp, 2)
57	LDGP(pv)
58	ldq	t0, (81 * 8)(a0)		/* get the mask */
59	bne	t0, Lrestoresig			/* if !zero, restore signals */
60	jmp	zero, _HIDDEN(_longjmp)
61Lrestoresig:
62	jmp	zero, _HIDDEN(longjmp)
63END_WEAK(siglongjmp)
64