]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/cycv/dat.h
1e08c3dab89b5363949348a022b368d0dccba3f0
[plan9front.git] / sys / src / 9 / cycv / 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 L1       L1;
6 typedef struct Label    Label;
7 typedef struct Lock     Lock;
8 typedef struct KMap     KMap;
9 typedef struct MMMU     MMMU;
10 typedef struct Mach     Mach;
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 struct DMAC     DMAC;
17 typedef uvlong          Tval;
18
19 #pragma incomplete Ureg
20
21 #define MAXSYSARG       5       /* for mount(fd, mpt, flag, arg, srv) */
22
23 #define AOUT_MAGIC      (E_MAGIC)
24
25 struct Lock
26 {
27         ulong   key;
28         u32int  sr;
29         uintptr pc;
30         Proc*   p;
31         Mach*   m;
32         int     isilock;
33 };
34
35 struct Label
36 {
37         uintptr sp;
38         uintptr pc;
39 };
40
41 struct FPsave
42 {
43         ulong   exc, scr;
44         uchar   regs[256];
45 };
46
47 struct PFPU
48 {
49         int     fpstate;
50         FPsave  fpsave[1];
51 };
52
53 enum
54 {
55         FPinit,
56         FPactive,
57         FPinactive,
58         FPillegal = 0x100
59 };
60
61 struct Confmem
62 {
63         uintptr base;
64         usize   npage;
65         uintptr kbase;
66         uintptr klimit;
67 };
68
69 struct Conf
70 {
71         ulong   nmach;          /* processors */
72         ulong   nproc;          /* processes */
73         Confmem mem[2];         /* physical memory */
74         ulong   npage;          /* total physical pages of memory */
75         usize   upages;         /* user page pool */
76         ulong   copymode;       /* 0 is copy on write, 1 is copy on reference */
77         ulong   ialloc;         /* max interrupt time allocation in bytes */
78         ulong   pipeqsize;      /* size in bytes of pipe queues */
79         ulong   nimage;         /* number of page cache image headers */
80         ulong   nswap;          /* number of swap pages */
81         int     nswppo;         /* max # of pageouts per segment pass */
82         int     monitor;
83 };
84
85 /*
86  *  MMU stuff in proc
87  */
88 #define NCOLOR  1
89
90 struct PMMU
91 {
92         L1 *l1;
93         Page *mmuused, *mmufree;
94         
95         int nkmap;
96         Page *kmaptable;
97 };
98
99 #include "../port/portdat.h"
100
101 struct L1
102 {
103         Ref;
104         uintptr pa;
105         ulong *va;
106         L1 *next;
107 };
108
109 struct MMMU
110 {
111         L1 l1;
112         L1 *l1free;
113         int nfree;
114         uchar asid;
115 };
116
117 struct Mach
118 {
119         int     machno;                 /* physical id of processor */
120         uintptr splpc;                  /* pc of last caller to splhi */
121         Proc*   proc;                   /* current process */
122         ulong   excregs[3];
123         ulong   cycleshi;
124         /* end of known offsets to assembly */
125
126         MMMU;
127
128         PMach;
129
130         int     lastintr;
131
132         int     cpumhz;
133         uvlong  cpuhz;                  /* speed of cpu */
134
135         uintptr stack[1];
136 };
137
138 #define NISAOPT         8
139 struct ISAConf
140 {
141         char    *type;
142         ulong   port;
143         int     irq;
144         int     nopt;
145         char    *opt[NISAOPT];
146 };
147 #define BUSUNKNOWN -1
148
149 struct
150 {
151         char    machs[MAXMACH];         /* active CPUs */
152         int     exiting;                /* shutdown */
153 }active;
154
155 extern register Mach* m;                        /* R10 */
156 extern register Proc* up;                       /* R9 */
157
158 extern int normalprint;
159
160 void nope(void);
161 #define NOPE nope();
162
163 /*
164  *  hardware info about a device
165  */
166 typedef struct {
167         ulong   port;
168         int     size;
169 } Devport;
170
171 struct DevConf
172 {
173         ulong   intnum;                 /* interrupt number */
174         char    *type;                  /* card type, malloced */
175         int     nports;                 /* Number of ports */
176         Devport *ports;                 /* The ports themselves */
177 };
178
179 #define mpcore ((ulong*)MPCORE_BASE)
180 #define resetmgr ((ulong*)RESETMGR_BASE)
181 #define sysmgr ((ulong*)SYSMGR_BASE)
182 #define l3 ((ulong*)L3_BASE)
183
184 /*dmacopy*/
185 #define SRC_INC (1<<0)
186 #define DST_INC (1<<14)