ancient ARM cpus
Martin Husemann
martin at duskware.de
Sat Nov 14 19:33:45 UTC 2015
Hey folks,
with NetBSD we still have some architectures using ARMv4 cpus (e.g. I run
weekly regression tests on an DNARD shark machine with strongarm110).
On those old cpus the "bx register" return variant is not supported yet,
but instead "mov pc, register" needs to be used.
We use the attached (pretty systematic) patches locally.
Would be great if you could review and maybe integrate them.
Thanks,
Martin
--- mpn/arm/aorslsh1_n.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/aorslsh1_n.asm
@@ -163,5 +163,8 @@ L(rt1): mov r14, r12
REVCY(r12)
L(rt0): RETVAL( r14)
pop {r4-r10r11, r14}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/bdiv_dbm1c.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/bdiv_dbm1c.asm
@@ -109,5 +109,8 @@ L(wd1): subs r5, r5, r8
str r5, [qp]
sbc r0, r5, r12
pop {r4, r5, r6, r7, r8}
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
--- mpn/arm/cnd_aors_n.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/cnd_aors_n.asm
@@ -130,5 +130,8 @@ L(top): ldm vp!, {r4,r5,r6,r7}
L(end): RETVAL
pop {r4-r11}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/com.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/com.asm
@@ -71,5 +71,9 @@ L(top): ldmia up!, { r3, r8, r9, r12 } C
bne L(top)
ldmfd sp!, { r7, r8, r9 } C restore regs from stack
-L(rtn): bx lr
+L(rtn):
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
--- mpn/arm/copyd.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/copyd.asm
@@ -80,5 +80,9 @@ L(top): subs n, n, #4
L(end): stmda rp, { r3,r4,r5,r12 }
pop { r4-r5 }
-L(rtn): bx lr
+L(rtn):
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
--- mpn/arm/copyi.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/copyi.asm
@@ -75,5 +75,9 @@ L(top): subs n, n, #4
L(end): stm rp, { r3,r4,r5,r12 }
pop { r4-r5 }
-L(rtn): bx lr
+L(rtn):
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
--- mpn/arm/dive_1.asm.orig 2015-11-01 15:19:49.000000000 +0000
+++ mpn/arm/dive_1.asm
@@ -112,7 +112,10 @@ L(end): sbc cy, r5, cy
mul r9, r4, cy
str r9, [rp]
pop {r4-r9}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
L(unnorm):
rsb tnc, cnt, #32
@@ -136,7 +139,10 @@ L(edu): sbc cy, r5, cy
mul r9, r4, cy
str r9, [rp]
pop {r4-r9}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
RODATA
--- mpn/arm/invert_limb.asm.orig 2015-11-01 15:19:49.000000000 +0000
+++ mpn/arm/invert_limb.asm
@@ -52,7 +52,10 @@ PROLOGUE(mpn_invert_limb)
adds r1, r12, r0
adc r3, r3, r0
rsb r0, r3, r2
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
RODATA
--- mpn/arm/logops_n.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/logops_n.asm
@@ -135,5 +135,8 @@ L(mid): sub n, n, #4
pop { r4, r5, r6, r7 } C popping r8-r10 here strangely fails
L(rtn): pop { r8, r9, r10 }
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/lshift.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/lshift.asm
@@ -84,5 +84,8 @@ L(end): orr r7, r7, r6, lsr tnc
L(1): str r7, [rp, #-4]
mov r0, r4, lsr tnc
pop {r4, r6, r7, r8}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/lshiftc.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/lshiftc.asm
@@ -91,5 +91,8 @@ L(1): mvn r6, #0
str r7, [rp, #-4]
mov r0, r4, lsr tnc
pop {r4, r6, r7, r8}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/mod_34lsub1.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/mod_34lsub1.asm
@@ -106,7 +106,10 @@ L(sum2):
add r0, r0, r12, lsr #8
pop { r4, r5, r6, r7 }
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
L(le2): cmn n, #1
bne L(1)
@@ -117,5 +120,8 @@ L(1): ldr r2, [ap]
bic r0, r2, #0xff000000
add r0, r0, r2, lsr #24
pop { r4, r5, r6, r7 }
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
--- mpn/arm/mode1o.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/mode1o.asm
@@ -88,5 +88,8 @@ L(end): sbcs cy, r5, cy
addcc r0, r0, #1
ldmfd sp!, {r4, r5}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/rsh1aors_n.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/rsh1aors_n.asm
@@ -120,5 +120,8 @@ L(e1): RSTCY( r12, r1)
str r4, [rp, #0]
mov r0, r11
pop {r4-r11}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/rshift.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/rshift.asm
@@ -82,5 +82,8 @@ L(end): orr r7, r7, r6, lsl tnc
L(1): str r7, [rp]
mov r0, r4, lsl tnc
pop {r4, r6, r7, r8}
- bx r14
+ifdef(`ARM_THUMB_MODE',
+` bx r14
+',` mov pc, r14
+')
EPILOGUE()
--- mpn/arm/sec_tabselect.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/sec_tabselect.asm
@@ -109,7 +109,10 @@ L(tp2): subs c, c, #1
bge L(tp2)
stmia rp, {r8,r9}
pop {r4-r11, r14}
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
L(n2): cmp j, #-2
bne L(n1)
@@ -127,5 +130,8 @@ L(tp1): subs c, c, #1
bge L(tp1)
str r8, [rp]
L(n1): pop {r4-r11, r14}
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
EPILOGUE()
--- mpn/arm/udiv.asm.orig 2014-03-25 14:37:55.000000000 +0000
+++ mpn/arm/udiv.asm
@@ -61,7 +61,10 @@ L(oop): divstep(n1,n0,d)
str n1, [rem_ptr] C store remainder
adc r0, n0, n0 C quotient: add last carry from divstep
- bx lr
+ifdef(`ARM_THUMB_MODE',
+` bx lr
+',` mov pc, lr
+')
L(_large_divisor):
stmfd sp!, { r8, lr }
More information about the gmp-bugs
mailing list