Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d5c34ec authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Linus Torvalds
Browse files

[PATCH] Alpha: strncpy() fix



As it turned out after recent SCSI changes, strncpy() was broken -
it mixed up the return values from __stxncpy() in registers $24 and $27.

Thanks to Mathieu Chouquet-Stringer for tracking down the problem
and providing an excellent test case.

Signed-off-by: default avatarIvan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 454ac778
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -43,8 +43,8 @@ strncpy:


	.align	4
	.align	4
$multiword:
$multiword:
	subq	$24, 1, $2	# clear the final bits in the prev word
	subq	$27, 1, $2	# clear the final bits in the prev word
	or	$2, $24, $2
	or	$2, $27, $2
	zapnot	$1, $2, $1
	zapnot	$1, $2, $1
	subq	$18, 1, $18
	subq	$18, 1, $18


@@ -70,8 +70,8 @@ $multiword:
	bne	$18, 0b
	bne	$18, 0b


1:	ldq_u	$1, 0($16)	# clear the leading bits in the final word
1:	ldq_u	$1, 0($16)	# clear the leading bits in the final word
	subq	$27, 1, $2
	subq	$24, 1, $2
	or	$2, $27, $2
	or	$2, $24, $2


	zap	$1, $2, $1
	zap	$1, $2, $1
	stq_u	$1, 0($16)
	stq_u	$1, 0($16)