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