freemyipod r702 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r701‎ | r702 | r703 >
Date:01:41, 24 April 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Fix CPU exception handling
Modified paths:
  • /emcore/trunk/arm/contextswitch.S (modified) (history)
  • /emcore/trunk/contextswitch.h (modified) (history)
  • /emcore/trunk/panic.c (modified) (history)
  • /emcore/trunk/target/ipodclassic/crt0.S (modified) (history)
  • /emcore/trunk/target/ipodnano2g/crt0.S (modified) (history)
  • /emcore/trunk/target/ipodnano3g/crt0.S (modified) (history)
  • /emcore/trunk/target/ipodnano4g/crt0.S (modified) (history)

Diff [purge]

Index: emcore/trunk/panic.c
@@ -45,7 +45,7 @@
4646 current_thread->state = THREAD_DEFUNCT_ACK;
4747 current_thread->block_type = THREAD_DEFUNCT_PANIC;
4848 leave_critical_section(mode);
49 - yield();
 49+ panic_recover();
5050 }
5151
5252 void panic(enum panic_severity severity, const char* string)
Index: emcore/trunk/target/ipodnano2g/crt0.S
@@ -144,41 +144,116 @@
145145
146146 .type reset_handler, %function
147147 reset_handler:
 148+ stmfd sp, {r10-r12}
 149+ mov r10, sp
 150+ mov r11, lr
 151+ mrs r12, cpsr
 152+ msr cpsr_c, #0xd7
 153+ sub sp, sp, #0x44
 154+ stmia sp!, {r0-r9}
 155+ sub r0, r10, #0xc
 156+ ldmia r0, {r0-r2}
 157+ mov r3, r10
 158+ mov r4, r11
 159+ mov r5, r11
 160+ mov r6, r12
 161+ stmia sp!, {r0-r6}
 162+ sub sp, sp, #0x44
148163 mov r0, #0
149164 adr r1, reset_text
 165+ mov r2, r11
150166 b panic
151 -reset_text:
152 - .ascii "Hit reset vector!\0"
153167 .size reset_handler, .-reset_handler
154168
155169 .type undef_instr_handler, %function
156170 undef_instr_handler:
 171+ sub sp, sp, #0x44
 172+ stmia sp!, {r0-r12}
 173+ sub r2, lr, #4
 174+ mrs r3, spsr
 175+ mrs r4, cpsr
 176+ orr r0, r3, #0xc0
 177+ msr cpsr_c, r0
 178+ mov r0, sp
 179+ mov r1, lr
 180+ msr cpsr_c, r4
 181+ stmia sp!, {r0-r3}
 182+ sub sp, sp, #0x44
157183 mov r0, #0
158184 adr r1, undef_instr_text
159 - sub r2, lr, #4
 185+ ldr r3, [r2]
160186 b panicf
161187 .size undef_instr_handler, .-undef_instr_handler
162188
163189 .type prefetch_abort_handler, %function
164190 prefetch_abort_handler:
 191+ sub sp, sp, #0x44
 192+ stmia sp!, {r0-r12}
 193+ sub r2, lr, #4
 194+ mrs r3, spsr
 195+ mrs r4, cpsr
 196+ orr r0, r3, #0xc0
 197+ msr cpsr_c, r0
 198+ mov r0, sp
 199+ mov r1, lr
 200+ msr cpsr_c, r4
 201+ stmia sp!, {r0-r3}
 202+ sub sp, sp, #0x44
165203 mov r0, #0
166204 adr r1, prefetch_abort_text
167 - sub r2, lr, #4
 205+ mrc p15, 0, r3,c5,c0
 206+ mov r4, r3,lsr#4
 207+ and r4, r4, #0xf
 208+ and r5, r3, #0xf
 209+ stmfd sp!, {r4-r5}
168210 b panicf
169211 .size prefetch_abort_handler, .-prefetch_abort_handler
170212
171213 .type data_abort_handler, %function
172214 data_abort_handler:
 215+ sub sp, sp, #0x44
 216+ stmia sp!, {r0-r12}
 217+ sub r2, lr, #8
 218+ mrs r3, spsr
 219+ mrs r4, cpsr
 220+ orr r0, r3, #0xc0
 221+ msr cpsr_c, r0
 222+ mov r0, sp
 223+ mov r1, lr
 224+ msr cpsr_c, r4
 225+ stmia sp!, {r0-r3}
 226+ sub sp, sp, #0x44
