1864cbcb8SAndrew Turner /* $NetBSD: setjmp.h,v 1.5 2013/01/11 13:56:32 matt Exp $ */ 26fc729afSOlivier Houchard 36fc729afSOlivier Houchard /* 46fc729afSOlivier Houchard * machine/setjmp.h: machine dependent setjmp-related information. 56fc729afSOlivier Houchard */ 66fc729afSOlivier Houchard 798fe51fcSOlivier Houchard #ifndef _MACHINE_SETJMP_H_ 898fe51fcSOlivier Houchard #define _MACHINE_SETJMP_H_ 9864cbcb8SAndrew Turner 106fc729afSOlivier Houchard #define _JBLEN 64 /* size, in longs, of a jmp_buf */ 116fc729afSOlivier Houchard 126fc729afSOlivier Houchard /* 136fc729afSOlivier Houchard * NOTE: The internal structure of a jmp_buf is *PRIVATE* 146fc729afSOlivier Houchard * This information is provided as there is software 156fc729afSOlivier Houchard * that fiddles with this with obtain the stack pointer 166fc729afSOlivier Houchard * (yes really ! and its commercial !). 176fc729afSOlivier Houchard * 186fc729afSOlivier Houchard * Description of the setjmp buffer 196fc729afSOlivier Houchard * 20864cbcb8SAndrew Turner * word 0 magic number (dependent on creator) 21864cbcb8SAndrew Turner * 13 fpscr vfp status control register 226fc729afSOlivier Houchard * 14 r4 register 4 236fc729afSOlivier Houchard * 15 r5 register 5 246fc729afSOlivier Houchard * 16 r6 register 6 256fc729afSOlivier Houchard * 17 r7 register 7 266fc729afSOlivier Houchard * 18 r8 register 8 276fc729afSOlivier Houchard * 19 r9 register 9 286fc729afSOlivier Houchard * 20 r10 register 10 (sl) 296fc729afSOlivier Houchard * 21 r11 register 11 (fp) 306fc729afSOlivier Houchard * 22 r12 register 12 (ip) 316fc729afSOlivier Houchard * 23 r13 register 13 (sp) 326fc729afSOlivier Houchard * 24 r14 register 14 (lr) 33864cbcb8SAndrew Turner * 25 signal mask (dependent on magic) 346fc729afSOlivier Houchard * 26 (con't) 356fc729afSOlivier Houchard * 27 (con't) 366fc729afSOlivier Houchard * 28 (con't) 37864cbcb8SAndrew Turner * 32-33 d8 (vfp register d8) 38864cbcb8SAndrew Turner * 34-35 d9 (vfp register d9) 39864cbcb8SAndrew Turner * 36-37 d10 (vfp register d10) 40864cbcb8SAndrew Turner * 38-39 d11 (vfp register d11) 41864cbcb8SAndrew Turner * 40-41 d12 (vfp register d12) 42864cbcb8SAndrew Turner * 42-43 d13 (vfp register d13) 43864cbcb8SAndrew Turner * 44-45 d14 (vfp register d14) 44864cbcb8SAndrew Turner * 46-47 d15 (vfp register d15) 456fc729afSOlivier Houchard * 46*26713ad9SGordon Bergling * The magic number identifies the jmp_buf and 476fc729afSOlivier Houchard * how the buffer was created as well as providing 486fc729afSOlivier Houchard * a sanity check 496fc729afSOlivier Houchard * 506fc729afSOlivier Houchard * A side note I should mention - Please do not tamper 516fc729afSOlivier Houchard * with the floating point fields. While they are 526fc729afSOlivier Houchard * always saved and restored at the moment this cannot 536fc729afSOlivier Houchard * be garenteed especially if the compiler happens 546fc729afSOlivier Houchard * to be generating soft-float code so no fp 556fc729afSOlivier Houchard * registers will be used. 566fc729afSOlivier Houchard * 576fc729afSOlivier Houchard * Whilst this can be seen an encouraging people to 586fc729afSOlivier Houchard * use the setjmp buffer in this way I think that it 596fc729afSOlivier Houchard * is for the best then if changes occur compiles will 606fc729afSOlivier Houchard * break rather than just having new builds falling over 616fc729afSOlivier Houchard * mysteriously. 626fc729afSOlivier Houchard */ 636fc729afSOlivier Houchard 646fc729afSOlivier Houchard #define _JB_MAGIC__SETJMP 0x4278f500 656fc729afSOlivier Houchard #define _JB_MAGIC_SETJMP 0x4278f501 66864cbcb8SAndrew Turner #define _JB_MAGIC__SETJMP_VFP 0x4278f502 67864cbcb8SAndrew Turner #define _JB_MAGIC_SETJMP_VFP 0x4278f503 686fc729afSOlivier Houchard 696fc729afSOlivier Houchard /* Valid for all jmp_buf's */ 706fc729afSOlivier Houchard 716fc729afSOlivier Houchard #define _JB_MAGIC 0 72864cbcb8SAndrew Turner #define _JB_REG_FPSCR 13 736fc729afSOlivier Houchard #define _JB_REG_R4 14 746fc729afSOlivier Houchard #define _JB_REG_R5 15 756fc729afSOlivier Houchard #define _JB_REG_R6 16 766fc729afSOlivier Houchard #define _JB_REG_R7 17 776fc729afSOlivier Houchard #define _JB_REG_R8 18 786fc729afSOlivier Houchard #define _JB_REG_R9 19 796fc729afSOlivier Houchard #define _JB_REG_R10 20 806fc729afSOlivier Houchard #define _JB_REG_R11 21 816fc729afSOlivier Houchard #define _JB_REG_R12 22 826fc729afSOlivier Houchard #define _JB_REG_R13 23 836fc729afSOlivier Houchard #define _JB_REG_R14 24 846fc729afSOlivier Houchard 856fc729afSOlivier Houchard /* Only valid with the _JB_MAGIC_SETJMP magic */ 866fc729afSOlivier Houchard 876fc729afSOlivier Houchard #define _JB_SIGMASK 25 8864277b97SAndrew Turner 89864cbcb8SAndrew Turner #define _JB_REG_D8 32 90864cbcb8SAndrew Turner #define _JB_REG_D9 34 91864cbcb8SAndrew Turner #define _JB_REG_D10 36 92864cbcb8SAndrew Turner #define _JB_REG_D11 38 93864cbcb8SAndrew Turner #define _JB_REG_D12 40 94864cbcb8SAndrew Turner #define _JB_REG_D13 42 95864cbcb8SAndrew Turner #define _JB_REG_D14 44 96864cbcb8SAndrew Turner #define _JB_REG_D15 46 97864cbcb8SAndrew Turner 9864277b97SAndrew Turner #ifndef __ASSEMBLER__ 996fc729afSOlivier Houchard #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE 1006fc729afSOlivier Houchard typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; 1016fc729afSOlivier Houchard #endif 1026fc729afSOlivier Houchard 1036fc729afSOlivier Houchard typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1]; 10464277b97SAndrew Turner #endif 1056fc729afSOlivier Houchard 10698fe51fcSOlivier Houchard #endif /* !_MACHINE_SETJMP_H_ */ 107