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