diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-11 04:41:36 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-11 04:41:36 +0000 |
commit | 45c7498f59ad2889f2120a865a51043004eddd5d (patch) | |
tree | 1a62b0e8549a7f2750679de8d7dd3f82039c5719 /firmware/export | |
parent | fe7ca44471b309a0adea563cce947de9efb62ab5 (diff) |
FS#11335 by me: make ARM assembly functions thumb-friendly
We can't pop into pc on ARMv4t when using thumb: the T bit won't be
modified if we are returning to a thumb function
Code running on ARMv4t should use the new ldrpc / ldmpc macros instead
of ldr pc, [sp], #4 and ldm(cond) sp!, {regs, pc}
No modification on pure ARM builds and ARMv5+
Note: USE_THUMB is currently never defined, no targets can currently be
built with -mthumb, see FS#6734
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26756 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/config.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index 5947ca171e..3e269c287d 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -710,6 +710,26 @@ Lyre prototype 1 */ #define ROCKBOX_STRICT_ALIGN 1 #endif +#if defined(CPU_ARM) && defined(__ASSEMBLER__) +/* ARMv4T doesn't switch the T bit when popping pc directly, we must use BX */ +.macro ldmpc cond="", order="ia", regs:req +#if ARM_ARCH == 4 && defined(USE_THUMB) + ldm\cond\order sp!, { \regs, lr } + bx\cond lr +#else + ldm\cond\order sp!, { \regs, pc } +#endif +.endm +.macro ldrpc cond="" +#if ARM_ARCH == 4 && defined(USE_THUMB) + ldr\cond lr, [sp], #4 + bx\cond lr +#else + ldr\cond pc, [sp], #4 +#endif +.endm +#endif + #ifndef CODEC_SIZE #define CODEC_SIZE 0 #endif |