Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.7
      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  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by the University of
     19  *	California, Berkeley and its contributors.
     20  * 4. Neither the name of the University nor the names of its contributors
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  *	from: @(#)cpu.h	8.4 (Berkeley) 1/4/94
     37  *      $Id: cpu.h,v 1.7 1994/06/02 06:15:03 glass Exp $
     38  */
     39 
     40 #ifndef _CPU_H_
     41 #define _CPU_H_
     42 
     43 #include <machine/machConst.h>
     44 
     45 /*
     46  * Exported definitions unique to pmax/mips cpu support.
     47  */
     48 
     49 /*
     50  * definitions of cpu-dependent requirements
     51  * referenced in generic code
     52  */
     53 #define	COPY_SIGCODE		/* copy sigcode above user stack in exec */
     54 
     55 #define	cpu_exec(p)		(p->p_md.md_ss_addr = 0) /* init single step */
     56 #define	cpu_wait(p)		/* nothing */
     57 #define cpu_set_init_frame(p, fp) /* nothing */
     58 
     59 /*
     60  * Arguments to hardclock and gatherstats encapsulate the previous
     61  * machine state in an opaque clockframe.
     62  */
     63 struct clockframe {
     64 	int	pc;	/* program counter at time of interrupt */
     65 	int	sr;	/* status register at time of interrupt */
     66 };
     67 
     68 #define	CLKF_USERMODE(framep)	((framep)->sr & MACH_SR_KU_PREV)
     69 #define	CLKF_BASEPRI(framep)	\
     70 	((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0)
     71 #define	CLKF_PC(framep)		((framep)->pc)
     72 #define	CLKF_INTR(framep)	(0)
     73 
     74 /*
     75  * Preempt the current process if in interrupt from user mode,
     76  * or after the current trap/syscall if in system mode.
     77  */
     78 #define	need_resched()	{ want_resched = 1; aston(); }
     79 
     80 /*
     81  * Give a profiling tick to the current process when the user profiling
     82  * buffer pages are invalid.  On the PMAX, request an ast to send us
     83  * through trap, marking the proc as needing a profiling tick.
     84  */
     85 #define	need_proftick(p)	{ (p)->p_flag |= P_OWEUPC; aston(); }
     86 
     87 /*
     88  * Notify the current process (p) that it has a signal pending,
     89  * process as soon as possible.
     90  */
     91 #define	signotify(p)	aston()
     92 
     93 #define aston()		(astpending = 1)
     94 
     95 int	astpending;	/* need to trap before returning to user mode */
     96 int	want_resched;	/* resched() was called */
     97 
     98 /*
     99  * CPU identification, from PRID register.
    100  */
    101 union cpuprid {
    102 	int	cpuprid;
    103 	struct {
    104 #if BYTE_ORDER == BIG_ENDIAN
    105 		u_int	pad1:16;	/* reserved */
    106 		u_int	cp_imp:8;	/* implementation identifier */
    107 		u_int	cp_majrev:4;	/* major revision identifier */
    108 		u_int	cp_minrev:4;	/* minor revision identifier */
    109 #else
    110 		u_int	cp_minrev:4;	/* minor revision identifier */
    111 		u_int	cp_majrev:4;	/* major revision identifier */
    112 		u_int	cp_imp:8;	/* implementation identifier */
    113 		u_int	pad1:16;	/* reserved */
    114 #endif
    115 	} cpu;
    116 };
    117 
    118 /*
    119  * CTL_MACHDEP definitions.
    120  */
    121 #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
    122 #define	CPU_MAXID		2	/* number of valid machdep ids */
    123 
    124 #define CTL_MACHDEP_NAMES { \
    125 	{ 0, 0 }, \
    126 	{ "console_device", CTLTYPE_STRUCT }, \
    127 }
    128 
    129 /*
    130  * MIPS CPU types (cp_imp).
    131  */
    132 #define	MIPS_R2000	0x01
    133 #define	MIPS_R3000	0x02
    134 #define	MIPS_R6000	0x03
    135 #define	MIPS_R4000	0x04
    136 #define	MIPS_R6000A	0x06
    137 
    138 /*
    139  * MIPS FPU types
    140  */
    141 #define	MIPS_R2010	0x02
    142 #define	MIPS_R3010	0x03
    143 #define	MIPS_R6010	0x04
    144 #define	MIPS_R4010	0x05
    145 
    146 #ifdef KERNEL
    147 union	cpuprid cpu;
    148 union	cpuprid fpu;
    149 u_int	machDataCacheSize;
    150 u_int	machInstCacheSize;
    151 extern	struct intr_tab intr_tab[];
    152 #endif
    153 
    154 /*
    155  * Enable realtime clock (always enabled).
    156  */
    157 #define	enablertclock()
    158 
    159 #endif /* _CPU_H_ */
    160