1 /* $NetBSD: setjmp.h,v 1.5 2013/01/11 13:56:32 matt Exp $ */
5 * machine/setjmp.h: machine dependent setjmp-related information.
8 #ifndef _MACHINE_SETJMP_H_
9 #define _MACHINE_SETJMP_H_
11 #define _JBLEN 64 /* size, in longs, of a jmp_buf */
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 !).
19 * Description of the setjmp buffer
21 * word 0 magic number (dependent on creator)
22 * 13 fpscr vfp status control register
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 (dependent on magic)
38 * 32-33 d8 (vfp register d8)
39 * 34-35 d9 (vfp register d9)
40 * 36-37 d10 (vfp register d10)
41 * 38-39 d11 (vfp register d11)
42 * 40-41 d12 (vfp register d12)
43 * 42-43 d13 (vfp register d13)
44 * 44-45 d14 (vfp register d14)
45 * 46-47 d15 (vfp register d15)
47 * The magic number number identifies the jmp_buf and
48 * how the buffer was created as well as providing
51 * A side note I should mention - Please do not tamper
52 * with the floating point fields. While they are
53 * always saved and restored at the moment this cannot
54 * be garenteed especially if the compiler happens
55 * to be generating soft-float code so no fp
56 * registers will be used.
58 * Whilst this can be seen an encouraging people to
59 * use the setjmp buffer in this way I think that it
60 * is for the best then if changes occur compiles will
61 * break rather than just having new builds falling over
65 #define _JB_MAGIC__SETJMP 0x4278f500
66 #define _JB_MAGIC_SETJMP 0x4278f501
67 #define _JB_MAGIC__SETJMP_VFP 0x4278f502
68 #define _JB_MAGIC_SETJMP_VFP 0x4278f503
70 /* Valid for all jmp_buf's */
73 #define _JB_REG_FPSCR 13
80 #define _JB_REG_R10 20
81 #define _JB_REG_R11 21
82 #define _JB_REG_R12 22
83 #define _JB_REG_R13 23
84 #define _JB_REG_R14 24
86 /* Only valid with the _JB_MAGIC_SETJMP magic */
88 #define _JB_SIGMASK 25
92 #define _JB_REG_D10 36
93 #define _JB_REG_D11 38
94 #define _JB_REG_D12 40
95 #define _JB_REG_D13 42
96 #define _JB_REG_D14 44
97 #define _JB_REG_D15 46
100 #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
101 typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1];
104 typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1];
107 #endif /* !_MACHINE_SETJMP_H_ */