cpu.h revision 2056
1133359Sobrien/*- 2133359Sobrien * Copyright (c) 1990 The Regents of the University of California. 3267843Sdelphij * All rights reserved. 4133359Sobrien * 5133359Sobrien * This code is derived from software contributed to Berkeley by 6133359Sobrien * William Jolitz. 7133359Sobrien * 8159764Sobrien * Redistribution and use in source and binary forms, with or without 9133359Sobrien * modification, are permitted provided that the following conditions 10133359Sobrien * are met: 11133359Sobrien * 1. Redistributions of source code must retain the above copyright 12133359Sobrien * notice, this list of conditions and the following disclaimer. 13133359Sobrien * 2. Redistributions in binary form must reproduce the above copyright 14133359Sobrien * notice, this list of conditions and the following disclaimer in the 15133359Sobrien * documentation and/or other materials provided with the distribution. 16133359Sobrien * 3. All advertising materials mentioning features or use of this software 17133359Sobrien * must display the following acknowledgement: 18133359Sobrien * This product includes software developed by the University of 19133359Sobrien * California, Berkeley and its contributors. 20133359Sobrien * 4. Neither the name of the University nor the names of its contributors 21159764Sobrien * may be used to endorse or promote products derived from this software 22159764Sobrien * without specific prior written permission. 23159764Sobrien * 24159764Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25159764Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26159764Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27159764Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28159764Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29159764Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30159764Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31159764Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32169942Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33159764Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34159764Sobrien * SUCH DAMAGE. 35159764Sobrien * 36159764Sobrien * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 37159764Sobrien * $Id: cpu.h,v 1.6 1994/05/25 08:55:47 rgrimes Exp $ 38159764Sobrien */ 39159764Sobrien 40159764Sobrien#ifndef _MACHINE_CPU_H_ 41159764Sobrien#define _MACHINE_CPU_H_ 1 42159764Sobrien 43159764Sobrien/* 44133359Sobrien * Definitions unique to i386 cpu support. 45267843Sdelphij */ 46267843Sdelphij#include <machine/frame.h> 47267843Sdelphij#include <machine/segments.h> 48267843Sdelphij#include <machine/spl.h> 49267843Sdelphij 50267843Sdelphij/* 51267843Sdelphij * definitions of cpu-dependent requirements 52267843Sdelphij * referenced in generic code 53267843Sdelphij */ 54267843Sdelphij#undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */ 55267843Sdelphij 56267843Sdelphij#define cpu_exec(p) /* nothing */ 57267843Sdelphij#define cpu_swapin(p) /* nothing */ 58267843Sdelphij#define cpu_setstack(p, ap) (p)->p_md.md_regs = ap 59267843Sdelphij#define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp 60267843Sdelphij 61267843Sdelphij#define CLKF_USERMODE(framep) (ISPL((framep)->cf_cs) == SEL_UPL) 62267843Sdelphij#define CLKF_INTR(framep) (0) 63267843Sdelphij#define CLKF_BASEPRI(framep) (((framep)->cf_ppl & ~SWI_AST_MASK) == 0) 64267843Sdelphij#define CLKF_PC(framep) ((framep)->cf_eip) 65267843Sdelphij 66267843Sdelphij#define resettodr() /* no todr to set */ 67267843Sdelphij 68267843Sdelphij/* 69267843Sdelphij * Preempt the current process if in interrupt from user mode, 70267843Sdelphij * or after the current trap/syscall if in system mode. 71267843Sdelphij */ 72267843Sdelphij#define need_resched() { want_resched = 1; aston(); } 73267843Sdelphij 74267843Sdelphij/* 75267843Sdelphij * Give a profiling tick to the current process from the softclock 76267843Sdelphij * interrupt. On tahoe, request an ast to send us through trap(), 77267843Sdelphij * marking the proc as needing a profiling tick. 78267843Sdelphij */ 79133359Sobrien#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } 80159764Sobrien 81267843Sdelphij/* 82267843Sdelphij * Notify the current process (p) that it has a signal pending, 83267843Sdelphij * process as soon as possible. 84267843Sdelphij */ 85267843Sdelphij#define signotify(p) aston() 86267843Sdelphij 87267843Sdelphij#define aston() setsoftast() 88226048Sobrien#define astoff() 89226048Sobrien 90226048Sobrien/* 91226048Sobrien * pull in #defines for kinds of processors 92226048Sobrien */ 93267843Sdelphij#include "machine/cputypes.h" 94267843Sdelphij 95267843Sdelphijstruct cpu_nameclass { 96267843Sdelphij char *cpu_name; 97267843Sdelphij int cpu_class; 98267843Sdelphij}; 99267843Sdelphij 100267843Sdelphij/* 101169942Sobrien * CTL_MACHDEP definitions. 102226048Sobrien */ 103226048Sobrien#define CPU_CONSDEV 1 /* dev_t: console terminal device */ 104226048Sobrien#define CPU_MAXID 2 /* number of valid machdep ids */ 105226048Sobrien 106226048Sobrien#define CTL_MACHDEP_NAMES { \ 107226048Sobrien { 0, 0 }, \ 108226048Sobrien { "console_device", CTLTYPE_STRUCT }, \ 109226048Sobrien} 110226048Sobrien 111226048Sobrien#ifdef KERNEL 112226048Sobrienextern int want_resched; /* resched was called */ 113226048Sobrien 114226048Sobrienextern int cpu; 115226048Sobrienextern int cpu_class; 116226048Sobrienextern struct cpu_nameclass i386_cpus[]; 117226048Sobrien#endif 118226048Sobrien#endif /* _MACHINE_CPU_H_ */ 119226048Sobrien