Merge branch 'intelfb-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / include / asm-v850 / unistd.h
index 5a86f8e..552b7c8 100644 (file)
@@ -14,8 +14,6 @@
 #ifndef __V850_UNISTD_H__
 #define __V850_UNISTD_H__
 
-#include <asm/clinkage.h>
-
 #define __NR_restart_syscall     0
 #define __NR_exit                1
 #define __NR_fork                2
    except the syscall number (r12).  */
 #define SYSCALL_SHORT_CLOBBERS SYSCALL_CLOBBERS, "r13", "r14"
 
+#ifdef __KERNEL__
 
-/* User programs sometimes end up including this header file
-   (indirectly, via uClibc header files), so I'm a bit nervous just
-   including <linux/compiler.h>.  */
-#if !defined(__builtin_expect) && __GNUC__ == 2 && __GNUC_MINOR__ < 96
-#define __builtin_expect(x, expected_value) (x)
-#endif
+#include <asm/clinkage.h>
+#include <linux/err.h>
 
 #define __syscall_return(type, res)                                          \
   do {                                                                       \
-         /* user-visible error numbers are in the range -1 - -124:           \
+         /* user-visible error numbers are in the range -1 - -MAX_ERRNO:      \
             see <asm-v850/errno.h> */                                        \
-         if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-125), 0)) { \
+         if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO), 0)) { \
                  errno = -(res);                                             \
                  res = -1;                                                   \
          }                                                                   \
@@ -346,20 +341,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e)                          \
   __syscall_return (type, __ret);                                            \
 }
 
-#if __GNUC__ < 3
-/* In older versions of gcc, `asm' statements with more than 10
-   input/output arguments produce a fatal error.  To work around this
-   problem, we use two versions, one for gcc-3.x and one for earlier
-   versions of gcc (the `earlier gcc' version doesn't work with gcc-3.x
-   because gcc-3.x doesn't allow clobbers to also be input arguments).  */
-#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f)                              \
-  __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP                            \
-                       : "=r" (ret), "=r" (syscall)                          \
-                       : "1" (syscall),                                      \
-                       "r" (a), "r" (b), "r" (c), "r" (d),                   \
-                       "r" (e), "r" (f)                                      \
-                       : SYSCALL_CLOBBERS, SYSCALL_ARG4, SYSCALL_ARG5);
-#else /* __GNUC__ >= 3 */
 #define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f)                              \
   __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP                            \
                        : "=r" (ret), "=r" (syscall),                         \
@@ -368,7 +349,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e)                           \
                        "r" (a), "r" (b), "r" (c), "r" (d),                   \
                        "2" (e), "3" (f)                                      \
                        : SYSCALL_CLOBBERS);
-#endif
 
 #define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \
 type name (atype a, btype b, ctype c, dtype d, etype e, ftype f)             \
@@ -386,7 +366,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e, ftype f)          \
 }
                
 
-#ifdef __KERNEL__
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
@@ -407,7 +386,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e, ftype f)          \
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
-#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
@@ -458,7 +436,7 @@ asmlinkage long sys_rt_sigaction(int sig,
                                struct sigaction __user *oact,
                                size_t sigsetsize);
 
-#endif
+#endif /* __KERNEL_SYSCALLS__ */
 
 /*
  * "Conditional" syscalls
@@ -473,4 +451,5 @@ asmlinkage long sys_rt_sigaction(int sig,
   void name (void) __attribute__ ((weak, alias ("sys_ni_syscall")));
 #endif
 
+#endif /* __KERNEL__ */
 #endif /* __V850_UNISTD_H__ */