2007-02-21 17:52:32 +03:00
|
|
|
/* $NetBSD: cpu.h,v 1.81 2007/02/21 14:52:32 simonb Exp $ */
|
1994-10-27 00:08:38 +03:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
/*-
|
1994-05-27 12:39:00 +04:00
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-10-12 06:22:19 +03:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Ralph Campbell and Rick Macklem.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-10-12 06:22:19 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-10-27 00:08:38 +03:00
|
|
|
* @(#)cpu.h 8.4 (Berkeley) 1/4/94
|
1993-10-12 06:22:19 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CPU_H_
|
|
|
|
#define _CPU_H_
|
|
|
|
|
2001-09-04 10:23:15 +04:00
|
|
|
#include <mips/cpuregs.h>
|
2001-09-04 10:19:21 +04:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
/*
|
1996-03-19 05:42:28 +03:00
|
|
|
* Exported definitions unique to NetBSD/mips cpu support.
|
1993-10-12 06:22:19 +03:00
|
|
|
*/
|
|
|
|
|
2002-11-24 10:26:04 +03:00
|
|
|
#ifdef _KERNEL
|
2001-09-04 10:19:21 +04:00
|
|
|
#ifndef _LOCORE
|
2004-09-22 15:32:02 +04:00
|
|
|
#include <sys/cpu_data.h>
|
2001-09-04 13:23:27 +04:00
|
|
|
|
2001-09-04 10:19:21 +04:00
|
|
|
#if defined(_KERNEL_OPT)
|
|
|
|
#include "opt_lockdebug.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct cpu_info {
|
2004-09-22 15:32:02 +04:00
|
|
|
struct cpu_data ci_data; /* MI per-cpu data */
|
2002-03-05 18:34:04 +03:00
|
|
|
u_long ci_cpu_freq; /* CPU frequency */
|
|
|
|
u_long ci_cycles_per_hz; /* CPU freq / hz */
|
|
|
|
u_long ci_divisor_delay; /* for delay/DELAY */
|
2002-06-04 09:42:41 +04:00
|
|
|
u_long ci_divisor_recip; /* scaled reciprocal of previous;
|
|
|
|
see below */
|
2007-02-10 00:55:00 +03:00
|
|
|
int ci_mtx_count; /* negative count of held mutexes */
|
|
|
|
int ci_mtx_oldspl; /* saved SPL value */
|
2001-09-04 10:19:21 +04:00
|
|
|
};
|
2002-11-24 10:26:04 +03:00
|
|
|
|
2002-06-04 09:42:41 +04:00
|
|
|
/*
|
|
|
|
* To implement a more accurate microtime using the CP0 COUNT register
|
|
|
|
* we need to divide that register by the number of cycles per MHz.
|
|
|
|
* But...
|
|
|
|
*
|
|
|
|
* DIV and DIVU are expensive on MIPS (eg 75 clocks on the R4000). MULT
|
|
|
|
* and MULTU are only 12 clocks on the same CPU.
|
|
|
|
*
|
|
|
|
* The strategy we use is to calculate the reciprical of cycles per MHz,
|
|
|
|
* scaled by 1<<32. Then we can simply issue a MULTU and pluck of the
|
|
|
|
* HI register and have the results of the division.
|
|
|
|
*/
|
|
|
|
#define MIPS_SET_CI_RECIPRICAL(cpu) \
|
|
|
|
do { \
|
|
|
|
KASSERT((cpu)->ci_divisor_delay != 0); \
|
|
|
|
(cpu)->ci_divisor_recip = 0x100000000ULL / (cpu)->ci_divisor_delay; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define MIPS_COUNT_TO_MHZ(cpu, count, res) \
|
2005-12-25 01:45:33 +03:00
|
|
|
__asm volatile("multu %1,%2 ; mfhi %0" \
|
2002-06-04 09:42:41 +04:00
|
|
|
: "=r"((res)) : "r"((count)), "r"((cpu)->ci_divisor_recip))
|
2002-11-24 10:26:04 +03:00
|
|
|
|
|
|
|
#endif /* !_LOCORE */
|
|
|
|
#endif /* _KERNEL */
|
2001-09-04 10:19:21 +04:00
|
|
|
|
2000-03-25 02:06:03 +03:00
|
|
|
/*
|
|
|
|
* CTL_MACHDEP definitions.
|
|
|
|
*/
|
|
|
|
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
|
|
|
|
#define CPU_BOOTED_KERNEL 2 /* string: booted kernel name */
|
|
|
|
#define CPU_ROOT_DEVICE 3 /* string: root device name */
|
2002-08-04 05:47:15 +04:00
|
|
|
#define CPU_LLSC 4 /* OS/CPU supports LL/SC instruction */
|
2000-07-13 11:37:11 +04:00
|
|
|
|
|
|
|
/*
|
2001-06-11 05:50:48 +04:00
|
|
|
* Platform can override, but note this breaks userland compatibility
|
2000-07-13 11:37:11 +04:00
|
|
|
* with other mips platforms.
|
|
|
|
*/
|
|
|
|
#ifndef CPU_MAXID
|
2002-08-05 17:00:47 +04:00
|
|
|
#define CPU_MAXID 5 /* number of valid machdep ids */
|
2000-03-25 02:06:03 +03:00
|
|
|
|
|
|
|
#define CTL_MACHDEP_NAMES { \
|
|
|
|
{ 0, 0 }, \
|
|
|
|
{ "console_device", CTLTYPE_STRUCT }, \
|
|
|
|
{ "booted_kernel", CTLTYPE_STRING }, \
|
|
|
|
{ "root_device", CTLTYPE_STRING }, \
|
2002-08-04 05:47:15 +04:00
|
|
|
{ "llsc", CTLTYPE_INT }, \
|
2000-03-25 02:06:03 +03:00
|
|
|
}
|
2000-07-11 10:34:57 +04:00
|
|
|
#endif
|
2000-03-25 02:06:03 +03:00
|
|
|
|
2000-01-09 16:24:14 +03:00
|
|
|
#ifdef _KERNEL
|
2006-03-23 19:16:45 +03:00
|
|
|
#ifdef _LKM
|
|
|
|
/* Assume all CPU architectures are valid for LKM's */
|
|
|
|
#define MIPS1 1
|
|
|
|
#define MIPS3 1
|
|
|
|
#define MIPS4 1
|
|
|
|
#define MIPS32 1
|
|
|
|
#define MIPS64 1
|
|
|
|
#endif
|
2001-09-04 10:19:21 +04:00
|
|
|
|
2006-03-23 19:16:45 +03:00
|
|
|
#if (MIPS1 + MIPS3 + MIPS4 + MIPS32 + MIPS64) == 0
|
|
|
|
#error at least one of MIPS1, MIPS3, MIPS4, MIPS32 or MIPS64 must be specified
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Shortcut for MIPS3 or above defined */
|
|
|
|
#if defined(MIPS3) || defined(MIPS4) || defined(MIPS32) || defined(MIPS64)
|
|
|
|
#define MIPS3_PLUS 1
|
|
|
|
#else
|
|
|
|
#undef MIPS3_PLUS
|
|
|
|
#endif
|
2000-01-09 16:24:14 +03:00
|
|
|
|
1997-06-21 08:18:09 +04:00
|
|
|
/*
|
|
|
|
* Macros to find the CPU architecture we're on at run-time,
|
|
|
|
* or if possible, at compile-time.
|
|
|
|
*/
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
#define CPU_ARCH_MIPSx 0 /* XXX unknown */
|
2000-10-05 06:13:14 +04:00
|
|
|
#define CPU_ARCH_MIPS1 (1 << 0)
|
|
|
|
#define CPU_ARCH_MIPS2 (1 << 1)
|
|
|
|
#define CPU_ARCH_MIPS3 (1 << 2)
|
|
|
|
#define CPU_ARCH_MIPS4 (1 << 3)
|
|
|
|
#define CPU_ARCH_MIPS5 (1 << 4)
|
|
|
|
#define CPU_ARCH_MIPS32 (1 << 5)
|
|
|
|
#define CPU_ARCH_MIPS64 (1 << 6)
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
#ifndef _LOCORE
|
2006-03-23 19:16:45 +03:00
|
|
|
extern struct cpu_info cpu_info_store;
|
|
|
|
|
|
|
|
#define curcpu() (&cpu_info_store)
|
|
|
|
#define cpu_number() (0)
|
|
|
|
#define cpu_proc_fork(p1, p2)
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
/* XXX simonb
|
|
|
|
* Should the following be in a cpu_info type structure?
|
|
|
|
* And how many of these are per-cpu vs. per-system? (Ie,
|
|
|
|
* we can assume that all cpus have the same mmu-type, but
|
|
|
|
* maybe not that all cpus run at the same clock speed.
|
|
|
|
* Some SGI's apparently support R12k and R14k in the same
|
|
|
|
* box.)
|
|
|
|
*/
|
|
|
|
extern int cpu_arch;
|
|
|
|
extern int mips_cpu_flags;
|
|
|
|
extern int mips_has_r4k_mmu;
|
|
|
|
extern int mips_has_llsc;
|
|
|
|
extern int mips3_pg_cached;
|
2005-11-05 14:57:25 +03:00
|
|
|
extern u_int mips3_pg_shift;
|
2002-03-05 18:34:04 +03:00
|
|
|
|
|
|
|
#define CPU_MIPS_R4K_MMU 0x0001
|
|
|
|
#define CPU_MIPS_NO_LLSC 0x0002
|
|
|
|
#define CPU_MIPS_CAUSE_IV 0x0004
|
|
|
|
#define CPU_MIPS_HAVE_SPECIAL_CCA 0x0008 /* Defaults to '3' if not set. */
|
|
|
|
#define CPU_MIPS_CACHED_CCA_MASK 0x0070
|
|
|
|
#define CPU_MIPS_CACHED_CCA_SHIFT 4
|
2002-04-05 05:22:16 +04:00
|
|
|
#define CPU_MIPS_DOUBLE_COUNT 0x0080 /* 1 cp0 count == 2 clock cycles */
|
2002-06-01 16:10:45 +04:00
|
|
|
#define CPU_MIPS_USE_WAIT 0x0100 /* Use "wait"-based cpu_idle() */
|
|
|
|
#define CPU_MIPS_NO_WAIT 0x0200 /* Inverse of previous, for mips32/64 */
|
2002-12-17 15:04:29 +03:00
|
|
|
#define CPU_MIPS_D_CACHE_COHERENT 0x0400 /* D-cache is fully coherent */
|
|
|
|
#define CPU_MIPS_I_D_CACHE_COHERENT 0x0800 /* I-cache funcs don't need to flush the D-cache */
|
2002-03-05 18:34:04 +03:00
|
|
|
#define MIPS_NOT_SUPP 0x8000
|
|
|
|
|
2007-02-10 00:55:00 +03:00
|
|
|
#endif /* !_LOCORE */
|
|
|
|
|
|
|
|
#if ((MIPS1 + MIPS3 + MIPS4 + MIPS32 + MIPS64) == 1) || defined(_LOCORE)
|
|
|
|
|
|
|
|
#if defined(MIPS1)
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
# define CPUISMIPS3 0
|
|
|
|
# define CPUIS64BITS 0
|
|
|
|
# define CPUISMIPS32 0
|
|
|
|
# define CPUISMIPS64 0
|
|
|
|
# define CPUISMIPSNN 0
|
|
|
|
# define MIPS_HAS_R4K_MMU 0
|
|
|
|
# define MIPS_HAS_CLOCK 0
|
|
|
|
# define MIPS_HAS_LLSC 0
|
|
|
|
|
2007-02-10 00:55:00 +03:00
|
|
|
#elif defined(MIPS3) || defined(MIPS4)
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
# define CPUISMIPS3 1
|
|
|
|
# define CPUIS64BITS 1
|
|
|
|
# define CPUISMIPS32 0
|
|
|
|
# define CPUISMIPS64 0
|
|
|
|
# define CPUISMIPSNN 0
|
|
|
|
# define MIPS_HAS_R4K_MMU 1
|
|
|
|
# define MIPS_HAS_CLOCK 1
|
2007-02-10 00:55:00 +03:00
|
|
|
# if defined(_LOCORE)
|
|
|
|
# if !defined(MIPS3_5900) && !defined(MIPS3_4100)
|
|
|
|
# define MIPS_HAS_LLSC 1
|
|
|
|
# else
|
|
|
|
# define MIPS_HAS_LLSC 0
|
|
|
|
# endif
|
|
|
|
# else /* _LOCORE */
|
|
|
|
# define MIPS_HAS_LLSC (mips_has_llsc)
|
|
|
|
# endif /* _LOCORE */
|
|
|
|
|
|
|
|
#elif defined(MIPS32)
|
2002-03-05 18:34:04 +03:00
|
|
|
|
|
|
|
# define CPUISMIPS3 1
|
|
|
|
# define CPUIS64BITS 0
|
|
|
|
# define CPUISMIPS32 1
|
|
|
|
# define CPUISMIPS64 0
|
|
|
|
# define CPUISMIPSNN 1
|
|
|
|
# define MIPS_HAS_R4K_MMU 1
|
|
|
|
# define MIPS_HAS_CLOCK 1
|
|
|
|
# define MIPS_HAS_LLSC 1
|
|
|
|
|
2007-02-16 06:30:48 +03:00
|
|
|
#elif defined(MIPS64)
|
2007-02-10 00:55:00 +03:00
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
# define CPUISMIPS3 1
|
|
|
|
# define CPUIS64BITS 1
|
|
|
|
# define CPUISMIPS32 0
|
|
|
|
# define CPUISMIPS64 1
|
|
|
|
# define CPUISMIPSNN 1
|
|
|
|
# define MIPS_HAS_R4K_MMU 1
|
|
|
|
# define MIPS_HAS_CLOCK 1
|
|
|
|
# define MIPS_HAS_LLSC 1
|
2007-02-10 00:55:00 +03:00
|
|
|
|
|
|
|
#endif
|
1997-06-21 08:18:09 +04:00
|
|
|
|
|
|
|
#else /* run-time test */
|
2000-10-05 04:52:59 +04:00
|
|
|
|
2007-02-10 00:55:00 +03:00
|
|
|
#ifndef _LOCORE
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
#define MIPS_HAS_R4K_MMU (mips_has_r4k_mmu)
|
|
|
|
#define MIPS_HAS_LLSC (mips_has_llsc)
|
|
|
|
|
2000-10-05 04:52:59 +04:00
|
|
|
/* This test is ... rather bogus */
|
2002-03-05 18:34:04 +03:00
|
|
|
#define CPUISMIPS3 ((cpu_arch & \
|
|
|
|
(CPU_ARCH_MIPS3 | CPU_ARCH_MIPS4 | CPU_ARCH_MIPS32 | CPU_ARCH_MIPS64)) != 0)
|
|
|
|
|
|
|
|
/* And these aren't much better while the previous test exists as is... */
|
|
|
|
#define CPUISMIPS32 ((cpu_arch & CPU_ARCH_MIPS32) != 0)
|
|
|
|
#define CPUISMIPS64 ((cpu_arch & CPU_ARCH_MIPS64) != 0)
|
|
|
|
#define CPUISMIPSNN ((cpu_arch & (CPU_ARCH_MIPS32 | CPU_ARCH_MIPS64)) != 0)
|
|
|
|
#define CPUIS64BITS ((cpu_arch & \
|
|
|
|
(CPU_ARCH_MIPS3 | CPU_ARCH_MIPS4 | CPU_ARCH_MIPS64)) != 0)
|
|
|
|
|
|
|
|
#define MIPS_HAS_CLOCK (cpu_arch >= CPU_ARCH_MIPS3)
|
2007-02-10 00:55:00 +03:00
|
|
|
|
|
|
|
#else /* !_LOCORE */
|
|
|
|
|
|
|
|
#define MIPS_HAS_LLSC 0
|
|
|
|
|
|
|
|
#endif /* !_LOCORE */
|
|
|
|
|
1997-06-21 08:18:09 +04:00
|
|
|
#endif /* run-time test */
|
|
|
|
|
2007-02-10 00:55:00 +03:00
|
|
|
#ifndef _LOCORE
|
2002-03-05 18:34:04 +03:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
/*
|
|
|
|
* definitions of cpu-dependent requirements
|
|
|
|
* referenced in generic code
|
|
|
|
*/
|
1995-05-05 07:41:51 +04:00
|
|
|
#define cpu_swapout(p) panic("cpu_swapout: can't get here");
|
1993-10-12 06:22:19 +03:00
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
void cpu_intr(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
|
2000-07-11 10:34:57 +04:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
/*
|
|
|
|
* Arguments to hardclock and gatherstats encapsulate the previous
|
|
|
|
* machine state in an opaque clockframe.
|
|
|
|
*/
|
1994-05-27 12:39:00 +04:00
|
|
|
struct clockframe {
|
1993-10-12 06:22:19 +03:00
|
|
|
int pc; /* program counter at time of interrupt */
|
|
|
|
int sr; /* status register at time of interrupt */
|
2001-10-16 20:31:32 +04:00
|
|
|
int ppl; /* previous priority level at time of interrupt */
|
1994-05-27 12:39:00 +04:00
|
|
|
};
|
1993-10-12 06:22:19 +03:00
|
|
|
|
1996-03-23 23:21:49 +03:00
|
|
|
/*
|
2007-02-16 05:53:43 +03:00
|
|
|
* A port must provde CLKF_USERMODE() for use in machine-independent code.
|
|
|
|
* These differ on r4000 and r3000 systems; provide them in the
|
|
|
|
* port-dependent file that includes this one, using the macros below.
|
1996-03-23 23:21:49 +03:00
|
|
|
*/
|
|
|
|
|
1997-06-21 08:18:09 +04:00
|
|
|
/* mips1 versions */
|
1997-06-22 11:42:25 +04:00
|
|
|
#define MIPS1_CLKF_USERMODE(framep) ((framep)->sr & MIPS_SR_KU_PREV)
|
1996-03-23 23:21:49 +03:00
|
|
|
|
1997-06-21 08:18:09 +04:00
|
|
|
/* mips3 versions */
|
1997-06-22 11:42:25 +04:00
|
|
|
#define MIPS3_CLKF_USERMODE(framep) ((framep)->sr & MIPS_SR_KSU_USER)
|
2001-10-16 20:31:32 +04:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
#define CLKF_PC(framep) ((framep)->pc)
|
|
|
|
#define CLKF_INTR(framep) (0)
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
#if defined(MIPS3_PLUS) && !defined(MIPS1) /* XXX bogus! */
|
1997-06-21 08:18:09 +04:00
|
|
|
#define CLKF_USERMODE(framep) MIPS3_CLKF_USERMODE(framep)
|
|
|
|
#endif
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
#if !defined(MIPS3_PLUS) && defined(MIPS1) /* XXX bogus! */
|
1997-06-21 08:18:09 +04:00
|
|
|
#define CLKF_USERMODE(framep) MIPS1_CLKF_USERMODE(framep)
|
2001-10-16 20:31:32 +04:00
|
|
|
#endif
|
|
|
|
|
2002-03-05 18:34:04 +03:00
|
|
|
#if defined(MIPS3_PLUS) && defined(MIPS1) /* XXX bogus! */
|
1997-06-21 08:18:09 +04:00
|
|
|
#define CLKF_USERMODE(framep) \
|
|
|
|
((CPUISMIPS3) ? MIPS3_CLKF_USERMODE(framep): MIPS1_CLKF_USERMODE(framep))
|
|
|
|
#endif
|
|
|
|
|
2001-01-11 21:30:16 +03:00
|
|
|
/*
|
|
|
|
* This is used during profiling to integrate system time. It can safely
|
|
|
|
* assume that the process is resident.
|
|
|
|
*/
|
2001-01-12 00:08:18 +03:00
|
|
|
#define PROC_PC(p) \
|
|
|
|
(((struct frame *)(p)->p_md.md_regs)->f_regs[37]) /* XXX PC */
|
1997-06-21 08:18:09 +04:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
/*
|
|
|
|
* Preempt the current process if in interrupt from user mode,
|
|
|
|
* or after the current trap/syscall if in system mode.
|
|
|
|
*/
|
2007-02-10 00:55:00 +03:00
|
|
|
#define cpu_need_resched(ci) \
|
2001-01-15 00:18:39 +03:00
|
|
|
do { \
|
|
|
|
want_resched = 1; \
|
2007-02-10 00:55:00 +03:00
|
|
|
if (curlwp != NULL) \
|
|
|
|
aston(curlwp); \
|
2001-01-15 00:18:39 +03:00
|
|
|
} while (/*CONSTCOND*/0)
|
1993-10-12 06:22:19 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Give a profiling tick to the current process when the user profiling
|
1996-03-19 05:42:28 +03:00
|
|
|
* buffer pages are invalid. On the MIPS, request an ast to send us
|
1993-10-12 06:22:19 +03:00
|
|
|
* through trap, marking the proc as needing a profiling tick.
|
|
|
|
*/
|
2007-02-10 00:55:00 +03:00
|
|
|
#define cpu_need_proftick(l) \
|
2001-01-15 00:18:39 +03:00
|
|
|
do { \
|
2007-02-10 00:55:00 +03:00
|
|
|
(l)->l_pflag |= LP_OWEUPC; \
|
|
|
|
aston(l); \
|
2001-01-15 00:18:39 +03:00
|
|
|
} while (/*CONSTCOND*/0)
|
1993-10-12 06:22:19 +03:00
|
|
|
|
|
|
|
/*
|
2007-02-21 17:52:32 +03:00
|
|
|
* Notify the current lwp (l) that it has a signal pending,
|
1993-10-12 06:22:19 +03:00
|
|
|
* process as soon as possible.
|
|
|
|
*/
|
2007-02-21 17:52:32 +03:00
|
|
|
#define cpu_signotify(l) aston(l)
|
1993-10-12 06:22:19 +03:00
|
|
|
|
2007-02-10 00:55:00 +03:00
|
|
|
#define aston(l) ((l)->l_md.md_astpending = 1)
|
1993-10-12 06:22:19 +03:00
|
|
|
|
2001-01-14 03:10:28 +03:00
|
|
|
extern int want_resched; /* resched() was called */
|
1999-01-14 21:45:45 +03:00
|
|
|
|
1998-02-20 02:07:14 +03:00
|
|
|
/*
|
2000-03-28 07:11:26 +04:00
|
|
|
* Misc prototypes and variable declarations.
|
1998-02-20 02:07:14 +03:00
|
|
|
*/
|
2003-01-18 01:58:53 +03:00
|
|
|
struct lwp;
|
1999-01-14 21:45:45 +03:00
|
|
|
struct user;
|
|
|
|
|
2003-01-18 01:58:53 +03:00
|
|
|
extern struct lwp *fpcurlwp; /* the current FPU owner */
|
2002-11-24 10:26:04 +03:00
|
|
|
extern struct pcb *curpcb; /* the current running pcb */
|
|
|
|
extern struct segtab *segbase; /* current segtab base */
|
2000-03-28 07:11:26 +04:00
|
|
|
|
1999-01-14 21:45:45 +03:00
|
|
|
/* trap.c */
|
2002-03-05 18:34:04 +03:00
|
|
|
void netintr(void);
|
|
|
|
int kdbpeek(vaddr_t);
|
1998-02-20 02:07:14 +03:00
|
|
|
|
1999-01-14 21:45:45 +03:00
|
|
|
/* mips_machdep.c */
|
2002-03-05 18:34:04 +03:00
|
|
|
void dumpsys(void);
|
|
|
|
int savectx(struct user *);
|
|
|
|
void mips_init_msgbuf(void);
|
2003-01-18 01:58:53 +03:00
|
|
|
void savefpregs(struct lwp *);
|
|
|
|
void loadfpregs(struct lwp *);
|
1996-03-19 05:42:28 +03:00
|
|
|
|
2002-04-03 07:48:33 +04:00
|
|
|
/* locore*.S */
|
2002-03-05 18:34:04 +03:00
|
|
|
int badaddr(void *, size_t);
|
2002-04-03 07:48:33 +04:00
|
|
|
int badaddr64(uint64_t, size_t);
|
1998-09-11 20:46:31 +04:00
|
|
|
|
|
|
|
/* mips_machdep.c */
|
2002-03-05 18:34:04 +03:00
|
|
|
void cpu_identify(void);
|
|
|
|
void mips_vector_init(void);
|
1998-09-11 20:46:31 +04:00
|
|
|
|
2000-01-09 16:24:14 +03:00
|
|
|
#endif /* ! _LOCORE */
|
1999-01-14 21:45:45 +03:00
|
|
|
#endif /* _KERNEL */
|
1993-10-12 06:22:19 +03:00
|
|
|
#endif /* _CPU_H_ */
|