summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/include/cpufunc.h
blob: 4caa651bd6af421e7300a6b28931f9e2f7ac3222 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
/*	$OpenBSD: cpufunc.h,v 1.1 1998/07/07 21:32:40 mickey Exp $	*/

/*
 *  (c) Copyright 1988 HEWLETT-PACKARD COMPANY
 *
 *  To anyone who acknowledges that this file is provided "AS IS"
 *  without any express or implied warranty:
 *      permission to use, copy, modify, and distribute this file
 *  for any purpose is hereby granted without fee, provided that
 *  the above copyright notice and this notice appears in all
 *  copies, and that the name of Hewlett-Packard Company not be
 *  used in advertising or publicity pertaining to distribution
 *  of the software without specific, written prior permission.
 *  Hewlett-Packard Company makes no representations about the
 *  suitability of this software for any purpose.
 */

/*
 * Copyright (c) 1990,1994 The University of Utah and
 * the Computer Systems Laboratory (CSL).  All rights reserved.
 *
 * THE UNIVERSITY OF UTAH AND CSL PROVIDE THIS SOFTWARE IN ITS "AS IS"
 * CONDITION, AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
 * WHATSOEVER RESULTING FROM ITS USE.
 *
 * CSL requests users of this software to return to csl-dist@cs.utah.edu any
 * improvements that they make and grant CSL redistribution rights.
 *
 * 	Utah $Hdr: c_support.s 1.8 94/12/14$
 *	Author: Bob Wheeler, University of Utah CSL
 */

/*
 * hppa routines to move to and from control registers from C
 */


/*
 * Get space register for an address
 */

static __inline u_int ldsid(vm_offset_t p) {
	register u_int ret;
	__asm __volatile("ldsid (%1),%0" : "=r" (p) : "r" (ret));
	return ret;
}

/*
 * Move the specified value into the control register. The register is taken
 * modulo 32. If the register is invalid the operation is ignored.
 */
static __inline void mtctl(int reg, int value) {
	reg %= 32;
	if (reg == 0)
		__asm __volatile("mtctl %0, cr0" : : "r" (value));
	else if (reg > 7)
		;
#if 0
	bv 0(r2)
	mtctl	arg1,cr8
	bv 0(r2)
	mtctl	arg1,cr9
	bv 0(r2)
	mtctl	arg1,cr10
	bv 0(r2)
	mtctl	arg1,cr11
	bv 0(r2)
	mtctl	arg1,cr12
	bv 0(r2)
	mtctl	arg1,cr13
	bv 0(r2)
	mtctl	arg1,cr14
	bv 0(r2)
	mtctl	arg1,cr15
	bv 0(r2)
	mtctl	arg1,cr16
	bv 0(r2)
	mtctl	arg1,cr17
	bv 0(r2)
	mtctl	arg1,cr18
	bv 0(r2)
	mtctl	arg1,cr19
	bv 0(r2)
	mtctl	arg1,cr20
	bv 0(r2)
	mtctl	arg1,cr21
	bv 0(r2)
	mtctl	arg1,cr22
	bv 0(r2)
	mtctl	arg1,cr23
	bv 0(r2)
	mtctl	arg1,cr24
	bv 0(r2)
	mtctl	arg1,cr25
	bv 0(r2)
	mtctl	arg1,cr26
	bv 0(r2)
	mtctl	arg1,cr27
	bv 0(r2)
	mtctl	arg1,cr28
	bv 0(r2)
	mtctl	arg1,cr29
	bv 0(r2)
	mtctl	arg1,cr30
	bv 0(r2)
	mtctl	arg1,cr31
#endif
}

/*
 * Return the contents of the specified control register. The register is taken
 * modulo 32. If the register is invalid the operation is ignored.
 */

