Back to index

glibc  2.9
sysdep.h
Go to the documentation of this file.
00001 /* Copyright (C) 2000, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _LINUX_SPARC_SYSDEP_H
00021 #define _LINUX_SPARC_SYSDEP_H 1
00022 
00023 #undef INLINE_SYSCALL
00024 #define INLINE_SYSCALL(name, nr, args...) \
00025   inline_syscall##nr(__SYSCALL_STRING, __NR_##name, args)
00026 
00027 #undef INTERNAL_SYSCALL_DECL
00028 #define INTERNAL_SYSCALL_DECL(err) do { } while (0)
00029 
00030 #undef INTERNAL_SYSCALL
00031 #define INTERNAL_SYSCALL(name, err, nr, args...) \
00032   inline_syscall##nr(__INTERNAL_SYSCALL_STRING, __NR_##name, args)
00033 
00034 #undef INTERNAL_SYSCALL_NCS
00035 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
00036   inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args)
00037 
00038 #undef INTERNAL_SYSCALL_ERROR_P
00039 #define INTERNAL_SYSCALL_ERROR_P(val, err) \
00040   ((unsigned long) (val) >= -515L)
00041 
00042 #undef INTERNAL_SYSCALL_ERRNO
00043 #define INTERNAL_SYSCALL_ERRNO(val, err)  (-(val))
00044 
00045 #define inline_syscall0(string,name,dummy...)                         \
00046 ({                                                             \
00047        register long __o0 __asm__ ("o0");                      \
00048        register long __g1 __asm__ ("g1") = name;               \
00049        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00050                        "0" (__g1) :                                   \
00051                        __SYSCALL_CLOBBERS);                           \
00052        __o0;                                                   \
00053 })
00054 
00055 #define inline_syscall1(string,name,arg1)                      \
00056 ({                                                             \
00057        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00058        register long __g1 __asm__ ("g1") = name;               \
00059        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00060                        "0" (__g1), "1" (__o0) :                \
00061                        __SYSCALL_CLOBBERS);                           \
00062        __o0;                                                   \
00063 })
00064 
00065 #define inline_syscall2(string,name,arg1,arg2)                        \
00066 ({                                                             \
00067        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00068        register long __o1 __asm__ ("o1") = (long)(arg2);              \
00069        register long __g1 __asm__ ("g1") = name;               \
00070        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00071                        "0" (__g1), "1" (__o0), "r" (__o1) :           \
00072                        __SYSCALL_CLOBBERS);                           \
00073        __o0;                                                   \
00074 })
00075 
00076 #define inline_syscall3(string,name,arg1,arg2,arg3)                   \
00077 ({                                                             \
00078        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00079        register long __o1 __asm__ ("o1") = (long)(arg2);              \
00080        register long __o2 __asm__ ("o2") = (long)(arg3);              \
00081        register long __g1 __asm__ ("g1") = name;               \
00082        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00083                        "0" (__g1), "1" (__o0), "r" (__o1),            \
00084                        "r" (__o2) :                                   \
00085                        __SYSCALL_CLOBBERS);                           \
00086        __o0;                                                   \
00087 })
00088 
00089 #define inline_syscall4(string,name,arg1,arg2,arg3,arg4)              \
00090 ({                                                             \
00091        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00092        register long __o1 __asm__ ("o1") = (long)(arg2);              \
00093        register long __o2 __asm__ ("o2") = (long)(arg3);              \
00094        register long __o3 __asm__ ("o3") = (long)(arg4);              \
00095        register long __g1 __asm__ ("g1") = name;               \
00096        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00097                        "0" (__g1), "1" (__o0), "r" (__o1),            \
00098                        "r" (__o2), "r" (__o3) :                \
00099                        __SYSCALL_CLOBBERS);                           \
00100        __o0;                                                   \
00101 })
00102 
00103 #define inline_syscall5(string,name,arg1,arg2,arg3,arg4,arg5)         \
00104 ({                                                             \
00105        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00106        register long __o1 __asm__ ("o1") = (long)(arg2);              \
00107        register long __o2 __asm__ ("o2") = (long)(arg3);              \
00108        register long __o3 __asm__ ("o3") = (long)(arg4);              \
00109        register long __o4 __asm__ ("o4") = (long)(arg5);              \
00110        register long __g1 __asm__ ("g1") = name;               \
00111        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00112                        "0" (__g1), "1" (__o0), "r" (__o1),            \
00113                        "r" (__o2), "r" (__o3), "r" (__o4) :           \
00114                        __SYSCALL_CLOBBERS);                           \
00115        __o0;                                                   \
00116 })
00117 
00118 #define inline_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6)    \
00119 ({                                                             \
00120        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00121        register long __o1 __asm__ ("o1") = (long)(arg2);              \
00122        register long __o2 __asm__ ("o2") = (long)(arg3);              \
00123        register long __o3 __asm__ ("o3") = (long)(arg4);              \
00124        register long __o4 __asm__ ("o4") = (long)(arg5);              \
00125        register long __o5 __asm__ ("o5") = (long)(arg6);              \
00126        register long __g1 __asm__ ("g1") = name;               \
00127        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :          \
00128                        "0" (__g1), "1" (__o0), "r" (__o1),            \
00129                        "r" (__o2), "r" (__o3), "r" (__o4),            \
00130                        "r" (__o5) :                                   \
00131                        __SYSCALL_CLOBBERS);                           \
00132        __o0;                                                   \
00133 })
00134 
00135 #define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5)                \
00136 ({                                                             \
00137        register long __o0 __asm__ ("o0") = (long)(arg1);              \
00138        register long __o1 __asm__ ("o1") = (long)(arg2);              \
00139        register long __o2 __asm__ ("o2") = (long)(arg3);              \
00140        register long __o3 __asm__ ("o3") = (long)(arg4);              \
00141        register long __o4 __asm__ ("o4") = (long)(arg5);              \
00142        register long __g1 __asm__ ("g1") = __NR_clone;                \
00143        __asm __volatile (__CLONE_SYSCALL_STRING :                     \
00144                        "=r" (__g1), "=r" (__o0), "=r" (__o1)   :      \
00145                        "0" (__g1), "1" (__o0), "2" (__o1),            \
00146                        "r" (__o2), "r" (__o3), "r" (__o4) :           \
00147                        __SYSCALL_CLOBBERS);                           \
00148        __o0;                                                   \
00149 })
00150 
00151 
00152 #ifdef __ASSEMBLER__
00153 # define JUMPTARGET(sym) sym
00154 #endif
00155 
00156 #endif /* _LINUX_SPARC_SYSDEP_H */