patches/glibc/2.3.2/glibc-2.3.2-sh4-socket.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
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
yann@1
     2
yann@1
     3
Ankur Sheth said:
yann@1
     4
"The problem that I ran into was that multi-threaded apps would crash with a
yann@1
     5
seg fault when they invoked some of the socket calls (sendto() in my case.
yann@1
     6
This happened only on the sh4.  Turns out that a certain register (PR) was
yann@1
     7
not being saved and restored properly before and after invoking the system
yann@1
     8
call.  This patch fixes it.  It applies cleanly on glibc 2.3.2. 
yann@1
     9
[Thanks to Kaz for helping us find this.]"
yann@1
    10
yann@1
    11
===================================================================
yann@1
    12
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sh/socket.S,v
yann@1
    13
retrieving revision 1.5
yann@1
    14
retrieving revision 1.6
yann@1
    15
diff -u -r1.5 -r1.6
yann@1
    16
--- libc/sysdeps/unix/sysv/linux/sh/socket.S	2003/01/05 11:07:44	1.5
yann@1
    17
+++ libc/sysdeps/unix/sysv/linux/sh/socket.S	2003/07/12 01:25:53	1.6
yann@1
    18
@@ -94,7 +94,9 @@
yann@1
    19
 #if defined NEED_CANCELLATION && defined CENABLE
yann@1
    20
 .Lsocket_cancel:
yann@1
    21
 	/* Enable asynchronous cancellation.  */
yann@1
    22
+	sts.l pr,@-r15
yann@1
    23
 	CENABLE
yann@1
    24
+	lds.l @r15+,pr
yann@1
    25
 
yann@1
    26
 	/* Do the system call trap.  */
yann@1
    27
 	mov #+P(SOCKOP_,socket), r4
yann@1
    28
@@ -102,9 +104,11 @@
yann@1
    29
 	mov.l .L1,r3
yann@1
    30
 	trapa #0x12
yann@1
    31
 
yann@1
    32
+	sts.l pr,@-r15
yann@1
    33
 	mov.l r0,@-r15
yann@1
    34
 	CDISABLE
yann@1
    35
 	mov.l @r15+,r0
yann@1
    36
+	lds.l @r15+,pr
yann@1
    37
 
yann@1
    38
 	/* Pop args off the stack */
yann@1
    39
 	P(POPARGS_,NARGS)