This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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]

Avoid reuse of MIPS "hi" and "lo"


We discovered a problem in uClibc where GCC 4.4 has gotten more
aggressive in use of "hi" and "lo".  The kernel does not promise that
these will be saved across system calls; they often are, but it's
a matter of luck and what paths the kernel takes.  So we should mark
them as clobbered.

I rebuilt a mips-linux o32 glibc and diffed the assembly.  There is a
bit of register selection churn, but no references to hi/lo are added
or removed; so at the moment, I think this is only a latent bug.

I've checked this in.  I'm pretty sure I did it right, but not in the
most reliable or git-like way; GlibcGit has a lot of text for
complicated operations... but nothing for basic "I'm a dumb committer"
guidelines.  So I guessed...

I ended up with:

  git push ssh://sourceware.org/git/glibc-ports.git master:master

Which I suspect is fine except it'd be wiser to use a local branch
instead of my local master.

Anyway, if I did something wrong, please correct me and/or update the
wiki.  Thanks.

-- 
Daniel Jacobowitz
CodeSourcery

2009-09-25  Daniel Jacobowitz  <dan@codesourcery.com>

	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
	(__SYSCALL_CLOBBERS): Add "hi" and "lo".
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
	(__SYSCALL_CLOBBERS): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
	(__SYSCALL_CLOBBERS): Likewise.

diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
index 753f98a..20a345d 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -285,7 +285,7 @@
 })
 
 #define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
+	"$14", "$15", "$24", "$25", "hi", "lo", "memory"
 
 #endif /* __ASSEMBLER__ */
 
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
index 1513306..665f88b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
@@ -253,7 +253,7 @@
 })
 
 #define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
+	"$14", "$15", "$24", "$25", "hi", "lo", "memory"
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling is not yet supported for MIPS.  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
index af12bbd..b998a63 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
@@ -249,7 +249,7 @@
 })
 
 #define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
+	"$14", "$15", "$24", "$25", "hi", "lo", "memory"
 #endif /* __ASSEMBLER__ */
 
 /* Pointer mangling is not yet supported for MIPS.  */


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