]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/zynq/dat.h
games/galaxy: simplify zoom loop
[plan9front.git] / sys / src / 9 / zynq / dat.h
1 typedef struct Conf     Conf;
2 typedef struct Confmem  Confmem;
3 typedef struct FPsave   FPsave;
4 typedef struct L1       L1;
5 typedef struct Label    Label;
6 typedef struct Lock     Lock;
7 typedef struct KMap     KMap;
8 typedef struct MMMU     MMMU;
9 typedef struct Mach     Mach;
10 typedef struct Notsave  Notsave;
11 typedef struct Page     Page;
12 typedef struct Proc     Proc;
13 typedef struct PMMU     PMMU;
14 typedef struct Ureg     Ureg;
15 typedef struct ISAConf  ISAConf;
16 typedef uvlong          Tval;
17
18 #pragma incomplete Ureg
19
20 #define MAXSYSARG       5       /* for mount(fd, mpt, flag, arg, srv) */
21
22 #define AOUT_MAGIC      (E_MAGIC)
23
24 struct Lock
25 {
26         ulong   key;
27         u32int  sr;
28         uintptr pc;
29         Proc*   p;
30         Mach*   m;
31         int     isilock;
32 };
33
34 struct Label
35 {
36         uintptr sp;
37         uintptr pc;
38 };
39
40 struct FPsave
41 {
42         ulong   exc, scr;
43         uchar   regs[256];
44 };
45
46 /*
47  * FPsave.status
48  */
49 enum
50 {
51         FPinit,
52         FPactive,
53         FPinactive,
54         FPillegal = 0x100
55 };
56
57 struct Confmem
58 {
59         uintptr base;
60         uintptr limit;
61         usize   npage;
62         uintptr kbase;
63         uintptr klimit;
64 };
65
66 struct Conf
67 {
68         ulong   nmach;          /* processors */
69         ulong   nproc;          /* processes */
70         Confmem mem[1];         /* physical memory */
71         ulong   npage;          /* total physical pages of memory */
72         usize   upages;         /* user page pool */
73         ulong   copymode;       /* 0 is copy on write, 1 is copy on reference */
74         ulong   ialloc;         /* max interrupt time allocation in bytes */
75         ulong   pipeqsize;      /* size in bytes of pipe queues */
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         int     monitor;
80 };
81
82 /*
83  *  things saved in the Proc structure during a notify
84  */
85 struct Notsave {
86         int     emptiness;
87 };
88
89 /*
90  *  MMU stuff in proc
91  */
92 #define NCOLOR  1
93
94 struct PMMU
95 {
96         L1 *l1;
97         Page *mmuused, *mmufree;
98         
99         int nkmap;
100         Page *kmaptable;
101 };
102
103 #include "../port/portdat.h"
104
105 struct L1
106 {
107         Ref;
108         uintptr pa;
109         ulong *va;
110         L1 *next;
111 };
112
113 struct MMMU
114 {
115         L1 l1;
116         L1 *l1free;
117         int nfree;
118         uchar asid;
119 };
120
121 struct Mach
122 {
123         /* known to assembly */
124         int     machno;                 /* physical id of processor */
125         uintptr splpc;                  /* pc of last caller to splhi */
126         Proc*   proc;                   /* current process */
127         ulong   excregs[3];
128         ulong   cycleshi;
129         /* end of known to assembly */
130
131         int     flushmmu;               /* flush current proc mmu state */
132
133         ulong   ticks;                  /* of the clock since boot time */
134         Label   sched;                  /* scheduler wakeup */
135         Lock    alarmlock;              /* access to alarm list */
136         void*   alarm;                  /* alarms bound to this clock */
137         int     inclockintr;
138
139         Proc*   readied;                /* for runproc */
140         ulong   schedticks;             /* next forced context switch */
141
142         ulong   delayloop;
143
144         /* stats */
145         int     tlbfault;
146         int     tlbpurge;
147         int     pfault;
148         int     cs;
149         int     syscall;
150         int     load;
151         int     intr;
152         int     lastintr;
153         int     ilockdepth;
154         Perf    perf;                   /* performance counters */
155
156
157         int     cpumhz;
158         uvlong  cpuhz;                  /* speed of cpu */
159         uvlong  cyclefreq;              /* Frequency of user readable cycle counter */
160         
161         MMMU;
162
163         int     stack[1];
164 };
165
166 struct ISAConf
167 {
168         int dummy;
169         char *type;
170         ulong port;
171         int irq;
172 };
173 #define BUSUNKNOWN -1
174
175 struct
176 {
177         Lock;
178         char    machs[MAXMACH];         /* active CPUs */
179         int     exiting;                /* shutdown */
180 }active;
181
182 extern register Mach* m;                        /* R10 */
183 extern register Proc* up;                       /* R9 */
184
185 extern int normalprint;
186
187 extern ulong *mpcore, *slcr;
188
189 void nope(void);
190 #define NOPE nope();
191
192 /*
193  *  hardware info about a device
194  */
195 typedef struct {
196         ulong   port;
197         int     size;
198 } Devport;
199
200 struct DevConf
201 {
202         ulong   intnum;                 /* interrupt number */
203         char    *type;                  /* card type, malloced */
204         int     nports;                 /* Number of ports */
205         Devport *ports;                 /* The ports themselves */
206 };