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