root/include/asm-mips/unistd.h

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

INCLUDED FROM


   1 #ifndef _ASM_MIPS_UNISTD_H_
   2 #define _ASM_MIPS_UNISTD_H_
   3 
   4 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
   5 #define _syscall0(type,name) \
   6 type name(void) \
   7 { \
   8 register long __res; \
   9 __asm__ volatile (".set\tnoat\n\t" \
  10                   "li\t$1,%1\n\t" \
  11                   ".set\tat\n\t" \
  12                   "syscall\n\t" \
  13                   : "=d" (__res) \
  14                   : "i" (__NR_##name) \
  15                   : "$1"); \
  16 if (__res >= 0) \
  17         return (type) __res; \
  18 errno = -__res; \
  19 return -1; \
  20 }
  21 
  22 #define _syscall1(type,name,atype,a) \
  23 type name(atype a) \
  24 { \
  25 register long __res; \
  26 __asm__ volatile ("move\t$2,%2\n\t" \
  27                   ".set\tnoat\n\t" \
  28                   "li\t$1,%1\n\t" \
  29                   ".set\tat\n\t" \
  30                   "syscall" \
  31                   : "=d" (__res) \
  32                   : "i" (__NR_##name),"d" ((long)(a)) \
  33                   : "$1","$2"); \
  34 if (__res >= 0) \
  35         return (type) __res; \
  36 errno = -__res; \
  37 return -1; \
  38 }
  39 
  40 #define _syscall2(type,name,atype,a,btype,b) \
  41 type name(atype a,btype b) \
  42 { \
  43 register long __res; \
  44 __asm__ volatile ("move\t$2,%2\n\t" \
  45                   "move\t$3,%3\n\t" \
  46                   ".set\tnoat\n\t" \
  47                   "li\t$1,%1\n\t" \
  48                   ".set\tat\n\t" \
  49                   "syscall" \
  50                   : "=d" (__res) \
  51                   : "i" (__NR_##name),"d" ((long)(a)), \
  52                                       "d" ((long)(b))); \
  53                   : "$1","$2","$3"); \
  54 if (__res >= 0) \
  55         return (type) __res; \
  56 errno = -__res; \
  57 return -1; \
  58 }
  59 
  60 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
  61 type name (atype a, btype b, ctype c) \
  62 { \
  63 register long __res; \
  64 __asm__ volatile ("move\t$2,%2\n\t" \
  65                   "move\t$3,%3\n\t" \
  66                   "move\t$4,%4\n\t" \
  67                   ".set\tnoat\n\t" \
  68                   "li\t$1,%1\n\t" \
  69                   ".set\tat\n\t" \
  70                   "syscall" \
  71                   : "=d" (__res) \
  72                   : "i" (__NR_##name),"d" ((long)(a)), \
  73                                       "d" ((long)(b)), \
  74                                       "d" ((long)(c)) \
  75                   : "$1","$2","$3","$4"); \
  76 if (__res>=0) \
  77         return (type) __res; \
  78 errno=-__res; \
  79 return -1; \
  80 }
  81 
  82 #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
  83 type name (atype a, btype b, ctype c, dtype d) \
  84 { \
  85 register long __res; \
  86 __asm__ volatile (".set\tnoat\n\t" \
  87                   "move\t$2,%2\n\t" \
  88                   "move\t$3,%3\n\t" \
  89                   "move\t$4,%4\n\t" \
  90                   "move\t$5,%5\n\t" \
  91                   ".set\tnoat\n\t" \
  92                   "li\t$1,%1\n\t" \
  93                   ".set\tat\n\t" \
  94                   "syscall" \
  95                   : "=d" (__res) \
  96                   : "i" (__NR_##name),"d" ((long)(a)), \
  97                                       "d" ((long)(b)), \
  98                                       "d" ((long)(c)), \
  99                                       "d" ((long)(d)) \
 100                   : "$1","$2","$3","$4","$5"); \
 101 if (__res>=0) \
 102         return (type) __res; \
 103 errno=-__res; \
 104 return -1; \
 105 }
 106 
 107 #define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
 108 type name (atype a,btype b,ctype c,dtype d,etype e) \
 109 { \
 110 register long __res; \
 111 __asm__ volatile (".set\tnoat\n\t" \
 112                   "move\t$2,%2\n\t" \
 113                   "move\t$3,%3\n\t" \
 114                   "move\t$4,%4\n\t" \
 115                   "move\t$5,%5\n\t" \
 116                   "move\t$6,%6\n\t" \
 117                   ".set\tnoat\n\t" \
 118                   "li\t$1,%1\n\t" \
 119                   ".set\tat\n\t" \
 120                   "syscall" \
 121                   : "=d" (__res) \
 122                   : "i" (__NR_##name),"d" ((long)(a)), \
 123                                       "d" ((long)(b)), \
 124                                       "d" ((long)(c)), \
 125                                       "d" ((long)(d)), \
 126                                       "d" ((long)(e)) \
 127                   : "$1","$2","$3","$4","$5","$6"); \
 128 if (__res>=0) \
 129         return (type) __res; \
 130 errno=-__res; \
 131 return -1; \
 132 }
 133 
 134 #endif /* _ASM_MIPS_UNISTD_H_ */

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