1/* $OpenBSD: setjmp.h,v 1.6 2023/04/11 00:45:07 jsg 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 fpscr fpscr
15 * 2 - 17 d8 - d15 vfp registers
16 * 18 r13 register 13 (sp) XOR cookie0
17 * 19 r14 register 14 (lr) XOR cookie1
18 * 20 r4 register 4
19 * 21 r5 register 5
20 * 22 r6 register 6
21 * 23 r7 register 7
22 * 24 r8 register 8
23 * 25 r9 register 9
24 * 26 r10 register 10 (sl)
25 * 27 r11 register 11 (fp)
26 * 28 unused unused
27 * 29 signal mask (dependant on magic)
28 * 30 (con't)
29 * 31 (con't)
30 * 32 (con't)
31 *
32 * The magic number identifies the jmp_buf and
33 * how the buffer was created as well as providing
34 * a sanity check.
35 *
36 * A side note I should mention - please do not tamper
37 * with the floating point fields. While they are
38 * always saved and restored at the moment this cannot
39 * be guaranteed especially if the compiler happens
40 * to be generating soft-float code so no fp
41 * registers will be used.
42 *
43 * Whilst this can be seen an encouraging people to
44 * use the setjmp buffer in this way I think that it
45 * is for the best then if changes occur compiles will
46 * break rather than just having new builds falling over
47 * mysteriously.
48 */
49
50#define _JB_MAGIC__SETJMP 0x4278f500
51#define _JB_MAGIC_SETJMP 0x4278f501
52
53/* Valid for all jmp_buf's */
54
55#define _JB_MAGIC 0
56#define _JB_REG_R4 20
57#define _JB_REG_R5 21
58#define _JB_REG_R6 22
59#define _JB_REG_R7 23
60#define _JB_REG_R8 24
61#define _JB_REG_R9 25
62#define _JB_REG_R10 26
63#define _JB_REG_R11 27
64
65/* Only valid with the _JB_MAGIC_SETJMP magic */
66
67#define _JB_SIGMASK 29