xref: /original-bsd/sys/pmax/include/cpu.h (revision f17085de)
1 /*-
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Ralph Campbell and Rick Macklem.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)cpu.h	8.5 (Berkeley) 05/17/95
11  */
12 
13 #ifndef _CPU_H_
14 #define _CPU_H_
15 
16 #include <machine/machConst.h>
17 
18 /*
19  * Exported definitions unique to pmax/mips cpu support.
20  */
21 
22 /*
23  * definitions of cpu-dependent requirements
24  * referenced in generic code
25  */
26 #define	COPY_SIGCODE		/* copy sigcode above user stack in exec */
27 
28 #define	cpu_exec(p)		(p->p_md.md_ss_addr = 0) /* init single step */
29 #define	cpu_wait(p)		/* nothing */
30 #define cpu_setstack(p, ap)	(p)->p_md.md_regs[SP] = ap
31 #define cpu_set_init_frame(p, fp) /* nothing */
32 #define	BACKTRACE(p)		/* not implemented */
33 
34 /*
35  * Arguments to hardclock and gatherstats encapsulate the previous
36  * machine state in an opaque clockframe.
37  */
38 struct clockframe {
39 	int	pc;	/* program counter at time of interrupt */
40 	int	sr;	/* status register at time of interrupt */
41 };
42 
43 #define	CLKF_USERMODE(framep)	((framep)->sr & MACH_SR_KU_PREV)
44 #define	CLKF_BASEPRI(framep)	\
45 	((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
46 #define	CLKF_PC(framep)		((framep)->pc)
47 #define	CLKF_INTR(framep)	(0)
48 
49 /*
50  * Preempt the current process if in interrupt from user mode,
51  * or after the current trap/syscall if in system mode.
52  */
53 #define	need_resched()	{ want_resched = 1; aston(); }
54 
55 /*
56  * Give a profiling tick to the current process when the user profiling
57  * buffer pages are invalid.  On the PMAX, request an ast to send us
58  * through trap, marking the proc as needing a profiling tick.
59  */
60 #define	need_proftick(p)	{ (p)->p_flag |= P_OWEUPC; aston(); }
61 
62 /*
63  * Notify the current process (p) that it has a signal pending,
64  * process as soon as possible.
65  */
66 #define	signotify(p)	aston()
67 
68 #define aston()		(astpending = 1)
69 
70 int	astpending;	/* need to trap before returning to user mode */
71 int	want_resched;	/* resched() was called */
72 
73 /*
74  * CPU identification, from PRID register.
75  */
76 union cpuprid {
77 	int	cpuprid;
78 	struct {
79 #if BYTE_ORDER == BIG_ENDIAN
80 		u_int	pad1:16;	/* reserved */
81 		u_int	cp_imp:8;	/* implementation identifier */
82 		u_int	cp_majrev:4;	/* major revision identifier */
83 		u_int	cp_minrev:4;	/* minor revision identifier */
84 #else
85 		u_int	cp_minrev:4;	/* minor revision identifier */
86 		u_int	cp_majrev:4;	/* major revision identifier */
87 		u_int	cp_imp:8;	/* implementation identifier */
88 		u_int	pad1:16;	/* reserved */
89 #endif
90 	} cpu;
91 };
92 
93 /*
94  * CTL_MACHDEP definitions.
95  */
96 #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
97 #define	CPU_MAXID		2	/* number of valid machdep ids */
98 
99 #define CTL_MACHDEP_NAMES { \
100 	{ 0, 0 }, \
101 	{ "console_device", CTLTYPE_STRUCT }, \
102 }
103 
104 /*
105  * MIPS CPU types (cp_imp).
106  */
107 #define	MIPS_R2000	0x01
108 #define	MIPS_R3000	0x02
109 #define	MIPS_R6000	0x03
110 #define	MIPS_R4000	0x04
111 #define	MIPS_R6000A	0x06
112 
113 /*
114  * MIPS FPU types
115  */
116 #define	MIPS_R2010	0x02
117 #define	MIPS_R3010	0x03
118 #define	MIPS_R6010	0x04
119 #define	MIPS_R4010	0x05
120 
121 #ifdef KERNEL
122 union	cpuprid cpu;
123 union	cpuprid fpu;
124 u_int	machDataCacheSize;
125 u_int	machInstCacheSize;
126 extern	struct intr_tab intr_tab[];
127 #endif
128 
129 /*
130  * Enable realtime clock (always enabled).
131  */
132 #define	enablertclock()
133 
134 #endif /* _CPU_H_ */
135