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