dat.h 3.7 KB

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