dat.h 3.8 KB

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