This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] SH: memset fix


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]