summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-congatec-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-congatec-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch')
-rw-r--r--recipes-kernel/linux/linux-congatec-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-congatec-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch b/recipes-kernel/linux/linux-congatec-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch
new file mode 100644
index 0000000..b8d6f53
--- /dev/null
+++ b/recipes-kernel/linux/linux-congatec-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch
@@ -0,0 +1,87 @@
1From 2ba23fa6c4128febaaf57fe184420a7111caa237 Mon Sep 17 00:00:00 2001
2From: Nicolas Pitre <nicolas.pitre@linaro.org>
3Date: Tue, 12 Mar 2013 13:00:42 +0100
4Subject: [PATCH] ARM: 7670/1: fix the memset fix
5Organization: O.S. Systems Software LTDA.
6
7Commit 455bd4c430b0 ("ARM: 7668/1: fix memset-related crashes caused by
8recent GCC (4.7.2) optimizations") attempted to fix a compliance issue
9with the memset return value. However the memset itself became broken
10by that patch for misaligned pointers.
11
12This fixes the above by branching over the entry code from the
13misaligned fixup code to avoid reloading the original pointer.
14
15Also, because the function entry alignment is wrong in the Thumb mode
16compilation, that fixup code is moved to the end.
17
18While at it, the entry instructions are slightly reworked to help dual
19issue pipelines.
20
21Upstream-Status: Pending
22
23Signed-off-by: Nicolas Pitre <nico@linaro.org>
24Tested-by: Alexander Holler <holler@ahsoftware.de>
25Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
26(cherry picked from commit 418df63adac56841ef6b0f1fcf435bc64d4ed177)
27---
28 arch/arm/lib/memset.S | 33 +++++++++++++--------------------
29 1 file changed, 13 insertions(+), 20 deletions(-)
30
31diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
32index d912e73..94b0650 100644
33--- a/arch/arm/lib/memset.S
34+++ b/arch/arm/lib/memset.S
35@@ -14,31 +14,15 @@
36
37 .text
38 .align 5
39- .word 0
40-
41-1: subs r2, r2, #4 @ 1 do we have enough
42- blt 5f @ 1 bytes to align with?
43- cmp r3, #2 @ 1
44- strltb r1, [ip], #1 @ 1
45- strleb r1, [ip], #1 @ 1
46- strb r1, [ip], #1 @ 1
47- add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
48-/*
49- * The pointer is now aligned and the length is adjusted. Try doing the
50- * memset again.
51- */
52
53 ENTRY(memset)
54-/*
55- * Preserve the contents of r0 for the return value.
56- */
57- mov ip, r0
58- ands r3, ip, #3 @ 1 unaligned?
59- bne 1b @ 1
60+ ands r3, r0, #3 @ 1 unaligned?
61+ mov ip, r0 @ preserve r0 as return value
62+ bne 6f @ 1
63 /*
64 * we know that the pointer in ip is aligned to a word boundary.
65 */
66- orr r1, r1, r1, lsl #8
67+1: orr r1, r1, r1, lsl #8
68 orr r1, r1, r1, lsl #16
69 mov r3, r1
70 cmp r2, #16
71@@ -127,4 +111,13 @@ ENTRY(memset)
72 tst r2, #1
73 strneb r1, [ip], #1
74 mov pc, lr
75+
76+6: subs r2, r2, #4 @ 1 do we have enough
77+ blt 5b @ 1 bytes to align with?
78+ cmp r3, #2 @ 1
79+ strltb r1, [ip], #1 @ 1
80+ strleb r1, [ip], #1 @ 1
81+ strb r1, [ip], #1 @ 1
82+ add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
83+ b 1b
84 ENDPROC(memset)
85--
861.8.4.rc3
87