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 ulong npage; /* total physical pages of memory */
124 ulong upages; /* user page pool */
125 ulong nimage; /* number of page cache image headers */
126 ulong nswap; /* number of swap pages */
127 int nswppo; /* max # of pageouts per segment pass */
128 ulong copymode; /* 0 is copy on write, 1 is copy on reference */
129 ulong ialloc; /* max interrupt time allocation in bytes */
130 ulong pipeqsize; /* size in bytes of pipe queues */
131 int nuart; /* number of uart devices */
132 Confmem mem[64]; /* physical memory */
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 */
196 int machno; /* physical id of processor */
197 uintptr splpc; /* pc of last caller to splhi */
198 Proc* proc; /* current process on this processor */
199 Proc* externup; /* extern register Proc *up */
226 ulong* pdb; /* page directory base for this processor (va) */
227 Tss* tss; /* tss for this processor */
228 Segdesc*gdt; /* gdt for this processor */
230 u32int dr7; /* shadow copy of dr7 */
243 * KMap the structure doesn't exist, but the functions do.
245 typedef struct KMap KMap;
246 #define VA(k) ((void*)(k))
250 extern u32int MemMin;
254 char machs[MAXMACH]; /* active CPUs */
255 int exiting; /* shutdown */
259 * routines for things outside the PC model, like power management
264 int (*ident)(void); /* this should be in the model */
265 void (*reset)(void); /* this should be in the model */
267 void (*intrinit)(void);
268 int (*intrassign)(Vctl*);
269 int (*intrirqno)(int, int);
270 int (*intrspurious)(int);
271 int (*intrvecno)(int);
272 void (*introff)(void);
273 void (*intron)(void);
275 void (*clockinit)(void);
276 void (*clockenable)(void);
277 uvlong (*fastclock)(uvlong*);
278 void (*timerset)(uvlong);
281 /* cpuid instruction result register bits */
288 Vmex = 1<<1, /* virtual-mode extensions */
289 Pse = 1<<3, /* page size extensions */
290 Tsc = 1<<4, /* time-stamp counter */
291 Cpumsr = 1<<5, /* model-specific registers, rdmsr/wrmsr */
292 Pae = 1<<6, /* physical-addr extensions */
293 Mce = 1<<7, /* machine-check exception */
296 Mtrr = 1<<12, /* memory-type range regs. */
297 Pge = 1<<13, /* page global extension */
298 Mca = 1<<14, /* machine-check architecture */
299 Pat = 1<<16, /* page attribute table */
300 Pse2 = 1<<17, /* more page size extensions */
302 Acpif = 1<<22, /* therm control msr */
304 Fxsr = 1<<24, /* have SSE FXSAVE/FXRSTOR */
305 Sse = 1<<25, /* thus sfence instr. */
306 Sse2 = 1<<26, /* thus mfence & lfence instr.s */
307 Rdrnd = 1<<30, /* RDRAND support bit */
310 /* model-specific registers, for compatibility with pc64 code */
312 Efer = 0xc0000080, /* Extended Feature Enable */
313 Star = 0xc0000081, /* Legacy Target IP and [CS]S */
314 Lstar = 0xc0000082, /* Long Mode Target IP */
315 Cstar = 0xc0000083, /* Compatibility Target IP */
316 Sfmask = 0xc0000084, /* SYSCALL Flags Mask */
317 FSbase = 0xc0000100, /* 64-bit FS Base Address */
318 GSbase = 0xc0000101, /* 64-bit GS Base Address */
319 KernelGSbase = 0xc0000102, /* SWAPGS instruction */
323 * a parsed plan9.ini line
340 extern PCArch *arch; /* PC architecture */
343 * Each processor sees its own Mach structure at address MACHADDR.
344 * However, the Mach structures must also be available via the per-processor
345 * MMU information array machp, mainly for disambiguation and access to
346 * the clock which is only maintained by the bootstrap processor (0).
348 Mach* machp[MAXMACH];
350 #define MACHP(n) (machp[n])
353 #define up (((Mach*)MACHADDR)->externup)
356 * hardware info about a device
365 ulong intnum; /* interrupt number */
366 char *type; /* card type, malloced */
367 int nports; /* Number of ports */
368 Devport *ports; /* The ports themselves */
371 typedef struct BIOS32ci { /* BIOS32 Calling Interface */