1 typedef struct Conf Conf; 2 typedef struct Confmem Confmem; 3 typedef struct FPsave FPsave; 4 typedef struct KMap KMap; 5 typedef struct Lance Lance; 6 typedef struct Lancemem Lancemem; 7 typedef struct Label Label; 8 typedef struct Lock Lock; 9 typedef struct Mach Mach; 10 typedef struct MMU MMU; 11 typedef struct Notsave Notsave; 12 typedef struct Pcidev Pcidev; 13 typedef struct PMMU PMMU; 14 typedef struct Rbconf Rbconf; 15 typedef struct Softtlb Softtlb; 16 typedef struct Ureg Ureg; 17 typedef struct Proc Proc; 18 typedef uvlong Tval; 19 20 #pragma incomplete Pcidev 21 22 #define MAXSYSARG 5 /* for mount(fd, afd, mpt, flag, arg) */ 23 24 /* 25 * parameters for sysproc.c and rebootcmd.c 26 */ 27 #define AOUT_MAGIC V_MAGIC || magic==M_MAGIC 28 /* r3k or r4k boot images */ 29 #define BOOT_MAGIC (0x160<<16) || magic == ((0x160<<16)|3) 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 ushort isilock; 43 }; 44 45 struct Label 46 { 47 ulong sp; 48 ulong pc; 49 }; 50 51 struct Confmem 52 { 53 ulong base; 54 ulong npage; 55 ulong kbase; 56 ulong klimit; 57 }; 58 59 struct Conf 60 { 61 ulong nmach; /* processors */ 62 ulong nproc; /* processes */ 63 Confmem mem[1]; 64 /* npage may exclude kernel pages */ 65 ulong npage; /* total physical pages of memory */ 66 ulong upages; /* user page pool */ 67 ulong nimage; /* number of page cache image headers */ 68 ulong nswap; /* number of swap pages */ 69 int nswppo; /* max # of pageouts per segment pass */ 70 ulong copymode; /* 0 is copy on write, 1 is copy on reference */ 71 ulong ialloc; /* bytes available for interrupt-time allocation */ 72 ulong pipeqsize; /* size in bytes of pipe queues */ 73 int nuart; /* number of uart devices */ 74 }; 75 76 struct Rbconf { 77 char *ether0mac; 78 char *memsize; 79 char *hz; 80 char *console; 81 char *null; /* act as end of argv when rebooting */ 82 }; 83 84 /* 85 * floating point registers 86 */ 87 enum 88 { 89 /* floating point state */ 90 FPinit, 91 FPactive, 92 FPinactive, 93 FPemu, 94 95 /* bit meaning floating point illegal */ 96 FPillegal= 0x100, 97 }; 98 99 enum { 100 Nfpregs = 32, /* floats; half as many doubles */ 101 }; 102 103 /* 104 * emulated floating point (mips32r2 with ieee fp regs) 105 * fpstate is separate, kept in Proc 106 */ 107 struct FPsave 108 { 109 /* /dev/proc expects the registers to be first in FPsave */ 110 ulong reg[Nfpregs]; /* the canonical bits */ 111 union { 112 ulong fpstatus; /* both are fcr31 */ 113 ulong fpcontrol; 114 }; 115 116 int fpdelayexec; /* executing delay slot of branch */ 117 uintptr fpdelaypc; /* pc to resume at after */ 118 ulong fpdelaysts; /* save across user-mode delay-slot execution */ 119 120 /* stuck-fault detection */ 121 uintptr fppc; /* addr of last fault */ 122 int fpcnt; /* how many consecutive at that addr */ 123 }; 124 125 int fpemudebug; 126 127 /* 128 * mmu goo in the Proc structure 129 */ 130 struct PMMU 131 { 132 int pidonmach[MAXMACH]; 133 }; 134 135 /* 136 * things saved in the Proc structure during a notify 137 */ 138 struct Notsave 139 { 140 ulong nonempty; 141 }; 142 143 #include "../port/portdat.h" 144 145 /* First FIVE members' offsets known by l.s */ 146 struct Mach 147 { 148 /* the following are all known by l.s and cannot be moved */ 149 int machno; /* physical id of processor FIRST */ 150 Softtlb*stb; /* Software tlb simulation SECOND */ 151 Proc* proc; /* process on this processor THIRD */ 152 ulong splpc; /* pc that called splhi() FOURTH */ 153 ulong tlbfault; /* # of tlb faults FIFTH */ 154 ulong ktlbfault; 155 ulong utlbfault; 156 157 /* the following is safe to move */ 158 ulong tlbpurge; 159 ulong ticks; /* of the clock since boot time */ 160 Label sched; /* scheduler wakeup */ 161 void* alarm; /* alarms bound to this clock */ 162 int lastpid; /* last pid allocated on this machine */ 163 Proc* pidproc[NTLBPID]; /* proc that owns tlbpid on this mach */ 164 KMap* kactive; /* active on this machine */ 165 int knext; 166 uchar ktlbx[NTLB]; /* tlb index used for kmap */ 167 uchar ktlbnext; 168 int speed; /* cpu speed */ 169 ulong delayloop; /* for the delay() routine */ 170 ulong fairness; /* for runproc */ 171 int flushmmu; 172 int inclockintr; 173 int ilockdepth; 174 Perf perf; /* performance counters */ 175 uvlong cyclefreq; /* Frequency of user readable cycle counter */ 176 177 /* for per-processor timers */ 178 ulong lastcount; 179 uvlong fastticks; 180 ulong hz; 181 ulong maxperiod; 182 ulong minperiod; 183 184 Proc* readied; /* for runproc */ 185 ulong schedticks; /* next forced context switch */ 186 187 int pfault; 188 int cs; 189 int syscall; 190 int load; 191 int intr; 192 int hashcoll; /* soft-tlb hash collisions */ 193 int paststartup; /* for putktlb */ 194 195 int stack[1]; 196 }; 197 198 struct KMap 199 { 200 Ref; 201 ulong virt; 202 ulong phys0; 203 ulong phys1; 204 KMap* next; 205 KMap* konmach[MAXMACH]; 206 Page* pg; 207 ulong pc; /* of caller to kmap() */ 208 }; 209 210 #define VA(k) ((k)->virt) 211 #define PPN(x) ((ulong)(x)>>6) 212 213 /* offsets known by l.s */ 214 struct Softtlb 215 { 216 ulong virt; 217 ulong phys0; 218 ulong phys1; 219 }; 220 221 struct 222 { 223 Lock; 224 union { 225 uvlong machs; /* bitmap of active CPUs */ 226 ulong machsmap[(MAXMACH+BI2WD-1)/BI2WD]; 227 }; 228 int nmachs; /* number of bits set in machs(map) */ 229 short exiting; 230 int ispanic; 231 }active; 232 233 extern KMap kpte[]; 234 extern register Mach *m; 235 extern register Proc *up; 236 237 extern FPsave initfp; 238 239 extern int normalprint; 240 extern ulong memsize; 241 extern Rbconf rbconf; 242