|
300 | 300 | mov r2, sp
|
301 | 301 | ldr r1, [r2, #\offset + S_PSR] @ get calling cpsr
|
302 | 302 | ldr lr, [r2, #\offset + S_PC]! @ get pc
|
| 303 | + tst r1, #0xcf |
| 304 | + bne 1f |
303 | 305 | msr spsr_cxsf, r1 @ save in spsr_svc
|
304 | 306 | #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
|
305 | 307 | @ We must avoid clrex due to Cortex-A15 erratum #830321
|
|
314 | 316 | @ after ldm {}^
|
315 | 317 | add sp, sp, #\offset + PT_REGS_SIZE
|
316 | 318 | movs pc, lr @ return & move spsr_svc into cpsr
|
| 319 | +1: bug "Returning to usermode but unexpected PSR bits set?", \@ |
317 | 320 | #elif defined(CONFIG_CPU_V7M)
|
318 | 321 | @ V7M restore.
|
319 | 322 | @ Note that we don't need to do clrex here as clearing the local
|
|
329 | 332 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
|
330 | 333 | ldr lr, [sp, #\offset + S_PC] @ get pc
|
331 | 334 | add sp, sp, #\offset + S_SP
|
| 335 | + tst r1, #0xcf |
| 336 | + bne 1f |
332 | 337 | msr spsr_cxsf, r1 @ save in spsr_svc
|
333 | 338 |
|
334 | 339 | @ We must avoid clrex due to Cortex-A15 erratum #830321
|
|
341 | 346 | .endif
|
342 | 347 | add sp, sp, #PT_REGS_SIZE - S_SP
|
343 | 348 | movs pc, lr @ return & move spsr_svc into cpsr
|
| 349 | +1: bug "Returning to usermode but unexpected PSR bits set?", \@ |
344 | 350 | #endif /* !CONFIG_THUMB2_KERNEL */
|
345 | 351 | .endm
|
346 | 352 |
|
|
0 commit comments