xref: /original-bsd/sys/vax/inline/langpats.c (revision a0a7d8f4)
1 /* Copyright (c) 1984 Regents of the University of California */
2 
3 #ifndef lint
4 static char sccsid[] = "@(#)langpats.c	2.8 (Berkeley) 02/20/85";
5 #endif
6 
7 #include "inline.h"
8 
9 /*
10  * Pattern table for kernel specific routines.
11  * These patterns are based on the old asm.sed script.
12  */
13 struct pats language_ptab[] = {
14 
15 #ifdef vax
16 	{ "0,_spl0\n",
17 "	mfpr	$18,r0\n\
18 	mtpr	$0,$18\n" },
19 
20 	{ "0,_spl1\n",
21 "	mfpr	$18,r0\n\
22 	mtpr	$1,$18\n" },
23 
24 	{ "0,_splsoftclock\n",
25 "	mfpr	$18,r0\n\
26 	mtpr	$0x8,$18\n" },
27 
28 	{ "0,_splnet\n",
29 "	mfpr	$18,r0\n\
30 	mtpr	$0xc,$18\n" },
31 
32 	{ "0,_splimp\n",
33 "	mfpr	$18,r0\n\
34 	mtpr	$0x16,$18\n" },
35 
36 	{ "0,_spl4\n",
37 "	mfpr	$18,r0\n\
38 	mtpr	$0x14,$18\n" },
39 
40 	{ "0,_splbio\n",
41 "	mfpr	$18,r0\n\
42 	mtpr	$0x15,$18\n" },
43 
44 	{ "0,_spltty\n",
45 "	mfpr	$18,r0\n\
46 	mtpr	$0x15,$18\n" },
47 
48 	{ "0,_spl5\n",
49 "	mfpr	$18,r0\n\
50 	mtpr	$0x15,$18\n" },
51 
52 	{ "0,_splclock\n",
53 "	mfpr	$18,r0\n\
54 	mtpr	$0x18,$18\n" },
55 
56 	{ "0,_spl6\n",
57 "	mfpr	$18,r0\n\
58 	mtpr	$0x18,$18\n" },
59 
60 	{ "0,_splhigh\n",
61 "	mfpr	$18,r0\n\
62 	mtpr	$0x1f,$18\n" },
63 
64 	{ "0,_spl7\n",
65 "	mfpr	$18,r0\n\
66 	mtpr	$0x1f,$18\n" },
67 
68 	{ "1,_splx\n",
69 "	movl	(sp)+,r1\n\
70 	mfpr	$18,r0\n\
71 	mtpr	r1,$18\n" },
72 
73 	{ "1,_mfpr\n",
74 "	movl	(sp)+,r5\n\
75 	mfpr	r5,r0\n" },
76 
77 	{ "2,_mtpr\n",
78 "	movl	(sp)+,r4\n\
79 	movl	(sp)+,r5\n\
80 	mtpr	r5,r4\n" },
81 
82 	{ "0,_setsoftclock\n",
83 "	mtpr	$0x8,$0x14\n" },
84 
85 	{ "1,_resume\n",
86 "	movl	(sp)+,r5\n\
87 	ashl	$9,r5,r0\n\
88 	movpsl	-(sp)\n\
89 	jsb	_Resume\n" },
90 
91 	{ "3,_copyin\n",
92 "	movl	(sp)+,r1\n\
93 	movl	(sp)+,r3\n\
94 	movl	(sp)+,r5\n\
95 	jsb	_Copyin\n" },
96 
97 	{ "3,_copyout\n",
98 "	movl	(sp)+,r1\n\
99 	movl	(sp)+,r3\n\
100 	movl	(sp)+,r5\n\
101 	jsb	_Copyout\n" },
102 
103 	{ "1,_fubyte\n",
104 "	movl	(sp)+,r0\n\
105 	jsb	_Fubyte\n" },
106 
107 	{ "1,_fuibyte\n",
108 "	movl	(sp)+,r0\n\
109 	jsb	_Fubyte\n" },
110 
111 	{ "1,_fuword\n",
112 "	movl	(sp)+,r0\n\
113 	jsb	_Fuword\n" },
114 
115 	{ "1,_fuiword\n",
116 "	movl	(sp)+,r0\n\
117 	jsb	_Fuword\n" },
118 
119 	{ "2,_subyte\n",
120 "	movl	(sp)+,r0\n\
121 	movl	(sp)+,r1\n\
122 	jsb	_Subyte\n" },
123 
124 	{ "2,_suibyte\n",
125 "	movl	(sp)+,r0\n\
126 	movl	(sp)+,r1\n\
127 	jsb	_Subyte\n" },
128 
129 	{ "2,_suword\n",
130 "	movl	(sp)+,r0\n\
131 	movl	(sp)+,r1\n\
132 	jsb	_Suword\n" },
133 
134 	{ "2,_suiword\n",
135 "	movl	(sp)+,r0\n\
136 	movl	(sp)+,r1\n\
137 	jsb	_Suword\n" },
138 
139 	{ "1,_setrq\n",
140 "	movl	(sp)+,r0\n\
141 	jsb	_Setrq\n" },
142 
143 	{ "1,_remrq\n",
144 "	movl	(sp)+,r0\n\
145 	jsb	_Remrq\n" },
146 
147 	{ "0,_swtch\n",
148 "	movpsl	-(sp)\n\
149 	jsb	_Swtch\n" },
150 
151 	{ "1,_setjmp\n",
152 "	movl	(sp)+,r1\n\
153 	clrl	r0\n\
154 	movl	fp,(r1)+\n\
155 	moval	1(pc),(r1)\n" },
156 
157 	{ "1,_longjmp\n",
158 "	movl	(sp)+,r0\n\
159 	jsb	_Longjmp\n" },
160 
161 	{ "1,_ffs\n",
162 "	movl	(sp)+,r1\n\
163 	ffs	$0,$32,r1,r0\n\
164 	bneq	1f\n\
165 	mnegl	$1,r0\n\
166 1:\n\
167 	incl	r0\n" },
168 
169 	{ "1,_htons\n",
170 "	movl	(sp)+,r5\n\
171 	rotl	$8,r5,r0\n\
172 	rotl	$-8,r5,r1\n\
173 	movb	r1,r0\n\
174 	movzwl	r0,r0\n" },
175 
176 	{ "1,_ntohs\n",
177 "	movl	(sp)+,r5\n\
178 	rotl	$8,r5,r0\n\
179 	rotl	$-8,r5,r1\n\
180 	movb	r1,r0\n\
181 	movzwl	r0,r0\n" },
182 
183 	{ "1,_htonl\n",
184 "	movl	(sp)+,r5\n\
185 	rotl	$-8,r5,r0\n\
186 	insv	r0,$16,$8,r0\n\
187 	rotl	$8,r5,r1\n\
188 	movb	r1,r0\n" },
189 
190 	{ "1,_ntohl\n",
191 "	movl	(sp)+,r5\n\
192 	rotl	$-8,r5,r0\n\
193 	insv	r0,$16,$8,r0\n\
194 	rotl	$8,r5,r1\n\
195 	movb	r1,r0\n" },
196 
197 	{ "2,__insque\n",
198 "	movl	(sp)+,r4\n\
199 	movl	(sp)+,r5\n\
200 	insque	(r4),(r5)\n" },
201 
202 	{ "1,__remque\n",
203 "	movl	(sp)+,r5\n\
204 	remque	(r5),r0\n" },
205 
206 	{ "2,__queue\n",
207 "	movl	(sp)+,r0\n\
208 	movl	(sp)+,r1\n\
209 	insque	(r1),*4(r0)\n" },
210 
211 	{ "1,__dequeue\n",
212 "	movl	(sp)+,r0\n\
213 	remque	*(r0),r0\n" },
214 
215 	{ "2,_imin\n",
216 "	movl	(sp)+,r0\n\
217 	movl	(sp)+,r5\n\
218 	cmpl	r0,r5\n\
219 	bleq	1f\n\
220 	movl	r5,r0\n\
221 1:\n" },
222 
223 	{ "2,_imax\n",
224 "	movl	(sp)+,r0\n\
225 	movl	(sp)+,r5\n\
226 	cmpl	r0,r5\n\
227 	bgeq	1f\n\
228 	movl	r5,r0\n\
229 1:\n" },
230 
231 	{ "2,_min\n",
232 "	movl	(sp)+,r0\n\
233 	movl	(sp)+,r5\n\
234 	cmpl	r0,r5\n\
235 	blequ	1f\n\
236 	movl	r5,r0\n\
237 1:\n" },
238 
239 	{ "2,_max\n",
240 "	movl	(sp)+,r0\n\
241 	movl	(sp)+,r5\n\
242 	cmpl	r0,r5\n\
243 	bgequ	1f\n\
244 	movl	r5,r0\n\
245 1:\n" },
246 #endif vax
247 
248 #ifdef mc68000
249 /* someday... */
250 #endif mc68000
251 
252 	{ "", "" }
253 };
254