1 /*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)cpu.h 8.4 (Berkeley) 01/05/94 11 */ 12 13 /* 14 * Definitions unique to i386 cpu support. 15 */ 16 #include <machine/frame.h> 17 #include <machine/segments.h> 18 19 /* 20 * definitions of cpu-dependent requirements 21 * referenced in generic code 22 */ 23 #undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */ 24 25 #define cpu_exec(p) /* nothing */ 26 #define cpu_swapin(p) /* nothing */ 27 #define cpu_setstack(p, ap) (p)->p_md.md_regs[SP] = ap 28 #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp 29 30 /* 31 * Arguments to hardclock, softclock and gatherstats 32 * encapsulate the previous machine state in an opaque 33 * clockframe; for now, use generic intrframe. 34 */ 35 struct clockframe { 36 struct intrframe cf_if; 37 }; 38 39 #define CLKF_USERMODE(framep) (ISPL((framep)->cf_if.if_cs) == SEL_UPL) 40 #define CLKF_BASEPRI(framep) ((framep)->cf_if.if_ppl == 0) 41 #define CLKF_PC(framep) ((framep)->cf_if.if_eip) 42 43 #define resettodr() /* no todr to set */ 44 45 /* 46 * Preempt the current process if in interrupt from user mode, 47 * or after the current trap/syscall if in system mode. 48 */ 49 #define need_resched() { want_resched++; aston(); } 50 51 /* 52 * Give a profiling tick to the current process from the softclock 53 * interrupt. On tahoe, request an ast to send us through trap(), 54 * marking the proc as needing a profiling tick. 55 */ 56 #define profile_tick(p, framep) { (p)->p_flag |= P_OWEUPC; aston(); } 57 58 /* 59 * Notify the current process (p) that it has a signal pending, 60 * process as soon as possible. 61 */ 62 #define signotify(p) aston() 63 64 #define aston() (astpending++) 65 66 int astpending; /* need to trap before returning to user mode */ 67 int want_resched; /* resched() was called */ 68 69 /* 70 * Kinds of processor 71 */ 72 73 #define CPU_386SX 0 74 #define CPU_386 1 75 #define CPU_486SX 2 76 #define CPU_486 3 77 #define CPU_586 4 78 79 /* 80 * CTL_MACHDEP definitions. 81 */ 82 #define CPU_CONSDEV 1 /* dev_t: console terminal device */ 83 #define CPU_MAXID 2 /* number of valid machdep ids */ 84 85 #define CTL_MACHDEP_NAMES { \ 86 { 0, 0 }, \ 87 { "console_device", CTLTYPE_STRUCT }, \ 88 } 89