dat.h 4.6 KB

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