Hello Stefan,
On 20-11-14 13:15, Stefan Agner wrote:
Hi Jeroen,
On 2014-11-20 10:21, Jeroen Hofstee wrote:
Hello Stefan,
On 19-11-14 15:16, Stefan Agner wrote:
Resynchronize memcpy/memset with kernel and build them explicitly
in Thumb2 mode (unified syntax). Those assembler files can be
built and linked in ARM mode too, however when calling them from
Thumb2 built code, the stack got corrupted and the copy did not
succeed (the exact details have not been traced back). Hoever,
the Linux kernel builds those files in Thumb2 mode. Hence U-Boot
should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD
is set.
Also add implicit-it=always to AFLAGS when building for Thumb2.
Furthermore add no-warn-deprecated option to AFLAGS to rid of
deprecated unified syntax:
arch/arm/lib/memcpy.S: Assembler messages:
arch/arm/lib/memcpy.S:153: Warning: conditional infixes are deprecated in
unified syntax
arch/arm/lib/memcpy.S:154: Warning: conditional infixes are deprecated in
unified syntax
...
Any particular reason not to fix these warnings instead? It Is
just a matter of making the conditionals suffixes. [I guess
you can even disassemble to file to get the UAL represenation].
Or are there gas version around which actually choke on that?
No particular reason, I did not know how to fix this without digging
into it. Hence, after I discovered this, I checked why those warnings do
not happen for the kernel, then I applied just the AFLAGS the kernel is
using. I guess fixing the underlying issue is the better option, and
doing this also for the kernel would be the best way... Maybe the kernel
community also knows better why they choose to use the AFLAGS instead
(and if there are gas version which do have problems with a proper
fix)...
for what it is worth, I have attached patch hanging around, but I never
actually tested it. It is for the current version.
Regards,
Jeroen
>From c151254b3de49d8fccb69ab4f9442d884b9ff85c Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <[email protected]>
Date: Thu, 20 Nov 2014 14:06:26 +0100
Subject: [PATCH] arm: memset: make it UAL compliant
---
arch/arm/lib/memset.S | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 0cdf895..4fe38f6 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -18,8 +18,8 @@
1: subs r2, r2, #4 @ 1 do we have enough
blt 5f @ 1 bytes to align with?
cmp r3, #2 @ 1
- strltb r1, [r0], #1 @ 1
- strleb r1, [r0], #1 @ 1
+ strblt r1, [r0], #1 @ 1
+ strble r1, [r0], #1 @ 1
strb r1, [r0], #1 @ 1
add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
/*
@@ -51,20 +51,20 @@ memset:
mov lr, r1
2: subs r2, r2, #64
- stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time.
- stmgeia r0!, {r1, r3, ip, lr}
- stmgeia r0!, {r1, r3, ip, lr}
- stmgeia r0!, {r1, r3, ip, lr}
+ stmiage r0!, {r1, r3, ip, lr} @ 64 bytes at a time.
+ stmiage r0!, {r1, r3, ip, lr}
+ stmiage r0!, {r1, r3, ip, lr}
+ stmiage r0!, {r1, r3, ip, lr}
bgt 2b
ldmeqfd sp!, {pc} @ Now <64 bytes to go.
/*
* No need to correct the count; we're only testing bits from now on
*/
tst r2, #32
- stmneia r0!, {r1, r3, ip, lr}
- stmneia r0!, {r1, r3, ip, lr}
+ stmiage r0!, {r1, r3, ip, lr}
+ stmiage r0!, {r1, r3, ip, lr}
tst r2, #16
- stmneia r0!, {r1, r3, ip, lr}
+ stmiage r0!, {r1, r3, ip, lr}
ldr lr, [sp], #4
#else
@@ -90,28 +90,28 @@ memset:
rsb ip, ip, #32
sub r2, r2, ip
movs ip, ip, lsl #(32 - 4)
- stmcsia r0!, {r4, r5, r6, r7}
- stmmiia r0!, {r4, r5}
+ stmiacs r0!, {r4, r5, r6, r7}
+ stmiami r0!, {r4, r5}
tst ip, #(1 << 30)
mov ip, r1
strne r1, [r0], #4
3: subs r2, r2, #64
- stmgeia r0!, {r1, r3-r7, ip, lr}
- stmgeia r0!, {r1, r3-r7, ip, lr}
+ stmiage r0!, {r1, r3-r7, ip, lr}
+ stmiage r0!, {r1, r3-r7, ip, lr}
bgt 3b
- ldmeqfd sp!, {r4-r7, pc}
+ ldmfdeq sp!, {r4-r7, pc}
tst r2, #32
- stmneia r0!, {r1, r3-r7, ip, lr}
+ stmiage r0!, {r1, r3-r7, ip, lr}
tst r2, #16
- stmneia r0!, {r4-r7}
+ stmiage r0!, {r4-r7}
ldmfd sp!, {r4-r7, lr}
#endif
4: tst r2, #8
- stmneia r0!, {r1, r3}
+ stmiage r0!, {r1, r3}
tst r2, #4
strne r1, [r0], #4
/*
@@ -119,8 +119,8 @@ memset:
* may have an unaligned pointer as well.
*/
5: tst r2, #2
- strneb r1, [r0], #1
- strneb r1, [r0], #1
+ strbne r1, [r0], #1
+ strbne r1, [r0], #1
tst r2, #1
- strneb r1, [r0], #1
+ strbne r1, [r0], #1
mov pc, lr
--
2.1.0
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot