1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Magnus Holmgren 2009-03-08 12:48:58 +00:00
parent 3f69bb2b1d
commit f4515c3082
6 changed files with 340 additions and 2 deletions

59
apps/codecs/lib/setjmp.h Normal file
View file

@ -0,0 +1,59 @@
#ifndef _SETJMP_H_
#define _SETJMP_H_
/* Combined parts of include/setjmp.h and include/machine/setjmp.h in
* newlib 1.17.0, with minor changes for Rockbox.
*/
#ifdef CPU_ARM
/*
* All callee preserved registers:
* v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
*/
#define _JBLEN 23
#endif
/* necv70 was 9 as well. */
#ifdef CPU_COLDFIRE
/*
* onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
* fp2-fp7 for 68881.
* All else recovered by under/over(flow) handling.
*/
#define _JBLEN 34
#endif
#ifdef __mips__
#ifdef __mips64
#define _JBTYPE long long
#endif
#ifdef __mips_soft_float
#define _JBLEN 11
#else
#define _JBLEN 23
#endif
#endif
#ifdef __sh__
#if __SH5__
#define _JBLEN 50
#define _JBTYPE long long
#else
#define _JBLEN 20
#endif /* __SH5__ */
#endif
#ifdef _JBLEN
#ifdef _JBTYPE
typedef _JBTYPE jmp_buf[_JBLEN];
#else
typedef int jmp_buf[_JBLEN];
#endif
#endif
extern void longjmp(jmp_buf __jmpb, int __retval);
extern int setjmp(jmp_buf __jmpb);
#endif // _SETJMP_H_