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