diff options
Diffstat (limited to 'firmware/target/arm/pnx0101/crt0-pnx0101.S')
-rw-r--r-- | firmware/target/arm/pnx0101/crt0-pnx0101.S | 225 |
1 files changed, 0 insertions, 225 deletions
diff --git a/firmware/target/arm/pnx0101/crt0-pnx0101.S b/firmware/target/arm/pnx0101/crt0-pnx0101.S deleted file mode 100644 index 51be8c72a3..0000000000 --- a/firmware/target/arm/pnx0101/crt0-pnx0101.S +++ /dev/null | |||
@@ -1,225 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: crt0.S 11850 2006-12-29 02:49:12Z markun $ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #define ASM /* do not include structure definitions from pnx0101.h */ | ||
22 | |||
23 | #include "config.h" | ||
24 | #include "cpu.h" | ||
25 | |||
26 | .section .init.text,"ax",%progbits | ||
27 | |||
28 | .global start | ||
29 | start: | ||
30 | |||
31 | /* Arm bootloader and startup code based on startup.s from the iPodLinux loader | ||
32 | * | ||
33 | * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org) | ||
34 | * Copyright (c) 2005, Bernard Leach <leachbj@bouncycastle.org> | ||
35 | * | ||
36 | */ | ||
37 | |||
38 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ | ||
39 | |||
40 | #ifndef BOOTLOADER | ||
41 | #ifndef DEBUG | ||
42 | ldr r0, =0x80105000 | ||
43 | mov r1, #1 | ||
44 | str r1, [r0, #4] | ||
45 | mov r1, #0 | ||
46 | str r1, [r0, #4] | ||
47 | 1: ldr r1, [r0] | ||
48 | cmp r1, #0 | ||
49 | bne 1b | ||
50 | mov r1, #0x74 | ||
51 | str r1, [r0, #8] | ||
52 | mov r1, #2 | ||
53 | str r1, [r0, #0x18] | ||
54 | mov r1, #2 | ||
55 | str r1, [r0, #0x20] | ||
56 | mov r1, #82 | ||
57 | str r1, [r0, #0x28] | ||
58 | mov r1, #100 | ||
59 | str r1, [r0, #0x2c] | ||
60 | mov r1, #0x120 | ||
61 | str r1, [r0, #0x30] | ||
62 | mov r1, #6 | ||
63 | str r1, [r0, #4] | ||
64 | ldr r0, =1f | ||
65 | mov r15, r0 | ||
66 | 1: | ||
67 | #endif /* !DEBUG */ | ||
68 | |||
69 | #ifndef DEBUG | ||
70 | /* Copy exception handler code to address 0 */ | ||
71 | ldr r2, =_vectorsstart | ||
72 | ldr r3, =_vectorsend | ||
73 | ldr r4, =_vectorscopy | ||
74 | 1: | ||
75 | cmp r3, r2 | ||
76 | ldrhi r5, [r4], #4 | ||
77 | strhi r5, [r2], #4 | ||
78 | bhi 1b | ||
79 | #else | ||
80 | ldr r1, =vectors | ||
81 | ldr r0, =irq_handler | ||
82 | str r0, [r1, #24] | ||
83 | ldr r0, =fiq_handler | ||
84 | str r0, [r1, #28] | ||
85 | #endif | ||
86 | |||
87 | #ifndef STUB | ||
88 | /* Zero out IBSS */ | ||
89 | ldr r2, =_iedata | ||
90 | ldr r3, =_iend | ||
91 | mov r4, #0 | ||
92 | 1: | ||
93 | cmp r3, r2 | ||
94 | strhi r4, [r2], #4 | ||
95 | bhi 1b | ||
96 | |||
97 | /* Copy the IRAM */ | ||
98 | ldr r2, =_iramcopy | ||
99 | ldr r3, =_iramstart | ||
100 | ldr r4, =_iramend | ||
101 | 1: | ||
102 | cmp r4, r3 | ||
103 | ldrhi r5, [r2], #4 | ||
104 | strhi r5, [r3], #4 | ||
105 | bhi 1b | ||
106 | #endif /* !STUB */ | ||
107 | #endif /* !BOOTLOADER */ | ||
108 | |||
109 | /* Initialise bss section to zero */ | ||
110 | ldr r2, =_edata | ||
111 | ldr r3, =_end | ||
112 | mov r4, #0 | ||
113 | 1: | ||
114 | cmp r3, r2 | ||
115 | strhi r4, [r2], #4 | ||
116 | bhi 1b | ||
117 | |||
118 | /* Set up stack for IRQ mode */ | ||
119 | msr cpsr_c, #0xd2 | ||
120 | ldr sp, =irq_stack | ||
121 | /* Set up stack for FIQ mode */ | ||
122 | msr cpsr_c, #0xd1 | ||
123 | ldr sp, =fiq_stack | ||
124 | |||
125 | /* Let svc, abort and undefined modes use irq stack */ | ||
126 | msr cpsr_c, #0xd3 | ||
127 | ldr sp =irq_stack | ||
128 | msr cpsr_c, #0xd7 | ||
129 | ldr sp, =irq_stack | ||
130 | msr cpsr_c, #0xdb | ||
131 | ldr sp, =irq_stack | ||
132 | |||
133 | /* Switch to sys mode */ | ||
134 | msr cpsr_c, #0xdf | ||
135 | |||
136 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
137 | ldr sp, =stackend | ||
138 | mov r3, sp | ||
139 | ldr r2, =stackbegin | ||
140 | ldr r4, =0xdeadbeef | ||
141 | 1: | ||
142 | cmp r3, r2 | ||
143 | strhi r4, [r2], #4 | ||
144 | bhi 1b | ||
145 | |||
146 | bl main | ||
147 | /* main() should never return */ | ||
148 | |||
149 | /* Exception handlers. Will be copied to address 0 after memory remapping */ | ||
150 | .section .vectors,"aw" | ||
151 | ldr pc, [pc, #24] | ||
152 | ldr pc, [pc, #24] | ||
153 | ldr pc, [pc, #24] | ||
154 | ldr pc, [pc, #24] | ||
155 | ldr pc, [pc, #24] | ||
156 | ldr pc, [pc, #24] | ||
157 | ldr pc, [pc, #24] | ||
158 | ldr pc, [pc, #24] | ||
159 | |||
160 | /* Exception vectors */ | ||
161 | .global vectors | ||
162 | vectors: | ||
163 | .word start | ||
164 | .word undef_instr_handler | ||
165 | .word software_int_handler | ||
166 | .word prefetch_abort_handler | ||
167 | .word data_abort_handler | ||
168 | .word reserved_handler | ||
169 | .word irq_handler | ||
170 | .word fiq_handler | ||
171 | |||
172 | .text | ||
173 | |||
174 | /* All illegal exceptions call into UIE with exception address as first | ||
175 | parameter. This is calculated differently depending on which exception | ||
176 | we're in. Second parameter is exception number, used for a string lookup | ||
177 | in UIE. | ||
178 | */ | ||
179 | undef_instr_handler: | ||
180 | sub r0, lr, #4 | ||
181 | mov r1, #0 | ||
182 | b UIE | ||
183 | |||
184 | /* We run sys mode most of the time, and should never see a software | ||
185 | exception being thrown. Make it illegal and call UIE. | ||
186 | */ | ||
187 | software_int_handler: | ||
188 | reserved_handler: | ||
189 | sub r0, lr, #4 | ||
190 | mov r1, #4 | ||
191 | b UIE | ||
192 | |||
193 | prefetch_abort_handler: | ||
194 | sub r0, lr, #4 | ||
195 | mov r1, #1 | ||
196 | b UIE | ||
197 | |||
198 | fiq_handler: | ||
199 | @ Branch straight to FIQ handler in pcm_playback.c. This also handles the | ||
200 | @ the correct return sequence. | ||
201 | stmfd sp!, {r0-r7, r12, lr} | ||
202 | bl fiq | ||
203 | ldmfd sp!, {r0-r7, r12, lr} | ||
204 | subs pc, lr, #4 | ||
205 | |||
206 | irq_handler: | ||
207 | #ifndef STUB | ||
208 | stmfd sp!, {r0-r11, r12, lr} | ||
209 | bl irq | ||
210 | ldmfd sp!, {r0-r11, r12, lr} | ||
211 | #endif | ||
212 | subs pc, lr, #4 | ||
213 | |||
214 | #ifdef STUB | ||
215 | UIE: | ||
216 | b UIE | ||
217 | #endif | ||
218 | |||
219 | /* 256 words of IRQ stack */ | ||
220 | .space 256*4 | ||
221 | irq_stack: | ||
222 | |||
223 | /* 256 words of FIQ stack */ | ||
224 | .space 256*4 | ||
225 | fiq_stack: | ||