Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.5
      1 /*	$NetBSD: cpu.h,v 1.5 1999/12/24 08:29:23 msaitoh Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1990 The Regents of the University of California.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to Berkeley by
      8  * William Jolitz.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by the University of
     21  *	California, Berkeley and its contributors.
     22  * 4. Neither the name of the University nor the names of its contributors
     23  *    may be used to endorse or promote products derived from this software
     24  *    without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  * SUCH DAMAGE.
     37  *
     38  *	@(#)cpu.h	5.4 (Berkeley) 5/9/91
     39  */
     40 
     41 /*
     42  * SH3 Version
     43  *
     44  *  T.Horiuchi    Brains Corp.   5/22/98
     45  */
     46 
     47 #ifndef _SH3_CPU_H_
     48 #define _SH3_CPU_H_
     49 
     50 /*
     51  * Definitions unique to sh3 cpu support.
     52  */
     53 #include <machine/psl.h>
     54 #include <machine/frame.h>
     55 #include <machine/segments.h>
     56 
     57 /*
     58  * definitions of cpu-dependent requirements
     59  * referenced in generic code
     60  */
     61 #define	cpu_swapin(p)			/* nothing */
     62 #define	cpu_wait(p)			/* nothing */
     63 #define	cpu_number()			0
     64 
     65 /*
     66  * Arguments to hardclock, softclock and statclock
     67  * encapsulate the previous machine state in an opaque
     68  * clockframe; for now, use generic intrframe.
     69  *
     70  * XXX intrframe has a lot of gunk we don't need.
     71  */
     72 #define clockframe intrframe
     73 
     74 #if 1
     75 #define	CLKF_USERMODE(frame)	(!KERNELMODE((frame)->if_r15))
     76 #else
     77 #define	CLKF_USERMODE(frame)	USERMODE((frame)->if_spc, (frame)->if_ssr)
     78 #endif
     79 #if 0
     80 #define	CLKF_BASEPRI(frame)	((frame)->if_pri == 0)
     81 #else
     82 /* XXX we should fix this */
     83 #define	CLKF_BASEPRI(frame)	(0)
     84 #endif
     85 #define	CLKF_PC(frame)		((frame)->if_spc)
     86 #define	CLKF_INTR(frame)	(0)	/* XXX should have an interrupt stack */
     87 
     88 /*
     89  * Preempt the current process if in interrupt from user mode,
     90  * or after the current trap/syscall if in system mode.
     91  */
     92 int	want_resched;		/* resched() was called */
     93 #define	need_resched()		(want_resched = 1, setsoftast())
     94 
     95 /*
     96  * Give a profiling tick to the current process when the user profiling
     97  * buffer pages are invalid.  On the i386, request an ast to send us
     98  * through trap(), marking the proc as needing a profiling tick.
     99  */
    100 #define	need_proftick(p)	((p)->p_flag |= P_OWEUPC, setsoftast())
    101 
    102 /*
    103  * Notify the current process (p) that it has a signal pending,
    104  * process as soon as possible.
    105  */
    106 #define	signotify(p)		setsoftast()
    107 
    108 /*
    109  * We need a machine-independent name for this.
    110  */
    111 #define	DELAY(x)		delay(x)
    112 void	delay __P((int));
    113 
    114 /*
    115  * Logical address space of SH3 CPU.
    116  */
    117 #define SH3_P0SEG_BASE	0x00000000
    118 #define SH3_P0SEG_END	0x7fffffff
    119 #define SH3_P1SEG_BASE	0x80000000	/* pa == va */
    120 #define SH3_P1SEG_END	0x9fffffff
    121 #define SH3_P2SEG_BASE	0xa0000000	/* pa == va, non-cacheable */
    122 #define SH3_P2SEG_END	0xbfffffff
    123 #define SH3_P3SEG_BASE	0xc0000000
    124 #define SH3_P3SEG_END	0xdfffffff
    125 #define SH3_P4SEG_BASE	0xe0000000
    126 #define SH3_P4SEG_END	0xffffffff
    127 
    128 /*
    129  * pull in #defines for kinds of processors
    130  */
    131 #include <machine/cputypes.h>
    132 
    133 
    134 #ifdef _KERNEL
    135 extern int cpu;
    136 extern int cpu_class;
    137 extern struct cpu_nocpuid_nameclass sh3_nocpuid_cpus[];
    138 extern struct cpu_cpuid_nameclass sh3_cpuid_cpus[];
    139 
    140 /* autoconf.c */
    141 void	configure __P((void));
    142 
    143 /* machdep.c */
    144 void	delay __P((int));
    145 void	dumpconf __P((void));
    146 void	cpu_reset __P((void));
    147 
    148 /* locore.s */
    149 struct region_descriptor;
    150 void	lgdt __P((struct region_descriptor *));
    151 void	fillw __P((short, void *, size_t));
    152 void
    153 bcopyb  __P((caddr_t from, caddr_t to, size_t len));
    154 void
    155 bcopyw __P((caddr_t from, caddr_t to, size_t len));
    156 void
    157 setPageDirReg __P((int pgdir));
    158 
    159 
    160 struct pcb;
    161 void	savectx __P((struct pcb *));
    162 void	switch_exit __P((struct proc *));
    163 void	proc_trampoline __P((void));
    164 
    165 /* clock.c */
    166 void	startrtclock __P((void));
    167 
    168 /* npx.c */
    169 void	npxdrop __P((void));
    170 void	npxsave __P((void));
    171 
    172 /* vm_machdep.c */
    173 int kvtop __P((caddr_t));
    174 
    175 #ifdef MATH_EMULATE
    176 /* math_emulate.c */
    177 int	math_emulate __P((struct trapframe *));
    178 #endif
    179 
    180 
    181 /* trap.c */
    182 void	child_return __P((struct proc *, int, int, int, struct trapframe));
    183 
    184 #endif /* _KERNEL */
    185 
    186 /*
    187  * CTL_MACHDEP definitions.
    188  */
    189 #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
    190 #define	CPU_NKPDE		2	/* int: number of kernel PDEs */
    191 #define	CPU_BOOTED_KERNEL	3	/* string: booted kernel name */
    192 #define	CPU_SETPRIVPROC		4	/* set current proc to piviledged proc
    193 					   */
    194 #define	CPU_DEBUGMODE		5	/* set debug mode */
    195 #define	CPU_LOADANDRESET	6	/* load kernel image and reset */
    196 #define	CPU_MAXID		7	/* number of valid machdep ids */
    197 
    198 #define	CTL_MACHDEP_NAMES { \
    199 	{ 0, 0 }, \
    200 	{ "console_device", CTLTYPE_STRUCT }, \
    201 	{ "nkpde", CTLTYPE_INT }, \
    202 	{ "booted_kernel", CTLTYPE_STRING }, \
    203 	{ "set_priv_proc", CTLTYPE_INT }, \
    204 	{ "debug_mode", CTLTYPE_INT }, \
    205 	{ "load_and_reset", CTLTYPE_INT }, \
    206 }
    207 
    208 #include <machine/sh3.h>
    209 
    210 
    211 #endif /* !_SH3_CPU_H_ */
    212