diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2009-03-08 12:48:58 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2009-03-08 12:48:58 +0000 |
commit | f4515c3082dd413017ae06c25d7e85b1dcee30bf (patch) | |
tree | 1154b2fd5049aa42a1fdd2047effd39e9da1ccaa /apps/codecs/lib/setjmp.h | |
parent | 3f69bb2b1d00ccc54e2097fd9da750fcd2f7e11b (diff) | |
download | rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.gz rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.zip |
Add setjmp/longjmp for ARM and ColdFire to the codec lib, and use it in the Vorbis codec to better handle out of memory conditions (to exit rather than crash; the AAC codec could use it too). setjmp/longjmp comes from newlib 1.17.0 with a few minor changes (combine parts of some files, remove support for some architectures, change some ifdef's).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20235 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/lib/setjmp.h')
-rw-r--r-- | apps/codecs/lib/setjmp.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/codecs/lib/setjmp.h b/apps/codecs/lib/setjmp.h new file mode 100644 index 0000000000..4bcf6af623 --- /dev/null +++ b/apps/codecs/lib/setjmp.h | |||
@@ -0,0 +1,59 @@ | |||
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 | |||
8 | #ifdef CPU_ARM | ||
9 | /* | ||
10 | * All callee preserved registers: | ||
11 | * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7 | ||
12 | */ | ||
13 | #define _JBLEN 23 | ||
14 | #endif | ||
15 | |||
16 | /* necv70 was 9 as well. */ | ||
17 | |||
18 | #ifdef CPU_COLDFIRE | ||
19 | /* | ||
20 | * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, | ||
21 | * fp2-fp7 for 68881. | ||
22 | * All else recovered by under/over(flow) handling. | ||
23 | */ | ||
24 | #define _JBLEN 34 | ||
25 | #endif | ||
26 | |||
27 | #ifdef __mips__ | ||
28 | #ifdef __mips64 | ||
29 | #define _JBTYPE long long | ||
30 | #endif | ||
31 | #ifdef __mips_soft_float | ||
32 | #define _JBLEN 11 | ||
33 | #else | ||
34 | #define _JBLEN 23 | ||
35 | #endif | ||
36 | #endif | ||
37 | |||
38 | #ifdef __sh__ | ||
39 | #if __SH5__ | ||
40 | #define _JBLEN 50 | ||
41 | #define _JBTYPE long long | ||
42 | #else | ||
43 | #define _JBLEN 20 | ||
44 | #endif /* __SH5__ */ | ||
45 | #endif | ||
46 | |||
47 | #ifdef _JBLEN | ||
48 | #ifdef _JBTYPE | ||
49 | typedef _JBTYPE jmp_buf[_JBLEN]; | ||
50 | #else | ||
51 | typedef int jmp_buf[_JBLEN]; | ||
52 | #endif | ||
53 | #endif | ||
54 | |||
55 | |||
56 | extern void longjmp(jmp_buf __jmpb, int __retval); | ||
57 | extern int setjmp(jmp_buf __jmpb); | ||
58 | |||
59 | #endif // _SETJMP_H_ | ||