Home | History | Annotate | Download | only in s390x
      1 #ifndef SVC_H
      2 #define SVC_H
      3 #include <asm/unistd.h>
      4 #include <sys/syscall.h>
      5 
      6 static inline long
      7 svc0(int num)
      8 {
      9   register int _num asm("1") = num;
     10   register long ret asm("2");
     11 
     12   asm volatile(	"svc 0\n"
     13 		:"=d"(ret)
     14 		: "d" (_num)
     15 		: "cc", "memory");
     16   return ret;
     17 }
     18 
     19 static inline long
     20 svc1(int num, unsigned long arg1)
     21 {
     22   register int _num asm("1") = num;
     23   register long ret asm("2");
     24   register unsigned long _arg1 asm("2") = arg1;
     25 
     26   asm volatile(	"svc 0\n"
     27 		:"=d"(ret)
     28 		: "d" (_num), "d" (_arg1)
     29 		: "cc", "memory");
     30   return ret;
     31 }
     32 
     33 static inline long
     34 svc2(int num, unsigned long arg1, unsigned long arg2)
     35 {
     36   register int _num asm("1") = num;
     37   register long ret asm("2");
     38   register unsigned long _arg1 asm("2") = arg1;
     39   register unsigned long _arg2 asm("3") = arg2;
     40 
     41   asm volatile(	"svc 0\n"
     42 		:"=d"(ret)
     43 		: "d" (_num), "d" (_arg1), "d" (_arg2)
     44 		: "cc", "memory");
     45   return ret;
     46 }
     47 
     48 
     49 static inline long
     50 svc3(int num, unsigned long arg1, unsigned long arg2, unsigned long arg3)
     51 {
     52   register int _num asm("1") = num;
     53   register long ret asm("2");
     54   register unsigned long _arg1 asm("2") = arg1;
     55   register unsigned long _arg2 asm("3") = arg2;
     56   register unsigned long _arg3 asm("4") = arg3;
     57 
     58   asm volatile(	"svc 0\n"
     59 		:"=d"(ret)
     60 		: "d" (_num), "d" (_arg1), "d" (_arg2), "d" (_arg3)
     61 		: "cc", "memory");
     62   return ret;
     63 }
     64 
     65 
     66 
     67 static inline long
     68 svc4(int num, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4)
     69 {
     70   register int _num asm("1") = num;
     71   register long ret asm("2");
     72   register unsigned long _arg1 asm("2") = arg1;
     73   register unsigned long _arg2 asm("3") = arg2;
     74   register unsigned long _arg3 asm("4") = arg3;
     75   register unsigned long _arg4 asm("5") = arg4;
     76 
     77   asm volatile(	"svc 0\n"
     78 		:"=d"(ret)
     79 		: "d" (_num), "d" (_arg1), "d" (_arg2), "d" (_arg3), "d" (_arg4)
     80 		: "cc", "memory");
     81   return ret;
     82 }
     83 
     84 
     85 
     86 static inline long
     87 svc5(int num, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4,
     88 	unsigned long arg5)
     89 {
     90   register int _num asm("1") = num;
     91   register long ret asm("2");
     92   register unsigned long _arg1 asm("2") = arg1;
     93   register unsigned long _arg2 asm("3") = arg2;
     94   register unsigned long _arg3 asm("4") = arg3;
     95   register unsigned long _arg4 asm("5") = arg4;
     96   register unsigned long _arg5 asm("6") = arg5;
     97 
     98   asm volatile(	"svc 0\n"
     99 		:"=d"(ret)
    100 		: "d" (_num), "d" (_arg1), "d" (_arg2), "d" (_arg3), "d" (_arg4), "d" (_arg5)
    101 		: "cc", "memory");
    102   return ret;
    103 }
    104 
    105 #endif /* SVC_H */
    106