Subject: memmove problem
To: None <port-arm@netbsd.org>
From: Katsumi Yamada <ymd@iij.ad.jp>
List: port-arm
Date: 02/01/2006 17:26:28
Hello,
In src/sys/lib/libkern/arch/arm/memmove.S of the netbsd-3 branch
and the netbsd-2 branch, it seems that a part of lsl and lsr have changed
mutually places.
When the following both conditions are satisfied, this problem happens:
* The source address(A) is greater than the destination address(B).
* remainder of (A-B)/4 is 1.
I made the following patch that fixes this problem. Is this correct?
--- memmove.S.org Mon Jan 30 16:04:59 2006
+++ memmove.S Mon Jan 30 16:05:56 2006
@@ -204,14 +204,6 @@
#endif
ldmia r1!, {r4, r5, r12, lr}
#ifdef __ARMEB__
- orr r3, r3, r4, lsl #24
- mov r4, r4, lsr #8
- orr r4, r4, r5, lsl #24
- mov r5, r5, lsr #8
- orr r5, r5, r12, lsl #24
- mov r12, r12, lsr #8
- orr r12, r12, lr, lsl #24
-#else
orr r3, r3, r4, lsr #24
mov r4, r4, lsl #8
orr r4, r4, r5, lsr #24
@@ -219,6 +211,14 @@
orr r5, r5, r12, lsr #24
mov r12, r12, lsl #8
orr r12, r12, lr, lsr #24
+#else
+ orr r3, r3, r4, lsl #24
+ mov r4, r4, lsr #8
+ orr r4, r4, r5, lsl #24
+ mov r5, r5, lsr #8
+ orr r5, r5, r12, lsl #24
+ mov r12, r12, lsr #8
+ orr r12, r12, lr, lsl #24
#endif
stmia r0!, {r3-r5, r12}
subs r2, r2, #0x10