dat.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. typedef struct Conf Conf;
  2. typedef struct FPsave FPsave;
  3. typedef struct ISAConf ISAConf;
  4. typedef struct Imap Imap;
  5. typedef struct Label Label;
  6. typedef struct Lock Lock;
  7. typedef struct Mach Mach;
  8. typedef struct Notsave Notsave;
  9. typedef struct PCArch PCArch;
  10. typedef struct PMMU PMMU;
  11. typedef struct Page Page;
  12. typedef struct Pcidev Pcidev;
  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. #pragma incomplete Imap
  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; /* semaphore (non-zero = locked) */
  30. ulong sr;
  31. ulong pc;
  32. Proc *p;
  33. ulong pid;
  34. ushort isilock;
  35. };
  36. struct Label
  37. {
  38. ulong sp;
  39. ulong pc;
  40. };
  41. /*
  42. * Proc.fpstate
  43. */
  44. enum
  45. {
  46. /* Floating point states */
  47. FPinit = 0,
  48. FPactive = 1,
  49. FPinactive = 2,
  50. /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */
  51. FPillegal = 0x100,
  52. };
  53. /*
  54. * This structure must agree with fpsave and fprestore asm routines
  55. */
  56. struct FPsave
  57. {
  58. double fpreg[32];
  59. union {
  60. double fpscrd;
  61. struct {
  62. ulong pad;
  63. ulong fpscr;
  64. };
  65. };
  66. };
  67. struct Conf
  68. {
  69. ulong nmach; /* processors */
  70. ulong nproc; /* processes */
  71. ulong npage0; /* total physical pages of memory */
  72. ulong npage1; /* total physical pages of memory */
  73. ulong npage; /* total physical pages of memory */
  74. ulong base0; /* base of bank 0 */
  75. ulong base1; /* base of bank 1 */
  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. Ureg *mmureg; /* pointer to ureg structure */
  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. ulong ticks; /* of the clock since boot time */
  125. Label sched; /* scheduler wakeup */
  126. Lock alarmlock; /* access to alarm list */
  127. void *alarm; /* alarms bound to this clock */
  128. int inclockintr;
  129. int cputype;
  130. ulong loopconst;
  131. Perf perf; /* performance counters */
  132. Proc* readied; /* for runproc */
  133. ulong schedticks; /* next forced context switch */
  134. ulong clkin; /* basic clock frequency */
  135. ulong vco_out;
  136. vlong cpuhz;
  137. uvlong cyclefreq; /* Frequency of user readable cycle counter */
  138. ulong bushz;
  139. ulong dechz;
  140. ulong tbhz;
  141. ulong cpmhz; /* communications processor module frequency */
  142. ulong brghz; /* baud rate generator frequency */
  143. ulong pcclast;
  144. uvlong fastclock;
  145. int tlbpurge; /* # of tlb purges */
  146. int pfault; /* # of page faults */
  147. int cs;
  148. int syscall;
  149. int load;
  150. int intr;
  151. int flushmmu; /* make current proc flush it's mmu state */
  152. int ilockdepth;
  153. ulong ptabbase; /* start of page table in kernel virtual space */
  154. int slotgen; /* next pte (byte offset) when pteg is full */
  155. int mmupid; /* next mmu pid to use */
  156. int sweepcolor;
  157. int trigcolor;
  158. Rendez sweepr;
  159. ulong spuriousintr;
  160. int lastintr;
  161. /* MUST BE LAST */
  162. int stack[1];
  163. };
  164. struct
  165. {
  166. Lock;
  167. short machs;
  168. short exiting;
  169. short ispanic;
  170. }active;
  171. /*
  172. * a parsed plan9.ini line
  173. */
  174. #define NISAOPT 8
  175. struct ISAConf {
  176. char *type;
  177. ulong port;
  178. int irq;
  179. ulong dma;
  180. ulong mem;
  181. ulong size;
  182. ulong freq;
  183. int nopt;
  184. char *opt[NISAOPT];
  185. };
  186. struct Vctl {
  187. Vctl* next; /* handlers on this vector */
  188. char name[KNAMELEN]; /* of driver */
  189. int isintr; /* interrupt or fault/trap */
  190. int irq;
  191. void (*f)(Ureg*, void*); /* handler to call */
  192. void* a; /* argument to call it with */
  193. };
  194. extern Mach mach0;
  195. extern register Mach *m;
  196. extern register Proc *up;
  197. extern FPsave initfp;