xref: /csrg-svn/sys/pmax/include/cpu.h (revision 52131)
1*52131Smckusick /*
2*52131Smckusick  * Copyright (c) 1992 Regents of the University of California.
3*52131Smckusick  * All rights reserved.
4*52131Smckusick  *
5*52131Smckusick  * This code is derived from software contributed to Berkeley by
6*52131Smckusick  * Ralph Campbell.
7*52131Smckusick  *
8*52131Smckusick  * %sccs.include.redist.c%
9*52131Smckusick  *
10*52131Smckusick  *	@(#)cpu.h	7.1 (Berkeley) 01/07/92
11*52131Smckusick  */
12*52131Smckusick 
13*52131Smckusick #ifndef _CPU_H_
14*52131Smckusick #define _CPU_H_
15*52131Smckusick 
16*52131Smckusick #include "machConst.h"
17*52131Smckusick 
18*52131Smckusick /*
19*52131Smckusick  * Exported definitions unique to pmax/mips cpu support.
20*52131Smckusick  */
21*52131Smckusick 
22*52131Smckusick /*
23*52131Smckusick  * definitions of cpu-dependent requirements
24*52131Smckusick  * referenced in generic code
25*52131Smckusick  */
26*52131Smckusick #undef	COPY_SIGCODE		/* copy sigcode above user stack in exec */
27*52131Smckusick 
28*52131Smckusick /*
29*52131Smckusick  * function vs. inline configuration;
30*52131Smckusick  * these are defined to get generic functions
31*52131Smckusick  * rather than inline or machine-dependent implementations
32*52131Smckusick  */
33*52131Smckusick #define	NEED_MINMAX		/* need {,i,l,ul}{min,max} functions */
34*52131Smckusick #undef	NEED_FFS		/* don't need ffs function */
35*52131Smckusick #undef	NEED_BCMP		/* don't need bcmp function */
36*52131Smckusick #undef	NEED_STRLEN		/* don't need strlen function */
37*52131Smckusick 
38*52131Smckusick #define	cpu_exec(p)	/* nothing */
39*52131Smckusick #define	cpu_wait(p)	/* nothing */
40*52131Smckusick 
41*52131Smckusick /*
42*52131Smckusick  * Arguments to hardclock, softclock and gatherstats
43*52131Smckusick  * encapsulate the previous machine state in an opaque
44*52131Smckusick  * clockframe;
45*52131Smckusick  */
46*52131Smckusick typedef struct intrframe {
47*52131Smckusick 	int	pc;
48*52131Smckusick 	int	ps;
49*52131Smckusick } clockframe;
50*52131Smckusick 
51*52131Smckusick #define	CLKF_USERMODE(framep)	((framep)->ps & MACH_SR_KU_PREV)
52*52131Smckusick #define	CLKF_BASEPRI(framep)	\
53*52131Smckusick 	(((framep)->ps & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == \
54*52131Smckusick 	(MACH_INT_MASK | MACH_SR_INT_ENA_PREV))
55*52131Smckusick #define	CLKF_PC(framep)		((framep)->pc)
56*52131Smckusick 
57*52131Smckusick /*
58*52131Smckusick  * Preempt the current process if in interrupt from user mode,
59*52131Smckusick  * or after the current trap/syscall if in system mode.
60*52131Smckusick  */
61*52131Smckusick #define	need_resched()	{ want_resched = 1; aston(); }
62*52131Smckusick 
63*52131Smckusick /*
64*52131Smckusick  * Give a profiling tick to the current process from the softclock
65*52131Smckusick  * interrupt.
66*52131Smckusick  */
67*52131Smckusick #define	profile_tick(p, framep) \
68*52131Smckusick 	addupc((framep)->pc, &p->p_stats->p_prof, 1);
69*52131Smckusick 
70*52131Smckusick /*
71*52131Smckusick  * Notify the current process (p) that it has a signal pending,
72*52131Smckusick  * process as soon as possible.
73*52131Smckusick  */
74*52131Smckusick #define	signotify(p)	aston()
75*52131Smckusick 
76*52131Smckusick #define aston()		(astpending = 1)
77*52131Smckusick 
78*52131Smckusick int	astpending;	/* need to trap before returning to user mode */
79*52131Smckusick int	want_resched;	/* resched() was called */
80*52131Smckusick 
81*52131Smckusick /*
82*52131Smckusick  * CPU identification, from PRID register.
83*52131Smckusick  */
84*52131Smckusick union cpuprid {
85*52131Smckusick 	int	cpuprid;
86*52131Smckusick 	struct {
87*52131Smckusick #if BYTE_ORDER == BIG_ENDIAN
88*52131Smckusick 		u_int	pad1:16;	/* reserved */
89*52131Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
90*52131Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
91*52131Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
92*52131Smckusick #else
93*52131Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
94*52131Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
95*52131Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
96*52131Smckusick 		u_int	pad1:16;	/* reserved */
97*52131Smckusick #endif
98*52131Smckusick 	} cpu;
99*52131Smckusick };
100*52131Smckusick 
101*52131Smckusick /*
102*52131Smckusick  * MIPS CPU types (cp_imp).
103*52131Smckusick  */
104*52131Smckusick #define	MIPS_R2000	2
105*52131Smckusick 
106*52131Smckusick /*
107*52131Smckusick  * MIPS FPU types
108*52131Smckusick  */
109*52131Smckusick #define	MIPS_R2010	3
110*52131Smckusick 
111*52131Smckusick #ifdef KERNEL
112*52131Smckusick union	cpuprid cpu;
113*52131Smckusick union	cpuprid fpu;
114*52131Smckusick u_int	machDataCacheSize;
115*52131Smckusick u_int	machInstCacheSize;
116*52131Smckusick #endif
117*52131Smckusick 
118*52131Smckusick /*
119*52131Smckusick  * Enable realtime clock (always enabled).
120*52131Smckusick  */
121*52131Smckusick #define	enablertclock()
122*52131Smckusick 
123*52131Smckusick #endif /* _CPU_H_ */
124