1 /* $NetBSD: setjmp.h,v 1.5 2013/01/11 13:56:32 matt Exp $ */
4 * machine/setjmp.h: machine dependent setjmp-related information.
7 #ifndef _MACHINE_SETJMP_H_
8 #define _MACHINE_SETJMP_H_
10 #define _JBLEN 64 /* size, in longs, of a jmp_buf */
13 * NOTE: The internal structure of a jmp_buf is *PRIVATE*
14 * This information is provided as there is software
15 * that fiddles with this with obtain the stack pointer
16 * (yes really ! and its commercial !).
18 * Description of the setjmp buffer
20 * word 0 magic number (dependent on creator)
21 * 13 fpscr vfp status control register
28 * 20 r10 register 10 (sl)
29 * 21 r11 register 11 (fp)
30 * 22 r12 register 12 (ip)
31 * 23 r13 register 13 (sp)
32 * 24 r14 register 14 (lr)
33 * 25 signal mask (dependent on magic)
37 * 32-33 d8 (vfp register d8)
38 * 34-35 d9 (vfp register d9)
39 * 36-37 d10 (vfp register d10)
40 * 38-39 d11 (vfp register d11)
41 * 40-41 d12 (vfp register d12)
42 * 42-43 d13 (vfp register d13)
43 * 44-45 d14 (vfp register d14)
44 * 46-47 d15 (vfp register d15)
46 * The magic number identifies the jmp_buf and
47 * how the buffer was created as well as providing
50 * A side note I should mention - Please do not tamper
51 * with the floating point fields. While they are
52 * always saved and restored at the moment this cannot
53 * be garenteed especially if the compiler happens
54 * to be generating soft-float code so no fp
55 * registers will be used.
57 * Whilst this can be seen an encouraging people to
58 * use the setjmp buffer in this way I think that it
59 * is for the best then if changes occur compiles will
60 * break rather than just having new builds falling over
64 #define _JB_MAGIC__SETJMP 0x4278f500
65 #define _JB_MAGIC_SETJMP 0x4278f501
66 #define _JB_MAGIC__SETJMP_VFP 0x4278f502
67 #define _JB_MAGIC_SETJMP_VFP 0x4278f503
69 /* Valid for all jmp_buf's */
72 #define _JB_REG_FPSCR 13
79 #define _JB_REG_R10 20
80 #define _JB_REG_R11 21
81 #define _JB_REG_R12 22
82 #define _JB_REG_R13 23
83 #define _JB_REG_R14 24
85 /* Only valid with the _JB_MAGIC_SETJMP magic */
87 #define _JB_SIGMASK 25
91 #define _JB_REG_D10 36
92 #define _JB_REG_D11 38
93 #define _JB_REG_D12 40
94 #define _JB_REG_D13 42
95 #define _JB_REG_D14 44
96 #define _JB_REG_D15 46
99 #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
100 typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1];
103 typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1];
106 #endif /* !_MACHINE_SETJMP_H_ */