summaryrefslogtreecommitdiff
path: root/apps/codecs/lib/setjmp.h
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2009-03-08 12:48:58 +0000
committerMagnus Holmgren <magnushol@gmail.com>2009-03-08 12:48:58 +0000
commitf4515c3082dd413017ae06c25d7e85b1dcee30bf (patch)
tree1154b2fd5049aa42a1fdd2047effd39e9da1ccaa /apps/codecs/lib/setjmp.h
parent3f69bb2b1d00ccc54e2097fd9da750fcd2f7e11b (diff)
downloadrockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.zip
rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.gz
rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.bz2
rockbox-f4515c3082dd413017ae06c25d7e85b1dcee30bf.tar.xz
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.h59
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 0000000..4bcf6af
--- /dev/null
+++ b/apps/codecs/lib/setjmp.h
@@ -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_