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.1 (Berkeley) 01/07/92 11 */ 12 13 #ifndef _CPU_H_ 14 #define _CPU_H_ 15 16 #include "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 #undef COPY_SIGCODE /* copy sigcode above user stack in exec */ 27 28 /* 29 * function vs. inline configuration; 30 * these are defined to get generic functions 31 * rather than inline or machine-dependent implementations 32 */ 33 #define NEED_MINMAX /* need {,i,l,ul}{min,max} functions */ 34 #undef NEED_FFS /* don't need ffs function */ 35 #undef NEED_BCMP /* don't need bcmp function */ 36 #undef NEED_STRLEN /* don't need strlen function */ 37 38 #define cpu_exec(p) /* nothing */ 39 #define cpu_wait(p) /* nothing */ 40 41 /* 42 * Arguments to hardclock, softclock and gatherstats 43 * encapsulate the previous machine state in an opaque 44 * clockframe; 45 */ 46 typedef struct intrframe { 47 int pc; 48 int ps; 49 } clockframe; 50 51 #define CLKF_USERMODE(framep) ((framep)->ps & MACH_SR_KU_PREV) 52 #define CLKF_BASEPRI(framep) \ 53 (((framep)->ps & (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) == \ 54 (MACH_INT_MASK | MACH_SR_INT_ENA_PREV)) 55 #define CLKF_PC(framep) ((framep)->pc) 56 57 /* 58 * Preempt the current process if in interrupt from user mode, 59 * or after the current trap/syscall if in system mode. 60 */ 61 #define need_resched() { want_resched = 1; aston(); } 62 63 /* 64 * Give a profiling tick to the current process from the softclock 65 * interrupt. 66 */ 67 #define profile_tick(p, framep) \ 68 addupc((framep)->pc, &p->p_stats->p_prof, 1); 69 70 /* 71 * Notify the current process (p) that it has a signal pending, 72 * process as soon as possible. 73 */ 74 #define signotify(p) aston() 75 76 #define aston() (astpending = 1) 77 78 int astpending; /* need to trap before returning to user mode */ 79 int want_resched; /* resched() was called */ 80 81 /* 82 * CPU identification, from PRID register. 83 */ 84 union cpuprid { 85 int cpuprid; 86 struct { 87 #if BYTE_ORDER == BIG_ENDIAN 88 u_int pad1:16; /* reserved */ 89 u_int cp_imp:8; /* implementation identifier */ 90 u_int cp_majrev:4; /* major revision identifier */ 91 u_int cp_minrev:4; /* minor revision identifier */ 92 #else 93 u_int cp_minrev:4; /* minor revision identifier */ 94 u_int cp_majrev:4; /* major revision identifier */ 95 u_int cp_imp:8; /* implementation identifier */ 96 u_int pad1:16; /* reserved */ 97 #endif 98 } cpu; 99 }; 100 101 /* 102 * MIPS CPU types (cp_imp). 103 */ 104 #define MIPS_R2000 2 105 106 /* 107 * MIPS FPU types 108 */ 109 #define MIPS_R2010 3 110 111 #ifdef KERNEL 112 union cpuprid cpu; 113 union cpuprid fpu; 114 u_int machDataCacheSize; 115 u_int machInstCacheSize; 116 #endif 117 118 /* 119 * Enable realtime clock (always enabled). 120 */ 121 #define enablertclock() 122 123 #endif /* _CPU_H_ */ 124