dat.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 PCB PCB;
  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. #define MAXSYSARG 6 /* for mount(fd, mpt, flag, arg, srv) */
  18. /*
  19. * parameters for sysproc.c
  20. */
  21. #define AOUT_MAGIC L_MAGIC
  22. /*
  23. * machine dependent definitions used by ../port/dat.h
  24. */
  25. struct Lock
  26. {
  27. ulong key; /* semaphore (non-zero = locked) */
  28. ulong sr;
  29. ulong pc;
  30. Proc *p;
  31. ulong pid;
  32. ushort isilock;
  33. };
  34. struct Label
  35. {
  36. ulong sp;
  37. ulong pc;
  38. };
  39. /*
  40. * Proc.fpstate
  41. */
  42. enum
  43. {
  44. /* floating point states */
  45. FPinit,
  46. FPactive,
  47. FPinactive,
  48. /* bit or'd with the state */
  49. FPillegal= 0x100,
  50. };
  51. struct FPsave
  52. {
  53. long fpreg[2*32];
  54. long dummy; /* lower bits of FPCR, useless */
  55. long fpstatus;
  56. };
  57. struct Conf
  58. {
  59. ulong nmach; /* processors */
  60. ulong nproc; /* processes */
  61. ulong npage0; /* total physical pages of memory */
  62. ulong npage1; /* total physical pages of memory */
  63. ulong npage; /* total physical pages of memory */
  64. ulong base0; /* base of bank 0 */
  65. ulong base1; /* base of bank 1 */
  66. ulong upages; /* user page pool */
  67. ulong nimage; /* number of page cache image headers */
  68. ulong nswap; /* number of swap pages */
  69. int nswppo; /* max # of pageouts per segment pass */
  70. ulong copymode; /* 0 is copy on write, 1 is copy on reference */
  71. int monitor; /* has display? */
  72. ulong ialloc; /* bytes available for interrupt time allocation */
  73. ulong pipeqsize; /* size in bytes of pipe queues */
  74. };
  75. /*
  76. * mmu goo in the Proc structure
  77. */
  78. struct PMMU
  79. {
  80. Page *mmutop; /* 1st level table */
  81. Page *mmulvl2; /* 2nd level table */
  82. Page *mmufree; /* unused page table pages */
  83. Page *mmuused; /* used page table pages, except for mmustk */
  84. };
  85. /*
  86. * things saved in the Proc structure during a notify
  87. */
  88. struct Notsave
  89. {
  90. ulong UNUSED;
  91. };
  92. #include "../port/portdat.h"
  93. /*
  94. * machine dependent definitions not used by ../port/dat.h
  95. */
  96. /*
  97. * Fake kmap
  98. */
  99. typedef void KMap;
  100. #define VA(k) ((ulong)(k))
  101. #define kmap(p) (KMap*)((p)->pa|KZERO)
  102. #define kunmap(k)
  103. /*
  104. * Process Control Block, used by PALcode
  105. */
  106. struct PCB {
  107. uvlong ksp;
  108. uvlong usp;
  109. uvlong ptbr;
  110. ulong asn;
  111. ulong pcc;
  112. uvlong unique;
  113. ulong fen;
  114. ulong dummy;
  115. uvlong rsrv1;
  116. uvlong rsrv2;
  117. };
  118. struct Mach
  119. {
  120. /* OFFSETS OF THE FOLLOWING KNOWN BY l.s */
  121. int machno; /* physical id of processor */
  122. ulong splpc; /* pc that called splhi() */
  123. Proc *proc; /* current process on this processor */
  124. /* ordering from here on irrelevant */
  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. ulong fairness; /* for runproc */
  131. vlong cpuhz; /* hwrpb->cfreq */
  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 spuriousintr;
  145. int lastintr;
  146. PCB;
  147. /* MUST BE LAST */
  148. int stack[1];
  149. };
  150. struct
  151. {
  152. Lock;
  153. short machs;
  154. short exiting;
  155. short ispanic;
  156. }active;
  157. /*
  158. * Implementation-dependant functions (outside of Alpha architecture proper).
  159. * Called PCArch because that's what mkdevc calls it (for the PC).
  160. */
  161. struct PCArch
  162. {
  163. char* id;
  164. int (*ident)(void);
  165. void (*coreinit)(void); /* set up core logic, PCI mappings etc */
  166. void (*corehello)(void); /* identify core logic to user */
  167. void (*coredetach)(void); /* restore core logic before return to console */
  168. void *(*pcicfg)(int, int); /* map and point to PCI cfg space */
  169. void *(*pcimem)(int, int); /* map and point to PCI memory space */
  170. int (*intrenable)(Vctl*);
  171. int (*intrvecno)(int);
  172. int (*intrdisable)(int);
  173. int (*_inb)(int);
  174. ushort (*_ins)(int);
  175. ulong (*_inl)(int);
  176. void (*_outb)(int, int);
  177. void (*_outs)(int, ushort);
  178. void (*_outl)(int, ulong);
  179. void (*_insb)(int, void*, int);
  180. void (*_inss)(int, void*, int);
  181. void (*_insl)(int, void*, int);
  182. void (*_outsb)(int, void*, int);
  183. void (*_outss)(int, void*, int);
  184. void (*_outsl)(int, void*, int);
  185. };
  186. /*
  187. * a parsed plan9.ini line
  188. */
  189. #define NISAOPT 8
  190. struct ISAConf {
  191. char *type;
  192. ulong port;
  193. int irq;
  194. ulong dma;
  195. ulong mem;
  196. ulong size;
  197. ulong freq;
  198. int nopt;
  199. char *opt[NISAOPT];
  200. };
  201. extern PCArch *arch;
  202. #define MACHP(n) ((Mach *)((int)&mach0+n*BY2PG))
  203. extern Mach mach0;
  204. extern register Mach *m;
  205. extern register Proc *up;
  206. /*
  207. * hardware info about a device
  208. */
  209. typedef struct {
  210. ulong port;
  211. int size;
  212. } port_t;
  213. struct DevConf
  214. {
  215. ulong intnum; /* interrupt number */
  216. char *type; /* card type, malloced */
  217. int nports; /* Number of ports */
  218. port_t *ports; /* The ports themselves */
  219. };