@@ -61,13 +61,14 @@
result_var; })
#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err))
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((unsigned long) (val) >= (unsigned long) -4095)
#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
+#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
/* Note that the original Linux syscall restart convention required the
instruction immediately preceding SYSCALL to initialize $v0 with the
@@ -128,7 +129,6 @@ union __mips_syscall_return
({ \
union __mips_syscall_return _sc_ret; \
_sc_ret.val = __mips16_syscall##nr (args, number); \
- err = _sc_ret.reg.v1; \
_sc_ret.reg.v0; \
})
@@ -167,8 +167,7 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -191,8 +190,7 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -216,8 +214,7 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -243,8 +240,7 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -270,8 +266,7 @@ union __mips_syscall_return
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -300,8 +295,7 @@ libc_hidden_proto (__mips_syscall5, nomips16)
(long) (arg4), \
(long) (arg5), \
(long) (number)); \
- err = _sc_ret.reg.v1; \
- _sc_ret.reg.v0; \
+ _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
})
long long __nomips16 __mips_syscall6 (long arg1, long arg2, long arg3,
@@ -320,8 +314,7 @@ libc_hidden_proto (__mips_syscall6, nomips16)
(long) (arg5), \
(long) (arg6), \
(long) (number)); \
- err = _sc_ret.reg.v1; \
- _sc_ret.reg.v0; \
+ _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
})
long long __nomips16 __mips_syscall7 (long arg1, long arg2, long arg3,
@@ -342,8 +335,7 @@ libc_hidden_proto (__mips_syscall7, nomips16)
(long) (arg6), \
(long) (arg7), \
(long) (number)); \
- err = _sc_ret.reg.v1; \
- _sc_ret.reg.v0; \
+ _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
})
#if __mips_isa_rev >= 6
@@ -69,13 +69,14 @@ typedef long int __syscall_arg_t;
result_var; })
#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err))
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((unsigned long) (val) >= (unsigned long) -4095)
#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
+#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
/* Note that the original Linux syscall restart convention required the
instruction immediately preceding SYSCALL to initialize $v0 with the
@@ -133,8 +134,7 @@ typedef long int __syscall_arg_t;
: "=r" (__v0), "=r" (__a3) \
: input \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -157,8 +157,7 @@ typedef long int __syscall_arg_t;
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -182,8 +181,7 @@ typedef long int __syscall_arg_t;
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -209,8 +207,7 @@ typedef long int __syscall_arg_t;
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -236,8 +233,7 @@ typedef long int __syscall_arg_t;
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -264,8 +260,7 @@ typedef long int __syscall_arg_t;
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -294,8 +289,7 @@ typedef long int __syscall_arg_t;
: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
"r" (__a5) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -28,19 +28,3 @@
#endif
#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
#define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres"
-
-#ifndef __ASSEMBLER__
-
-/* Standard MIPS syscalls have an error flag, and return a positive errno
- when the error flag is set. Emulate this behaviour for vsyscalls so that
- the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */
-#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
- ({ \
- long _ret = funcptr (args); \
- err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \
- if (err) \
- _ret = -_ret; \
- _ret; \
- })
-
-#endif /* __ASSEMBLER__ */