root/include/asm-m68k/unistd.h

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

INCLUDED FROM


   1 #ifndef _ASM_M68K_UNISTD_H_
   2 #define _ASM_M68K_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 __asm__ ("d0") = __NR_##name; \
   9 __asm__ __volatile__ ("trap  #0" \
  10                       : "=g" (__res) \
  11                       : "0" (__NR_##name) \
  12                       : "d0"); \
  13 if (__res >= 0) \
  14         return (type) __res; \
  15 errno = -__res; \
  16 return -1; \
  17 }
  18 
  19 #define _syscall1(type,name,atype,a) \
  20 type name(atype a) \
  21 { \
  22 register long __res __asm__ ("d0") = __NR_##name; \
  23 __asm__ __volatile__ ("movel %2,d1\n\t" \
  24                       "trap  #0" \
  25                       : "=g" (__res) \
  26                       : "0" (__NR_##name), "g" ((long)(a)) \
  27                       : "d0", "d1"); \
  28 if (__res >= 0) \
  29         return (type) __res; \
  30 errno = -__res; \
  31 return -1; \
  32 }
  33 
  34 #define _syscall2(type,name,atype,a,btype,b) \
  35 type name(atype a,btype b) \
  36 { \
  37 register long __res __asm__ ("d0") = __NR_##name; \
  38 __asm__ __volatile__ ("movel %2,d1\n\t" \
  39                       "movel %3,d2\n\t" \
  40                       "trap  #0" \
  41                       : "=g" (__res) \
  42                       : "0" (__NR_##name), "g" ((long)(a)), \
  43                                           "g" ((long)(b)) \
  44                       : "d0", "d1", "d2"); \
  45 if (__res >= 0) \
  46         return (type) __res; \
  47 errno = -__res; \
  48 return -1; \
  49 }
  50 
  51 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
  52 type name(atype a,btype b,ctype c) \
  53 { \
  54 register long __res __asm__ ("d0") = __NR_##name; \
  55 __asm__ __volatile__ ("movel %2,d1\n\t" \
  56                       "movel %3,d2\n\t" \
  57                       "movel %4,d3\n\t" \
  58                       "trap  #0" \
  59                       : "=g" (__res) \
  60                       : "0" (__NR_##name), "g" ((long)(a)), \
  61                                           "g" ((long)(b)), \
  62                                           "g" ((long)(c)) \
  63                       : "d0", "d1", "d2", "d3"); \
  64 if (__res >= 0) \
  65         return (type) __res; \
  66 errno = -__res; \
  67 return -1; \
  68 }
  69 
  70 #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
  71 type name (atype a, btype b, ctype c, dtype d) \
  72 { \
  73 register long __res __asm__ ("d0") = __NR_##name; \
  74 __asm__ __volatile__ ("movel %2,d1\n\t" \
  75                       "movel %3,d2\n\t" \
  76                       "movel %4,d3\n\t" \
  77                       "movel %5,d4\n\t" \
  78                       "trap  #0" \
  79                       : "=g" (__res) \
  80                       : "0" (__NR_##name), "g" ((long)(a)), \
  81                                           "g" ((long)(b)), \
  82                                           "g" ((long)(c)), \
  83                                           "g" ((long)(d))  \
  84                       : "d0", "d1", "d2", "d3", "d4"); \
  85 if (__res >= 0) \
  86         return (type) __res; \
  87 errno = -__res; \
  88 return -1; \
  89 }
  90 
  91 #define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  92 type name (atype a,btype b,ctype c,dtype d,etype e) \
  93 { \
  94 register long __res __asm__ ("d0") = __NR_##name; \
  95 __asm__ __volatile__ ("movel %2,d1\n\t" \
  96                       "movel %3,d2\n\t" \
  97                       "movel %4,d3\n\t" \
  98                       "movel %5,d4\n\t" \
  99                       "movel %6,d5\n\t" \
 100                       "trap  #0" \
 101                       : "=g" (__res) \
 102                       : "0" (__NR_##name), "g" ((long)(a)), \
 103                                           "g" ((long)(b)), \
 104                                           "g" ((long)(c)), \
 105                                           "g" ((long)(d)), \
 106                                           "g" ((long)(e))  \
 107                       : "d0", "d1", "d2", "d3", "d4", "d5"); \
 108 if (__res >= 0) \
 109         return (type) __res; \
 110 errno = -__res; \
 111 return -1; \
 112 }
 113 
 114 #endif /* _ASM_M68K_UNISTD_H_ */

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