Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 1 | #ifndef _SETJMP_H_ |
| 2 | #define _SETJMP_H_ |
| 3 | |
| 4 | /* Combined parts of include/setjmp.h and include/machine/setjmp.h in |
| 5 | * newlib 1.17.0, with minor changes for Rockbox. |
| 6 | */ |
| 7 | |
Thomas Martitz | 46454ac | 2010-08-24 12:38:42 +0000 | [diff] [blame] | 8 | #include "config.h" |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 9 | #ifdef CPU_ARM |
| 10 | /* |
| 11 | * All callee preserved registers: |
| 12 | * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7 |
| 13 | */ |
| 14 | #define _JBLEN 23 |
| 15 | #endif |
| 16 | |
| 17 | /* necv70 was 9 as well. */ |
| 18 | |
| 19 | #ifdef CPU_COLDFIRE |
| 20 | /* |
| 21 | * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, |
Andree Buschmann | 398b371 | 2010-02-22 19:44:05 +0000 | [diff] [blame] | 22 | * fp2-fp7 for 68881. |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 23 | * All else recovered by under/over(flow) handling. |
| 24 | */ |
Andree Buschmann | 398b371 | 2010-02-22 19:44:05 +0000 | [diff] [blame] | 25 | #define _JBLEN 34 |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 26 | #endif |
| 27 | |
Maurus Cuelenaere | f364318 | 2009-04-16 13:48:34 +0000 | [diff] [blame] | 28 | #ifdef CPU_MIPS |
| 29 | #if CPU_MIPS == 64 |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 30 | #define _JBTYPE long long |
| 31 | #endif |
| 32 | #ifdef __mips_soft_float |
| 33 | #define _JBLEN 11 |
| 34 | #else |
| 35 | #define _JBLEN 23 |
| 36 | #endif |
| 37 | #endif |
| 38 | |
Thomas Martitz | 46454ac | 2010-08-24 12:38:42 +0000 | [diff] [blame] | 39 | #ifdef CPU_SH |
| 40 | #define __SH5__ 0 |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 41 | #if __SH5__ |
| 42 | #define _JBLEN 50 |
| 43 | #define _JBTYPE long long |
| 44 | #else |
Thomas Martitz | 46454ac | 2010-08-24 12:38:42 +0000 | [diff] [blame] | 45 | /* r8 through r15 (callee saved), pr, fp regs if available */ |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 46 | #define _JBLEN 20 |
| 47 | #endif /* __SH5__ */ |
| 48 | #endif |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 49 | |
| 50 | #ifdef _JBLEN |
| 51 | #ifdef _JBTYPE |
Andree Buschmann | 398b371 | 2010-02-22 19:44:05 +0000 | [diff] [blame] | 52 | typedef _JBTYPE jmp_buf[_JBLEN]; |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 53 | #else |
Andree Buschmann | 398b371 | 2010-02-22 19:44:05 +0000 | [diff] [blame] | 54 | typedef int jmp_buf[_JBLEN]; |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 55 | #endif |
Maurus Cuelenaere | 17d9d80 | 2009-04-22 15:04:26 +0000 | [diff] [blame] | 56 | #else |
| 57 | typedef int jmp_buf; |
Magnus Holmgren | f4515c3 | 2009-03-08 12:48:58 +0000 | [diff] [blame] | 58 | #endif |
| 59 | |
| 60 | |
| 61 | extern void longjmp(jmp_buf __jmpb, int __retval); |
| 62 | extern int setjmp(jmp_buf __jmpb); |
| 63 | |
| 64 | #endif // _SETJMP_H_ |