xref: /original-bsd/sys/news3400/include/cpu.h (revision 333da485)
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 Kazumasa Utashiro of Software Research
7  * Associates, Inc.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)cpu.h	8.2 (Berkeley) 01/21/94
12  */
13 
14 #ifndef _CPU_H_
15 #define _CPU_H_
16 
17 #include <machine/machConst.h>
18 
19 /*
20  * Exported definitions unique to pmax/mips cpu support.
21  */
22 
23 /*
24  * definitions of cpu-dependent requirements
25  * referenced in generic code
26  */
27 #define	COPY_SIGCODE		/* copy sigcode above user stack in exec */
28 
29 #define	cpu_exec(p)		(p->p_md.md_ss_addr = 0) /* init single step */
30 #define	cpu_swapin(p)		/* nothing */
31 #define	cpu_wait(p)		/* nothing */
32 #define cpu_setstack(p, ap)	(p)->p_md.md_regs[SP] = ap
33 #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp
34 
35 /*
36  * Arguments to hardclock and gatherstats encapsulate the previous
37  * machine state in an opaque clockframe.
38  */
39 struct clockframe {
40 	int	pc;	/* program counter at time of interrupt */
41 	int	sr;	/* status register at time of interrupt */
42 };
43 
44 #define	CLKF_USERMODE(framep)	((framep)->sr & MACH_SR_KU_PREV)
45 #define	CLKF_BASEPRI(framep)	\
46 	((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
47 #define	CLKF_PC(framep)		((framep)->pc)
48 #define	CLKF_INTR(framep)	(0)
49 
50 /*
51  * Preempt the current process if in interrupt from user mode,
52  * or after the current trap/syscall if in system mode.
53  */
54 #define	need_resched()	{ want_resched = 1; aston(); }
55 
56 /*
57  * Give a profiling tick to the current process when the user profiling
58  * buffer pages are invalid.  On the PMAX, request an ast to send us
59  * through trap, marking the proc as needing a profiling tick.
60  */
61 #define	need_proftick(p)	{ (p)->p_flag |= SOWEUPC; aston(); }
62 
63 /*
64  * Notify the current process (p) that it has a signal pending,
65  * process as soon as possible.
66  */
67 #define	signotify(p)	aston()
68 
69 #define aston()		(astpending = 1)
70 
71 int	astpending;	/* need to trap before returning to user mode */
72 int	want_resched;	/* resched() was called */
73 
74 /*
75  * CPU identification, from PRID register.
76  */
77 union cpuprid {
78 	int	cpuprid;
79 	struct {
80 #if BYTE_ORDER == BIG_ENDIAN
81 		u_int	pad1:16;	/* reserved */
82 		u_int	cp_imp:8;	/* implementation identifier */
83 		u_int	cp_majrev:4;	/* major revision identifier */
84 		u_int	cp_minrev:4;	/* minor revision identifier */
85 #else
86 		u_int	cp_minrev:4;	/* minor revision identifier */
87 		u_int	cp_majrev:4;	/* major revision identifier */
88 		u_int	cp_imp:8;	/* implementation identifier */
89 		u_int	pad1:16;	/* reserved */
90 #endif
91 	} cpu;
92 };
93 
94 /*
95  * MIPS CPU types (cp_imp).
96  */
97 #define	MIPS_R2000	0x01
98 #define	MIPS_R3000	0x02
99 #define	MIPS_R6000	0x03
100 #define	MIPS_R4000	0x04
101 #define	MIPS_R6000A	0x06
102 
103 /*
104  * MIPS FPU types
105  */
106 #define	MIPS_R2010_FPU	0x02
107 #define	MIPS_R3010_FPU	0x03
108 #define	MIPS_R6010_FPU	0x04
109 #define	MIPS_R4000_FPU	0x05
110 
111 struct intr_tab {
112 	void	(*func)();	/* pointer to interrupt routine */
113 	int	unit;		/* logical unit number */
114 };
115 
116 #ifdef KERNEL
117 union	cpuprid cpu;
118 union	cpuprid fpu;
119 u_int	machDataCacheSize;
120 u_int	machInstCacheSize;
121 extern	struct intr_tab intr_tab[];
122 #endif
123 
124 #endif /* _CPU_H_ */
125