Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / lib / libstand / alpha / _setjmp.S
1 /*      $NetBSD: _setjmp.S,v 1.2 1996/10/17 03:08:03 cgd Exp $  */
2 /* $FreeBSD: src/lib/libstand/alpha/_setjmp.S,v 1.2.2.1 2000/05/18 08:01:16 ps Exp $ */
3 /* $DragonFly: src/lib/libstand/alpha/Attic/_setjmp.S,v 1.2 2003/06/17 04:26:51 dillon Exp $ */
4
5 /*
6  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
7  * All rights reserved.
8  *
9  * Author: Chris G. Demetriou
10  * 
11  * Permission to use, copy, modify and distribute this software and
12  * its documentation is hereby granted, provided that both the copyright
13  * notice and this permission notice appear in all copies of the
14  * software, derivative works or modified versions, and any portions
15  * thereof, and that both notices appear in supporting documentation.
16  * 
17  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
18  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
19  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
20  * 
21  * Carnegie Mellon requests users of this software to return to
22  *
23  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
24  *  School of Computer Science
25  *  Carnegie Mellon University
26  *  Pittsburgh PA 15213-3890
27  *
28  * any improvements or extensions that they make and grant Carnegie the
29  * rights to redistribute these changes.
30  */
31
32 #include <machine/asm.h>
33
34 /*
35  * C library -- _setjmp, _longjmp
36  *
37  *      _longjmp(a,v)
38  * will generate a "return(v)" from
39  * the last call to
40  *      _setjmp(a)
41  * by restoring registers from the stack,
42  * The previous signal state is NOT restored.
43  */
44
45         .set    noreorder
46
47 LEAF(_setjmp, 1)
48         LDGP(pv)
49         stq     ra, (2 * 8)(a0)                 /* sc_pc = return address */
50         stq     s0, (( 9 + 4) * 8)(a0)          /* saved bits of sc_regs */
51         stq     s1, ((10 + 4) * 8)(a0)
52         stq     s2, ((11 + 4) * 8)(a0)
53         stq     s3, ((12 + 4) * 8)(a0)
54         stq     s4, ((13 + 4) * 8)(a0)
55         stq     s5, ((14 + 4) * 8)(a0)
56         stq     s6, ((15 + 4) * 8)(a0)
57         stq     ra, ((26 + 4) * 8)(a0)
58         stq     sp, ((30 + 4) * 8)(a0)
59         ldiq    t0, 0xacedbadd                  /* sigcontext magic number */
60         stq     t0, ((31 + 4) * 8)(a0)          /* magic in sc_regs[31] */
61         /* Too bad we can't check if we actually used FP */
62         ldiq    t0, 1
63         stq     t0, (36 * 8)(a0)                /* say we've used FP.  */
64 #if 0
65         stt     fs0, ((2 + 37) * 8)(a0)         /* saved bits of sc_fpregs */
66         stt     fs1, ((3 + 37) * 8)(a0)
67         stt     fs2, ((4 + 37) * 8)(a0)
68         stt     fs3, ((5 + 37) * 8)(a0)
69         stt     fs4, ((6 + 37) * 8)(a0)
70         stt     fs5, ((7 + 37) * 8)(a0)
71         stt     fs6, ((8 + 37) * 8)(a0)
72         stt     fs7, ((9 + 37) * 8)(a0)
73         mf_fpcr ft0                             /* get FP control reg */
74         stt     ft0, (69 * 8)(a0)               /* and store it in sc_fpcr */
75         stq     zero, (70 * 8)(a0)              /* FP software control XXX */
76 #endif
77         stq     zero, (71 * 8)(a0)              /* sc_reserved[0] */
78         stq     zero, (72 * 8)(a0)              /* sc_reserved[1] */
79         stq     zero, (73 * 8)(a0)              /* sc_xxx[0] */
80         stq     zero, (74 * 8)(a0)              /* sc_xxx[1] */
81         stq     zero, (75 * 8)(a0)              /* sc_xxx[2] */
82         stq     zero, (76 * 8)(a0)              /* sc_xxx[3] */
83         stq     zero, (77 * 8)(a0)              /* sc_xxx[4] */
84         stq     zero, (78 * 8)(a0)              /* sc_xxx[5] */
85         stq     zero, (79 * 8)(a0)              /* sc_xxx[6] */
86         stq     zero, (80 * 8)(a0)              /* sc_xxx[7] */
87
88         mov     zero, v0                        /* return zero */
89         RET
90 END(_setjmp)
91
92 LEAF(_longjmp, 2)
93         LDGP(pv)
94
95         ldq     ra, (2 * 8)(a0)                 /* sc_pc = return address */
96         ldq     s0, (( 9 + 4) * 8)(a0)          /* saved bits of sc_regs */
97         ldq     s1, ((10 + 4) * 8)(a0)
98         ldq     s2, ((11 + 4) * 8)(a0)
99         ldq     s3, ((12 + 4) * 8)(a0)
100         ldq     s4, ((13 + 4) * 8)(a0)
101         ldq     s5, ((14 + 4) * 8)(a0)
102         ldq     s6, ((15 + 4) * 8)(a0)
103         /* ldq  ra, ((26 + 4) * 8)(a0)          set above */
104         ldq     sp, ((30 + 4) * 8)(a0)
105 #if 0
106         ldt     fs0, ((2 + 37) * 8)(a0)         /* saved bits of sc_fpregs */
107         ldt     fs1, ((3 + 37) * 8)(a0)
108         ldt     fs2, ((4 + 37) * 8)(a0)
109         ldt     fs3, ((5 + 37) * 8)(a0)
110         ldt     fs4, ((6 + 37) * 8)(a0)
111         ldt     fs5, ((7 + 37) * 8)(a0)
112         ldt     fs6, ((8 + 37) * 8)(a0)
113         ldt     fs7, ((9 + 37) * 8)(a0)
114         ldt     ft0, (69 * 8)(a0)               /* get sc_fpcr */
115         mt_fpcr ft0                             /* and restore it. */
116 #endif
117
118         mov     a1, v0                          /* return second arg */
119         RET
120
121 END(_longjmp)