static __inline u_int mfctl(int reg) {
	register u_int ret;
	reg %= 32;
	if (reg == 0)
		__asm __volatile("mfctl cr0,%0" : "=r" (ret));
	else if (reg > 7)
		;
#if 0
	bv	0(r2)
	mfctl	cr8,ret0
	bv	0(r2)
	mfctl	cr9,ret0
	bv	0(r2)
	mfctl	cr10,ret0
	bv	0(r2)
	mfctl	cr11,ret0
	bv	0(r2)
	mfctl	cr12,ret0
	bv	0(r2)
	mfctl	cr13,ret0
	bv	0(r2)
	mfctl	cr14,ret0
	bv	0(r2)
	mfctl	cr15,ret0
	bv	0(r2)
	mfctl	cr16,ret0
	bv	0(r2)
	mfctl	cr17,ret0
	bv	0(r2)
	mfctl	cr18,ret0
	bv	0(r2)
	mfctl	cr19,ret0
	bv	0(r2)
	mfctl	cr20,ret0
	bv	0(r2)
	mfctl	cr21,ret0
	bv	0(r2)
	mfctl	cr22,ret0
	bv	0(r2)
	mfctl	cr23,ret0
	bv	0(r2)
	mfctl	cr24,ret0
	bv	0(r2)
	mfctl	cr25,ret0
	bv	0(r2)
	mfctl	cr26,ret0
	bv	0(r2)
	mfctl	cr27,ret0
	bv	0(r2)
	mfctl	cr28,ret0
	bv	0(r2)
	mfctl	cr29,ret0
	bv	0(r2)
	mfctl	cr30,ret0
	bv	0(r2)
	mfctl	cr31,ret0
#endif
	return ret;
}

#if 0
/*
 * int mtsp(sr, value)
 *	int	sr;
 *	int	value;
 *
 * Move the specified value into a space register. The space register is taken
 * modulo 8.
 */

	.export	mtsp,entry
	.proc
	.callinfo
mtsp

/*
 * take the register number modulo 8
 */
	ldi	7,t1
	and	t1,arg0,arg0

/*
 * write the value to the specified register
 */

	blr,n	arg0,r0
	nop

	bv	0(r2)
	mtsp	arg1,sr0
	bv	0(r2)
	mtsp	arg1,sr1
	bv	0(r2)
	mtsp	arg1,sr2
	bv	0(r2)
	mtsp	arg1,sr3
	bv	0(r2)
	mtsp	arg1,sr4
	bv	0(r2)
	mtsp	arg1,sr5
	bv	0(r2)
	mtsp	arg1,sr6
	bv	0(r2)
	mtsp	arg1,sr7

	.procend


/*
 * int mfsr(reg)
 *	int	reg;
 *
 * Return the contents of the specified space register. The space register is 
 * taken modulo 8.
 */

	.export	mfsp,entry
	.proc
	.callinfo
mfsp

/*
 * take the register number modulo 8
 */
	ldi	7,t1
	and	t1,arg0,arg0

/*
 * write the value to the specified register
 */

	blr,n	arg0,r0
	nop

	bv	0(r2)
	mfsp	sr0,ret0
	bv	0(r2)
	mfsp	sr1,ret0
	bv	0(r2)
	mfsp	sr2,ret0
	bv	0(r2)
	mfsp	sr3,ret0
	bv	0(r2)
	mfsp	sr4,ret0
	bv	0(r2)
	mfsp	sr5,ret0
	bv	0(r2)
	mfsp	sr6,ret0
	bv	0(r2)
	mfsp	sr7,ret0

	.procend


/*
 * int ssm(mask)
 *	int	mask;
 *
 * Set system mask. This call will not set the Q bit even if it is 
 * specified.
 *
 * Returns the old system mask
 */

	.export	ssm,entry
	.proc
	.callinfo
ssm

/*
 * look at only the lower 5 bits of the mask
 */
	ldi	31,t1
	and	t1,arg0,arg0


