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