xref: /f-stack/freebsd/mips/include/cpu.h (revision 22ce4aff)
1 /*	$OpenBSD: cpu.h,v 1.4 1998/09/15 10:50:12 pefo Exp $	*/
2 
3 /*-
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  * Copyright (c) 1992, 1993
7  *	The Regents of the University of California.  All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * Ralph Campbell and Rick Macklem.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	Copyright (C) 1989 Digital Equipment Corporation.
37  *	Permission to use, copy, modify, and distribute this software and
38  *	its documentation for any purpose and without fee is hereby granted,
39  *	provided that the above copyright notice appears in all copies.
40  *	Digital Equipment Corporation makes no representations about the
41  *	suitability of this software for any purpose.  It is provided "as is"
42  *	without express or implied warranty.
43  *
44  *	from: @(#)cpu.h	8.4 (Berkeley) 1/4/94
45  *	JNPR: cpu.h,v 1.9.2.2 2007/09/10 08:23:46 girish
46  * $FreeBSD$
47  */
48 
49 #ifndef _MACHINE_CPU_H_
50 #define	_MACHINE_CPU_H_
51 
52 #include <machine/endian.h>
53 
54 /* BEGIN: these are going away */
55 
56 #define	soft_int_mask(softintr)	(1 << ((softintr) + 8))
57 #define	hard_int_mask(hardintr)	(1 << ((hardintr) + 10))
58 
59 /* END: These are going away */
60 
61 /*
62  * Exported definitions unique to mips cpu support.
63  */
64 
65 #ifndef _LOCORE
66 #include <machine/cpufunc.h>
67 #include <machine/frame.h>
68 
69 #define	TRAPF_USERMODE(framep)  (((framep)->sr & MIPS_SR_KSU_USER) != 0)
70 #define	TRAPF_PC(framep)	((framep)->pc)
71 #define	cpu_getstack(td)	((td)->td_frame->sp)
72 #define	cpu_setstack(td, nsp)	((td)->td_frame->sp = (nsp))
73 #define	cpu_spinwait()		/* nothing */
74 #define	cpu_lock_delay()	DELAY(1)
75 
76 /*
77  * A machine-independent interface to the CPU's counter.
78  */
79 #define get_cyclecount()	mips_rd_count()
80 #endif				/* !_LOCORE */
81 
82 #if defined(_KERNEL) && !defined(_LOCORE)
83 
84 extern char btext[];
85 extern char etext[];
86 
87 void swi_vm(void *);
88 void cpu_halt(void);
89 void cpu_reset(void);
90 
91 #endif				/* _KERNEL */
92 #endif				/* !_MACHINE_CPU_H_ */
93