/*
 * Set System Mask and Return
 */

	blr,n	arg0,r0
	nop

	bv	0(r2)
	ssm	0,ret0
	bv	0(r2)
	ssm	1,ret0
	bv	0(r2)
	ssm	2,ret0
	bv	0(r2)
	ssm	3,ret0
	bv	0(r2)
	ssm	4,ret0
	bv	0(r2)
	ssm	5,ret0
	bv	0(r2)
	ssm	6,ret0
	bv	0(r2)
	ssm	7,ret0
	bv	0(r2)
	ssm	0,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	1,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	2,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	3,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	4,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	5,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	6,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	7,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	16,ret0
	bv	0(r2)
	ssm	17,ret0
	bv	0(r2)
	ssm	18,ret0
	bv	0(r2)
	ssm	19,ret0
	bv	0(r2)
	ssm	20,ret0
	bv	0(r2)
	ssm	21,ret0
	bv	0(r2)
	ssm	22,ret0
	bv	0(r2)
	ssm	23,ret0
	bv	0(r2)
	ssm	16,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	17,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	18,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	19,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	20,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	21,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	22,ret0		/* can't set Q bit with ssm */
	bv	0(r2)
	ssm	23,ret0		/* can't set Q bit with ssm */

	.procend


/*
 * int rsm(mask)
 *	int	mask;
 *
 * Reset system mask. 
 *
 * Returns the old system mask
 */

	.export	rsm,entry
	.proc
	.callinfo
rsm

/*
 * look at only the lower 5 bits of the mask
 */
	ldi	31,t1
	and	t1,arg0,arg0

/*
 * Set System Mask and Return
 */

	blr,n	arg0,r0
	nop

	bv	0(r2)
	rsm	0,ret0
	bv	0(r2)
	rsm	1,ret0
	bv	0(r2)
	rsm	2,ret0
	bv	0(r2)
	rsm	3,ret0
	bv	0(r2)
	rsm	4,ret0
	bv	0(r2)
	rsm	5,ret0
	bv	0(r2)
	rsm	6,ret0
	bv	0(r2)
	rsm	7,ret0
	bv	0(r2)
	rsm	8,ret0
	bv	0(r2)
	rsm	9,ret0
	bv	0(r2)
	rsm	10,ret0
	bv	0(r2)
	rsm	11,ret0
	bv	0(r2)
	rsm	12,ret0
	bv	0(r2)
	rsm	13,ret0
	bv	0(r2)
	rsm	14,ret0
	bv	0(r2)
	rsm	15,ret0
	bv	0(r2)
	rsm	16,ret0
	bv	0(r2)
	rsm	17,ret0
	bv	0(r2)
	rsm	18,ret0
	bv	0(r2)
	rsm	19,ret0
	bv	0(r2)
	rsm	20,ret0
	bv	0(r2)
	rsm	21,ret0
	bv	0(r2)
	rsm	22,ret0
	bv	0(r2)
	rsm	23,ret0
	bv	0(r2)
	rsm	24,ret0
	bv	0(r2)
	rsm	25,ret0
	bv	0(r2)
	rsm	26,ret0
	bv	0(r2)
	rsm	27,ret0
	bv	0(r2)
	rsm	28,ret0
	bv	0(r2)
	rsm	29,ret0
	bv	0(r2)
	rsm	30,ret0
	bv	0(r2)
	rsm	31,ret0

	.procend


/*
 * int mtsm(mask)
 *	int mask;
 *
 * Move to system mask. Old value of system mask is returned.
 */

	.export	mtsm,entry
	.proc
	.callinfo
mtsm

/* 
 * Move System Mask and Return
 */
	ssm	0,ret0
	bv	0(r2)
	mtsm	arg0

	.procend
#endif

static __inline void
ficache(pa_space_t space, vm_offset_t off, vm_size_t size)
{

}

static __inline void
fdcache(pa_space_t space, vm_offset_t off, vm_size_t size)
{

}

static __inline void
pitlb(pa_space_t sp, vm_offset_t off)
{

}

static __inline void
pdtlb(pa_space_t sp, vm_offset_t off)
{

}

void phys_page_copy __P((vm_offset_t, vm_offset_t));
void phys_bzero __P((vm_offset_t, vm_size_t));
void lpage_copy __P((int, pa_space_t, vm_offset_t, vm_offset_t));
void lpage_zero __P((int, vm_offset_t, pa_space_t));