OSDN Git Service

mips: fix errno setting after syscall
authorAlexander Gordeev <lasaine@lvk.cs.msu.su>
Thu, 7 Oct 2010 14:54:24 +0000 (18:54 +0400)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wed, 27 Oct 2010 19:23:15 +0000 (21:23 +0200)
If there was an error during syscall then after it's completion a3
register holds a non-zero value and v0 holds an actual error code which
should be saved in errno. This can be achieved by calling
__syscall_error with the value from v0 as a parameter. So this value
should be stored in a0, but the appropriate assembly instructions are
missing. Fixed this now by adding "move a0, v0".

I think it was once fixed by 58c5f8ba4cdf62342d05a546d15404cbbb3c4e07
but then something went wrong. Again...

Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/sysdeps/linux/mips/sysdep.h
libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h

index 0860c1a..9de4f1a 100644 (file)
@@ -98,7 +98,8 @@
 #ifdef __PIC__
 #define PSEUDO(name, syscall_name, args)               \
   .align 2;                                            \
-  99: la t9,__syscall_error;                           \
+  99: move a0, v0;                                     \
+  la t9,__syscall_error;                               \
   jr t9;                                               \
   ENTRY(name)                                          \
   .set noreorder;                                      \
@@ -112,7 +113,8 @@ L(syse1):
 #define PSEUDO(name, syscall_name, args)               \
   .set noreorder;                                      \
   .align 2;                                            \
-  99: j __syscall_error;                               \
+  99: move a0, v0;                                     \
+  j __syscall_error;                                   \
   nop;                                                 \
   ENTRY(name)                                          \
   .set noreorder;                                      \
index 1fff782..b2c0dfe 100644 (file)
@@ -28,7 +28,8 @@
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)                                    \
   .align 2;                                                                  \
-  99: la t9,__syscall_error;                                                 \
+  99: move a0, v0;                                                           \
+  la t9,__syscall_error;                                                     \
   jr t9;                                                                     \
   ENTRY (name)                                                               \
     .set noreorder;                                                          \
index 1cf625f..c2cd14f 100644 (file)
 
 # ifdef __PIC__
 #  define PSEUDO_CPLOAD .cpload t9;
-#  define PSEUDO_ERRJMP la t9, __syscall_error; jr t9;
+#  define PSEUDO_ERRJMP move a0, v0; la t9, __syscall_error; jr t9;
 #  define PSEUDO_SAVEGP sw gp, 32(sp); cfi_rel_offset (gp, 32);
 #  define PSEUDO_LOADGP lw gp, 32(sp);
 # else
 #  define PSEUDO_CPLOAD
-#  define PSEUDO_ERRJMP j __syscall_error;
+#  define PSEUDO_ERRJMP move a0, v0; j __syscall_error;
 #  define PSEUDO_SAVEGP
 #  define PSEUDO_LOADGP
 # endif