summaryrefslogtreecommitdiff
blob: c7be942d0bec261bcd968100a5fca58441adb90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff -NurpP util-vserver-0.30.209/lib/syscall-alternative.h util-vserver-0.30.209-mips/lib/syscall-alternative.h
--- util-vserver-0.30.209/lib/syscall-alternative.h	2005-10-28 18:33:50 +0200
+++ util-vserver-0.30.209-mips/lib/syscall-alternative.h	2006-01-06 18:42:05 +0100
@@ -1,9 +1,9 @@
-  // from http://vserver.13thfloor.at/Experimental/SYSCALL/syscall_shiny7.h
+  // from http://vserver.13thfloor.at/Experimental/SYSCALL/syscall_shiny8.h
 
 #ifndef	__SYSCALL_NEW_H
 #define	__SYSCALL_NEW_H
 
-/*	Copyright (C) 2005 Herbert P�tzl
+/*	Copyright (C) 2005-2006 Herbert P�tzl
 
 		global config options
 
@@ -399,8 +399,43 @@
 
 #elif	defined(__mips__)
 
-#error syscall arch mips not implemented yet
+/*	The ABIO32 calling convention uses a0-a3  to pass the first
+	four arguments, the rest is passed on the userspace stack.  The 5th arg
+	starts at 16($sp).
+
+	ABIN32 and ABI64 pass 6 args in a0-a3, t0-t1.
+
+	scnr:	id(v0)
+	args:	a1(a0), a2(a1), a3(a2), a4(a3), a5(16($sp)), a6(20($sp))
+	sret:	r0(v0)
+	serr:	e0(a3)
+	call:	syscall
+	clob:	at, v0, t0-t7, t8-t9
+*/
+
+#define	__sysc_reg_cid	"v0"
+#define __sysc_reg_ret	"v0"
+#define __sysc_reg_err	"a3"
+#define	__sysc_cmd_sys	"syscall"
 
+#define __sysc_reg(n) __arg_##n\
+	("a0","a1","a2","a3", "t0", "t1")
+
+#define __sysc_clobber "$1", "$3", "$8", "$9", "$10", "$11", "$12",	\
+	"$13", "$14", "$15", "$24", "$25", "memory"
+
+#if _MIPS_SIM == _ABIO32
+#define __sysc_pre(n) 							\
+	__casm(n,5,1,"addiu $sp,$sp,-32",)				\
+	__casm(n,6,1,"sw $9,20($sp)",)					\
+	__casm(n,5,1,"sw $8, 16($sp)",)
+#define __sysc_fin(n) 							\
+	__casm(n,5,1,"addiu $sp,$sp,32",)
+#elif (_MIPS_SIM == _ABIN32) || (_MIPS_SIM == _ABI64)
+#warning syscall arch mips with ABI N32 and 64 not tested yet
+#else
+#error unknown mips ABI version
+#endif
 
 
 /*	*****************************************