summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/copy_template.S
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-10 12:05:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-01-02 15:00:28 +0100
commite0d23ec7c8a9ded9730b04ac12b22c18242b9159 (patch)
tree6d00aaf275e5de0851344002500c344fb05a37fd /arch/arm/lib/copy_template.S
parent16dc67a2445eca5f9633026ac97b1bd4e59611bb (diff)
downloadbarebox-e0d23ec7c8a9ded9730b04ac12b22c18242b9159.tar.gz
barebox-e0d23ec7c8a9ded9730b04ac12b22c18242b9159.tar.xz
ARM: update string functions from Linux Kernel
The newer versions contain fixes for Thumb-2 mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/copy_template.S')
-rw-r--r--arch/arm/lib/copy_template.S24
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 61b6e54e9e..d8eb06328a 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -57,6 +57,13 @@
*
* Restore registers with the values previously saved with the
* 'preserv' macro. Called upon code termination.
+ *
+ * LDR1W_SHIFT
+ * STR1W_SHIFT
+ *
+ * Correction to be applied to the "ip" register when branching into
+ * the ldr1w or str1w instructions (some of these macros may expand to
+ * than one 32bit instruction in Thumb-2)
*/
@@ -99,9 +106,15 @@
5: ands ip, r2, #28
rsb ip, ip, #32
+#if LDR1W_SHIFT > 0
+ lsl ip, ip, #LDR1W_SHIFT
+#endif
addne pc, pc, ip @ C is always clear here
b 7f
-6: nop
+6:
+ .rept (1 << LDR1W_SHIFT)
+ W(nop)
+ .endr
ldr1w r1, r3, abort=20f
ldr1w r1, r4, abort=20f
ldr1w r1, r5, abort=20f
@@ -110,9 +123,16 @@
ldr1w r1, r8, abort=20f
ldr1w r1, lr, abort=20f
+#if LDR1W_SHIFT < STR1W_SHIFT
+ lsl ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
+#elif LDR1W_SHIFT > STR1W_SHIFT
+ lsr ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
+#endif
add pc, pc, ip
nop
- nop
+ .rept (1 << STR1W_SHIFT)
+ W(nop)
+ .endr
str1w r0, r3, abort=20f
str1w r0, r4, abort=20f
str1w r0, r5, abort=20f