173227 mov r0, #0
174228 adr r1, data_abort_text
175 - sub r2, lr, #4
 229+ mrc p15, 0, r3,c5,c0
 230+ mov r4, r3,lsr#4
 231+ and r4, r4, #0xf
 232+ and r5, r3, #0xf
 233+ mrc p15, 0, r6,c6,c0
 234+ stmfd sp!, {r4-r6}
176235 b panicf
177236 .size data_abort_handler, .-data_abort_handler
178237
179238 .type reserved_handler, %function
180239 reserved_handler:
 240+ stmfd sp, {r10-r12}
 241+ mov r10, sp
 242+ mov r11, lr
 243+ mrs r12, cpsr
 244+ msr cpsr_c, #0xd7
 245+ sub sp, sp, #0x44
 246+ stmia sp!, {r0-r9}
 247+ sub r0, r10, #0xc
 248+ ldmia r0, {r0-r2}
 249+ mov r3, r10
 250+ mov r4, r11
 251+ mov r5, r11
 252+ mov r6, r12
 253+ stmia sp!, {r0-r6}
 254+ sub sp, sp, #0x44
181255 mov r0, #0
182256 adr r1, reserved_text
 257+ mov r2, r11
183258 b panic
184259 .size reserved_handler, .-reserved_handler
185260
@@ -189,21 +264,24 @@
190265 b panic
191266 .size fiq_handler, .-fiq_handler
192267
 268+prefetch_abort_text:
 269+ .ascii "Prefetch abort at %08X!\nFSR: %08X (domain %d, fault %d)\0"
 270+
 271+reset_text:
 272+ .ascii "Hit reset vector!\n(Last known PC: %08X)\0"
 273+
193274 undef_instr_text:
194 - .ascii "Undefined instruction at %08X!\0"
 275+ .ascii "Undefined instruction at %08X!\n(Opcode: %08X)\0"
195276
196 -prefetch_abort_text:
197 - .ascii "Prefetch abort at %08X!\0"
198 -
199277 data_abort_text:
200 - .ascii "Data abort at %08X!\0"
 278+ .ascii "Data abort at %08X!\nFSR: %08X (domain %d, fault %d)\nAddress: %08X\0"
201279
202 -reserved_text:
203 - .ascii "Hit reserved exception handler!\0"
204 -
205280 fiq_text:
206281 .ascii "Unhandled FIQ!\0"
207282
 283+reserved_text:
 284+ .ascii "Hit reserved exception handler!\n(Last known PC: %08X)\0"
 285+
208286 syscall_text:
209287 .ascii "Unhandled syscall!\0"
210288
Index: emcore/trunk/target/ipodnano3g/crt0.S
@@ -185,41 +185,116 @@
186186
187187 .type reset_handler, %function
188188 reset_handler:
 189+ stmfd sp, {r10-r12}
 190+ mov r10, sp
 191+ mov r11, lr
 192+ mrs r12, cpsr
 193+ msr cpsr_c, #0xd7
 194+ sub sp, sp, #0x44
 195+ stmia sp!, {r0-r9}
 196+ sub r0, r10, #0xc
 197+ ldmia r0, {r0-r2}
 198+ mov r3, r10
 199+ mov r4, r11
 200+ mov r5, r11
 201+ mov r6, r12
 202+ stmia sp!, {r0-r6}
 203+ sub sp, sp, #0x44
189204 mov r0, #0
190205 adr r1, reset_text
 206+ mov r2, r11
191207 b panic
192 -reset_text:
193 - .ascii "Hit reset vector!\0"
194208 .size reset_handler, .-reset_handler
195209
196210 .type undef_instr_handler, %function
197211 undef_instr_handler:
 212+ sub sp, sp, #0x44
 213+ stmia sp!, {r0-r12}
 214+ sub r2, lr, #4
 215+ mrs r3, spsr
 216+ mrs r4, cpsr
 217+ orr r0, r3, #0xc0
 218+ msr cpsr_c, r0
 219+ mov r0, sp
 220+ mov r1, lr
 221+ msr cpsr_c, r4
 222+ stmia sp!, {r0-r3}
 223+ sub sp, sp, #0x44
198224 mov r0, #0
199225 adr r1, undef_instr_text
200 - sub r2, lr, #4
 226+ ldr r3, [r2]
