Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.90.16.23
      1 /*	$NetBSD: cpu.h,v 1.90.16.23 2010/02/27 07:58:52 matt Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1992, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * This code is derived from software contributed to Berkeley by
      8  * Ralph Campbell and Rick Macklem.
      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. Neither the name of the University nor the names of its contributors
     19  *    may be used to endorse or promote products derived from this software
     20  *    without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  * SUCH DAMAGE.
     33  *
     34  *	@(#)cpu.h	8.4 (Berkeley) 1/4/94
     35  */
     36 
     37 #ifndef _CPU_H_
     38 #define _CPU_H_
     39 
     40 #include <mips/cpuregs.h>
     41 
     42 /*
     43  * Exported definitions unique to NetBSD/mips cpu support.
     44  */
     45 
     46 #ifdef _KERNEL
     47 
     48 #ifndef _LOCORE
     49 #include <sys/cpu_data.h>
     50 #include <sys/device.h>
     51 
     52 #if defined(_KERNEL_OPT)
     53 #include "opt_lockdebug.h"
     54 #include "opt_multiprocessor.h"
     55 #endif
     56 
     57 struct pridtab {
     58 	int	cpu_cid;
     59 	int	cpu_pid;
     60 	int	cpu_rev;	/* -1 == wildcard */
     61 	int	cpu_copts;	/* -1 == wildcard */
     62 	int	cpu_isa;	/* -1 == probed (mips32/mips64) */
     63 	int	cpu_ntlb;	/* -1 == unknown, 0 == probed */
     64 	int	cpu_flags;
     65 	u_int	cpu_cp0flags;	/* presence of some cp0 regs */
     66 	u_int	cpu_cidflags;	/* company-specific flags */
     67 	const char	*cpu_name;
     68 };
     69 
     70 /*
     71  * bitfield defines for cpu_cp0flags
     72  */
     73 #define  MIPS_CP0FL_USE		__BIT(0)	/* use these flags */
     74 #define  MIPS_CP0FL_ECC		__BIT(1)
     75 #define  MIPS_CP0FL_CACHE_ERR	__BIT(2)
     76 #define  MIPS_CP0FL_EIRR	__BIT(3)
     77 #define  MIPS_CP0FL_EIMR	__BIT(4)
     78 #define  MIPS_CP0FL_EBASE	__BIT(5)
     79 #define  MIPS_CP0FL_CONFIG	__BIT(6)
     80 #define  MIPS_CP0FL_CONFIGn(n)	(__BIT(7) << ((n) & 7))
     81 
     82 /*
     83  * cpu_cidflags defines, by company
     84  */
     85 /*
     86  * RMI company-specific cpu_cidflags
     87  */
     88 #define MIPS_CIDFL_RMI_TYPE     	__BITS(2,0)
     89 # define  CIDFL_RMI_TYPE_XLR     	0
     90 # define  CIDFL_RMI_TYPE_XLS     	1
     91 # define  CIDFL_RMI_TYPE_XLP     	2
     92 #define MIPS_CIDFL_RMI_THREADS_MASK	__BITS(6,3)
     93 # define MIPS_CIDFL_RMI_THREADS_SHIFT	3
     94 #define MIPS_CIDFL_RMI_CORES_MASK	__BITS(10,7)
     95 # define MIPS_CIDFL_RMI_CORES_SHIFT	7
     96 # define LOG2_1	0
     97 # define LOG2_2	1
     98 # define LOG2_4	2
     99 # define LOG2_8	3
    100 # define MIPS_CIDFL_RMI_CPUS(ncores, nthreads)				\
    101 		((LOG2_ ## ncores << MIPS_CIDFL_RMI_CORES_SHIFT)	\
    102 		|(LOG2_ ## nthreads << MIPS_CIDFL_RMI_THREADS_SHIFT))
    103 # define MIPS_CIDFL_RMI_NTHREADS(cidfl)					\
    104 		(1 << (((cidfl) & MIPS_CIDFL_RMI_THREADS_MASK)		\
    105 			>> MIPS_CIDFL_RMI_THREADS_SHIFT))
    106 # define MIPS_CIDFL_RMI_NCORES(cidfl)					\
    107 		(1 << (((cidfl) & MIPS_CIDFL_RMI_CORES_MASK)		\
    108 			>> MIPS_CIDFL_RMI_CORES_SHIFT))
    109 #define MIPS_CIDFL_RMI_L2SZ_MASK	__BITS(14,11)
    110 # define MIPS_CIDFL_RMI_L2SZ_SHIFT	11
    111 # define RMI_L2SZ_256KB	 0
    112 # define RMI_L2SZ_512KB  1
    113 # define RMI_L2SZ_1MB    2
    114 # define RMI_L2SZ_2MB    3
    115 # define RMI_L2SZ_4MB    4
    116 # define MIPS_CIDFL_RMI_L2(l2sz)					\
    117 		(RMI_L2SZ_ ## l2sz << MIPS_CIDFL_RMI_L2SZ_SHIFT)
    118 # define MIPS_CIDFL_RMI_L2SZ(cidfl)					\
    119 		((256*1024) << (((cidfl) & MIPS_CIDFL_RMI_L2SZ_MASK)	\
    120 			>> MIPS_CIDFL_RMI_L2SZ_SHIFT))
    121 
    122 
    123 
    124 struct cpu_info {
    125 	struct cpu_data ci_data;	/* MI per-cpu data */
    126 	struct cpu_info *ci_next;	/* Next CPU in list */
    127 	cpuid_t ci_cpuid;		/* Machine-level identifier */
    128 	u_long ci_cpu_freq;		/* CPU frequency */
    129 	u_long ci_cycles_per_hz;	/* CPU freq / hz */
    130 	u_long ci_divisor_delay;	/* for delay/DELAY */
    131 	u_long ci_divisor_recip;	/* unused, for obsolete microtime(9) */
    132 	struct lwp *ci_curlwp;		/* currently running lwp */
    133 	struct lwp *ci_fpcurlwp;	/* the current FPU owner */
    134 	int ci_want_resched;		/* user preemption pending */
    135 	int ci_mtx_count;		/* negative count of held mutexes */
    136 	int ci_mtx_oldspl;		/* saved SPL value */
    137 	int ci_idepth;			/* hardware interrupt depth */
    138 	int ci_cpl;			/* current [interrupt] priority level */
    139 	device_t ci_dev;		/* owning device */
    140 	u_long ci_cctr_freq;		/* cycle counter frequency */
    141 	struct lwp *ci_softlwps[SOFTINT_COUNT];
    142 #define	ci_softints	ci_data.cpu_softints
    143 	/*
    144 	 * Per-cpu pmap information
    145 	 */
    146 	uint32_t ci_ksp_tlb_slot;	/* reserved tlb entry for kernel stack */
    147 	int ci_tlb_slot;		/* reserved tlb entry for cpu_info */
    148 	struct pmap_tlb_info *ci_tlb_info;
    149 	struct segtab *ci_pmap_segbase;
    150 	vaddr_t ci_pmap_srcbase;	/* starting VA of ephemeral src space */
    151 	vaddr_t ci_pmap_dstbase;	/* starting VA of ephemeral dst space */
    152 };
    153 
    154 #define	CPU_INFO_ITERATOR		int
    155 #define	CPU_INFO_FOREACH(cii, ci)	\
    156     (void)(cii), ci = &cpu_info_store; ci != NULL; ci = ci->ci_next
    157 
    158 #endif /* !_LOCORE */
    159 #endif /* _KERNEL */
    160 
    161 /*
    162  * CTL_MACHDEP definitions.
    163  */
    164 #define CPU_CONSDEV		1	/* dev_t: console terminal device */
    165 #define CPU_BOOTED_KERNEL	2	/* string: booted kernel name */
    166 #define CPU_ROOT_DEVICE		3	/* string: root device name */
    167 #define CPU_LLSC		4	/* OS/CPU supports LL/SC instruction */
    168 
    169 /*
    170  * Platform can override, but note this breaks userland compatibility
    171  * with other mips platforms.
    172  */
    173 #ifndef CPU_MAXID
    174 #define CPU_MAXID		5	/* number of valid machdep ids */
    175 
    176 #endif
    177 
    178 #ifdef _KERNEL
    179 #if defined(_LKM) || defined(_STANDALONE)
    180 /* Assume all CPU architectures are valid for LKM's and standlone progs */
    181 #define	MIPS1	1
    182 #define	MIPS3	1
    183 #define	MIPS4	1
    184 #define	MIPS32	1
    185 #define	MIPS64	1
    186 #endif
    187 
    188 #if (MIPS1 + MIPS3 + MIPS4 + MIPS32 + MIPS64) == 0
    189 #error at least one of MIPS1, MIPS3, MIPS4, MIPS32 or MIPS64 must be specified
    190 #endif
    191 
    192 /* Shortcut for MIPS3 or above defined */
    193 #if defined(MIPS3) || defined(MIPS4) || defined(MIPS32) || defined(MIPS64)
    194 #define	MIPS3_PLUS	1
    195 #else
    196 #undef MIPS3_PLUS
    197 #endif
    198 
    199 /*
    200  * Macros to find the CPU architecture we're on at run-time,
    201  * or if possible, at compile-time.
    202  */
    203 
    204 #define	CPU_ARCH_MIPSx	0		/* XXX unknown */
    205 #define	CPU_ARCH_MIPS1	(1 << 0)
    206 #define	CPU_ARCH_MIPS2	(1 << 1)
    207 #define	CPU_ARCH_MIPS3	(1 << 2)
    208 #define	CPU_ARCH_MIPS4	(1 << 3)
    209 #define	CPU_ARCH_MIPS5	(1 << 4)
    210 #define	CPU_ARCH_MIPS32	(1 << 5)
    211 #define	CPU_ARCH_MIPS64	(1 << 6)
    212 
    213 /* Note: must be kept in sync with -ffixed-?? Makefile.mips. */
    214 #define MIPS_CURLWP             $24
    215 #define MIPS_CURLWP_QUOTED      "$24"
    216 #define MIPS_CURLWP_LABEL	_L_T8
    217 #define MIPS_CURLWP_REG		_R_T8
    218 #define TF_MIPS_CURLWP(x)	TF_REG_T8(x)
    219 
    220 #ifndef _LOCORE
    221 
    222 extern struct cpu_info cpu_info_store;
    223 register struct lwp *mips_curlwp asm(MIPS_CURLWP_QUOTED);
    224 
    225 #define	curlwp			mips_curlwp
    226 #define	curcpu()		(curlwp->l_cpu)
    227 #define	curpcb			(&curlwp->l_addr->u_pcb)
    228 #define	fpcurlwp		(curcpu()->ci_fpcurlwp)
    229 #ifdef MULTIPROCESSOR
    230 #define	cpu_number()		(curcpu()->ci_cpuid)
    231 #define	CPU_IS_PRIMARY(ci)	((ci)->ci_cpuid == 0)
    232 #else
    233 #define	cpu_number()		(0)
    234 #endif
    235 #define	cpu_proc_fork(p1, p2)	((void)((p2)->p_md.md_abi = (p1)->p_md.md_abi))
    236 
    237 /* XXX simonb
    238  * Should the following be in a cpu_info type structure?
    239  * And how many of these are per-cpu vs. per-system?  (Ie,
    240  * we can assume that all cpus have the same mmu-type, but
    241  * maybe not that all cpus run at the same clock speed.
    242  * Some SGI's apparently support R12k and R14k in the same
    243  * box.)
    244  */
    245 struct mips_options {
    246 	const struct pridtab *mips_cpu;
    247 
    248 	u_int mips_cpu_arch;
    249 	u_int mips_cpu_mhz; /* CPU speed in MHz, estimated by mc_cpuspeed(). */
    250 	u_int mips_cpu_flags;
    251 	u_int mips_num_tlb_entries;
    252 	mips_prid_t mips_cpu_id;
    253 	mips_prid_t mips_fpu_id;
    254 	bool mips_has_r4k_mmu;
    255 	bool mips_has_llsc;
    256 	u_int mips3_pg_shift;
    257 	u_int mips3_pg_cached;
    258 #ifdef MIPS3_PLUS
    259 #ifdef _LP64
    260 	uint64_t mips3_xkphys_cached;
    261 #endif
    262 	uint64_t mips3_tlb_vpn_mask;
    263 	uint64_t mips3_tlb_pfn_mask;
    264 	uint32_t mips3_tlb_pg_mask;
    265 #endif
    266 };
    267 extern struct mips_options mips_options;
    268 
    269 #define	CPU_MIPS_R4K_MMU		0x0001
    270 #define	CPU_MIPS_NO_LLSC		0x0002
    271 #define	CPU_MIPS_CAUSE_IV		0x0004
    272 #define	CPU_MIPS_HAVE_SPECIAL_CCA	0x0008	/* Defaults to '3' if not set. */
    273 #define	CPU_MIPS_CACHED_CCA_MASK	0x0070
    274 #define	CPU_MIPS_CACHED_CCA_SHIFT	 4
    275 #define	CPU_MIPS_DOUBLE_COUNT		0x0080	/* 1 cp0 count == 2 clock cycles */
    276 #define	CPU_MIPS_USE_WAIT		0x0100	/* Use "wait"-based cpu_idle() */
    277 #define	CPU_MIPS_NO_WAIT		0x0200	/* Inverse of previous, for mips32/64 */
    278 #define	CPU_MIPS_D_CACHE_COHERENT	0x0400	/* D-cache is fully coherent */
    279 #define	CPU_MIPS_I_D_CACHE_COHERENT	0x0800	/* I-cache funcs don't need to flush the D-cache */
    280 #define	CPU_MIPS_NO_LLADDR		0x1000
    281 #define	CPU_MIPS_HAVE_MxCR		0x2000	/* have mfcr, mtcr insns */
    282 #define	MIPS_NOT_SUPP			0x8000
    283 
    284 #endif	/* !_LOCORE */
    285 
    286 #if ((MIPS1 + MIPS3 + MIPS4 + MIPS32 + MIPS64) == 1) || defined(_LOCORE)
    287 
    288 #if defined(MIPS1)
    289 
    290 # define CPUISMIPS3		0
    291 # define CPUIS64BITS		0
    292 # define CPUISMIPS32		0
    293 # define CPUISMIPS64		0
    294 # define CPUISMIPSNN		0
    295 # define MIPS_HAS_R4K_MMU	0
    296 # define MIPS_HAS_CLOCK		0
    297 # define MIPS_HAS_LLSC		0
    298 # define MIPS_HAS_LLADDR	0
    299 
    300 #elif defined(MIPS3) || defined(MIPS4)
    301 
    302 # define CPUISMIPS3		1
    303 # define CPUIS64BITS		1
    304 # define CPUISMIPS32		0
    305 # define CPUISMIPS64		0
    306 # define CPUISMIPSNN		0
    307 # define MIPS_HAS_R4K_MMU	1
    308 # define MIPS_HAS_CLOCK		1
    309 # if defined(_LOCORE)
    310 #  if !defined(MIPS3_5900) && !defined(MIPS3_4100)
    311 #   define MIPS_HAS_LLSC	1
    312 #  else
    313 #   define MIPS_HAS_LLSC	0
    314 #  endif
    315 # else	/* _LOCORE */
    316 #  define MIPS_HAS_LLSC		(mips_options.mips_has_llsc)
    317 # endif	/* _LOCORE */
    318 # define MIPS_HAS_LLADDR	((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
    319 
    320 #elif defined(MIPS32)
    321 
    322 # define CPUISMIPS3		1
    323 # define CPUIS64BITS		0
    324 # define CPUISMIPS32		1
    325 # define CPUISMIPS64		0
    326 # define CPUISMIPSNN		1
    327 # define MIPS_HAS_R4K_MMU	1
    328 # define MIPS_HAS_CLOCK		1
    329 # define MIPS_HAS_LLSC		1
    330 # define MIPS_HAS_LLADDR	((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
    331 
    332 #elif defined(MIPS64)
    333 
    334 # define CPUISMIPS3		1
    335 # define CPUIS64BITS		1
    336 # define CPUISMIPS32		0
    337 # define CPUISMIPS64		1
    338 # define CPUISMIPSNN		1
    339 # define MIPS_HAS_R4K_MMU	1
    340 # define MIPS_HAS_CLOCK		1
    341 # define MIPS_HAS_LLSC		1
    342 # define MIPS_HAS_LLADDR	((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
    343 
    344 #endif
    345 
    346 #else /* run-time test */
    347 
    348 #ifndef	_LOCORE
    349 
    350 #define	MIPS_HAS_R4K_MMU	(mips_options.mips_has_r4k_mmu)
    351 #define	MIPS_HAS_LLSC		(mips_options.mips_has_llsc)
    352 #define	MIPS_HAS_LLADDR		((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
    353 
    354 /* This test is ... rather bogus */
    355 #define	CPUISMIPS3	((mips_options.mips_cpu_arch & \
    356 	(CPU_ARCH_MIPS3 | CPU_ARCH_MIPS4 | CPU_ARCH_MIPS32 | CPU_ARCH_MIPS64)) != 0)
    357 
    358 /* And these aren't much better while the previous test exists as is... */
    359 #define	CPUISMIPS4	((mips_options.mips_cpu_arch & CPU_ARCH_MIPS4) != 0)
    360 #define	CPUISMIPS5	((mips_options.mips_cpu_arch & CPU_ARCH_MIPS5) != 0)
    361 #define	CPUISMIPS32	((mips_options.mips_cpu_arch & CPU_ARCH_MIPS32) != 0)
    362 #define	CPUISMIPS64	((mips_options.mips_cpu_arch & CPU_ARCH_MIPS64) != 0)
    363 #define	CPUISMIPSNN	((mips_options.mips_cpu_arch & (CPU_ARCH_MIPS32 | CPU_ARCH_MIPS64)) != 0)
    364 #define	CPUIS64BITS	((mips_options.mips_cpu_arch & \
    365 	(CPU_ARCH_MIPS3 | CPU_ARCH_MIPS4 | CPU_ARCH_MIPS64)) != 0)
    366 
    367 #define	MIPS_HAS_CLOCK	(mips_options.mips_cpu_arch >= CPU_ARCH_MIPS3)
    368 
    369 #else	/* !_LOCORE */
    370 
    371 #define	MIPS_HAS_LLSC	0
    372 
    373 #endif	/* !_LOCORE */
    374 
    375 #endif /* run-time test */
    376 
    377 #ifndef	_LOCORE
    378 
    379 /*
    380  * definitions of cpu-dependent requirements
    381  * referenced in generic code
    382  */
    383 #define	cpu_swapout(p)			panic("cpu_swapout: can't get here");
    384 
    385 /*
    386  * Send an inter-processor interupt to another CPU.
    387  */
    388 int cpu_send_ipi(struct cpu_info *, int);
    389 
    390 /*
    391  * cpu_intr(ppl, pc, status);  (most state needed by clockframe)
    392  */
    393 void cpu_intr(int, vaddr_t, uint32_t);
    394 
    395 /*
    396  * Arguments to hardclock and gatherstats encapsulate the previous
    397  * machine state in an opaque clockframe.
    398  */
    399 struct clockframe {
    400 	vaddr_t		pc;	/* program counter at time of interrupt */
    401 	uint32_t	sr;	/* status register at time of interrupt */
    402 	bool		intr;	/* interrupted a interrupt */
    403 };
    404 
    405 /*
    406  * A port must provde CLKF_USERMODE() for use in machine-independent code.
    407  * These differ on r4000 and r3000 systems; provide them in the
    408  * port-dependent file that includes this one, using the macros below.
    409  */
    410 
    411 /* mips1 versions */
    412 #define	MIPS1_CLKF_USERMODE(framep)	((framep)->sr & MIPS_SR_KU_PREV)
    413 
    414 /* mips3 versions */
    415 #define	MIPS3_CLKF_USERMODE(framep)	((framep)->sr & MIPS_SR_KSU_USER)
    416 
    417 #define	CLKF_PC(framep)		((framep)->pc)
    418 #define	CLKF_INTR(framep)	((framep)->intr)
    419 
    420 #if defined(MIPS3_PLUS) && !defined(MIPS1)		/* XXX bogus! */
    421 #define	CLKF_USERMODE(framep)	MIPS3_CLKF_USERMODE(framep)
    422 #endif
    423 
    424 #if !defined(MIPS3_PLUS) && defined(MIPS1)		/* XXX bogus! */
    425 #define	CLKF_USERMODE(framep)	MIPS1_CLKF_USERMODE(framep)
    426 #endif
    427 
    428 #if defined(MIPS3_PLUS) && defined(MIPS1)		/* XXX bogus! */
    429 #define CLKF_USERMODE(framep) \
    430     ((CPUISMIPS3) ? MIPS3_CLKF_USERMODE(framep):  MIPS1_CLKF_USERMODE(framep))
    431 #endif
    432 
    433 /*
    434  * Misc prototypes and variable declarations.
    435  */
    436 struct lwp;
    437 struct user;
    438 
    439 /*
    440  * Preempt the current process if in interrupt from user mode,
    441  * or after the current trap/syscall if in system mode.
    442  */
    443 void	cpu_need_resched(struct cpu_info *, int);
    444 /*
    445  * Notify the current lwp (l) that it has a signal pending,
    446  * process as soon as possible.
    447  */
    448 void	cpu_signotify(struct lwp *);
    449 
    450 /*
    451  * Give a profiling tick to the current process when the user profiling
    452  * buffer pages are invalid.  On the MIPS, request an ast to send us
    453  * through trap, marking the proc as needing a profiling tick.
    454  */
    455 void	cpu_need_proftick(struct lwp *);
    456 void	cpu_set_curpri(int);
    457 
    458 extern int mips_poolpage_vmfreelist;	/* freelist to allocate poolpages */
    459 
    460 /* copy.S */
    461 int8_t	ufetch_int8(void *);
    462 int16_t	ufetch_int16(void *);
    463 int32_t ufetch_int32(void *);
    464 uint8_t	ufetch_uint8(void *);
    465 uint16_t ufetch_uint16(void *);
    466 uint32_t ufetch_uint32(void *);
    467 int8_t	ufetch_int8_intrsafe(void *);
    468 int16_t	ufetch_int16_intrsafe(void *);
    469 int32_t ufetch_int32_intrsafe(void *);
    470 uint8_t	ufetch_uint8_intrsafe(void *);
    471 uint16_t ufetch_uint16_intrsafe(void *);
    472 uint32_t ufetch_uint32_intrsafe(void *);
    473 #ifdef _LP64
    474 int64_t ufetch_int64(void *);
    475 uint64_t ufetch_uint64(void *);
    476 int64_t ufetch_int64_intrsafe(void *);
    477 uint64_t ufetch_uint64_intrsafe(void *);
    478 #endif
    479 char	ufetch_char(void *);
    480 short	ufetch_short(void *);
    481 int	ufetch_int(void *);
    482 long	ufetch_long(void *);
    483 char	ufetch_char_intrsafe(void *);
    484 short	ufetch_short_intrsafe(void *);
    485 int	ufetch_int_intrsafe(void *);
    486 long	ufetch_long_intrsafe(void *);
    487 
    488 u_char	ufetch_uchar(void *);
    489 u_short	ufetch_ushort(void *);
    490 u_int	ufetch_uint(void *);
    491 u_long	ufetch_ulong(void *);
    492 u_char	ufetch_uchar_intrsafe(void *);
    493 u_short	ufetch_ushort_intrsafe(void *);
    494 u_int	ufetch_uint_intrsafe(void *);
    495 u_long	ufetch_ulong_intrsafe(void *);
    496 void 	*ufetch_ptr(void *);
    497 
    498 int	ustore_int8(void *, int8_t);
    499 int	ustore_int16(void *, int16_t);
    500 int	ustore_int32(void *, int32_t);
    501 int	ustore_uint8(void *, uint8_t);
    502 int	ustore_uint16(void *, uint16_t);
    503 int	ustore_uint32(void *, uint32_t);
    504 int	ustore_int8_intrsafe(void *, int8_t);
    505 int	ustore_int16_intrsafe(void *, int16_t);
    506 int	ustore_int32_intrsafe(void *, int32_t);
    507 int	ustore_uint8_intrsafe(void *, uint8_t);
    508 int	ustore_uint16_intrsafe(void *, uint16_t);
    509 int	ustore_uint32_intrsafe(void *, uint32_t);
    510 #ifdef _LP64
    511 int	ustore_int64(void *, int64_t);
    512 int	ustore_uint64(void *, uint64_t);
    513 int	ustore_int64_intrsafe(void *, int64_t);
    514 int	ustore_uint64_intrsafe(void *, uint64_t);
    515 #endif
    516 int	ustore_char(void *, char);
    517 int	ustore_char_intrsafe(void *, char);
    518 int	ustore_short(void *, short);
    519 int	ustore_short_intrsafe(void *, short);
    520 int	ustore_int(void *, int);
    521 int	ustore_int_intrsafe(void *, int);
    522 int	ustore_long(void *, long);
    523 int	ustore_long_intrsafe(void *, long);
    524 int	ustore_uchar(void *, u_char);
    525 int	ustore_uchar_intrsafe(void *, u_char);
    526 int	ustore_ushort(void *, u_short);
    527 int	ustore_ushort_intrsafe(void *, u_short);
    528 int	ustore_uint(void *, u_int);
    529 int	ustore_uint_intrsafe(void *, u_int);
    530 int	ustore_ulong(void *, u_long);
    531 int	ustore_ulong_intrsafe(void *, u_long);
    532 int 	ustore_ptr(void *, void *);
    533 int	ustore_ptr_intrsafe(void *, void *);
    534 
    535 int	ustore_uint32_isync(void *, uint32_t);
    536 
    537 /* trap.c */
    538 void	netintr(void);
    539 int	kdbpeek(vaddr_t);
    540 
    541 /* mips_machdep.c */
    542 struct mips_vmfreelist;
    543 struct phys_ram_seg;
    544 void	dumpsys(void);
    545 int	savectx(struct user *);
    546 void	mips_vector_init(void);
    547 void	mips_init_msgbuf(void);
    548 void	mips_init_lwp0_uarea(void);
    549 void	mips_page_physload(vaddr_t, vaddr_t,
    550 	    const struct phys_ram_seg *, size_t,
    551 	    const struct mips_vmfreelist *, size_t);
    552 void	savefpregs(struct lwp *);
    553 void	loadfpregs(struct lwp *);
    554 void	cpu_identify(device_t);
    555 #ifdef MULTIPROCESSOR
    556 void	cpu_boot_secondary_processors(void);
    557 #endif
    558 
    559 /* locore*.S */
    560 int	badaddr(void *, size_t);
    561 int	badaddr64(uint64_t, size_t);
    562 
    563 /* vm_machdep.c */
    564 void	cpu_uarea_remap(struct lwp *);
    565 
    566 #endif /* ! _LOCORE */
    567 #endif /* _KERNEL */
    568 #endif /* _CPU_H_ */
    569