patches/glibc/2.3.2/glibc-2.3.2-sh4-socket.patch
changeset 301 2be7232a73ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.3.2/glibc-2.3.2-sh4-socket.patch	Sat Jul 28 21:34:41 2007 +0000
     1.3 @@ -0,0 +1,39 @@
     1.4 +http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/sh/socket.S.diff?r1=1.5&r2=1.6&cvsroot=glibc
     1.5 +
     1.6 +Ankur Sheth said:
     1.7 +"The problem that I ran into was that multi-threaded apps would crash with a
     1.8 +seg fault when they invoked some of the socket calls (sendto() in my case.
     1.9 +This happened only on the sh4.  Turns out that a certain register (PR) was
    1.10 +not being saved and restored properly before and after invoking the system
    1.11 +call.  This patch fixes it.  It applies cleanly on glibc 2.3.2. 
    1.12 +[Thanks to Kaz for helping us find this.]"
    1.13 +
    1.14 +===================================================================
    1.15 +RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sh/socket.S,v
    1.16 +retrieving revision 1.5
    1.17 +retrieving revision 1.6
    1.18 +diff -u -r1.5 -r1.6
    1.19 +--- libc/sysdeps/unix/sysv/linux/sh/socket.S	2003/01/05 11:07:44	1.5
    1.20 ++++ libc/sysdeps/unix/sysv/linux/sh/socket.S	2003/07/12 01:25:53	1.6
    1.21 +@@ -94,7 +94,9 @@
    1.22 + #if defined NEED_CANCELLATION && defined CENABLE
    1.23 + .Lsocket_cancel:
    1.24 + 	/* Enable asynchronous cancellation.  */
    1.25 ++	sts.l pr,@-r15
    1.26 + 	CENABLE
    1.27 ++	lds.l @r15+,pr
    1.28 + 
    1.29 + 	/* Do the system call trap.  */
    1.30 + 	mov #+P(SOCKOP_,socket), r4
    1.31 +@@ -102,9 +104,11 @@
    1.32 + 	mov.l .L1,r3
    1.33 + 	trapa #0x12
    1.34 + 
    1.35 ++	sts.l pr,@-r15
    1.36 + 	mov.l r0,@-r15
    1.37 + 	CDISABLE
    1.38 + 	mov.l @r15+,r0
    1.39 ++	lds.l @r15+,pr
    1.40 + 
    1.41 + 	/* Pop args off the stack */
    1.42 + 	P(POPARGS_,NARGS)