201227 b panicf
202228 .size undef_instr_handler, .-undef_instr_handler
203229
204230 .type prefetch_abort_handler, %function
205231 prefetch_abort_handler:
 232+ sub sp, sp, #0x44
 233+ stmia sp!, {r0-r12}
 234+ sub r2, lr, #4
 235+ mrs r3, spsr
 236+ mrs r4, cpsr
 237+ orr r0, r3, #0xc0
 238+ msr cpsr_c, r0
 239+ mov r0, sp
 240+ mov r1, lr
 241+ msr cpsr_c, r4
 242+ stmia sp!, {r0-r3}
 243+ sub sp, sp, #0x44
206244 mov r0, #0
207245 adr r1, prefetch_abort_text
208 - sub r2, lr, #4
 246+ mrc p15, 0, r3,c5,c0
 247+ mov r4, r3,lsr#4
 248+ and r4, r4, #0xf
 249+ and r5, r3, #0xf
 250+ stmfd sp!, {r4-r5}
209251 b panicf
210252 .size prefetch_abort_handler, .-prefetch_abort_handler
211253
212254 .type data_abort_handler, %function
213255 data_abort_handler:
 256+ sub sp, sp, #0x44
 257+ stmia sp!, {r0-r12}
 258+ sub r2, lr, #8
 259+ mrs r3, spsr
 260+ mrs r4, cpsr
 261+ orr r0, r3, #0xc0
 262+ msr cpsr_c, r0
 263+ mov r0, sp
 264+ mov r1, lr
 265+ msr cpsr_c, r4
 266+ stmia sp!, {r0-r3}
 267+ sub sp, sp, #0x44
214268 mov r0, #0
215269 adr r1, data_abort_text
216 - sub r2, lr, #4
 270+ mrc p15, 0, r3,c5,c0
 271+ mov r4, r3,lsr#4
 272+ and r4, r4, #0xf
 273+ and r5, r3, #0xf
 274+ mrc p15, 0, r6,c6,c0
 275+ stmfd sp!, {r4-r6}
217276 b panicf
218277 .size data_abort_handler, .-data_abort_handler
219278
220279 .type reserved_handler, %function
221280 reserved_handler:
 281+ stmfd sp, {r10-r12}
 282+ mov r10, sp
 283+ mov r11, lr
 284+ mrs r12, cpsr
 285+ msr cpsr_c, #0xd7
 286+ sub sp, sp, #0x44
 287+ stmia sp!, {r0-r9}
 288+ sub r0, r10, #0xc
 289+ ldmia r0, {r0-r2}
 290+ mov r3, r10
 291+ mov r4, r11
 292+ mov r5, r11
 293+ mov r6, r12
 294+ stmia sp!, {r0-r6}
 295+ sub sp, sp, #0x44
222296 mov r0, #0
223297 adr r1, reserved_text
 298+ mov r2, r11
224299 b panic
225300 .size reserved_handler, .-reserved_handler
226301
@@ -230,21 +305,24 @@
231306 b panic
232307 .size fiq_handler, .-fiq_handler
233308
 309+prefetch_abort_text:
 310+ .ascii "Prefetch abort at %08X!\nFSR: %08X (domain %d, fault %d)\0"
 311+
 312+reset_text:
 313+ .ascii "Hit reset vector!\n(Last known PC: %08X)\0"
 314+
234315 undef_instr_text:
235 - .ascii "Undefined instruction at %08X!\0"
 316+ .ascii "Undefined instruction at %08X!\n(Opcode: %08X)\0"
236317
237 -prefetch_abort_text:
238 - .ascii "Prefetch abort at %08X!\0"
239 -
240318 data_abort_text:
241 - .ascii "Data abort at %08X!\0"
 319+ .ascii "Data abort at %08X!\nFSR: %08X (domain %d, fault %d)\nAddress: %08X\0"
242320
243 -reserved_text:
244 - .ascii "Hit reserved exception handler!\0"
245 -
246321 fiq_text:
247322 .ascii "Unhandled FIQ!\0"
248323
 324+reserved_text:
 325+ .ascii "Hit reserved exception handler!\n(Last known PC: %08X)\0"
 326+
