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