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