blob: f1f5d6a89e46f16d47f7c8e21f5ffb9ef7ba7d8d [file] [log] [blame]
Magnus Holmgrenf4515c32009-03-08 12:48:58 +00001#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 Martitz46454ac2010-08-24 12:38:42 +00008#include "config.h"
Magnus Holmgrenf4515c32009-03-08 12:48:58 +00009#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 Buschmann398b3712010-02-22 19:44:05 +000022 * fp2-fp7 for 68881.
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000023 * All else recovered by under/over(flow) handling.
24 */
Andree Buschmann398b3712010-02-22 19:44:05 +000025#define _JBLEN 34
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000026#endif
27
Maurus Cuelenaeref3643182009-04-16 13:48:34 +000028#ifdef CPU_MIPS
29#if CPU_MIPS == 64
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000030#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 Martitz46454ac2010-08-24 12:38:42 +000039#ifdef CPU_SH
40#define __SH5__ 0
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000041#if __SH5__
42#define _JBLEN 50
43#define _JBTYPE long long
44#else
Thomas Martitz46454ac2010-08-24 12:38:42 +000045/* r8 through r15 (callee saved), pr, fp regs if available */
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000046#define _JBLEN 20
47#endif /* __SH5__ */
48#endif
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000049
50#ifdef _JBLEN
51#ifdef _JBTYPE
Andree Buschmann398b3712010-02-22 19:44:05 +000052typedef _JBTYPE jmp_buf[_JBLEN];
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000053#else
Andree Buschmann398b3712010-02-22 19:44:05 +000054typedef int jmp_buf[_JBLEN];
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000055#endif
Maurus Cuelenaere17d9d802009-04-22 15:04:26 +000056#else
57typedef int jmp_buf;
Magnus Holmgrenf4515c32009-03-08 12:48:58 +000058#endif
59
60
61extern void longjmp(jmp_buf __jmpb, int __retval);
62extern int setjmp(jmp_buf __jmpb);
63
64#endif // _SETJMP_H_