diff options
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/codecs.make | 2 | ||||
-rw-r--r-- | apps/codecs/lib/SOURCES | 9 | ||||
-rw-r--r-- | apps/codecs/lib/setjmp.h | 63 | ||||
-rw-r--r-- | apps/codecs/lib/setjmp_arm.S | 174 | ||||
-rw-r--r-- | apps/codecs/lib/setjmp_cf.S | 79 | ||||
-rw-r--r-- | apps/codecs/lib/setjmp_mips.S | 101 |
6 files changed, 1 insertions, 427 deletions
diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make index 4ca54ce36e..30fea9969e 100644 --- a/apps/codecs/codecs.make +++ b/apps/codecs/codecs.make | |||
@@ -126,7 +126,7 @@ $(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECLIB | |||
126 | $(CODECLIB) \ | 126 | $(CODECLIB) \ |
127 | -lgcc $(subst .map,-pre.map,$(CODECLDFLAGS)) | 127 | -lgcc $(subst .map,-pre.map,$(CODECLDFLAGS)) |
128 | 128 | ||
129 | $(CODECDIR)/%.codec: $(CODECDIR)/%.o | 129 | $(CODECDIR)/%.codec: $(CODECDIR)/%.o $(LIBSETJMP) |
130 | $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \ | 130 | $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \ |
131 | $(filter %.o, $^) \ | 131 | $(filter %.o, $^) \ |
132 | $(filter %.a, $+) \ | 132 | $(filter %.a, $+) \ |
diff --git a/apps/codecs/lib/SOURCES b/apps/codecs/lib/SOURCES index f9b2447efe..cef214a3ab 100644 --- a/apps/codecs/lib/SOURCES +++ b/apps/codecs/lib/SOURCES | |||
@@ -13,18 +13,9 @@ mdct.c | |||
13 | 13 | ||
14 | #ifdef CPU_ARM | 14 | #ifdef CPU_ARM |
15 | mdct_arm.S | 15 | mdct_arm.S |
16 | setjmp_arm.S | ||
17 | ../../../firmware/target/arm/support-arm.S | 16 | ../../../firmware/target/arm/support-arm.S |
18 | #endif | 17 | #endif |
19 | 18 | ||
20 | #ifdef CPU_COLDFIRE | ||
21 | setjmp_cf.S | ||
22 | #endif | ||
23 | |||
24 | #ifdef CPU_MIPS | ||
25 | setjmp_mips.S | ||
26 | #endif | ||
27 | |||
28 | #elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) | 19 | #elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) |
29 | osx.dummy.c | 20 | osx.dummy.c |
30 | #endif | 21 | #endif |
diff --git a/apps/codecs/lib/setjmp.h b/apps/codecs/lib/setjmp.h deleted file mode 100644 index f7ff2ea58c..0000000000 --- a/apps/codecs/lib/setjmp.h +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
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 CPU_MIPS | ||
28 | #if CPU_MIPS == 64 | ||
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 | #if 0 /* Disabled for now, as SH doesn't have setjmp implementation (yet) */ | ||
39 | #ifdef __sh__ | ||
40 | #if __SH5__ | ||
41 | #define _JBLEN 50 | ||
42 | #define _JBTYPE long long | ||
43 | #else | ||
44 | #define _JBLEN 20 | ||
45 | #endif /* __SH5__ */ | ||
46 | #endif | ||
47 | #endif | ||
48 | |||
49 | #ifdef _JBLEN | ||
50 | #ifdef _JBTYPE | ||
51 | typedef _JBTYPE jmp_buf[_JBLEN]; | ||
52 | #else | ||
53 | typedef int jmp_buf[_JBLEN]; | ||
54 | #endif | ||
55 | #else | ||
56 | typedef int jmp_buf; | ||
57 | #endif | ||
58 | |||
59 | |||
60 | extern void longjmp(jmp_buf __jmpb, int __retval); | ||
61 | extern int setjmp(jmp_buf __jmpb); | ||
62 | |||
63 | #endif // _SETJMP_H_ | ||
diff --git a/apps/codecs/lib/setjmp_arm.S b/apps/codecs/lib/setjmp_arm.S deleted file mode 100644 index ee5ebd9169..0000000000 --- a/apps/codecs/lib/setjmp_arm.S +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | /* This is a simple version of setjmp and longjmp. | ||
2 | |||
3 | Nick Clifton, Cygnus Solutions, 13 June 1997. */ | ||
4 | |||
5 | /* ANSI concatenation macros. */ | ||
6 | #define CONCAT(a, b) CONCAT2(a, b) | ||
7 | #define CONCAT2(a, b) a##b | ||
8 | |||
9 | #ifndef __USER_LABEL_PREFIX__ | ||
10 | #error __USER_LABEL_PREFIX__ not defined | ||
11 | #endif | ||
12 | |||
13 | #define SYM(x) CONCAT (__USER_LABEL_PREFIX__, x) | ||
14 | |||
15 | #ifdef __ELF__ | ||
16 | #define TYPE(x) .type SYM(x),function | ||
17 | #define SIZE(x) .size SYM(x), . - SYM(x) | ||
18 | #else | ||
19 | #define TYPE(x) | ||
20 | #define SIZE(x) | ||
21 | #endif | ||
22 | |||
23 | /* Arm/Thumb interworking support: | ||
24 | |||
25 | The interworking scheme expects functions to use a BX instruction | ||
26 | to return control to their parent. Since we need this code to work | ||
27 | in both interworked and non-interworked environments as well as with | ||
28 | older processors which do not have the BX instruction we do the | ||
29 | following: | ||
30 | Test the return address. | ||
31 | If the bottom bit is clear perform an "old style" function exit. | ||
32 | (We know that we are in ARM mode and returning to an ARM mode caller). | ||
33 | Otherwise use the BX instruction to perform the function exit. | ||
34 | |||
35 | We know that we will never attempt to perform the BX instruction on | ||
36 | an older processor, because that kind of processor will never be | ||
37 | interworked, and a return address with the bottom bit set will never | ||
38 | be generated. | ||
39 | |||
40 | In addition, we do not actually assemble the BX instruction as this would | ||
41 | require us to tell the assembler that the processor is an ARM7TDMI and | ||
42 | it would store this information in the binary. We want this binary to be | ||
43 | able to be linked with binaries compiled for older processors however, so | ||
44 | we do not want such information stored there. | ||
45 | |||
46 | If we are running using the APCS-26 convention however, then we never | ||
47 | test the bottom bit, because this is part of the processor status. | ||
48 | Instead we just do a normal return, since we know that we cannot be | ||
49 | returning to a Thumb caller - the Thumb does not support APCS-26. | ||
50 | |||
51 | Function entry is much simpler. If we are compiling for the Thumb we | ||
52 | just switch into ARM mode and then drop through into the rest of the | ||
53 | function. The function exit code will take care of the restore to | ||
54 | Thumb mode. | ||
55 | |||
56 | For Thumb-2 do everything in Thumb mode. */ | ||
57 | |||
58 | #ifdef __APCS_26__ | ||
59 | #define RET movs pc, lr | ||
60 | #elif defined(__thumb2__) | ||
61 | #define RET bx lr | ||
62 | #elif !defined(ROCKBOX_SUPPORTS_AN_ARMV4_NON_T_CPU) | ||
63 | #define RET bx lr /* BX exists on v4T, v5 and more recent architectures */ | ||
64 | #else | ||
65 | #define RET tst lr, #1; \ | ||
66 | moveq pc, lr ; \ | ||
67 | .word 0xe12fff1e /* bx lr */ | ||
68 | #endif | ||
69 | |||
70 | #ifdef __thumb2__ | ||
71 | .macro COND where when | ||
72 | i\where \when | ||
73 | .endm | ||
74 | #else | ||
75 | .macro COND where when | ||
76 | .endm | ||
77 | #endif | ||
78 | |||
79 | #if defined(__thumb2__) | ||
80 | .syntax unified | ||
81 | .macro MODE | ||
82 | .thumb | ||
83 | .thumb_func | ||
84 | .endm | ||
85 | .macro PROLOGUE name | ||
86 | .endm | ||
87 | |||
88 | #elif defined(__thumb__) | ||
89 | #define MODE .thumb_func | ||
90 | .macro PROLOGUE name | ||
91 | .code 16 | ||
92 | bx pc | ||
93 | nop | ||
94 | .code 32 | ||
95 | SYM (.arm_start_of.\name): | ||
96 | .endm | ||
97 | #else /* Arm */ | ||
98 | #define MODE .code 32 | ||
99 | .macro PROLOGUE name | ||
100 | .endm | ||
101 | #endif | ||
102 | |||
103 | .macro FUNC_START name | ||
104 | .text | ||
105 | .align 2 | ||
106 | MODE | ||
107 | .globl SYM (\name) | ||
108 | TYPE (\name) | ||
109 | SYM (\name): | ||
110 | PROLOGUE \name | ||
111 | .endm | ||
112 | |||
113 | .macro FUNC_END name | ||
114 | RET | ||
115 | SIZE (\name) | ||
116 | .endm | ||
117 | |||
118 | /* -------------------------------------------------------------------- | ||
119 | int setjmp (jmp_buf); | ||
120 | -------------------------------------------------------------------- */ | ||
121 | |||
122 | FUNC_START setjmp | ||
123 | |||
124 | /* Save all the callee-preserved registers into the jump buffer. */ | ||
125 | #ifdef __thumb2__ | ||
126 | stmea a1!, { v1-v7, fp, ip, lr } | ||
127 | str sp, [a1],#+4 | ||
128 | #else | ||
129 | stmea a1!, { v1-v7, fp, ip, sp, lr } | ||
130 | #endif | ||
131 | |||
132 | #if 0 /* Simulator does not cope with FP instructions yet. */ | ||
133 | #ifndef __SOFTFP__ | ||
134 | /* Save the floating point registers. */ | ||
135 | sfmea f4, 4, [a1] | ||
136 | #endif | ||
137 | #endif | ||
138 | /* When setting up the jump buffer return 0. */ | ||
139 | mov a1, #0 | ||
140 | |||
141 | FUNC_END setjmp | ||
142 | |||
143 | /* -------------------------------------------------------------------- | ||
144 | volatile void longjmp (jmp_buf, int); | ||
145 | -------------------------------------------------------------------- */ | ||
146 | |||
147 | FUNC_START longjmp | ||
148 | |||
149 | /* If we have stack extension code it ought to be handled here. */ | ||
150 | |||
151 | /* Restore the registers, retrieving the state when setjmp() was called. */ | ||
152 | #ifdef __thumb2__ | ||
153 | ldmfd a1!, { v1-v7, fp, ip, lr } | ||
154 | ldr sp, [a1],#+4 | ||
155 | #else | ||
156 | ldmfd a1!, { v1-v7, fp, ip, sp, lr } | ||
157 | #endif | ||
158 | |||
159 | #if 0 /* Simulator does not cope with FP instructions yet. */ | ||
160 | #ifndef __SOFTFP__ | ||
161 | /* Restore floating point registers as well. */ | ||
162 | lfmfd f4, 4, [a1] | ||
163 | #endif | ||
164 | #endif | ||
165 | /* Put the return value into the integer result register. | ||
166 | But if it is zero then return 1 instead. */ | ||
167 | movs a1, a2 | ||
168 | #ifdef __thumb2__ | ||
169 | it eq | ||
170 | #endif | ||
171 | moveq a1, #1 | ||
172 | |||
173 | FUNC_END longjmp | ||
174 | |||
diff --git a/apps/codecs/lib/setjmp_cf.S b/apps/codecs/lib/setjmp_cf.S deleted file mode 100644 index 86eda8079c..0000000000 --- a/apps/codecs/lib/setjmp_cf.S +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
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 | ||
diff --git a/apps/codecs/lib/setjmp_mips.S b/apps/codecs/lib/setjmp_mips.S deleted file mode 100644 index 7fa127a7a4..0000000000 --- a/apps/codecs/lib/setjmp_mips.S +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | #include "config.h" | ||
2 | #include "mips.h" | ||
3 | |||
4 | /* This is a simple version of setjmp and longjmp for MIPS 32 and 64. | ||
5 | |||
6 | Ian Lance Taylor, Cygnus Support, 13 May 1993. */ | ||
7 | |||
8 | #ifdef __mips16 | ||
9 | /* This file contains 32 bit assembly code. */ | ||
10 | .set nomips16 | ||
11 | #endif | ||
12 | |||
13 | #define GPR_LAYOUT \ | ||
14 | GPR_OFFSET ($16, 0); \ | ||
15 | GPR_OFFSET ($17, 1); \ | ||
16 | GPR_OFFSET ($18, 2); \ | ||
17 | GPR_OFFSET ($19, 3); \ | ||
18 | GPR_OFFSET ($20, 4); \ | ||
19 | GPR_OFFSET ($21, 5); \ | ||
20 | GPR_OFFSET ($22, 6); \ | ||
21 | GPR_OFFSET ($23, 7); \ | ||
22 | GPR_OFFSET ($29, 8); \ | ||
23 | GPR_OFFSET ($30, 9); \ | ||
24 | GPR_OFFSET ($31, 10) | ||
25 | |||
26 | #define NUM_GPRS_SAVED 11 | ||
27 | |||
28 | #ifdef __mips_hard_float | ||
29 | #define FPR_LAYOUT \ | ||
30 | FPR_OFFSET ($f20, 0); \ | ||
31 | FPR_OFFSET ($f21, 1); \ | ||
32 | FPR_OFFSET ($f22, 2); \ | ||
33 | FPR_OFFSET ($f23, 3); \ | ||
34 | FPR_OFFSET ($f24, 4); \ | ||
35 | FPR_OFFSET ($f25, 5); \ | ||
36 | FPR_OFFSET ($f26, 6); \ | ||
37 | FPR_OFFSET ($f27, 7); \ | ||
38 | FPR_OFFSET ($f28, 8); \ | ||
39 | FPR_OFFSET ($f29, 9); \ | ||
40 | FPR_OFFSET ($f30, 10); \ | ||
41 | FPR_OFFSET ($f31, 11) | ||
42 | #else | ||
43 | #define FPR_LAYOUT | ||
44 | #endif | ||
45 | |||
46 | #if CPU_MIPS == 64 | ||
47 | #define BYTES_PER_WORD 8 | ||
48 | #define LOAD_GPR ld | ||
49 | #define LOAD_FPR ldc1 | ||
50 | #define STORE_GPR sd | ||
51 | #define STORE_FPR sdc1 | ||
52 | #else | ||
53 | #define BYTES_PER_WORD 4 | ||
54 | #define LOAD_GPR lw | ||
55 | #define LOAD_FPR lwc1 | ||
56 | #define STORE_GPR sw | ||
57 | #define STORE_FPR swc1 | ||
58 | #endif | ||
59 | |||
60 | #define GPOFF(INDEX) (INDEX * BYTES_PER_WORD) | ||
61 | #define FPOFF(INDEX) ((INDEX + NUM_GPRS_SAVED) * BYTES_PER_WORD) | ||
62 | |||
63 | /* int setjmp (jmp_buf); */ | ||
64 | .globl setjmp | ||
65 | .ent setjmp | ||
66 | setjmp: | ||
67 | .frame sp, 0, ra | ||
68 | |||
69 | #define GPR_OFFSET(REG, INDEX) STORE_GPR REG,GPOFF(INDEX)(a0) | ||
70 | #define FPR_OFFSET(REG, INDEX) STORE_FPR REG,FPOFF(INDEX)(a0) | ||
71 | GPR_LAYOUT | ||
72 | FPR_LAYOUT | ||
73 | #undef GPR_OFFSET | ||
74 | #undef FPR_OFFSET | ||
75 | |||
76 | move v0, $0 | ||
77 | j ra | ||
78 | |||
79 | .end setjmp | ||
80 | |||
81 | /* volatile void longjmp (jmp_buf, int); */ | ||
82 | .globl longjmp | ||
83 | .ent longjmp | ||
84 | longjmp: | ||
85 | .frame sp, 0, ra | ||
86 | |||
87 | #define GPR_OFFSET(REG, INDEX) LOAD_GPR REG,GPOFF(INDEX)(a0) | ||
88 | #define FPR_OFFSET(REG, INDEX) LOAD_FPR REG,FPOFF(INDEX)(a0) | ||
89 | GPR_LAYOUT | ||
90 | FPR_LAYOUT | ||
91 | #undef GPR_OFFSET | ||
92 | #undef FPR_OFFSET | ||
93 | |||
94 | bne a1, $0, 1f | ||
95 | li a1, 1 | ||
96 | 1: | ||
97 | move v0, a1 | ||
98 | j ra | ||
99 | |||
100 | .end longjmp | ||
101 | |||