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