141059Swilliam /*- 263359Sbostic * Copyright (c) 1990, 1993 363359Sbostic * The Regents of the University of California. All rights reserved. 440453Sbill * 541059Swilliam * This code is derived from software contributed to Berkeley by 641059Swilliam * William Jolitz. 741059Swilliam * 846006Swilliam * %sccs.include.redist.c% 941059Swilliam * 10*65498Smckusick * @(#)cpu.h 8.4 (Berkeley) 01/05/94 1140453Sbill */ 1240453Sbill 1349244Skarels /* 1449244Skarels * Definitions unique to i386 cpu support. 1549244Skarels */ 1656512Sbostic #include <machine/frame.h> 1756512Sbostic #include <machine/segments.h> 1849244Skarels 1949244Skarels /* 2049244Skarels * definitions of cpu-dependent requirements 2149244Skarels * referenced in generic code 2249244Skarels */ 2365069Smckusick #undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */ 2449244Skarels 2565069Smckusick #define cpu_exec(p) /* nothing */ 26*65498Smckusick #define cpu_swapin(p) /* nothing */ 2765069Smckusick #define cpu_setstack(p, ap) (p)->p_md.md_regs[SP] = ap 2865069Smckusick #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp 2949244Skarels 3049244Skarels /* 3149244Skarels * Arguments to hardclock, softclock and gatherstats 3249244Skarels * encapsulate the previous machine state in an opaque 3349244Skarels * clockframe; for now, use generic intrframe. 3449244Skarels */ 3563171Scgd struct clockframe { 3663171Scgd struct intrframe cf_if; 3763171Scgd }; 3849244Skarels 3963171Scgd #define CLKF_USERMODE(framep) (ISPL((framep)->cf_if.if_cs) == SEL_UPL) 4063171Scgd #define CLKF_BASEPRI(framep) ((framep)->cf_if.if_ppl == 0) 4163171Scgd #define CLKF_PC(framep) ((framep)->cf_if.if_eip) 4249244Skarels 4340453Sbill #define resettodr() /* no todr to set */ 4440453Sbill 4549244Skarels /* 4649244Skarels * Preempt the current process if in interrupt from user mode, 4749244Skarels * or after the current trap/syscall if in system mode. 4849244Skarels */ 4949244Skarels #define need_resched() { want_resched++; aston(); } 5049244Skarels 5149244Skarels /* 5249244Skarels * Give a profiling tick to the current process from the softclock 5349244Skarels * interrupt. On tahoe, request an ast to send us through trap(), 5449244Skarels * marking the proc as needing a profiling tick. 5549244Skarels */ 5664633Sbostic #define profile_tick(p, framep) { (p)->p_flag |= P_OWEUPC; aston(); } 5749244Skarels 5849244Skarels /* 5949244Skarels * Notify the current process (p) that it has a signal pending, 6049244Skarels * process as soon as possible. 6149244Skarels */ 6249244Skarels #define signotify(p) aston() 6349244Skarels 6449244Skarels #define aston() (astpending++) 6549244Skarels 6649244Skarels int astpending; /* need to trap before returning to user mode */ 6749244Skarels int want_resched; /* resched() was called */ 6849244Skarels 6949244Skarels /* 7049244Skarels * Kinds of processor 7149244Skarels */ 7249244Skarels 7349244Skarels #define CPU_386SX 0 7449244Skarels #define CPU_386 1 7549244Skarels #define CPU_486SX 2 7649244Skarels #define CPU_486 3 7749244Skarels #define CPU_586 4 7860205Smckusick 7960205Smckusick /* 8060205Smckusick * CTL_MACHDEP definitions. 8160205Smckusick */ 8260205Smckusick #define CPU_CONSDEV 1 /* dev_t: console terminal device */ 8360205Smckusick #define CPU_MAXID 2 /* number of valid machdep ids */ 8460205Smckusick 8560205Smckusick #define CTL_MACHDEP_NAMES { \ 8660205Smckusick { 0, 0 }, \ 8760205Smckusick { "console_device", CTLTYPE_STRUCT }, \ 8860205Smckusick } 89