249327 syscall_text:
250328 .ascii "Unhandled syscall!\0"
251329
Index: emcore/trunk/target/ipodnano4g/crt0.S
@@ -134,41 +134,116 @@
135135
136136 .type reset_handler, %function
137137 reset_handler:
 138+ stmfd sp, {r10-r12}
 139+ mov r10, sp
 140+ mov r11, lr
 141+ mrs r12, cpsr
 142+ msr cpsr_c, #0xd7
 143+ sub sp, sp, #0x44
 144+ stmia sp!, {r0-r9}
 145+ sub r0, r10, #0xc
 146+ ldmia r0, {r0-r2}
 147+ mov r3, r10
 148+ mov r4, r11
 149+ mov r5, r11
 150+ mov r6, r12
 151+ stmia sp!, {r0-r6}
 152+ sub sp, sp, #0x44
138153 mov r0, #0
139154 adr r1, reset_text
 155+ mov r2, r11
140156 b panic
141 -reset_text:
142 - .ascii "Hit reset vector!\0"
143157 .size reset_handler, .-reset_handler
144158
145159 .type undef_instr_handler, %function
146160 undef_instr_handler:
 161+ sub sp, sp, #0x44
 162+ stmia sp!, {r0-r12}
 163+ sub r2, lr, #4
 164+ mrs r3, spsr
 165+ mrs r4, cpsr
 166+ orr r0, r3, #0xc0
 167+ msr cpsr_c, r0
 168+ mov r0, sp
 169+ mov r1, lr
 170+ msr cpsr_c, r4
 171+ stmia sp!, {r0-r3}
 172+ sub sp, sp, #0x44
147173 mov r0, #0
148174 adr r1, undef_instr_text
149 - sub r2, lr, #4
 175+ ldr r3, [r2]
150176 b panicf
151177 .size undef_instr_handler, .-undef_instr_handler
152178
153179 .type prefetch_abort_handler, %function
154180 prefetch_abort_handler:
 181+ sub sp, sp, #0x44
 182+ stmia sp!, {r0-r12}
 183+ sub r2, lr, #4
 184+ mrs r3, spsr
 185+ mrs r4, cpsr
 186+ orr r0, r3, #0xc0
 187+ msr cpsr_c, r0
 188+ mov r0, sp
 189+ mov r1, lr
 190+ msr cpsr_c, r4
 191+ stmia sp!, {r0-r3}
 192+ sub sp, sp, #0x44
155193 mov r0, #0
156194 adr r1, prefetch_abort_text
157 - sub r2, lr, #4
 195+ mrc p15, 0, r3,c5,c0,1
 196+ mov r4, r3,lsr#4
 197+ and r4, r4, #0xf
 198+ and r5, r3, #0xf
 199+ stmfd sp!, {r4-r5}
158200 b panicf
159201 .size prefetch_abort_handler, .-prefetch_abort_handler
160202
161203 .type data_abort_handler, %function
162204 data_abort_handler:
 205+ sub sp, sp, #0x44
 206+ stmia sp!, {r0-r12}
 207+ sub r2, lr, #8
 208+ mrs r3, spsr
 209+ mrs r4, cpsr
 210+ orr r0, r3, #0xc0
 211+ msr cpsr_c, r0
 212+ mov r0, sp
 213+ mov r1, lr
 214+ msr cpsr_c, r4
 215+ stmia sp!, {r0-r3}
 216+ sub sp, sp, #0x44
163217 mov r0, #0
164218 adr r1, data_abort_text
165 - sub r2, lr, #4
 219+ mrc p15, 0, r3,c5,c0
 220+ mov r4, r3,lsr#4
 221+ and r4, r4, #0xf
 222+ and r5, r3, #0xf
 223+ mrc p15, 0, r6,c6,c0
 224+ stmfd sp!, {r4-r6}
166225 b panicf
167226 .size data_abort_handler, .-data_abort_handler
168227
169228 .type reserved_handler, %function
170229 reserved_handler:
 230+ stmfd sp, {r10-r12}
 231+ mov r10, sp
 232+ mov r11, lr
 233+ mrs r12, cpsr
 234+ msr cpsr_c, #0xd7
 235+ sub sp, sp, #0x44
 236+ stmia sp!, {r0-r9}
 237+ sub r0, r10, #0xc
 238+ ldmia r0, {r0-r2}
 239+ mov r3, r10
 240+ mov r4, r11
 241+ mov r5, r11
 242+ mov r6, r12
 243+ stmia sp!, {r0-r6}
 244+ sub sp, sp, #0x44
171245 mov r0, #0
172246 adr r1, reserved_text
 247+ mov r2, r11
