[patch] SH: memset fix

SUGIOKA Toshinobu sugioka@itonet.co.jp
Sat Jul 23 12:40:00 GMT 2005


Hi,

On sh[34]-linux, memset function does not work if 2nd argument is negative
and 3rd argument is greater than 12.
for example, memset(ptr, '\xda', 20) sets 0xff instead of 0xda.

Attached patch fixes this problem.

	* sysdeps/sh/memset.S (memset): Correct 2nd argument handling.

diff -u -p -r1.4 memset.S
--- sysdeps/sh/memset.S	29 Apr 2003 22:47:18 -0000	1.4
+++ sysdeps/sh/memset.S	23 Jul 2005 08:37:21 -0000
@@ -28,6 +28,7 @@ ENTRY(memset)
 	bt.s	L_byte_loop_init
 	mov	r4,r7
 
+	extu.b	r5,r5
 	swap.b	r5,r1
 	or	r1,r5
 	swap.w	r5,r1

Regards,
    SUGIOKA Toshinobu



More information about the Libc-alpha mailing list