xref: /openbsd-src/sys/arch/arm/include/setjmp.h (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1 /*	$OpenBSD: setjmp.h,v 1.4 2016/08/07 02:02:57 guenther Exp $	*/
2 /*	$NetBSD: setjmp.h,v 1.2 2001/08/25 14:45:59 bjh21 Exp $	*/
3 
4 /*
5  * machine/setjmp.h: machine dependent setjmp-related information.
6  */
7 
8 #define	_JBLEN	64		/* size, in longs, of a jmp_buf */
9 
10 /*
11  * Description of the setjmp buffer
12  *
13  * word  0	magic number	(dependant on creator)
14  *       1 -  3	f4		fp register 4
15  *	 4 -  6	f5		fp register 5
16  *	 7 -  9 f6		fp register 6
17  *	10 - 12	f7		fp register 7
18  *	13	fpsr		fp status register
19  *	14	r13		register 13 (sp) XOR cookie0
20  *	15	r14		register 14 (lr) XOR cookie1
21  *	16	r4		register 4
22  *	17	r5		register 5
23  *	18	r6		register 6
24  *	19	r7		register 7
25  *	20	r8		register 8
26  *	21	r9		register 9
27  *	22	r10		register 10 (sl)
28  *	23	r11		register 11 (fp)
29  *	24	unused		unused
30  *	25	signal mask	(dependant on magic)
31  *	26	(con't)
32  *	27	(con't)
33  *	28	(con't)
34  *
35  * The magic number number identifies the jmp_buf and
36  * how the buffer was created as well as providing
37  * a sanity check.
38  *
39  * A side note I should mention - please do not tamper
40  * with the floating point fields. While they are
41  * always saved and restored at the moment this cannot
42  * be guaranteed especially if the compiler happens
43  * to be generating soft-float code so no fp
44  * registers will be used.
45  *
46  * Whilst this can be seen an encouraging people to
47  * use the setjmp buffer in this way I think that it
48  * is for the best then if changes occur compiles will
49  * break rather than just having new builds falling over
50  * mysteriously.
51  */
52 
53 #define _JB_MAGIC__SETJMP	0x4278f500
54 #define _JB_MAGIC_SETJMP	0x4278f501
55 
56 /* Valid for all jmp_buf's */
57 
58 #define _JB_MAGIC		 0
59 #define _JB_REG_F4		 1
60 #define _JB_REG_F5		 4
61 #define _JB_REG_F6		 7
62 #define _JB_REG_F7		10
63 #define _JB_REG_FPSR		13
64 #define _JB_REG_R4		16
65 #define _JB_REG_R5		17
66 #define _JB_REG_R6		18
67 #define _JB_REG_R7		19
68 #define _JB_REG_R8		20
69 #define _JB_REG_R9		21
70 #define _JB_REG_R10		22
71 #define _JB_REG_R11		23
72 
73 /* Only valid with the _JB_MAGIC_SETJMP magic */
74 
75 #define _JB_SIGMASK		25
76