xref: /csrg-svn/sys/pmax/include/cpu.h (revision 56820)
1*56820Sralph /*-
2*56820Sralph  * Copyright (c) 1992 The Regents of the University of California.
352131Smckusick  * All rights reserved.
452131Smckusick  *
552131Smckusick  * This code is derived from software contributed to Berkeley by
6*56820Sralph  * Ralph Campbell and Rick Macklem.
752131Smckusick  *
852131Smckusick  * %sccs.include.redist.c%
952131Smckusick  *
10*56820Sralph  *	@(#)cpu.h	7.7 (Berkeley) 11/15/92
1152131Smckusick  */
1252131Smckusick 
1352131Smckusick #ifndef _CPU_H_
1452131Smckusick #define _CPU_H_
1552131Smckusick 
1656523Sbostic #include <machine/machConst.h>
1752131Smckusick 
1852131Smckusick /*
1952131Smckusick  * Exported definitions unique to pmax/mips cpu support.
2052131Smckusick  */
2152131Smckusick 
2252131Smckusick /*
2352131Smckusick  * definitions of cpu-dependent requirements
2452131Smckusick  * referenced in generic code
2552131Smckusick  */
2656636Sralph #define	COPY_SIGCODE		/* copy sigcode above user stack in exec */
2752131Smckusick 
2852744Sralph #define	cpu_exec(p)	(p->p_md.md_ss_addr = 0) /* init single step */
2952131Smckusick #define	cpu_wait(p)	/* nothing */
3052757Sralph #define cpu_setstack(p, ap) \
3152757Sralph 	(p)->p_md.md_regs[SP] = ap
3252131Smckusick 
3352131Smckusick /*
3455752Sralph  * Arguments to hardclock and gatherstats encapsulate the previous
3555752Sralph  * machine state in an opaque clockframe.
3652131Smckusick  */
3755752Sralph struct clockframe {
3855752Sralph 	int	pc;	/* program counter at time of interrupt */
3955752Sralph 	int	sr;	/* status register at time of interrupt */
4055752Sralph };
4152131Smckusick 
4255752Sralph #define	CLKF_USERMODE(framep)	((framep)->sr & MACH_SR_KU_PREV)
4352131Smckusick #define	CLKF_BASEPRI(framep)	\
4455752Sralph 	((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
4552131Smckusick #define	CLKF_PC(framep)		((framep)->pc)
4655752Sralph #define	CLKF_INTR(framep)	(0)
4752131Smckusick 
4852131Smckusick /*
4952131Smckusick  * Preempt the current process if in interrupt from user mode,
5052131Smckusick  * or after the current trap/syscall if in system mode.
5152131Smckusick  */
5252131Smckusick #define	need_resched()	{ want_resched = 1; aston(); }
5352131Smckusick 
5452131Smckusick /*
5555752Sralph  * Give a profiling tick to the current process when the user profiling
5655752Sralph  * buffer pages are invalid.  On the PMAX, request an ast to send us
5755752Sralph  * through trap, marking the proc as needing a profiling tick.
5852131Smckusick  */
5955752Sralph #define	need_proftick(p)	{ (p)->p_flag |= SOWEUPC; aston(); }
6052131Smckusick 
6152131Smckusick /*
6252131Smckusick  * Notify the current process (p) that it has a signal pending,
6352131Smckusick  * process as soon as possible.
6452131Smckusick  */
6552131Smckusick #define	signotify(p)	aston()
6652131Smckusick 
6752131Smckusick #define aston()		(astpending = 1)
6852131Smckusick 
6952131Smckusick int	astpending;	/* need to trap before returning to user mode */
7052131Smckusick int	want_resched;	/* resched() was called */
7152131Smckusick 
7252131Smckusick /*
7352131Smckusick  * CPU identification, from PRID register.
7452131Smckusick  */
7552131Smckusick union cpuprid {
7652131Smckusick 	int	cpuprid;
7752131Smckusick 	struct {
7852131Smckusick #if BYTE_ORDER == BIG_ENDIAN
7952131Smckusick 		u_int	pad1:16;	/* reserved */
8052131Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
8152131Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
8252131Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
8352131Smckusick #else
8452131Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
8552131Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
8652131Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
8752131Smckusick 		u_int	pad1:16;	/* reserved */
8852131Smckusick #endif
8952131Smckusick 	} cpu;
9052131Smckusick };
9152131Smckusick 
9252131Smckusick /*
9352131Smckusick  * MIPS CPU types (cp_imp).
9452131Smckusick  */
95*56820Sralph #define	MIPS_R2000	0x01
96*56820Sralph #define	MIPS_R3000	0x02
97*56820Sralph #define	MIPS_R6000	0x03
9852744Sralph #define	MIPS_R4000	0x04
99*56820Sralph #define	MIPS_R6000A	0x06
10052131Smckusick 
10152131Smckusick /*
10252131Smckusick  * MIPS FPU types
10352131Smckusick  */
104*56820Sralph #define	MIPS_R2010	0x02
105*56820Sralph #define	MIPS_R3010	0x03
106*56820Sralph #define	MIPS_R6010	0x04
10752744Sralph #define	MIPS_R4010	0x05
10852131Smckusick 
10952131Smckusick #ifdef KERNEL
11052131Smckusick union	cpuprid cpu;
11152131Smckusick union	cpuprid fpu;
11252131Smckusick u_int	machDataCacheSize;
11352131Smckusick u_int	machInstCacheSize;
11452744Sralph extern	struct intr_tab intr_tab[];
11552131Smckusick #endif
11652131Smckusick 
11752131Smckusick /*
11852131Smckusick  * Enable realtime clock (always enabled).
11952131Smckusick  */
12052131Smckusick #define	enablertclock()
12152131Smckusick 
12252131Smckusick #endif /* _CPU_H_ */
123