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