xref: /csrg-svn/sys/news3400/include/cpu.h (revision 69533)
153899Smckusick /*
265603Smckusick  * Copyright (c) 1992, 1993
365792Sbostic  *	The Regents of the University of California.  All rights reserved.
453899Smckusick  *
553899Smckusick  * This code is derived from software contributed to Berkeley by
653899Smckusick  * Ralph Campbell and Kazumasa Utashiro of Software Research
753899Smckusick  * Associates, Inc.
853899Smckusick  *
953899Smckusick  * %sccs.include.redist.c%
1053899Smckusick  *
11*69533Smckusick  *	@(#)cpu.h	8.3 (Berkeley) 05/17/95
1253899Smckusick  */
1353899Smckusick 
1453899Smckusick #ifndef _CPU_H_
1553899Smckusick #define _CPU_H_
1653899Smckusick 
1757181Sutashiro #include <machine/machConst.h>
1853899Smckusick 
1953899Smckusick /*
2053899Smckusick  * Exported definitions unique to pmax/mips cpu support.
2153899Smckusick  */
2253899Smckusick 
2353899Smckusick /*
2453899Smckusick  * definitions of cpu-dependent requirements
2553899Smckusick  * referenced in generic code
2653899Smckusick  */
2757604Sutashiro #define	COPY_SIGCODE		/* copy sigcode above user stack in exec */
2853899Smckusick 
2965074Smckusick #define	cpu_exec(p)		(p->p_md.md_ss_addr = 0) /* init single step */
3065500Smckusick #define	cpu_swapin(p)		/* nothing */
3165074Smckusick #define	cpu_wait(p)		/* nothing */
3265074Smckusick #define cpu_setstack(p, ap)	(p)->p_md.md_regs[SP] = ap
3365074Smckusick #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp
34*69533Smckusick #define	BACKTRACE(p)		/* not implemented */
3553899Smckusick 
3653899Smckusick /*
3755765Sbostic  * Arguments to hardclock and gatherstats encapsulate the previous
3855765Sbostic  * machine state in an opaque clockframe.
3953899Smckusick  */
4055765Sbostic struct clockframe {
4155765Sbostic 	int	pc;	/* program counter at time of interrupt */
4255765Sbostic 	int	sr;	/* status register at time of interrupt */
4355765Sbostic };
4453899Smckusick 
4555765Sbostic #define	CLKF_USERMODE(framep)	((framep)->sr & MACH_SR_KU_PREV)
4653899Smckusick #define	CLKF_BASEPRI(framep)	\
4755765Sbostic 	((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
4853899Smckusick #define	CLKF_PC(framep)		((framep)->pc)
4955765Sbostic #define	CLKF_INTR(framep)	(0)
5053899Smckusick 
5153899Smckusick /*
5253899Smckusick  * Preempt the current process if in interrupt from user mode,
5353899Smckusick  * or after the current trap/syscall if in system mode.
5453899Smckusick  */
5553899Smckusick #define	need_resched()	{ want_resched = 1; aston(); }
5653899Smckusick 
5753899Smckusick /*
5855765Sbostic  * Give a profiling tick to the current process when the user profiling
5955765Sbostic  * buffer pages are invalid.  On the PMAX, request an ast to send us
6055765Sbostic  * through trap, marking the proc as needing a profiling tick.
6153899Smckusick  */
6255765Sbostic #define	need_proftick(p)	{ (p)->p_flag |= SOWEUPC; aston(); }
6353899Smckusick 
6453899Smckusick /*
6553899Smckusick  * Notify the current process (p) that it has a signal pending,
6653899Smckusick  * process as soon as possible.
6753899Smckusick  */
6853899Smckusick #define	signotify(p)	aston()
6953899Smckusick 
7053899Smckusick #define aston()		(astpending = 1)
7153899Smckusick 
7253899Smckusick int	astpending;	/* need to trap before returning to user mode */
7353899Smckusick int	want_resched;	/* resched() was called */
7453899Smckusick 
7553899Smckusick /*
7653899Smckusick  * CPU identification, from PRID register.
7753899Smckusick  */
7853899Smckusick union cpuprid {
7953899Smckusick 	int	cpuprid;
8053899Smckusick 	struct {
8153899Smckusick #if BYTE_ORDER == BIG_ENDIAN
8253899Smckusick 		u_int	pad1:16;	/* reserved */
8353899Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
8453899Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
8553899Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
8653899Smckusick #else
8753899Smckusick 		u_int	cp_minrev:4;	/* minor revision identifier */
8853899Smckusick 		u_int	cp_majrev:4;	/* major revision identifier */
8953899Smckusick 		u_int	cp_imp:8;	/* implementation identifier */
9053899Smckusick 		u_int	pad1:16;	/* reserved */
9153899Smckusick #endif
9253899Smckusick 	} cpu;
9353899Smckusick };
9453899Smckusick 
9553899Smckusick /*
9653899Smckusick  * MIPS CPU types (cp_imp).
9753899Smckusick  */
9853899Smckusick #define	MIPS_R2000	0x01
9953899Smckusick #define	MIPS_R3000	0x02
10053899Smckusick #define	MIPS_R6000	0x03
10153899Smckusick #define	MIPS_R4000	0x04
10253899Smckusick #define	MIPS_R6000A	0x06
10353899Smckusick 
10453899Smckusick /*
10553899Smckusick  * MIPS FPU types
10653899Smckusick  */
10753899Smckusick #define	MIPS_R2010_FPU	0x02
10853899Smckusick #define	MIPS_R3010_FPU	0x03
10953899Smckusick #define	MIPS_R6010_FPU	0x04
11053899Smckusick #define	MIPS_R4000_FPU	0x05
11153899Smckusick 
11253899Smckusick struct intr_tab {
11353899Smckusick 	void	(*func)();	/* pointer to interrupt routine */
11453899Smckusick 	int	unit;		/* logical unit number */
11553899Smckusick };
11653899Smckusick 
11753899Smckusick #ifdef KERNEL
11853899Smckusick union	cpuprid cpu;
11953899Smckusick union	cpuprid fpu;
12053899Smckusick u_int	machDataCacheSize;
12153899Smckusick u_int	machInstCacheSize;
12253899Smckusick extern	struct intr_tab intr_tab[];
12353899Smckusick #endif
12453899Smckusick 
12553899Smckusick #endif /* _CPU_H_ */
126