173248 b panic
174249 .size reserved_handler, .-reserved_handler
175250
@@ -179,21 +254,24 @@
180255 b panic
181256 .size fiq_handler, .-fiq_handler
182257
 258+prefetch_abort_text:
 259+ .ascii "Prefetch abort at %08X!\nFSR: %08X (domain %d, fault %d)\0"
 260+
 261+reset_text:
 262+ .ascii "Hit reset vector!\n(Last known PC: %08X)\0"
 263+
183264 undef_instr_text:
184 - .ascii "Undefined instruction at %08X!\0"
 265+ .ascii "Undefined instruction at %08X!\n(Opcode: %08X)\0"
185266
186 -prefetch_abort_text:
187 - .ascii "Prefetch abort at %08X!\0"
188 -
189267 data_abort_text:
190 - .ascii "Data abort at %08X!\0"
 268+ .ascii "Data abort at %08X!\nFSR: %08X (domain %d, fault %d)\nAddress: %08X\0"
191269
192 -reserved_text:
193 - .ascii "Hit reserved exception handler!\0"
194 -
195270 fiq_text:
196271 .ascii "Unhandled FIQ!\0"
197272
 273+reserved_text:
 274+ .ascii "Hit reserved exception handler!\n(Last known PC: %08X)\0"
 275+
198276 syscall_text:
199277 .ascii "Unhandled syscall!\0"
200278
Index: emcore/trunk/target/ipodclassic/crt0.S
@@ -185,41 +185,116 @@
186186
187187 .type reset_handler, %function
188188 reset_handler:
 189+ stmfd sp, {r10-r12}
 190+ mov r10, sp
 191+ mov r11, lr
 192+ mrs r12, cpsr
 193+ msr cpsr_c, #0xd7
 194+ sub sp, sp, #0x44
 195+ stmia sp!, {r0-r9}
 196+ sub r0, r10, #0xc
 197+ ldmia r0, {r0-r2}
 198+ mov r3, r10
 199+ mov r4, r11
 200+ mov r5, r11
 201+ mov r6, r12
 202+ stmia sp!, {r0-r6}
 203+ sub sp, sp, #0x44
189204 mov r0, #0
190205 adr r1, reset_text
 206+ mov r2, r11
191207 b panic
192 -reset_text:
193 - .ascii "Hit reset vector!\0"
194208 .size reset_handler, .-reset_handler
195209
196210 .type undef_instr_handler, %function
197211 undef_instr_handler:
 212+ sub sp, sp, #0x44
 213+ stmia sp!, {r0-r12}
 214+ sub r2, lr, #4
 215+ mrs r3, spsr
 216+ mrs r4, cpsr
 217+ orr r0, r3, #0xc0
 218+ msr cpsr_c, r0
 219+ mov r0, sp
 220+ mov r1, lr
 221+ msr cpsr_c, r4
 222+ stmia sp!, {r0-r3}
 223+ sub sp, sp, #0x44
198224 mov r0, #0
199225 adr r1, undef_instr_text
200 - sub r2, lr, #4
 226+ ldr r3, [r2]
201227 b panicf
202228 .size undef_instr_handler, .-undef_instr_handler
203229
204230 .type prefetch_abort_handler, %function
205231 prefetch_abort_handler:
 232+ sub sp, sp, #0x44
 233+ stmia sp!, {r0-r12}
 234+ sub r2, lr, #4
 235+ mrs r3, spsr
 236+ mrs r4, cpsr
 237+ orr r0, r3, #0xc0
 238+ msr cpsr_c, r0
 239+ mov r0, sp
 240+ mov r1, lr
 241+ msr cpsr_c, r4
 242+ stmia sp!, {r0-r3}
 243+ sub sp, sp, #0x44
206244 mov r0, #0
207245 adr r1, prefetch_abort_text
208 - sub r2, lr, #4
 246+ mrc p15, 0, r3,c5,c0
 247+ mov r4, r3,lsr#4
 248+ and r4, r4, #0xf
 249+ and r5, r3, #0xf
 250+ stmfd sp!, {r4-r5}
209251 b panicf
210252 .size prefetch_abort_handler, .-prefetch_abort_handler
211253
212254 .type data_abort_handler, %function
213255 data_abort_handler:
 256+ sub sp, sp, #0x44
 257+ stmia sp!, {r0-r12}
 258+ sub r2, lr, #8
 259+ mrs r3, spsr
 260+ mrs r4, cpsr
 261+ orr r0, r3, #0xc0
 262+ msr cpsr_c, r0
 263+ mov r0, sp
 264+ mov r1, lr
 265+ msr cpsr_c, r4
 266+ stmia sp!, {r0-r3}
 267+ sub sp, sp, #0x44
