1 typedef struct BIOS32si BIOS32si;
2 typedef struct BIOS32ci BIOS32ci;
3 typedef struct Conf Conf;
4 typedef struct Confmem Confmem;
5 typedef struct FPsave FPsave;
6 typedef struct PFPU PFPU;
7 typedef struct ISAConf ISAConf;
8 typedef struct Label Label;
9 typedef struct Lock Lock;
10 typedef struct MMU MMU;
11 typedef struct Mach Mach;
12 typedef struct PCArch PCArch;
13 typedef struct Pcidev Pcidev;
14 typedef struct PCMmap PCMmap;
15 typedef struct PCMslot PCMslot;
16 typedef struct Page Page;
17 typedef struct PMMU PMMU;
18 typedef struct Proc Proc;
19 typedef struct Segdesc Segdesc;
21 typedef struct Ureg Ureg;
22 typedef struct Vctl Vctl;
24 #pragma incomplete BIOS32si
25 #pragma incomplete Pcidev
26 #pragma incomplete Ureg
28 #define MAXSYSARG 5 /* for mount(fd, afd, mpt, flag, arg) */
31 * parameters for sysproc.c
33 #define AOUT_MAGIC (S_MAGIC)
54 u16int fcw; /* x87 control word */
55 u16int fsw; /* x87 status word */
56 u8int ftw; /* x87 tag word */
58 u16int fop; /* last x87 opcode */
59 u64int rip; /* last x87 instruction pointer */
60 u64int rdp; /* last x87 data pointer */
61 u32int mxcsr; /* MMX control and status */
62 u32int mxcsrmask; /* supported MMX feature bits */
63 uchar st[128]; /* shared 64-bit media and x87 regs */
64 uchar xmm[256]; /* 128-bit media regs */
65 uchar ign[96]; /* reserved, ignored */
76 * the following are bits that can be or'd into the state.
78 * this is biased so that FPinit, FPactive and FPinactive
79 * without any flags refer to user fp state in fpslot[0].
81 FPillegal= 1<<8, /* fp forbidden in note handler */
82 FPpush= 2<<8, /* trap on use and initialize new fpslot */
83 FPnouser= 4<<8, /* fpslot[0] is kernel regs */
84 FPkernel= 8<<8, /* fp use in kernel (user in fpslot[0] when !FPnouser) */
87 FPindex1= 1<<FPindexs,
88 FPindexm= 3<<FPindexs,
94 FPsave *fpsave; /* fpslot[fpstate>>FPindexs] */
95 FPsave *fpslot[(FPindexm+1)>>FPindexs];
108 ulong nmach; /* processors */
109 ulong nproc; /* processes */
110 ulong monitor; /* has monitor? */
111 Confmem mem[16]; /* physical memory */
112 ulong npage; /* total physical pages of memory */
113 ulong upages; /* user page pool */
114 ulong nimage; /* number of page cache image headers */
115 ulong nswap; /* number of swap pages */
116 int nswppo; /* max # of pageouts per segment pass */
117 ulong copymode; /* 0 is copy on write, 1 is copy on reference */
118 ulong ialloc; /* max interrupt time allocation in bytes */
119 ulong pipeqsize; /* size in bytes of pipe queues */
120 int nuart; /* number of uart devices */
130 * MMU structure for PDP, PD, PT pages.
158 #include "../port/portdat.h"
173 int machno; /* physical id of processor (KNOWN TO ASSEMBLY) */
174 uintptr splpc; /* pc of last caller to splhi (KNOWN TO ASSEMBLY) */
176 Proc* proc; /* current process on this processor (KNOWN TO ASSEMBLY) */
178 u64int* pml4; /* pml4 base for this processor (va) */
179 Tss* tss; /* tss for this processor */
180 Segdesc *gdt; /* gdt for this processor */
182 u64int mmumap[4]; /* bitmap of pml4 entries for zapping */
183 MMU* mmufree; /* freelist for MMU structures */
184 ulong mmucount; /* number of MMU structures in freelist */
186 ulong ticks; /* of the clock since boot time */
187 Label sched; /* scheduler wakeup */
188 Lock alarmlock; /* access to alarm list */
189 void* alarm; /* alarms bound to this clock */
192 Proc* readied; /* for runproc */
193 ulong schedticks; /* next forced context switch */
202 int flushmmu; /* make current proc flush it's mmu state */
204 Perf perf; /* performance counters */
212 uvlong cyclefreq; /* Frequency of user readable cycle counter */
227 u64int dr7; /* shadow copy of dr7 */
238 #define VA(k) ((void*)k)
240 extern u32int MemMin;
244 char machs[MAXMACH]; /* bitmap of active CPUs */
245 int exiting; /* shutdown */
249 * routines for things outside the PC model, like power management
254 int (*ident)(void); /* this should be in the model */
255 void (*reset)(void); /* this should be in the model */
256 int (*serialpower)(int); /* 1 == on, 0 == off */
257 int (*modempower)(int); /* 1 == on, 0 == off */
259 void (*intrinit)(void);
260 int (*intrenable)(Vctl*);
261 int (*intrvecno)(int);
262 int (*intrdisable)(int);
263 void (*introff)(void);
264 void (*intron)(void);
266 void (*clockenable)(void);
267 uvlong (*fastclock)(uvlong*);
268 void (*timerset)(uvlong);
271 /* cpuid instruction result register bits */
278 Vmex = 1<<1, /* virtual-mode extensions */
279 Pse = 1<<3, /* page size extensions */
280 Tsc = 1<<4, /* time-stamp counter */
281 Cpumsr = 1<<5, /* model-specific registers, rdmsr/wrmsr */
282 Pae = 1<<6, /* physical-addr extensions */
283 Mce = 1<<7, /* machine-check exception */
286 Mtrr = 1<<12, /* memory-type range regs. */
287 Pge = 1<<13, /* page global extension */
288 Mca = 1<<14, /* machine-check architecture */
289 Pat = 1<<16, /* page attribute table */
290 Pse2 = 1<<17, /* more page size extensions */
292 Acpif = 1<<22, /* therm control msr */
294 Fxsr = 1<<24, /* have SSE FXSAVE/FXRSTOR */
295 Sse = 1<<25, /* thus sfence instr. */
296 Sse2 = 1<<26, /* thus mfence & lfence instr.s */
297 Rdrnd = 1<<30, /* RDRAND support bit */
301 PerfEvtbase = 0xc0010000, /* Performance Event Select */
302 PerfCtrbase = 0xc0010004, /* Performance Counters */
304 Efer = 0xc0000080, /* Extended Feature Enable */
305 Star = 0xc0000081, /* Legacy Target IP and [CS]S */
306 Lstar = 0xc0000082, /* Long Mode Target IP */
307 Cstar = 0xc0000083, /* Compatibility Target IP */
308 Sfmask = 0xc0000084, /* SYSCALL Flags Mask */
309 FSbase = 0xc0000100, /* 64-bit FS Base Address */
310 GSbase = 0xc0000101, /* 64-bit GS Base Address */
311 KernelGSbase = 0xc0000102, /* SWAPGS instruction */
315 * a parsed plan9.ini line
332 extern PCArch *arch; /* PC architecture */
334 Mach* machp[MAXMACH];
336 #define MACHP(n) (machp[n])
338 extern register Mach* m; /* R15 */
339 extern register Proc* up; /* R14 */
342 * hardware info about a device
351 ulong intnum; /* interrupt number */
352 char *type; /* card type, malloced */
353 int nports; /* Number of ports */
354 Devport *ports; /* The ports themselves */
357 typedef struct BIOS32ci { /* BIOS32 Calling Interface */