1 typedef struct Conf Conf; 2 typedef struct Confmem Confmem; 3 typedef struct FPsave FPsave; 4 typedef struct ISAConf ISAConf; 5 typedef struct Imap Imap; 6 typedef struct Label Label; 7 typedef struct Lock Lock; 8 typedef struct Mach Mach; 9 typedef struct Notsave Notsave; 10 typedef struct PCArch PCArch; 11 typedef struct PMMU PMMU; 12 typedef struct Page Page; 13 typedef struct Pcidev Pcidev; 14 typedef struct Proc Proc; 15 typedef struct Sys Sys; 16 typedef vlong Tval; 17 typedef struct Ureg Ureg; 18 typedef struct Vctl Vctl; 19 20 #pragma incomplete Ureg 21 #pragma incomplete Imap 22 #pragma incomplete Mach 23 24 #define MAXSYSARG 5 /* for mount(fd, mpt, flag, arg, srv) */ 25 26 /* 27 * parameters for sysproc.c 28 */ 29 #define AOUT_MAGIC Q_MAGIC 30 31 /* 32 * machine dependent definitions used by ../port/dat.h 33 */ 34 35 struct Lock 36 { 37 ulong key; /* semaphore (non-zero = locked) */ 38 ulong sr; 39 ulong pc; 40 Proc *p; 41 Mach *m; 42 ulong pid; 43 ushort isilock; 44 }; 45 46 struct Label 47 { 48 ulong sp; 49 ulong pc; 50 }; 51 52 /* 53 * Proc.fpstate 54 */ 55 enum 56 { 57 /* Floating point states */ 58 FPinit = 0, 59 FPactive = 1, 60 FPinactive = 2, 61 /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */ 62 FPillegal = 0x100, 63 }; 64 65 /* 66 * This structure must agree with fpsave and fprestore asm routines 67 */ 68 struct FPsave 69 { 70 double fpreg[32]; 71 union { 72 double fpscrd; 73 struct { 74 ulong pad; 75 ulong fpscr; 76 }; 77 }; 78 }; 79 80 struct Confmem 81 { 82 ulong base; 83 ulong npage; 84 ulong kbase; 85 ulong klimit; 86 }; 87 88 struct Conf 89 { 90 ulong nmach; /* processors */ 91 ulong nproc; /* processes */ 92 Confmem mem[2]; 93 ulong npage0; /* total physical pages of memory */ 94 ulong npage1; /* total physical pages of memory */ 95 ulong npage; /* total physical pages of memory */ 96 ulong base0; /* base of bank 0 */ 97 ulong base1; /* base of bank 1 */ 98 ulong upages; /* user page pool */ 99 ulong nimage; /* number of page cache image headers */ 100 ulong nswap; /* number of swap pages */ 101 int nswppo; /* max # of pageouts per segment pass */ 102 ulong copymode; /* 0 is copy on write, 1 is copy on reference */ 103 int monitor; /* has display? */ 104 ulong ialloc; /* bytes available for interrupt time allocation */ 105 ulong pipeqsize; /* size in bytes of pipe queues */ 106 }; 107 108 /* 109 * mmu goo in the Proc structure 110 */ 111 #define NCOLOR 1 112 struct PMMU 113 { 114 int mmupid; 115 Ureg *mmureg; /* pointer to ureg structure */ 116 }; 117 118 /* 119 * things saved in the Proc structure during a notify 120 */ 121 struct Notsave 122 { 123 ulong UNUSED; 124 }; 125 126 #include "../port/portdat.h" 127 128 /* 129 * machine dependent definitions not used by ../port/dat.h 130 */ 131 /* 132 * Fake kmap 133 */ 134 typedef void KMap; 135 #define VA(k) ((ulong)(k)) 136 #define kmap(p) (KMap*)((p)->pa|KZERO) 137 #define kunmap(k) 138 139 struct IMM; 140 typedef struct IMM IMM; 141 142 struct Mach 143 { 144 /* OFFSETS OF THE FOLLOWING KNOWN BY l.s */ 145 /*0x00*/ int machno; /* physical id of processor */ 146 /*0x04*/ ulong splpc; /* pc that called splhi() */ 147 /*0x08*/ Proc *proc; /* current process on this processor */ 148 /* Debugging/statistics for software TLB in l.s (therefore, also known by l.s) */ 149 /*0x0c*/ ulong tlbfault; /* type of last miss */ 150 /*0x10*/ ulong imiss; /* number of instruction misses */ 151 /*0x14*/ ulong dmiss; /* number of data misses */ 152 153 /* ordering from here on irrelevant */ 154 155 Imap* imap; 156 #ifndef ucuconf 157 IMM* immr; 158 #endif 159 ulong ticks; /* of the clock since boot time */ 160 Label sched; /* scheduler wakeup */ 161 Lock alarmlock; /* access to alarm list */ 162 void *alarm; /* alarms bound to this clock */ 163 int inclockintr; 164 int cputype; 165 ulong loopconst; 166 Perf perf; /* performance counters */ 167 168 Proc* readied; /* for runproc */ 169 ulong schedticks; /* next forced context switch */ 170 171 ulong clkin; /* basic clock frequency */ 172 ulong vco_out; 173 vlong cpuhz; 174 uvlong cyclefreq; /* Frequency of user readable cycle counter */ 175 ulong bushz; 176 ulong dechz; 177 ulong tbhz; 178 ulong cpmhz; /* communications processor module frequency */ 179 ulong brghz; /* baud rate generator frequency */ 180 181 ulong pcclast; 182 uvlong fastclock; 183 184 int tlbpurge; /* # of tlb purges */ 185 int pfault; /* # of page faults */ 186 int cs; 187 int syscall; 188 int load; 189 int intr; 190 int flushmmu; /* make current proc flush it's mmu state */ 191 int ilockdepth; 192 193 ulong ptabbase; /* start of page table in kernel virtual space */ 194 int slotgen; /* next pte (byte offset) when pteg is full */ 195 int mmupid; /* next mmu pid to use */ 196 int sweepcolor; 197 int trigcolor; 198 Rendez sweepr; 199 200 ulong spuriousintr; 201 int lastintr; 202 203 /* MUST BE LAST */ 204 int stack[1]; 205 }; 206 207 struct 208 { 209 Lock; 210 short machs; 211 short exiting; 212 short ispanic; 213 }active; 214 215 /* 216 * a parsed plan9.ini line 217 */ 218 #define NISAOPT 8 219 220 struct ISAConf { 221 char *type; 222 ulong port; 223 int irq; 224 ulong dma; 225 ulong mem; 226 ulong size; 227 ulong freq; 228 229 int nopt; 230 char *opt[NISAOPT]; 231 }; 232 233 struct Vctl { 234 Vctl* next; /* handlers on this vector */ 235 236 char name[KNAMELEN]; /* of driver */ 237 int isintr; /* interrupt or fault/trap */ 238 int irq; 239 240 void (*f)(Ureg*, void*); /* handler to call */ 241 void* a; /* argument to call it with */ 242 }; 243 244 extern Mach mach0; 245 246 extern register Mach *m; 247 extern register Proc *up; 248 249 extern FPsave initfp; 250