From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>

Herbert Xu wrote:

    The current stxncpy on alpha is still broken when it comes to single
    word, unaligned, src misalignment > dest misalignment copies.

    I've attached a program which demonstrates this problem.

It fails when there is a zero byte before the data.


---

 25-akpm/arch/alpha/lib/ev6-stxncpy.S |    2 +-
 25-akpm/arch/alpha/lib/stxncpy.S     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -puN arch/alpha/lib/ev6-stxncpy.S~alpha-fix-unaligned-stxncpy-again arch/alpha/lib/ev6-stxncpy.S
--- 25/arch/alpha/lib/ev6-stxncpy.S~alpha-fix-unaligned-stxncpy-again	Fri Apr  9 14:47:25 2004
+++ 25-akpm/arch/alpha/lib/ev6-stxncpy.S	Fri Apr  9 14:47:25 2004
@@ -365,7 +365,7 @@ $unaligned:
 	andnot	t2, t6, t12	# E : dest mask for a single word copy
 	or	t8, t10, t5	# E : test for end-of-count too
 
-	cmpbge	zero, t2, t3	# E :
+	cmpbge	zero, t12, t3	# E :
 	cmoveq	a2, t5, t8	# E : Latency=2, extra map slot
 	nop			# E : keep with cmoveq
 	andnot	t8, t3, t8	# E : (stall)
diff -puN arch/alpha/lib/stxncpy.S~alpha-fix-unaligned-stxncpy-again arch/alpha/lib/stxncpy.S
--- 25/arch/alpha/lib/stxncpy.S~alpha-fix-unaligned-stxncpy-again	Fri Apr  9 14:47:25 2004
+++ 25-akpm/arch/alpha/lib/stxncpy.S	Fri Apr  9 14:47:25 2004
@@ -317,7 +317,7 @@ $unaligned:
 	cmpbge	zero, t1, t8	# .. e1 : is there a zero?
 	andnot	t2, t6, t12	# e0    : dest mask for a single word copy
 	or	t8, t10, t5	# .. e1 : test for end-of-count too
-	cmpbge	zero, t2, t3	# e0    :
+	cmpbge	zero, t12, t3	# e0    :
 	cmoveq	a2, t5, t8	# .. e1 :
 	andnot	t8, t3, t8	# e0    :
 	beq	t8, $u_head	# .. e1 (zdb)

_