dat.h 3.7 KB

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