cpu.h revision 2056
19313Ssos/*- 29313Ssos * Copyright (c) 1990 The Regents of the University of California. 39313Ssos * All rights reserved. 49313Ssos * 59313Ssos * This code is derived from software contributed to Berkeley by 69313Ssos * William Jolitz. 79313Ssos * 89313Ssos * Redistribution and use in source and binary forms, with or without 99313Ssos * modification, are permitted provided that the following conditions 109313Ssos * are met: 119313Ssos * 1. Redistributions of source code must retain the above copyright 129313Ssos * notice, this list of conditions and the following disclaimer. 139313Ssos * 2. Redistributions in binary form must reproduce the above copyright 149313Ssos * notice, this list of conditions and the following disclaimer in the 159313Ssos * documentation and/or other materials provided with the distribution. 169313Ssos * 3. All advertising materials mentioning features or use of this software 179313Ssos * must display the following acknowledgement: 189313Ssos * This product includes software developed by the University of 199313Ssos * California, Berkeley and its contributors. 209313Ssos * 4. Neither the name of the University nor the names of its contributors 219313Ssos * may be used to endorse or promote products derived from this software 229313Ssos * without specific prior written permission. 239313Ssos * 249313Ssos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 259313Ssos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 269313Ssos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 279313Ssos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2850477Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 299313Ssos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 309313Ssos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 319313Ssos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3253758Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 339313Ssos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 349313Ssos * SUCH DAMAGE. 359313Ssos * 3653758Smarcel * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 3753758Smarcel * $Id: cpu.h,v 1.6 1994/05/25 08:55:47 rgrimes Exp $ 389313Ssos */ 399313Ssos 409313Ssos#ifndef _MACHINE_CPU_H_ 419313Ssos#define _MACHINE_CPU_H_ 1 4253758Smarcel 439313Ssos/* 449313Ssos * Definitions unique to i386 cpu support. 459313Ssos */ 4614331Speter#include <machine/frame.h> 4714331Speter#include <machine/segments.h> 489313Ssos#include <machine/spl.h> 499313Ssos 5050356Smarcel/* 5150356Smarcel * definitions of cpu-dependent requirements 5250356Smarcel * referenced in generic code 5350356Smarcel */ 5450356Smarcel#undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */ 5550356Smarcel 5650356Smarcel#define cpu_exec(p) /* nothing */ 5750356Smarcel#define cpu_swapin(p) /* nothing */ 5850356Smarcel#define cpu_setstack(p, ap) (p)->p_md.md_regs = ap 5950356Smarcel#define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp 6050356Smarcel 6150356Smarcel#define CLKF_USERMODE(framep) (ISPL((framep)->cf_cs) == SEL_UPL) 6250356Smarcel#define CLKF_INTR(framep) (0) 6350356Smarcel#define CLKF_BASEPRI(framep) (((framep)->cf_ppl & ~SWI_AST_MASK) == 0) 6450356Smarcel#define CLKF_PC(framep) ((framep)->cf_eip) 6550356Smarcel 6650356Smarcel#define resettodr() /* no todr to set */ 6750356Smarcel 6850356Smarcel/* 6950356Smarcel * Preempt the current process if in interrupt from user mode, 709313Ssos * or after the current trap/syscall if in system mode. 719313Ssos */ 7253758Smarcel#define need_resched() { want_resched = 1; aston(); } 7353758Smarcel 7453758Smarcel/* 7553758Smarcel * Give a profiling tick to the current process from the softclock 7653758Smarcel * interrupt. On tahoe, request an ast to send us through trap(), 7753758Smarcel * marking the proc as needing a profiling tick. 7853758Smarcel */ 7953758Smarcel#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } 809313Ssos 819313Ssos/* 829313Ssos * Notify the current process (p) that it has a signal pending, 8350356Smarcel * process as soon as possible. 849313Ssos */ 8550558Smarcel#define signotify(p) aston() 8650356Smarcel 8750356Smarcel#define aston() setsoftast() 8850356Smarcel#define astoff() 8950356Smarcel 9050356Smarcel/* 9150356Smarcel * pull in #defines for kinds of processors 9250356Smarcel */ 9350356Smarcel#include "machine/cputypes.h" 9450356Smarcel 9550356Smarcelstruct cpu_nameclass { 9650356Smarcel char *cpu_name; 9750356Smarcel int cpu_class; 9850356Smarcel}; 9950356Smarcel 1009313Ssos/* 1019313Ssos * CTL_MACHDEP definitions. 1029313Ssos */ 10330994Sphk#define CPU_CONSDEV 1 /* dev_t: console terminal device */ 1049313Ssos#define CPU_MAXID 2 /* number of valid machdep ids */ 10550356Smarcel 10650356Smarcel#define CTL_MACHDEP_NAMES { \ 10750356Smarcel { 0, 0 }, \ 10850356Smarcel { "console_device", CTLTYPE_STRUCT }, \ 10914331Speter} 11050356Smarcel 11150356Smarcel#ifdef KERNEL 11250356Smarcelextern int want_resched; /* resched was called */ 1139313Ssos 11450356Smarcelextern int cpu; 11550356Smarcelextern int cpu_class; 1169313Ssosextern struct cpu_nameclass i386_cpus[]; 11750356Smarcel#endif 11850356Smarcel#endif /* _MACHINE_CPU_H_ */ 11950356Smarcel