]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/ppc/dat.h
vmx(1): build vmxgdb by default, clean it up as well
[plan9front.git] / sys / src / 9 / ppc / dat.h
1 typedef struct Conf     Conf;
2 typedef struct Confmem  Confmem;
3 typedef struct FPsave   FPsave;
4 typedef struct PFPU     PFPU;
5 typedef struct ISAConf  ISAConf;
6 typedef struct Imap     Imap;
7 typedef struct Label    Label;
8 typedef struct Lock     Lock;
9 typedef struct Mach     Mach;
10 typedef struct PCArch   PCArch;
11 typedef struct PMMU     PMMU;
12 typedef struct Page     Page;
13 typedef struct Pcidev   Pcidev;
14 typedef struct Proc     Proc;
15 typedef struct Sys      Sys;
16 typedef struct Ureg     Ureg;
17 typedef struct Vctl     Vctl;
18 typedef long            Tval;
19
20 #pragma incomplete Ureg
21 #pragma incomplete Imap
22
23 #define MAXSYSARG       5       /* for mount(fd, mpt, flag, arg, srv) */
24
25 /*
26  *  parameters for sysproc.c
27  */
28 #define AOUT_MAGIC      Q_MAGIC
29
30 /*
31  *  machine dependent definitions used by ../port/dat.h
32  */
33
34 struct Lock
35 {
36         ulong   key;                    /* semaphore (non-zero = locked) */
37         ulong   sr;
38         ulong   pc;
39         Proc    *p;
40         ulong   pid;
41         ushort  isilock;
42 };
43
44 struct Label
45 {
46         ulong   sp;
47         ulong   pc;
48 };
49
50 /*
51  * This structure must agree with fpsave and fprestore asm routines
52  */
53 struct FPsave
54 {
55         double  fpreg[32];
56         union {
57                 double  fpscrd;
58                 struct {
59                         ulong   pad;
60                         ulong   fpscr;
61                 };
62         };
63 };
64
65 struct PFPU
66 {
67         int     fpstate;
68         FPsave  fpsave[1];
69 };
70
71 enum
72 {
73         /* Floating point states */
74         FPinit = 0,
75         FPactive = 1,
76         FPinactive = 2,
77         /* Bit that's or-ed in during note handling (FP is illegal in note handlers) */
78         FPillegal = 0x100,
79 };
80
81 struct Confmem
82 {
83         ulong   base;
84         ulong   npage;
85         ulong   kbase;
86         ulong   klimit;
87 };
88
89 struct Conf
90 {
91         ulong   nmach;          /* processors */
92         ulong   nproc;          /* processes */
93         Confmem mem[2];
94         ulong   npage;          /* total physical pages of memory */
95         ulong   upages;         /* user page pool */
96         ulong   nimage;         /* number of page cache image headers */
97         ulong   nswap;          /* number of swap pages */
98         int     nswppo;         /* max # of pageouts per segment pass */
99         ulong   copymode;       /* 0 is copy on write, 1 is copy on reference */
100         int     monitor;        /* has display? */
101         ulong   ialloc;         /* bytes available for interrupt time allocation */
102         ulong   pipeqsize;      /* size in bytes of pipe queues */
103 };
104
105 /*
106  *  mmu goo in the Proc structure
107  */
108 #define NCOLOR 1
109 struct PMMU
110 {
111         int     mmupid;
112         Ureg    *mmureg;                /* pointer to ureg structure */
113 };
114
115 #include "../port/portdat.h"
116
117 /*
118  *  machine dependent definitions not used by ../port/dat.h
119  */
120 /*
121  * Fake kmap
122  */
123 typedef void            KMap;
124 #define VA(k)           ((ulong)(k))
125 #define kmap(p)         (KMap*)((p)->pa|KZERO)
126 #define kunmap(k)
127
128 struct Mach
129 {
130         /* OFFSETS OF THE FOLLOWING KNOWN BY l.s */
131 /*0x00*/        int     machno; /* physical id of processor */
132 /*0x04*/        ulong   splpc;  /* pc that called splhi() */
133 /*0x08*/        Proc    *proc;  /* current process on this processor */
134         /* Debugging/statistics for software TLB in l.s (therefore, also known by l.s) */
135 /*0x0c*/        ulong   tlbfault;       /* type of last miss */
136 /*0x10*/        ulong   imiss;  /* number of instruction misses */
137 /*0x14*/        ulong   dmiss;  /* number of data misses */
138
139         /* ordering from here on irrelevant */
140
141         Imap*   imap;
142
143         ulong   ticks;          /* of the clock since boot time */
144         Label   sched;          /* scheduler wakeup */
145         Lock    alarmlock;      /* access to alarm list */
146         void    *alarm;         /* alarms bound to this clock */
147         int     inclockintr;
148         int     cputype;
149         ulong   loopconst;
150         Perf    perf;           /* performance counters */
151
152         Proc*   readied;        /* for runproc */
153         ulong   schedticks;     /* next forced context switch */
154
155         ulong   clkin;          /* basic clock frequency */
156         ulong   vco_out;
157         vlong   cpuhz;
158         uvlong  cyclefreq;      /* Frequency of user readable cycle counter */
159         ulong   bushz;
160         ulong   dechz;
161         ulong   tbhz;
162         ulong   cpmhz;          /* communications processor module frequency */
163         ulong   brghz;          /* baud rate generator frequency */
164
165         ulong   pcclast;
166         uvlong  fastclock;
167
168         int     tlbpurge;       /* # of tlb purges */
169         int     pfault;         /* # of page faults */
170         int     cs;
171         int     syscall;
172         int     load;
173         int     intr;
174         int     flushmmu;       /* make current proc flush it's mmu state */
175         int     ilockdepth;
176
177         ulong   ptabbase;       /* start of page table in kernel virtual space */
178         int     slotgen;        /* next pte (byte offset) when pteg is full */
179         int     mmupid;         /* next mmu pid to use */
180         int     sweepcolor;
181         int     trigcolor;
182         Rendez  sweepr;
183
184         ulong   spuriousintr;
185         int     lastintr;
186
187         /* MUST BE LAST */
188         int     stack[1];
189 };
190
191 struct
192 {
193         char    machs[MAXMACH];
194         int     exiting;
195 }active;
196
197 /*
198  *  a parsed plan9.ini line
199  */
200 #define NISAOPT         8
201
202 struct ISAConf {
203         char    *type;
204         ulong   port;
205         int     irq;
206         ulong   dma;
207         ulong   mem;
208         ulong   size;
209         ulong   freq;
210
211         int     nopt;
212         char    *opt[NISAOPT];
213 };
214
215 struct Vctl {
216         Vctl*   next;           /* handlers on this vector */
217
218         char    name[KNAMELEN]; /* of driver */
219         int     isintr;         /* interrupt or fault/trap */
220         int     irq;
221
222         void    (*f)(Ureg*, void*);     /* handler to call */
223         void*   a;              /* argument to call it with */
224 };
225
226 extern Mach mach0;
227
228 extern register Mach *m;
229 extern register Proc *up;
230
231 extern FPsave initfp;