Package: glibc
Version: 2.3.2.ds1-20
Severity: important
Tags: patch

Glibc for mips/mipsel has currently an incomplete list of clobbered
registers for syscalls. This apparently caused no problem so far,
at least when compiling with gcc-3.3, but I observed in similiar code
breakage when using gcc-3.4.

The appended patch adds "memory" and argument registers to that list
and uses for brk the standard inline syscall implementation, which
fixes the incomplete clobber list there as well.


Thiemo


#! /bin/sh -e

# All lines beginning with `# DP:' are a description of the patch.
# DP: Description: Expect syscalls to clobber argument registers and memory
# DP: Author: Thiemo Seufer <[EMAIL PROTECTED]>
# DP: Date:  2005-04-12

if [ $# -ne 2 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p2 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p2 < $0;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

# append the patch here and adjust the -p? flag in the patch calls.
diff -upr build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/brk.c 
build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/brk.c
--- build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/brk.c      
2001-07-07 21:21:35.000000000 +0200
+++ build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/brk.c   2005-02-28 
17:38:15.000000000 +0100
@@ -33,16 +33,7 @@ __brk (void *addr)
 {
   void *newbrk;
 
-  {
-    register long int res __asm__ ("$2");
-
-    asm ("move\t$4,%2\n\t"
-        "syscall"              /* Perform the system call.  */
-        : "=r" (res)
-        : "0" (SYS_ify (brk)), "r" (addr)
-        : "$4", "$7");
-    newbrk = (void *) res;
-  }
+  newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
   __curbrk = newbrk;
 
   if (newbrk < addr)
diff -upr 
build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h 
build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
--- build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h    
2005-02-28 23:42:22.000000000 +0100
+++ build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h 
2005-02-28 17:33:56.000000000 +0100
@@ -275,7 +275,7 @@
        _sys_result;                                                    \
 })
 
-#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 
"$14", "$15", "$24", "$25"
+#define __SYSCALL_CLOBBERS "memory", "$3", "$4", "$5", "$6", "$8", "$9", 
"$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
 
 #endif /* __ASSEMBLER__ */
 
diff -upr 
build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h 
build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
--- 
build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h    
    2005-02-28 23:42:22.000000000 +0100
+++ build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h     
2005-02-28 17:28:21.000000000 +0100
@@ -256,7 +256,7 @@
        _sys_result;                                                    \
 })
 
-#define __SYSCALL_CLOBBERS "$1", "$3", "$11", "$12", "$13", "$14", "$15", 
"$24", "$25"
+#define __SYSCALL_CLOBBERS "memory", "$3", "$4", "$5", "$6", "$8", "$9", 
"$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
 #endif /* untested */
 #endif /* __ASSEMBLER__ */
 
diff -upr 
build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h 
build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
--- 
build-tree.orig/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h    
    2005-02-28 23:42:22.000000000 +0100
+++ build-tree/glibc-2.3.2/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h     
2005-02-28 17:29:49.000000000 +0100
@@ -256,7 +256,7 @@
        _sys_result;                                                    \
 })
 
-#define __SYSCALL_CLOBBERS "$1", "$3", "$11", "$12", "$13", "$14", "$15", 
"$24", "$25"
+#define __SYSCALL_CLOBBERS "memory", "$3", "$4", "$5", "$6", "$8", "$9", 
"$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"
 #endif /* untested */
 #endif /* __ASSEMBLER__ */
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to