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