summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2007-05-24 03:00:08 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2007-05-24 03:00:08 +0000
commit58c5f8ba4cdf62342d05a546d15404cbbb3c4e07 (patch)
tree83feb0df9a391a09e9c0e5fd575fbf44b92e5f90
parent9ce2de577fd3d1089104e69eccea1c4a4a2824cf (diff)
Fix MIPS syscall() and pipe functions to set errno correctly as reported by Daniel Jacobowitz on the mailing list. More information available at <http://www.uclibc.org/lists/uclibc/2007-May/017968.html> .
-rw-r--r--libc/sysdeps/linux/mips/pipe.S15
-rw-r--r--libc/sysdeps/linux/mips/syscall.S10
2 files changed, 20 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/mips/pipe.S b/libc/sysdeps/linux/mips/pipe.S
index 791934da7..dd1aed1b2 100644
--- a/libc/sysdeps/linux/mips/pipe.S
+++ b/libc/sysdeps/linux/mips/pipe.S
@@ -17,7 +17,16 @@
pipe:
li v0,__NR_pipe
syscall
- beqz a3, 1f
+ bnez a3, 1f
+ sw v0, 0(a0)
+ sw v1, 4(a0)
+ li v0, 0
+ j ra
+1:
+ /* uClibc change -- start */
+ move a0,v0 /* Pass return val to C function. */
+ /* uClibc change -- stop */
+
#ifdef __PIC__
PTR_LA t9, __syscall_error
jr t9
@@ -25,10 +34,6 @@ pipe:
j __syscall_error
#endif
1:
- sw v0, 0(a0)
- sw v1, 4(a0)
- li v0, 0
- j ra
.end pipe
.size pipe,.-pipe
libc_hidden_def(pipe)
diff --git a/libc/sysdeps/linux/mips/syscall.S b/libc/sysdeps/linux/mips/syscall.S
index d5b1cbe3c..965eeac1e 100644
--- a/libc/sysdeps/linux/mips/syscall.S
+++ b/libc/sysdeps/linux/mips/syscall.S
@@ -60,6 +60,16 @@ syscall:
#else
addiu sp,sp,32
#endif
+ bnez a3, 1f
j ra /* Return to caller. */
+1:
+ move a0,v0 /* Pass return val to C function. */
+
+#ifdef __PIC__
+ PTR_LA t9, __syscall_error
+ jr t9
+#else
+ j __syscall_error
+#endif
.end syscall
.size syscall,.-syscall