1
0
Fork 0
forked from len0rd/rockbox

Correct ARMv5/6 signed divider, which was not saving return address to stack before using lr for calculation.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24457 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2010-02-02 15:55:10 +00:00
parent ff6053e4c3
commit e77cdd147c

View file

@ -582,7 +582,9 @@
.ifnc "", "\quotient" .ifnc "", "\quotient"
mov \quotient, #0 mov \quotient, #0
.endif .endif
.ifnc "", "\remainder"
ARM_SDIV32_POST "", \remainder, \sign ARM_SDIV32_POST "", \remainder, \sign
.endif
.ifnc "", "\return" .ifnc "", "\return"
\return \return
.endif .endif
@ -605,10 +607,10 @@ __div0_wrap:
.size __div0_wrap, . - __div0_wrap .size __div0_wrap, . - __div0_wrap
#ifndef __ARM_EABI__ #ifndef __ARM_EABI__
#if ARM_ARCH < 5 /* Gigabeat S is crashing on boot with this enabled */
.global __divsi3 .global __divsi3
.type __divsi3,%function .type __divsi3,%function
#endif .global __udivsi3
.type __udivsi3,%function
.global __udivsi3 .global __udivsi3
.type __udivsi3,%function .type __udivsi3,%function
#else #else
@ -619,14 +621,12 @@ __div0_wrap:
.global __aeabi_uidiv .global __aeabi_uidiv
.type __aeabi_uidiv,%function .type __aeabi_uidiv,%function
.set __aeabi_uidiv,__aeabi_uidivmod .set __aeabi_uidiv,__aeabi_uidivmod
#if ARM_ARCH < 5 /* Gigabeat S is crashing on boot with this enabled */
.global __aeabi_idivmod .global __aeabi_idivmod
.type __aeabi_idivmod,%function .type __aeabi_idivmod,%function
.global __aeabi_idiv .global __aeabi_idiv
.type __aeabi_idiv,%function .type __aeabi_idiv,%function
.set __aeabi_idiv,__aeabi_idivmod .set __aeabi_idiv,__aeabi_idivmod
#endif #endif
#endif
#if ARM_ARCH < 5 #if ARM_ARCH < 5
@ -675,23 +675,21 @@ __udivsi3:
ARMV5_UDIV32_BODY r0, r1, r0, "", r2, r3, ip, __div0_wrap, 1 ARMV5_UDIV32_BODY r0, r1, r0, "", r2, r3, ip, __div0_wrap, 1
.size __udivsi3, . - __udivsi3 .size __udivsi3, . - __udivsi3
#if ARM_ARCH < 5 /* Gigabeat S is crashing on boot with this enabled */
__divsi3: __divsi3:
str lr, [sp, #-4]
ARMV5_SDIV32_BODY r0, r1, r0, "", r2, lr, ip, r3, __div0_wrap_s, "ldr pc, [sp, #-4]" ARMV5_SDIV32_BODY r0, r1, r0, "", r2, lr, ip, r3, __div0_wrap_s, "ldr pc, [sp, #-4]"
.size __divsi3, . - __divsi3 .size __divsi3, . - __divsi3
#endif
#else #else
__aeabi_uidivmod: __aeabi_uidivmod:
ARMV5_UDIV32_BODY r0, r1, r0, r1, r2, r3, ip, __div0_wrap, 1 ARMV5_UDIV32_BODY r0, r1, r0, r1, r2, r3, ip, __div0_wrap, 1
.size __aeabi_uidivmod, . - __aeabi_uidivmo .size __aeabi_uidivmod, . - __aeabi_uidivmo
#if ARM_ARCH < 5 /* Gigabeat S is crashing on boot with this enabled */
__aeabi_idivmod: __aeabi_idivmod:
str lr, [sp, #-4]
ARMV5_SDIV32_BODY r0, r1, r0, r1, r2, lr, ip, r3, __div0_wrap_s, "ldr pc, [sp, #-4]" ARMV5_SDIV32_BODY r0, r1, r0, r1, r2, lr, ip, r3, __div0_wrap_s, "ldr pc, [sp, #-4]"
.size __aeabi_idivmod, . - __aeabi_idivmod .size __aeabi_idivmod, . - __aeabi_idivmod
#endif #endif
#endif
.L_udiv_est_table: .L_udiv_est_table:
.byte 0xff, 0xfc, 0xf8, 0xf4, 0xf0, 0xed, 0xea, 0xe6 .byte 0xff, 0xfc, 0xf8, 0xf4, 0xf0, 0xed, 0xea, 0xe6