cpu.h revision 303975
198184Sgordon/*	$OpenBSD: cpu.h,v 1.4 1998/09/15 10:50:12 pefo Exp $	*/
298184Sgordon
398184Sgordon/*-
498184Sgordon * Copyright (c) 1992, 1993
598184Sgordon *	The Regents of the University of California.  All rights reserved.
698184Sgordon *
7140339Sobrien * This code is derived from software contributed to Berkeley by
8180564Sdougb * Ralph Campbell and Rick Macklem.
998184Sgordon *
1098184Sgordon * Redistribution and use in source and binary forms, with or without
1198184Sgordon * modification, are permitted provided that the following conditions
12193119Sdougb * are met:
13230099Sdougb * 1. Redistributions of source code must retain the above copyright
14104039Sgordon *    notice, this list of conditions and the following disclaimer.
15124627Smtm * 2. Redistributions in binary form must reproduce the above copyright
16165664Syar *    notice, this list of conditions and the following disclaimer in the
17165664Syar *    documentation and/or other materials provided with the distribution.
18165664Syar * 4. Neither the name of the University nor the names of its contributors
19137112Smtm *    may be used to endorse or promote products derived from this software
2098184Sgordon *    without specific prior written permission.
21137112Smtm *
22137112Smtm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23137112Smtm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24137112Smtm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25158692Smatteo * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26230099Sdougb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27165664Syar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28165664Syar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29137112Smtm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30137112Smtm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3198184Sgordon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3298184Sgordon * SUCH DAMAGE.
33137112Smtm *
3498184Sgordon *	Copyright (C) 1989 Digital Equipment Corporation.
35137112Smtm *	Permission to use, copy, modify, and distribute this software and
36137112Smtm *	its documentation for any purpose and without fee is hereby granted,
37137112Smtm *	provided that the above copyright notice appears in all copies.
38137112Smtm *	Digital Equipment Corporation makes no representations about the
39137112Smtm *	suitability of this software for any purpose.  It is provided "as is"
40137112Smtm *	without express or implied warranty.
41137112Smtm *
42137112Smtm *	from: @(#)cpu.h	8.4 (Berkeley) 1/4/94
43137112Smtm *	JNPR: cpu.h,v 1.9.2.2 2007/09/10 08:23:46 girish
44137112Smtm * $FreeBSD: releng/11.0/sys/mips/include/cpu.h 253750 2013-07-28 18:44:17Z avg $
45137112Smtm */
46137112Smtm
47137112Smtm#ifndef _MACHINE_CPU_H_
48137112Smtm#define	_MACHINE_CPU_H_
49137112Smtm
50137112Smtm#include <machine/endian.h>
51137112Smtm
52137112Smtm/* BEGIN: these are going away */
53137112Smtm
54197947Sdougb#define	soft_int_mask(softintr)	(1 << ((softintr) + 8))
55165664Syar#define	hard_int_mask(hardintr)	(1 << ((hardintr) + 10))
56197947Sdougb
57137112Smtm/* END: These are going away */
58165664Syar
5998184Sgordon/*
6098184Sgordon * Exported definitions unique to mips cpu support.
6198184Sgordon */
6298184Sgordon
63165664Syar#ifndef _LOCORE
6498184Sgordon#include <machine/cpufunc.h>
6598184Sgordon#include <machine/frame.h>
6698184Sgordon
6798184Sgordon#define	TRAPF_USERMODE(framep)  (((framep)->sr & MIPS_SR_KSU_USER) != 0)
68165664Syar#define	TRAPF_PC(framep)	((framep)->pc)
6998184Sgordon#define	cpu_getstack(td)	((td)->td_frame->sp)
7098184Sgordon#define	cpu_setstack(td, nsp)	((td)->td_frame->sp = (nsp))
7198184Sgordon#define	cpu_spinwait()		/* nothing */
72137112Smtm
73/*
74 * A machine-independent interface to the CPU's counter.
75 */
76#define get_cyclecount()	mips_rd_count()
77#endif				/* !_LOCORE */
78
79#if defined(_KERNEL) && !defined(_LOCORE)
80
81extern char btext[];
82extern char etext[];
83
84void swi_vm(void *);
85void cpu_halt(void);
86void cpu_reset(void);
87
88#endif				/* _KERNEL */
89#endif				/* !_MACHINE_CPU_H_ */
90