214268 mov r0, #0
215269 adr r1, data_abort_text
216 - sub r2, lr, #4
 270+ mrc p15, 0, r3,c5,c0
 271+ mov r4, r3,lsr#4
 272+ and r4, r4, #0xf
 273+ and r5, r3, #0xf
 274+ mrc p15, 0, r6,c6,c0
 275+ stmfd sp!, {r4-r6}
217276 b panicf
218277 .size data_abort_handler, .-data_abort_handler
219278
220279 .type reserved_handler, %function
221280 reserved_handler:
 281+ stmfd sp, {r10-r12}
 282+ mov r10, sp
 283+ mov r11, lr
 284+ mrs r12, cpsr
 285+ msr cpsr_c, #0xd7
 286+ sub sp, sp, #0x44
 287+ stmia sp!, {r0-r9}
 288+ sub r0, r10, #0xc
 289+ ldmia r0, {r0-r2}
 290+ mov r3, r10
 291+ mov r4, r11
 292+ mov r5, r11
 293+ mov r6, r12
 294+ stmia sp!, {r0-r6}
 295+ sub sp, sp, #0x44
222296 mov r0, #0
223297 adr r1, reserved_text
 298+ mov r2, r11
224299 b panic
225300 .size reserved_handler, .-reserved_handler
226301
@@ -230,21 +305,24 @@
231306 b panic
232307 .size fiq_handler, .-fiq_handler
233308
 309+prefetch_abort_text:
 310+ .ascii "Prefetch abort at %08X!\nFSR: %08X (domain %d, fault %d)\0"
 311+
 312+reset_text:
 313+ .ascii "Hit reset vector!\n(Last known PC: %08X)\0"
 314+
234315 undef_instr_text:
235 - .ascii "Undefined instruction at %08X!\0"
 316+ .ascii "Undefined instruction at %08X!\n(Opcode: %08X)\0"
236317
237 -prefetch_abort_text:
238 - .ascii "Prefetch abort at %08X!\0"
239 -
240318 data_abort_text:
241 - .ascii "Data abort at %08X!\0"
 319+ .ascii "Data abort at %08X!\nFSR: %08X (domain %d, fault %d)\nAddress: %08X\0"
242320
243 -reserved_text:
244 - .ascii "Hit reserved exception handler!\0"
245 -
246321 fiq_text:
247322 .ascii "Unhandled FIQ!\0"
248323
 324+reserved_text:
 325+ .ascii "Hit reserved exception handler!\n(Last known PC: %08X)\0"
 326+
249327 syscall_text:
250328 .ascii "Unhandled syscall!\0"
251329
Index: emcore/trunk/arm/contextswitch.S
@@ -23,8 +23,31 @@
2424 #define ASM_FILE
2525 #include "global.h"
2626
27 -.section .icode.yield, "ax", %progbits
 27+.section .icode.contextswitch, "ax", %progbits
2828 .align 2
 29+.global panic_recover
 30+.type panic_recover, %function
 31+panic_recover:
 32+ mrs r0, cpsr
 33+ and r0, r0, #0x1f
 34+ cmp r0, #0x17
 35+ cmpne r0, #0x1b
 36+ bne yield
 37+ ldr sp, =_abortstackend - 0x44
 38+ ldr r9, =current_thread
 39+ ldr lr, [r9]
 40+ ldmia sp!, {r0-r7}
 41+ stmia lr!, {r0-r7}
 42+ ldmia sp!, {r0-r8}
 43+ stmia lr!, {r0-r8}
 44+ msr cpsr_c, #0xd2
 45+ bl scheduler_pause_accounting
 46+ adr lr, resume_thread
 47+ mov r0, #0
 48+ mov r1, r9
 49+ b scheduler_switch
 50+.size panic_recover, .-panic_recover
 51+
2952 .global yield
3053 .type yield, %function
3154 yield:
Index: emcore/trunk/contextswitch.h
@@ -29,6 +29,7 @@
3030
3131
3232 void handle_irq(void) __attribute__((noreturn)) ICODE_ATTR;
 33+void panic_recover() ICODE_ATTR;
3334 void yield() ICODE_ATTR;
3435 void resume_thread(void) __attribute__((noreturn)) ICODE_ATTR;
3536 uint32_t enter_critical_section(void) ICODE_ATTR;