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.3 (Berkeley) 12/10/93 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_setstack(p, ap) (p)->p_md.md_regs[SP] = ap 27 #define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp 28 29 /* 30 * Arguments to hardclock, softclock and gatherstats 31 * encapsulate the previous machine state in an opaque 32 * clockframe; for now, use generic intrframe. 33 */ 34 struct clockframe { 35 struct intrframe cf_if; 36 }; 37 38 #define CLKF_USERMODE(framep) (ISPL((framep)->cf_if.if_cs) == SEL_UPL) 39 #define CLKF_BASEPRI(framep) ((framep)->cf_if.if_ppl == 0) 40 #define CLKF_PC(framep) ((framep)->cf_if.if_eip) 41 42 #define resettodr() /* no todr to set */ 43 44 /* 45 * Preempt the current process if in interrupt from user mode, 46 * or after the current trap/syscall if in system mode. 47 */ 48 #define need_resched() { want_resched++; aston(); } 49 50 /* 51 * Give a profiling tick to the current process from the softclock 52 * interrupt. On tahoe, request an ast to send us through trap(), 53 * marking the proc as needing a profiling tick. 54 */ 55 #define profile_tick(p, framep) { (p)->p_flag |= P_OWEUPC; aston(); } 56 57 /* 58 * Notify the current process (p) that it has a signal pending, 59 * process as soon as possible. 60 */ 61 #define signotify(p) aston() 62 63 #define aston() (astpending++) 64 65 int astpending; /* need to trap before returning to user mode */ 66 int want_resched; /* resched() was called */ 67 68 /* 69 * Kinds of processor 70 */ 71 72 #define CPU_386SX 0 73 #define CPU_386 1 74 #define CPU_486SX 2 75 #define CPU_486 3 76 #define CPU_586 4 77 78 /* 79 * CTL_MACHDEP definitions. 80 */ 81 #define CPU_CONSDEV 1 /* dev_t: console terminal device */ 82 #define CPU_MAXID 2 /* number of valid machdep ids */ 83 84 #define CTL_MACHDEP_NAMES { \ 85 { 0, 0 }, \ 86 { "console_device", CTLTYPE_STRUCT }, \ 87 } 88