- Status Closed
- Percent Complete
- Task Type Patches
- Category Battery/Charging
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Release 3.4
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#11335 - Make ARM assembly functions thumb-friendly
A lot of functions use return instructions which won’t set the T bit if the caller was running in thumb:
- ldm reg, { …, pc } works on armv5 but not armv4t
- ldr pc, function works on ARMv5 and +
- add/sub/bic/orr/mov pc, lr works on armv7 but not before
DDI0100E (ARMv5 architecture reference manual) says of mov:
If <Rd> is R15, the SPSR of the current mode is copied to the CPSR
This patch changes all occurences of these instructions which could be run on armv4t (e.g. PP, AMSv1, ..).
I don’t think I have missed any, I used grep -E “1)pc” to find all the occurences.
I could have changed some code which would not run on ARMv4 though.
Cost of this change on ldm (the most used)
- 4 more bytes per return
- 1 more cycle on ARM7TDMI, no effect on newer CPUs
See FS#6734 for how to build thumb code
2010-06-11 04:42
Reason for closing: Accepted
Additional comments about closing: Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407
r26756
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
I didn’t change any crt0.S
I think we can return from vectors with anything, the spsr will be restored with the T bit (must check)
Exceptions which return already take care of restoring CPSR from SPSR so the T bit stays set
e200v1 built with -mthumb still doesn’t boot though
Tested OK on fuzev1 (armv4) and clipv2 (armv5)
All files checked
Modify some comments
Remove unrelated diffs
% grep -rE “1)pc” *|cut -d: -f1|sort|uniq
apps/codecs/demac/libdemac/udiv32_arm.S # ARMv5+
apps/codecs/libtremor/mapping0.c # false positive (ldmia %[pcm])
apps/dsp_arm_v6.S # ARMv6+
apps/plugins/mpegplayer/idct_armv6.S # ARMv6+
apps/plugins/mpegplayer/motion_comp_arm_s.S # branches to local ARM functions
apps/recorder/jpeg_idct_arm.S # ARMv5+
firmware/target/arm/as3525/sansa-clipplus/lcd-as-clip-plus.S # ARMv5
firmware/target/arm/as3525/sansa-clipv2/lcd-as-clipv2.S # ARMv5
# crt0 ignored: entered in ARM state, returning from exceptions restore SPSR into CPSR
firmware/target/arm/at91sam/lyre_proto1/crt0.S
firmware/target/arm/crt0-pp-bl.S
firmware/target/arm/crt0-pp.S
firmware/target/arm/crt0.S
firmware/target/arm/imx31/crt0.S
firmware/target/arm/pnx0101/crt0-pnx0101.S
firmware/target/arm/s3c2440/crt0.S
firmware/target/arm/s5l8700/crt0.S
firmware/target/arm/tcc77x/crt0.S
firmware/target/arm/tcc780x/crt0.S
firmware/target/arm/support-arm.S # ARMv5+
firmware/target/arm/s3c2440/system-s3c2440.c # return from exception (irq), restore SPSR into CPSR
# tools and bootloaders ignored
rbutil/mkamsboot/dualboot/dualboot.S
rbutil/mkamsboot/dualboot/nrv2e_d8.S
rbutil/mktccboot/mktccboot.c
bootloader/creativezvm.c
bootloader/ipodnano2g.c
Still not booting on e200v1 (built with -mthumb) - not sure why
sync to r26588
problem on PP is a problem with the linker, i think this patch could go in
i’ll make some test_codec run to confirm it hasn’t any noticeable impact
Results on fuzev1 built with eabi: last column is the % of time needed to decode with the patch, compared to without the patch
Replace ldm/ldr which pop pc by ldrpc/ldmpc macros