1 /*- 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ralph Campbell and Rick Macklem. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)cpu.h 7.8 (Berkeley) 05/24/93 11 */ 12 13 #ifndef _CPU_H_ 14 #define _CPU_H_ 15 16 #include <machine/machConst.h> 17 18 /* 19 * Exported definitions unique to pmax/mips cpu support. 20 */ 21 22 /* 23 * definitions of cpu-dependent requirements 24 * referenced in generic code 25 */ 26 #define COPY_SIGCODE /* copy sigcode above user stack in exec */ 27 28 #define cpu_exec(p) (p->p_md.md_ss_addr = 0) /* init single step */ 29 #define cpu_wait(p) /* nothing */ 30 #define cpu_setstack(p, ap) \ 31 (p)->p_md.md_regs[SP] = ap 32 33 /* 34 * Arguments to hardclock and gatherstats encapsulate the previous 35 * machine state in an opaque clockframe. 36 */ 37 struct clockframe { 38 int pc; /* program counter at time of interrupt */ 39 int sr; /* status register at time of interrupt */ 40 }; 41 42 #define CLKF_USERMODE(framep) ((framep)->sr & MACH_SR_KU_PREV) 43 #define CLKF_BASEPRI(framep) \ 44 ((~(framep)->sr & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == 0) 45 #define CLKF_PC(framep) ((framep)->pc) 46 #define CLKF_INTR(framep) (0) 47 48 /* 49 * Preempt the current process if in interrupt from user mode, 50 * or after the current trap/syscall if in system mode. 51 */ 52 #define need_resched() { want_resched = 1; aston(); } 53 54 /* 55 * Give a profiling tick to the current process when the user profiling 56 * buffer pages are invalid. On the PMAX, request an ast to send us 57 * through trap, marking the proc as needing a profiling tick. 58 */ 59 #define need_proftick(p) { (p)->p_flag |= SOWEUPC; aston(); } 60 61 /* 62 * Notify the current process (p) that it has a signal pending, 63 * process as soon as possible. 64 */ 65 #define signotify(p) aston() 66 67 #define aston() (astpending = 1) 68 69 int astpending; /* need to trap before returning to user mode */ 70 int want_resched; /* resched() was called */ 71 72 /* 73 * CPU identification, from PRID register. 74 */ 75 union cpuprid { 76 int cpuprid; 77 struct { 78 #if BYTE_ORDER == BIG_ENDIAN 79 u_int pad1:16; /* reserved */ 80 u_int cp_imp:8; /* implementation identifier */ 81 u_int cp_majrev:4; /* major revision identifier */ 82 u_int cp_minrev:4; /* minor revision identifier */ 83 #else 84 u_int cp_minrev:4; /* minor revision identifier */ 85 u_int cp_majrev:4; /* major revision identifier */ 86 u_int cp_imp:8; /* implementation identifier */ 87 u_int pad1:16; /* reserved */ 88 #endif 89 } cpu; 90 }; 91 92 /* 93 * CTL_MACHDEP definitions. 94 */ 95 #define CPU_CONSDEV 1 /* dev_t: console terminal device */ 96 #define CPU_MAXID 2 /* number of valid machdep ids */ 97 98 #define CTL_MACHDEP_NAMES { \ 99 { 0, 0 }, \ 100 { "console_device", CTLTYPE_STRUCT }, \ 101 } 102 103 /* 104 * MIPS CPU types (cp_imp). 105 */ 106 #define MIPS_R2000 0x01 107 #define MIPS_R3000 0x02 108 #define MIPS_R6000 0x03 109 #define MIPS_R4000 0x04 110 #define MIPS_R6000A 0x06 111 112 /* 113 * MIPS FPU types 114 */ 115 #define MIPS_R2010 0x02 116 #define MIPS_R3010 0x03 117 #define MIPS_R6010 0x04 118 #define MIPS_R4010 0x05 119 120 #ifdef KERNEL 121 union cpuprid cpu; 122 union cpuprid fpu; 123 u_int machDataCacheSize; 124 u_int machInstCacheSize; 125 extern struct intr_tab intr_tab[]; 126 #endif 127 128 /* 129 * Enable realtime clock (always enabled). 130 */ 131 #define enablertclock() 132 133 #endif /* _CPU_H_ */ 134