xref: /csrg-svn/sys/pmax/include/cpu.h (revision 52744)
152131Smckusick /*
252131Smckusick  * Copyright (c) 1992 Regents of the University of California.
352131Smckusick  * All rights reserved.
452131Smckusick  *
552131Smckusick  * This code is derived from software contributed to Berkeley by
652131Smckusick  * Ralph Campbell.
752131Smckusick  *
852131Smckusick  * %sccs.include.redist.c%
952131Smckusick  *
10*52744Sralph  *	@(#)cpu.h	7.2 (Berkeley) 02/29/92
1152131Smckusick  */
1252131Smckusick 
1352131Smckusick #ifndef _CPU_H_
1452131Smckusick #define _CPU_H_
1552131Smckusick 
1652131Smckusick #include "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  */
2652131Smckusick #undef	COPY_SIGCODE		/* copy sigcode above user stack in exec */
2752131Smckusick 
2852131Smckusick /*
2952131Smckusick  * function vs. inline configuration;
3052131Smckusick  * these are defined to get generic functions
3152131Smckusick  * rather than inline or machine-dependent implementations
3252131Smckusick  */
3352131Smckusick #define	NEED_MINMAX		/* need {,i,l,ul}{min,max} functions */
3452131Smckusick #undef	NEED_FFS		/* don't need ffs function */
3552131Smckusick #undef	NEED_BCMP		/* don't need bcmp function */
3652131Smckusick #undef	NEED_STRLEN		/* don't need strlen function */
3752131Smckusick 
38*52744Sralph #define	cpu_exec(p)	(p->p_md.md_ss_addr = 0) /* init single step */
3952131Smckusick #define	cpu_wait(p)	/* nothing */
4052131Smckusick 
4152131Smckusick /*
4252131Smckusick  * Arguments to hardclock, softclock and gatherstats
4352131Smckusick  * encapsulate the previous machine state in an opaque
4452131Smckusick  * clockframe;
4552131Smckusick  */
4652131Smckusick typedef struct intrframe {
4752131Smckusick 	int	pc;
4852131Smckusick 	int	ps;
4952131Smckusick } clockframe;
5052131Smckusick 
5152131Smckusick #define	CLKF_USERMODE(framep)	((framep)->ps & MACH_SR_KU_PREV)
5252131Smckusick #define	CLKF_BASEPRI(framep)	\
5352131Smckusick 	(((framep)->ps & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == \
5452131Smckusick 	(MACH_INT_MASK | MACH_SR_INT_ENA_PREV))
5552131Smckusick #define	CLKF_PC(framep)		((framep)->pc)
5652131Smckusick 
5752131Smckusick /*
5852131Smckusick  * Preempt the current process if in interrupt from user mode,
5952131Smckusick  * or after the current trap/syscall if in system mode.
6052131Smckusick  */
6152131Smckusick #define	need_resched()	{ want_resched = 1; aston(); }
6252131Smckusick 
6352131Smckusick /*
6452131Smckusick  * Give a profiling tick to the current process from the softclock
6552131Smckusick  * interrupt.
6652131Smckusick  */
6752131Smckusick #define	profile_tick(p, framep) \
6852131Smckusick 	addupc((framep)->pc, &p->p_stats->p_prof, 1);
6952131Smckusick 
7052131Smckusick /*
7152131Smckusick  * Notify the current process (p) that it has a signal pending,
7252131Smckusick  * process as soon as possible.
7352131Smckusick  */
7452131Smckusick #define	signotify(p)	aston()
7552131Smckusick 
7652131Smckusick #define aston()		(astpending = 1)
7752131Smckusick 
7852131Smckusick int	astpending;	/* need to trap before returning to user mode */
7952131Smckusick int	want_resched;	/* resched() was called */
8052131Smckusick 
8152131Smckusick /*
8252131Smckusick  * CPU identification, from PRID register.
8352131Smckusick  */
8452131Smckusick union cpuprid {
8552131Smckusick 	int	cpuprid;
8652131Smckusick 	struct {
8752131Smckusick #if BYTE_ORDER == BIG_ENDIAN
8852131Smckusick 		u_int	pad1:16;	/* reserved */
8952131Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
9052131Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
9152131Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
9252131Smckusick #else
9352131Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
9452131Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
9552131Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
9652131Smckusick 		u_int	pad1:16;	/* reserved */
9752131Smckusick #endif
9852131Smckusick 	} cpu;
9952131Smckusick };
10052131Smckusick 
10152131Smckusick /*
10252131Smckusick  * MIPS CPU types (cp_imp).
10352131Smckusick  */
104*52744Sralph #define	MIPS_R2000	0x02
105*52744Sralph #define	MIPS_R3000	0x03
106*52744Sralph #define	MIPS_R4000	0x04
10752131Smckusick 
10852131Smckusick /*
10952131Smckusick  * MIPS FPU types
11052131Smckusick  */
111*52744Sralph #define	MIPS_R2010	0x03
112*52744Sralph #define	MIPS_R3010	0x04
113*52744Sralph #define	MIPS_R4010	0x05
11452131Smckusick 
115*52744Sralph struct intr_tab {
116*52744Sralph 	void	(*func)();	/* pointer to interrupt routine */
117*52744Sralph 	int	unit;		/* logical unit number */
118*52744Sralph };
119*52744Sralph 
12052131Smckusick #ifdef KERNEL
12152131Smckusick union	cpuprid cpu;
12252131Smckusick union	cpuprid fpu;
12352131Smckusick u_int	machDataCacheSize;
12452131Smckusick u_int	machInstCacheSize;
125*52744Sralph extern	struct intr_tab intr_tab[];
12652131Smckusick #endif
12752131Smckusick 
12852131Smckusick /*
12952131Smckusick  * Enable realtime clock (always enabled).
13052131Smckusick  */
13152131Smckusick #define	enablertclock()
13252131Smckusick 
13352131Smckusick #endif /* _CPU_H_ */
134