summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Goger <klaus.goger@theobroma-systems.com>2018-04-26 20:18:10 +0200
committerTom Rini <trini@konsulko.com>2018-11-16 16:51:57 -0500
commitba08afe8377ac72f834f8baad38e9631957b2ea8 (patch)
tree7aacb588b50183b609350b18e13abe9afca5588b
parentf41a824b23c57dee86ac03b55fa426f2371c1a8e (diff)
downloadu-boot-ba08afe8377ac72f834f8baad38e9631957b2ea8.tar.gz
u-boot-ba08afe8377ac72f834f8baad38e9631957b2ea8.tar.bz2
u-boot-ba08afe8377ac72f834f8baad38e9631957b2ea8.zip
arm: Make arch specific memcpy thumb-safe.
The current arch implementation of memcpy cannot be called from thumb code, because it does not use bx instructions on return. This patch addresses that. Note, that this patch does not touch the hot loop of memcpy, so performance is not affected. Tested on MXS (arm926ejs) with and without thumb-mode enabled. Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r--arch/arm/lib/memcpy.S8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S
index 0ca61210da..f7fb77235c 100644
--- a/arch/arm/lib/memcpy.S
+++ b/arch/arm/lib/memcpy.S
@@ -59,7 +59,7 @@
#endif
ENTRY(memcpy)
cmp r0, r1
- moveq pc, lr
+ bxeq lr
enter r4, lr
@@ -147,7 +147,8 @@ ENTRY(memcpy)
str1b r0, r4, cs, abort=21f
str1b r0, ip, cs, abort=21f
- exit r4, pc
+ exit r4, lr
+ bx lr
9: rsb ip, ip, #4
cmp ip, #2
@@ -256,7 +257,8 @@ ENTRY(memcpy)
.endm
.macro copy_abort_end
- ldmfd sp!, {r4, pc}
+ ldmfd sp!, {r4, lr}
+ bx lr
.endm
ENDPROC(memcpy)