vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

syscall.h (883B)


      1 #include <errno.h>
      2 
      3 static inline int
      4 syscall(int num, unsigned a1, unsigned a2, unsigned a3, unsigned a4, unsigned a5)
      5 {
      6 	int ret;
      7 
      8 	asm volatile("syscall\n"
      9 		: "=a" (ret)
     10 		: "a" (num),
     11 		  "d" (a1),
     12 		  "c" (a2),
     13 		  "b" (a3),
     14 		  "D" (a4),
     15 		  "S" (a5)
     16 		: "cc", "memory");
     17 	
     18 	if(ret < 0){
     19 		errno = -ret;
     20 		return -1;
     21 	}
     22 	return ret;
     23 }
     24 
     25 enum
     26 {
     27 	VXSYSEXIT = 1,
     28 	VXSYSBRK = 2,
     29 	VXSYSREAD = 3,
     30 	VXSYSWRITE = 4,
     31 	VXSYSOPEN = 5,
     32 	VXSYSCLOSE = 6,
     33 	VXSYSLSEEK = 7,
     34 	VXSYSREMOVE = 8,
     35 	VXSYSTIME = 9,	// gettimeofday
     36 	VXSYSCLOCK = 10,
     37 	VXSYSSTAT = 11,
     38 	VXSYSFSTAT = 12,
     39 	VXSYSGETCWD = 13,
     40 	VXSYSCHDIR = 14,
     41 	VXSYSCHMOD = 15,
     42 	VXSYSDUP = 16,
     43 	VXSYSLINK = 17,
     44 	VXSYSSELECT = 18,
     45 	VXSYSMKDIR = 19,
     46 	VXSYSFCNTL = 20,
     47 	VXSYSTRUNCATE = 21,
     48 	VXSYSFTRUNCATE = 22,
     49 	VXSYSLSTAT = 23,
     50 	VXSYSFORK = 24,
     51 	VXSYSWAITPID = 25,
     52 	VXSYSEXEC = 26,
     53 	VXSYSPIPE = 27,
     54 	VXSYSSLEEP = 28,
     55 	VXSYSGETPID = 29,
     56 };
     57