root/include/asm-alpha/unistd.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _ALPHA_UNISTD_H
   2 #define _ALPHA_UNISTD_H
   3 
   4 /*
   5  * ".long 131" is "PAL_callsys"..
   6  *
   7  * Duh, the alpha gcc compiler doesn't allow us to specify regs
   8  * yet. I'll have to see about this later..
   9  */
  10 
  11 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
  12 #define _syscall0(type,name) \
  13 type name(void) \
  14 { \
  15 long __res; \
  16 __asm__ __volatile__ (".long 131" \
  17         : "=a" (__res) \
  18         : "0" (__NR_##name)); \
  19 if (__res >= 0) \
  20         return (type) __res; \
  21 errno = -__res; \
  22 return -1; \
  23 }
  24 
  25 #define _syscall1(type,name,type1,arg1) \
  26 type name(type1 arg1) \
  27 { \
  28 long __res; \
  29 __asm__ __volatile__ (".long 131" \
  30         : "=a" (__res) \
  31         : "0" (__NR_##name),"b" ((long)(arg1))); \
  32 if (__res >= 0) \
  33         return (type) __res; \
  34 errno = -__res; \
  35 return -1; \
  36 }
  37 
  38 #define _syscall2(type,name,type1,arg1,type2,arg2) \
  39 type name(type1 arg1,type2 arg2) \
  40 { \
  41 long __res; \
  42 __asm__ __volatile__ (".long 131" \
  43         : "=a" (__res) \
  44         : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
  45 if (__res >= 0) \
  46         return (type) __res; \
  47 errno = -__res; \
  48 return -1; \
  49 }
  50 
  51 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
  52 type name(type1 arg1,type2 arg2,type3 arg3) \
  53 { \
  54 long __res; \
  55 __asm__ __volatile__ (".long 131" \
  56         : "=a" (__res) \
  57         : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  58                   "d" ((long)(arg3))); \
  59 if (__res>=0) \
  60         return (type) __res; \
  61 errno=-__res; \
  62 return -1; \
  63 }
  64 
  65 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  66 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  67 { \
  68 long __res; \
  69 __asm__ __volatile__ (".long 131" \
  70         : "=a" (__res) \
  71         : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  72           "d" ((long)(arg3)),"S" ((long)(arg4))); \
  73 if (__res>=0) \
  74         return (type) __res; \
  75 errno=-__res; \
  76 return -1; \
  77 } 
  78 
  79 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
  80           type5,arg5) \
  81 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
  82 { \
  83 long __res; \
  84 __asm__ __volatile__ (".long 131" \
  85         : "=a" (__res) \
  86         : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  87           "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
  88 if (__res>=0) \
  89         return (type) __res; \
  90 errno=-__res; \
  91 return -1; \
  92 }
  93 
  94 #endif /* _ALPHA_UNISTD_H */

/* [previous][next][first][last][top][bottom][index][help] */