15b81b6b3SRodney W. Grimes /*- 25b81b6b3SRodney W. Grimes * Copyright (c) 1990 The Regents of the University of California. 35b81b6b3SRodney W. Grimes * All rights reserved. 45b81b6b3SRodney W. Grimes * 55b81b6b3SRodney W. Grimes * This code is derived from software contributed to Berkeley by 65b81b6b3SRodney W. Grimes * William Jolitz. 75b81b6b3SRodney W. Grimes * 85b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 95b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 105b81b6b3SRodney W. Grimes * are met: 115b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 125b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 135b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 145b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 155b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 165b81b6b3SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 175b81b6b3SRodney W. Grimes * must display the following acknowledgement: 185b81b6b3SRodney W. Grimes * This product includes software developed by the University of 195b81b6b3SRodney W. Grimes * California, Berkeley and its contributors. 205b81b6b3SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 215b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 225b81b6b3SRodney W. Grimes * without specific prior written permission. 235b81b6b3SRodney W. Grimes * 245b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 255b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 265b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 275b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 285b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 295b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 305b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 315b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 325b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 335b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 345b81b6b3SRodney W. Grimes * SUCH DAMAGE. 355b81b6b3SRodney W. Grimes * 3609f07fb0SRodney W. Grimes * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 37d2306226SDavid Greenman * $Id: cpu.h,v 1.4 1993/11/07 17:42:46 wollman Exp $ 385b81b6b3SRodney W. Grimes */ 395b81b6b3SRodney W. Grimes 406e393973SGarrett Wollman #ifndef _MACHINE_CPU_H_ 416e393973SGarrett Wollman #define _MACHINE_CPU_H_ 1 426e393973SGarrett Wollman 435b81b6b3SRodney W. Grimes /* 445b81b6b3SRodney W. Grimes * Definitions unique to i386 cpu support. 455b81b6b3SRodney W. Grimes */ 465b81b6b3SRodney W. Grimes #include "machine/frame.h" 475b81b6b3SRodney W. Grimes #include "machine/segments.h" 4826f9a767SRodney W. Grimes #include <machine/spl.h> 495b81b6b3SRodney W. Grimes 505b81b6b3SRodney W. Grimes /* 515b81b6b3SRodney W. Grimes * definitions of cpu-dependent requirements 525b81b6b3SRodney W. Grimes * referenced in generic code 535b81b6b3SRodney W. Grimes */ 545b81b6b3SRodney W. Grimes #undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */ 555b81b6b3SRodney W. Grimes 565b81b6b3SRodney W. Grimes #define cpu_exec(p) /* nothing */ 5726f9a767SRodney W. Grimes #define cpu_swapin(p) /* nothing */ 5826f9a767SRodney W. Grimes #define cpu_setstack(p, ap) (p)->p_md.md_regs = ap 5926f9a767SRodney W. Grimes #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp 605b81b6b3SRodney W. Grimes 6126f9a767SRodney W. Grimes #define CLKF_USERMODE(framep) (ISPL((framep)->cf_cs) == SEL_UPL) 6226f9a767SRodney W. Grimes #define CLKF_INTR(framep) (0) 6326f9a767SRodney W. Grimes #define CLKF_BASEPRI(framep) (((framep)->cf_ppl & ~SWI_AST_MASK) == 0) 6426f9a767SRodney W. Grimes #define CLKF_PC(framep) ((framep)->cf_eip) 655b81b6b3SRodney W. Grimes 6626f9a767SRodney W. Grimes #define resettodr() /* no todr to set */ 675b81b6b3SRodney W. Grimes 685b81b6b3SRodney W. Grimes /* 695b81b6b3SRodney W. Grimes * Preempt the current process if in interrupt from user mode, 705b81b6b3SRodney W. Grimes * or after the current trap/syscall if in system mode. 715b81b6b3SRodney W. Grimes */ 72d2306226SDavid Greenman #define need_resched() { want_resched = 1; aston(); } 735b81b6b3SRodney W. Grimes 745b81b6b3SRodney W. Grimes /* 755b81b6b3SRodney W. Grimes * Give a profiling tick to the current process from the softclock 765b81b6b3SRodney W. Grimes * interrupt. On tahoe, request an ast to send us through trap(), 775b81b6b3SRodney W. Grimes * marking the proc as needing a profiling tick. 785b81b6b3SRodney W. Grimes */ 7926f9a767SRodney W. Grimes #define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } 805b81b6b3SRodney W. Grimes 815b81b6b3SRodney W. Grimes /* 825b81b6b3SRodney W. Grimes * Notify the current process (p) that it has a signal pending, 835b81b6b3SRodney W. Grimes * process as soon as possible. 845b81b6b3SRodney W. Grimes */ 855b81b6b3SRodney W. Grimes #define signotify(p) aston() 865b81b6b3SRodney W. Grimes 87d2306226SDavid Greenman #define aston() setsoftast() 88d2306226SDavid Greenman #define astoff() 895b81b6b3SRodney W. Grimes 905b81b6b3SRodney W. Grimes /* 9109f07fb0SRodney W. Grimes * pull in #defines for kinds of processors 925b81b6b3SRodney W. Grimes */ 9309f07fb0SRodney W. Grimes #include "machine/cputypes.h" 945b81b6b3SRodney W. Grimes 9509f07fb0SRodney W. Grimes struct cpu_nameclass { 9609f07fb0SRodney W. Grimes char *cpu_name; 9709f07fb0SRodney W. Grimes int cpu_class; 9809f07fb0SRodney W. Grimes }; 9909f07fb0SRodney W. Grimes 10026f9a767SRodney W. Grimes /* 10126f9a767SRodney W. Grimes * CTL_MACHDEP definitions. 10226f9a767SRodney W. Grimes */ 10326f9a767SRodney W. Grimes #define CPU_CONSDEV 1 /* dev_t: console terminal device */ 10426f9a767SRodney W. Grimes #define CPU_MAXID 2 /* number of valid machdep ids */ 10526f9a767SRodney W. Grimes 10626f9a767SRodney W. Grimes #define CTL_MACHDEP_NAMES { \ 10726f9a767SRodney W. Grimes { 0, 0 }, \ 10826f9a767SRodney W. Grimes { "console_device", CTLTYPE_STRUCT }, \ 10926f9a767SRodney W. Grimes } 11026f9a767SRodney W. Grimes 11109f07fb0SRodney W. Grimes #ifdef KERNEL 1126e393973SGarrett Wollman extern int want_resched; /* resched was called */ 1136e393973SGarrett Wollman 11409f07fb0SRodney W. Grimes extern int cpu; 11509f07fb0SRodney W. Grimes extern int cpu_class; 11609f07fb0SRodney W. Grimes extern struct cpu_nameclass i386_cpus[]; 11709f07fb0SRodney W. Grimes #endif 1186e393973SGarrett Wollman #endif /* _MACHINE_CPU_H_ */ 119