typedef struct Conf Conf; typedef struct Confmem Confmem; typedef struct ISAConf ISAConf; typedef struct Label Label; typedef struct Lock Lock; typedef struct Mach Mach; typedef u32int Mreg; /* Msr - bloody UART */ typedef struct Page Page; typedef struct FPsave FPsave; typedef struct PMMU PMMU; typedef struct Notsave Notsave; typedef struct Proc Proc; typedef struct Softtlb Softtlb; typedef struct Sys Sys; typedef uvlong Tval; typedef struct Ureg Ureg; #pragma incomplete Ureg #define MAXSYSARG 5 /* for mount(fd, mpt, flag, arg, srv) */ /* * parameters for sysproc.c */ #define AOUT_MAGIC Q_MAGIC /* * intc bits, as of 18 aug 2009. * specific to rae's virtex5 design */ enum { Bitllfifo, Bittemac, Bitdma, Bitdma2, Bituart, Bitmiiphy, Bitqtmmacfail, /* qtm only */ Bitqtmdraminit, /* qtm only */ Intllfifo=1<pa|KZERO) #define kmapinval() #define kunmap(k) struct Mach { /* OFFSETS OF THE FOLLOWING KNOWN BY l.s */ int machno; /* physical id of processor [0*4] */ ulong splpc; /* pc that called splhi() [1*4] */ Proc *proc; /* current process on this processor [2*4] */ Softtlb* stlb; /* software tlb cache [3*4] */ int utlbhi; /* lowest tlb index in use by kernel [4*4] */ int utlbnext; /* next tlb entry to use for user (round robin) [5*4] */ int tlbfault; /* number of tlb i/d misses [6*4] */ /* ordering from here on irrelevant */ ulong ticks; /* of the clock since boot time */ Label sched; /* scheduler wakeup */ Lock alarmlock; /* access to alarm list */ void *alarm; /* alarms bound to this clock */ int inclockintr; Proc* readied; /* for runproc */ ulong schedticks; /* next forced context switch */ Mach *me; /* debugging: should be my own address */ long oscclk; /* oscillator frequency (MHz) */ long cpuhz; /* general system clock (cycles) */ long clockgen; /* clock generator frequency (cycles) */ long vcohz; long pllhz; long plbhz; long opbhz; long epbhz; long pcihz; int cputype; ulong delayloop; uvlong cyclefreq; /* frequency of user readable cycle clock */ Mach *me2; /* debugging: should be my own address */ uvlong fastclock; Perf perf; /* performance counters */ int tlbpurge; /* ... */ int pfault; int cs; int syscall; int load; int intr; int flushmmu; /* make current proc flush its mmu state */ int ilockdepth; int lastpid; /* last TLB pid allocated on this machine */ QLock stlblock; /* prevent context switch during tlb update */ Proc* pidproc[NTLBPID]; /* which proc owns a given pid */ ulong spuriousintr; int lastintr; ulong magic; /* debugging; also check for stack overflow */ /* MUST BE LAST */ int stack[1]; }; struct Softtlb { u32int hi; /* tlb hi, except that low order 10 bits have (pid[8]<<2) */ u32int mid; u32int lo; }; struct { Lock; short machs; short exiting; short ispanic; int thunderbirdsarego; /* lets the added processors continue to schedinit */ }active; /* * a parsed plan9.ini line */ #define NISAOPT 8 struct ISAConf { char *type; ulong port; int irq; ulong dma; ulong mem; ulong size; ulong freq; int nopt; char *opt[NISAOPT]; }; #define MACHP(n) ((Mach *)((int)&mach0 + (n)*MACHSIZE)) extern Mach mach0; extern register Mach *m; extern register Proc *up; /* * Horrid. But the alternative is 'defined'. */ #ifdef _DBGC_ #define DBGFLG (dbgflg[_DBGC_]) #else #define DBGFLG (0) #endif /* _DBGC_ */ // #define DBG(...) if(DBGFLG) dbgprint(__VA_ARGS__) typedef struct { ulong lasttm; /* last mutation start in seconds */ ulong startticks; ulong lastticks; ulong count; ulong totticks; ulong period; /* in seconds */ } Mutstats; extern Mutstats mutstats; char dbgflg[256]; ulong intrs1sec; /* count interrupts in this second */ uintptr memsz; int okprint; int securemem; int vflag; #define dbgprint print /* for now */