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_cf.S | |
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_cf.S')
-rw-r--r-- | apps/codecs/lib/setjmp_cf.S | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/apps/codecs/lib/setjmp_cf.S b/apps/codecs/lib/setjmp_cf.S new file mode 100644 index 0000000000..acc98c3f59 --- /dev/null +++ b/apps/codecs/lib/setjmp_cf.S | |||
@@ -0,0 +1,79 @@ | |||
1 | /* ANSI concatenation macros. */ | ||
2 | |||
3 | #define CONCAT1(a, b) CONCAT2(a, b) | ||
4 | #define CONCAT2(a, b) a ## b | ||
5 | |||
6 | /* Use the right prefix for global labels. */ | ||
7 | |||
8 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) | ||
9 | |||
10 | /* Use the right prefix for registers. */ | ||
11 | |||
12 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) | ||
13 | |||
14 | #define d0 REG (d0) | ||
15 | #define d1 REG (d1) | ||
16 | #define d2 REG (d2) | ||
17 | #define d3 REG (d3) | ||
18 | #define d4 REG (d4) | ||
19 | #define d5 REG (d5) | ||
20 | #define d6 REG (d6) | ||
21 | #define d7 REG (d7) | ||
22 | #define a0 REG (a0) | ||
23 | #define a1 REG (a1) | ||
24 | #define a2 REG (a2) | ||
25 | #define a3 REG (a3) | ||
26 | #define a4 REG (a4) | ||
27 | #define a5 REG (a5) | ||
28 | #define a6 REG (a6) | ||
29 | #define fp REG (fp) | ||
30 | #define sp REG (sp) | ||
31 | |||
32 | |||
33 | .global SYM (setjmp) | ||
34 | .global SYM (longjmp) | ||
35 | |||
36 | SYM (setjmp): | ||
37 | moveal sp@(4),a0 | ||
38 | movel sp@(0),a0@(12) | ||
39 | movel sp,a0@(8) | ||
40 | moveml d2-d7/a2-a6,a0@(20) | ||
41 | clrl d0 | ||
42 | rts | ||
43 | |||
44 | SYM (longjmp): | ||
45 | moveal sp@(4),a0 | ||
46 | movel sp@(8),d0 | ||
47 | bne 1f | ||
48 | movel &1,d0 | ||
49 | 1: | ||
50 | moveml a0@(20),d2-d7/a2-a6 | ||
51 | moveal a0@(8),sp | ||
52 | movel a0@(12),sp@ | ||
53 | rts | ||
54 | |||
55 | #ifdef M68881 | ||
56 | .global SYM (setjmp_68881) | ||
57 | .global SYM (longjmp_68881) | ||
58 | |||
59 | SYM (setjmp_68881): | ||
60 | moveal sp@(4),a0 | ||
61 | movel sp@(0),a0@(12) | ||
62 | movel sp,a0@(8) | ||
63 | moveml d2-d7/a2-a6,a0@(20) | ||
64 | fmovemx fp2-fp7,a0@(64) | ||
65 | clrl d0 | ||
66 | rts | ||
67 | |||
68 | SYM (longjmp_68881): | ||
69 | moveal sp@(4),a0 | ||
70 | fmovemx a0@(64),fp2-fp7 | ||
71 | movel sp@(8),d0 | ||
72 | bne 1f | ||
73 | movel &1,d0 | ||
74 | 1: | ||
75 | moveml a0@(20),d2-d7/a2-a6 | ||
76 | moveal a0@(8),sp | ||
77 | movel a0@(12),sp@ | ||
78 | rts | ||
79 | #endif | ||