1 /* 2 * Copyright (c) 1992 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. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)cpu.h 7.6 (Berkeley) 10/24/92 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 * MIPS CPU types (cp_imp). 94 */ 95 #define MIPS_R2000 0x02 96 #define MIPS_R3000 0x03 97 #define MIPS_R4000 0x04 98 99 /* 100 * MIPS FPU types 101 */ 102 #define MIPS_R2010 0x03 103 #define MIPS_R3010 0x04 104 #define MIPS_R4010 0x05 105 106 struct intr_tab { 107 void (*func)(); /* pointer to interrupt routine */ 108 int unit; /* logical unit number */ 109 }; 110 111 #ifdef KERNEL 112 union cpuprid cpu; 113 union cpuprid fpu; 114 u_int machDataCacheSize; 115 u_int machInstCacheSize; 116 extern struct intr_tab intr_tab[]; 117 #endif 118 119 /* 120 * Enable realtime clock (always enabled). 121 */ 122 #define enablertclock() 123 124 #endif /* _CPU_H_ */ 125