Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / boot / arc / lib / arch / alpha / setjmp.S
1 /* $FreeBSD: src/sys/boot/arc/lib/arch/alpha/setjmp.S,v 1.2 1999/08/28 00:39:40 peter Exp $ */
2 /* $DragonFly: src/sys/boot/arc/lib/arch/alpha/Attic/setjmp.S,v 1.2 2003/06/17 04:28:16 dillon Exp $ */
3 /*
4  * Copyright (c) 1994, 1995, 1996 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
30 #include <machine/asm.h>
31
32         .text
33 /*
34  * Kernel setjmp and longjmp.  Rather minimalist.
35  *
36  *      longjmp(label_t *a)
37  * will generate a "return (1)" from the last call to
38  *      setjmp(label_t *a)
39  * by restoring registers from the stack,
40  */
41
42         .set    noreorder
43
44 LEAF(setjmp, 1)
45         LDGP(pv)
46
47         stq     ra, (0 * 8)(a0)                 /* return address */
48         stq     s0, (1 * 8)(a0)                 /* callee-saved registers */
49         stq     s1, (2 * 8)(a0)
50         stq     s2, (3 * 8)(a0)
51         stq     s3, (4 * 8)(a0)
52         stq     s4, (5 * 8)(a0)
53         stq     s5, (6 * 8)(a0)
54         stq     s6, (7 * 8)(a0)
55         stq     sp, (8 * 8)(a0)
56
57         ldiq    t0, 0xbeeffedadeadbabe          /* set magic number */
58         stq     t0, (9 * 8)(a0)
59
60         mov     zero, v0                        /* return zero */
61         RET
62 END(setjmp)
63
64 LEAF(longjmp, 1)
65         LDGP(pv)
66
67         ldiq    t0, 0xbeeffedadeadbabe          /* check magic number */
68         ldq     t1, (9 * 8)(a0)
69         cmpeq   t0, t1, t0
70         beq     t0, longjmp_botch               /* if bad, punt */
71
72         ldq     ra, (0 * 8)(a0)                 /* return address */
73         ldq     s0, (1 * 8)(a0)                 /* callee-saved registers */
74         ldq     s1, (2 * 8)(a0)
75         ldq     s2, (3 * 8)(a0)
76         ldq     s3, (4 * 8)(a0)
77         ldq     s4, (5 * 8)(a0)
78         ldq     s5, (6 * 8)(a0)
79         ldq     s6, (7 * 8)(a0)
80         ldq     sp, (8 * 8)(a0)
81
82         ldiq    v0, 1
83         RET
84
85 longjmp_botch:
86         lda     a0, longjmp_botchmsg
87         mov     ra, a1
88         CALL(panic)
89         call_pal PAL_bugchk
90
91         .data
92 longjmp_botchmsg:
93         .asciz  "longjmp botch from %p"
94         .text
95
96 END(longjmp)