1 typedef struct BIOS32si BIOS32si;
2 typedef struct BIOS32ci BIOS32ci;
3 typedef struct Conf Conf;
4 typedef struct Confmem Confmem;
5 typedef union FPsave FPsave;
6 typedef struct FPx87state FPx87state;
7 typedef struct FPssestate FPssestate;
8 typedef struct PFPU PFPU;
9 typedef struct ISAConf ISAConf;
10 typedef struct Label Label;
11 typedef struct Lock Lock;
12 typedef struct MMU MMU;
13 typedef struct Mach Mach;
14 typedef struct PCArch PCArch;
15 typedef struct Pcidev Pcidev;
16 typedef struct PCMmap PCMmap;
17 typedef struct PCMslot PCMslot;
18 typedef struct Page Page;
19 typedef struct PMMU PMMU;
20 typedef struct Proc Proc;
21 typedef struct Segdesc Segdesc;
23 typedef struct Ureg Ureg;
24 typedef struct Vctl Vctl;
26 #pragma incomplete BIOS32si
27 #pragma incomplete Pcidev
28 #pragma incomplete Ureg
30 #define MAXSYSARG 5 /* for mount(fd, afd, mpt, flag, arg) */
33 * parameters for sysproc.c
35 #define AOUT_MAGIC (I_MAGIC)
54 struct FPx87state /* x87 fp state */
68 uchar regs[80]; /* floating point registers */
71 struct FPssestate /* SSE fp state */
73 ushort fcw; /* control */
74 ushort fsw; /* status */
76 ushort fop; /* opcode */
78 ushort cs; /* pc segment */
79 ushort rsrvd1; /* reserved */
80 ulong fpudp; /* data pointer */
81 ushort ds; /* data pointer segment */
83 ulong mxcsr; /* MXCSR register state */
84 ulong mxcsr_mask; /* MXCSR mask register */
85 uchar xregs[480]; /* extended registers */
101 /* this is a state */
106 /* the following is a bit that can be or'd into the state */
120 ulong nmach; /* processors */
121 ulong nproc; /* processes */
122 ulong monitor; /* has monitor? */
123 Confmem mem[4]; /* physical memory */
124 ulong npage; /* total physical pages of memory */
125 ulong upages; /* user page pool */
126 ulong nimage; /* number of page cache image headers */
127 ulong nswap; /* number of swap pages */
128 int nswppo; /* max # of pageouts per segment pass */
129 ulong copymode; /* 0 is copy on write, 1 is copy on reference */
130 ulong ialloc; /* max interrupt time allocation in bytes */
131 ulong pipeqsize; /* size in bytes of pipe queues */
132 int nuart; /* number of uart devices */
147 Page* mmupdb; /* page directory base */
148 Page* mmufree; /* unused page table pages */
149 Page* mmuused; /* used page table pages */
150 Page* kmaptable; /* page table used by kmap */
151 uint lastkmap; /* last entry used by kmap */
152 int nkmap; /* number of current kmaps */
154 Segdesc gdt[NPROCSEG]; /* per process descriptors */
155 Segdesc *ldt; /* local descriptor table */
156 int nldt; /* number of ldt descriptors allocated */
158 u32int dr[8]; /* debug registers */
162 #include "../port/portdat.h"
165 ulong link; /* link (old TSS selector) */
166 ulong esp0; /* privilege level 0 stack pointer */
167 ulong ss0; /* privilege level 0 stack selector */
168 ulong esp1; /* privilege level 1 stack pointer */
169 ulong ss1; /* privilege level 1 stack selector */
170 ulong esp2; /* privilege level 2 stack pointer */
171 ulong ss2; /* privilege level 2 stack selector */
172 ulong xcr3; /* page directory base register - not used because we don't use trap gates */
173 ulong eip; /* instruction pointer */
174 ulong eflags; /* flags register */
175 ulong eax; /* general registers */
183 ulong es; /* segment selectors */
189 ulong ldt; /* selector for task's LDT */
190 ulong iomap; /* I/O map base address + T-bit */
195 int machno; /* physical id of processor (KNOWN TO ASSEMBLY) */
196 ulong splpc; /* pc of last caller to splhi */
198 ulong* pdb; /* page directory base for this processor (va) */
199 Tss* tss; /* tss for this processor */
200 Segdesc *gdt; /* gdt for this processor */
202 Proc* proc; /* current process on this processor */
203 Proc* externup; /* extern register Proc *up */
208 ulong ticks; /* of the clock since boot time */
209 Label sched; /* scheduler wakeup */
210 Lock alarmlock; /* access to alarm list */
211 void* alarm; /* alarms bound to this clock */
214 Proc* readied; /* for runproc */
215 ulong schedticks; /* next forced context switch */
224 int flushmmu; /* make current proc flush it's mmu state */
226 Perf perf; /* performance counters */
234 uvlong cyclefreq; /* Frequency of user readable cycle counter */
252 u32int dr7; /* shadow copy of dr7 */
260 * KMap the structure doesn't exist, but the functions do.
262 typedef struct KMap KMap;
263 #define VA(k) ((void*)(k))
267 extern u32int MemMin;
271 char machs[MAXMACH]; /* active CPUs */
272 int exiting; /* shutdown */
276 * routines for things outside the PC model, like power management
281 int (*ident)(void); /* this should be in the model */
282 void (*reset)(void); /* this should be in the model */
283 int (*serialpower)(int); /* 1 == on, 0 == off */
284 int (*modempower)(int); /* 1 == on, 0 == off */
286 void (*intrinit)(void);
287 int (*intrenable)(Vctl*);
288 int (*intrvecno)(int);
289 int (*intrdisable)(int);
290 void (*introff)(void);
291 void (*intron)(void);
293 void (*clockenable)(void);
294 uvlong (*fastclock)(uvlong*);
295 void (*timerset)(uvlong);
298 /* cpuid instruction result register bits */
305 Vmex = 1<<1, /* virtual-mode extensions */
306 Pse = 1<<3, /* page size extensions */
307 Tsc = 1<<4, /* time-stamp counter */
308 Cpumsr = 1<<5, /* model-specific registers, rdmsr/wrmsr */
309 Pae = 1<<6, /* physical-addr extensions */
310 Mce = 1<<7, /* machine-check exception */
313 Mtrr = 1<<12, /* memory-type range regs. */
314 Pge = 1<<13, /* page global extension */
315 Mca = 1<<14, /* machine-check architecture */
316 Pat = 1<<16, /* page attribute table */
317 Pse2 = 1<<17, /* more page size extensions */
319 Acpif = 1<<22, /* therm control msr */
321 Fxsr = 1<<24, /* have SSE FXSAVE/FXRSTOR */
322 Sse = 1<<25, /* thus sfence instr. */
323 Sse2 = 1<<26, /* thus mfence & lfence instr.s */
324 Rdrnd = 1<<30, /* RDRAND support bit */
327 /* model-specific registers, for compatibility with pc64 code */
329 Efer = 0xc0000080, /* Extended Feature Enable */
330 Star = 0xc0000081, /* Legacy Target IP and [CS]S */
331 Lstar = 0xc0000082, /* Long Mode Target IP */
332 Cstar = 0xc0000083, /* Compatibility Target IP */
333 Sfmask = 0xc0000084, /* SYSCALL Flags Mask */
334 FSbase = 0xc0000100, /* 64-bit FS Base Address */
335 GSbase = 0xc0000101, /* 64-bit GS Base Address */
336 KernelGSbase = 0xc0000102, /* SWAPGS instruction */
340 * a parsed plan9.ini line
357 extern PCArch *arch; /* PC architecture */
360 * Each processor sees its own Mach structure at address MACHADDR.
361 * However, the Mach structures must also be available via the per-processor
362 * MMU information array machp, mainly for disambiguation and access to
363 * the clock which is only maintained by the bootstrap processor (0).
365 Mach* machp[MAXMACH];
367 #define MACHP(n) (machp[n])
370 #define up (((Mach*)MACHADDR)->externup)
373 * hardware info about a device
382 ulong intnum; /* interrupt number */
383 char *type; /* card type, malloced */
384 int nports; /* Number of ports */
385 Devport *ports; /* The ports themselves */
388 typedef struct BIOS32ci { /* BIOS32 Calling Interface */