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 */
228 u64int dr7; /* shadow copy of dr7 */
239 #define VA(k) ((void*)k)
241 extern u32int MemMin;
245 char machs[MAXMACH]; /* bitmap of active CPUs */
246 int exiting; /* shutdown */
250 * routines for things outside the PC model, like power management
255 int (*ident)(void); /* this should be in the model */
256 void (*reset)(void); /* this should be in the model */
257 int (*serialpower)(int); /* 1 == on, 0 == off */
258 int (*modempower)(int); /* 1 == on, 0 == off */
260 void (*intrinit)(void);
261 int (*intrenable)(Vctl*);
262 int (*intrvecno)(int);
263 int (*intrdisable)(int);
264 void (*introff)(void);
265 void (*intron)(void);
267 void (*clockenable)(void);
268 uvlong (*fastclock)(uvlong*);
269 void (*timerset)(uvlong);
272 /* cpuid instruction result register bits */
279 Vmex = 1<<1, /* virtual-mode extensions */
280 Pse = 1<<3, /* page size extensions */
281 Tsc = 1<<4, /* time-stamp counter */
282 Cpumsr = 1<<5, /* model-specific registers, rdmsr/wrmsr */
283 Pae = 1<<6, /* physical-addr extensions */
284 Mce = 1<<7, /* machine-check exception */
287 Mtrr = 1<<12, /* memory-type range regs. */
288 Pge = 1<<13, /* page global extension */
289 Mca = 1<<14, /* machine-check architecture */
290 Pat = 1<<16, /* page attribute table */
291 Pse2 = 1<<17, /* more page size extensions */
293 Acpif = 1<<22, /* therm control msr */
295 Fxsr = 1<<24, /* have SSE FXSAVE/FXRSTOR */
296 Sse = 1<<25, /* thus sfence instr. */
297 Sse2 = 1<<26, /* thus mfence & lfence instr.s */
298 Rdrnd = 1<<30, /* RDRAND support bit */
302 PerfEvtbase = 0xc0010000, /* Performance Event Select */
303 PerfCtrbase = 0xc0010004, /* Performance Counters */
305 Efer = 0xc0000080, /* Extended Feature Enable */
306 Star = 0xc0000081, /* Legacy Target IP and [CS]S */
307 Lstar = 0xc0000082, /* Long Mode Target IP */
308 Cstar = 0xc0000083, /* Compatibility Target IP */
309 Sfmask = 0xc0000084, /* SYSCALL Flags Mask */
310 FSbase = 0xc0000100, /* 64-bit FS Base Address */
311 GSbase = 0xc0000101, /* 64-bit GS Base Address */
312 KernelGSbase = 0xc0000102, /* SWAPGS instruction */
316 * a parsed plan9.ini line
333 extern PCArch *arch; /* PC architecture */
335 Mach* machp[MAXMACH];
337 #define MACHP(n) (machp[n])
339 extern register Mach* m; /* R15 */
340 extern register Proc* up; /* R14 */
343 * hardware info about a device
352 ulong intnum; /* interrupt number */
353 char *type; /* card type, malloced */
354 int nports; /* Number of ports */
355 Devport *ports; /* The ports themselves */
358 typedef struct BIOS32ci { /* BIOS32 Calling Interface */