dat.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. typedef struct Conf Conf;
  2. typedef struct FPsave FPsave;
  3. typedef struct ISAConf ISAConf;
  4. typedef struct Label Label;
  5. typedef struct Lock Lock;
  6. typedef struct Mach Mach;
  7. typedef struct Notsave Notsave;
  8. typedef struct Page Page;
  9. typedef struct PCArch PCArch;
  10. typedef struct Pcidev Pcidev;
  11. typedef struct PMMU PMMU;
  12. typedef struct Proc Proc;
  13. typedef struct Sys Sys;
  14. typedef struct Ureg Ureg;
  15. typedef struct Vctl Vctl;
  16. typedef struct Imap Imap;
  17. typedef struct Vctl Vctl;
  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; /* semaphore (non-zero = locked) */
  29. ulong sr;
  30. ulong pc;
  31. Proc *p;
  32. ulong pid;
  33. ushort isilock;
  34. };
  35. struct Label
  36. {
  37. ulong sp;
  38. ulong pc;
  39. };
  40. /*
  41. * Proc.fpstate
  42. */
  43. enum
  44. {
  45. /* Floating point states */
  46. FPinit = 0,
  47. FPactive = 1,
  48. FPinactive = 2,
  49. /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */
  50. FPillegal = 0x100,
  51. };
  52. /*
  53. * This structure must agree with fpsave and fprestore asm routines
  54. */
  55. struct FPsave
  56. {
  57. double fpreg[32];
  58. union {
  59. double fpscrd;
  60. struct {
  61. ulong pad;
  62. ulong fpscr;
  63. };
  64. };
  65. };
  66. struct Conf
  67. {
  68. ulong nmach; /* processors */
  69. ulong nproc; /* processes */
  70. ulong npage0; /* total physical pages of memory */
  71. ulong npage1; /* total physical pages of memory */
  72. ulong npage; /* total physical pages of memory */
  73. ulong base0; /* base of bank 0 */
  74. ulong base1; /* base of bank 1 */
  75. ulong upages; /* user page pool */
  76. ulong nimage; /* number of page cache image headers */
  77. ulong nswap; /* number of swap pages */
  78. int nswppo; /* max # of pageouts per segment pass */
  79. ulong copymode; /* 0 is copy on write, 1 is copy on reference */
  80. int monitor; /* has display? */
  81. ulong ialloc; /* bytes available for interrupt time allocation */
  82. ulong pipeqsize; /* size in bytes of pipe queues */
  83. };
  84. /*
  85. * mmu goo in the Proc structure
  86. */
  87. #define NCOLOR 1
  88. struct PMMU
  89. {
  90. int mmupid;
  91. Ureg * mmureg; /* pointer to ureg structure */
  92. ulong mmuinstr; /* last miss was an instruction miss */
  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. /*0x00*/ int machno; /* physical id of processor */
  116. /*0x04*/ ulong splpc; /* pc that called splhi() */
  117. /*0x08*/ Proc * proc; /* current process on this processor */
  118. /* Debugging/statistics for software TLB in l.s (therefore, also known by l.s) */
  119. /*0x0c*/ ulong tlbfault; /* type of last miss */
  120. /*0x10*/ ulong imiss; /* number of instruction misses */
  121. /*0x14*/ ulong dmiss; /* number of data misses */
  122. /* ordering from here on irrelevant */
  123. Imap* imap;
  124. uchar* flash;
  125. ulong ticks; /* of the clock since boot time */
  126. Label sched; /* scheduler wakeup */
  127. Lock alarmlock; /* access to alarm list */
  128. void * alarm; /* alarms bound to this clock */
  129. int inclockintr;
  130. int cputype;
  131. ulong loopconst;
  132. Perf perf; /* performance counters */
  133. ulong fairness; /* for runproc */
  134. ulong clkin; /* basic clock frequency */
  135. ulong vco_out;
  136. vlong cpuhz;
  137. ulong bushz;
  138. ulong dechz;
  139. ulong tbhz;
  140. ulong cpmhz; /* communications processor module frequency */
  141. ulong brghz; /* baud rate generator frequency */
  142. ulong pcclast;
  143. uvlong fastclock;
  144. int tlbpurge; /* # of tlb purges */
  145. int pfault; /* # of page faults */
  146. int cs;
  147. int syscall;
  148. int load;
  149. int intr;
  150. int flushmmu; /* make current proc flush it's mmu state */
  151. int ilockdepth;
  152. ulong ptabbase; /* start of page table in kernel virtual space */
  153. int slotgen; /* next pte (byte offset) when pteg is full */
  154. int mmupid; /* next mmu pid to use */
  155. int sweepcolor;
  156. int trigcolor;
  157. Rendez sweepr;
  158. ulong spuriousintr;
  159. int lastintr;
  160. /* MUST BE LAST */
  161. int stack[1];
  162. };
  163. struct
  164. {
  165. Lock;
  166. short machs;
  167. short exiting;
  168. short ispanic;
  169. }active;
  170. /*
  171. * a parsed plan9.ini line
  172. */
  173. #define NISAOPT 8
  174. struct ISAConf {
  175. char *type;
  176. ulong port;
  177. int irq;
  178. ulong dma;
  179. ulong mem;
  180. ulong size;
  181. ulong freq;
  182. int nopt;
  183. char *opt[NISAOPT];
  184. };
  185. struct Vctl {
  186. Vctl* next; /* handlers on this vector */
  187. char name[KNAMELEN]; /* of driver */
  188. int isintr; /* interrupt or fault/trap */
  189. int irq;
  190. void (*f)(Ureg*, void*); /* handler to call */
  191. void* a; /* argument to call it with */
  192. };
  193. extern Mach mach0;
  194. extern register Mach *m;
  195. extern register Proc *up;