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