IO APIC: Get rid of apic_imen
[dragonfly.git] / sys / platform / pc32 / i386 / genassym.c
CommitLineData
984263bc
MD
1/*-
2 * Copyright (c) 1982, 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
37 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $
aad81e48 38 * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.58 2008/05/09 06:35:11 dillon Exp $
984263bc
MD
39 */
40
984263bc
MD
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/assym.h>
5f456c40 44#include <sys/interrupt.h>
984263bc
MD
45#include <sys/buf.h>
46#include <sys/proc.h>
47#include <sys/errno.h>
48#include <sys/mount.h>
49#include <sys/socket.h>
8a8d5d85 50#include <sys/lock.h>
984263bc
MD
51#include <sys/resourcevar.h>
52#include <machine/frame.h>
53#include <machine/bootinfo.h>
54#include <machine/tss.h>
55#include <sys/vmmeter.h>
46b26c5e 56#include <sys/machintr.h>
984263bc
MD
57#include <vm/vm.h>
58#include <vm/vm_param.h>
59#include <vm/pmap.h>
60#include <vm/vm_map.h>
61#include <sys/user.h>
62#include <net/if.h>
63#include <netinet/in.h>
1f2de5d4
MD
64#include <vfs/nfs/nfsv2.h>
65#include <vfs/nfs/rpcv2.h>
66#include <vfs/nfs/nfs.h>
67#include <vfs/nfs/nfsdiskless.h>
984263bc 68#ifdef SMP
a9295349 69#include <machine_base/apic/apicreg.h>
3d911e0a 70#include <machine/smp.h>
984263bc
MD
71#endif
72#include <machine/segments.h>
73#include <machine/sigframe.h>
984263bc 74#include <machine/vm86.h>
85100692 75#include <machine/globaldata.h>
984263bc
MD
76
77ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
78ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
79ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
84b592ba 80
287ebb09
MD
81ASSYM(LWP_VMSPACE, offsetof(struct lwp, lwp_vmspace));
82
84b592ba 83ASSYM(TD_PROC, offsetof(struct thread, td_proc));
287ebb09 84ASSYM(TD_LWP, offsetof(struct thread, td_lwp));
b7c628e4 85ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
8ad65e08 86ASSYM(TD_SP, offsetof(struct thread, td_sp));
f1d1c3fa
MD
87ASSYM(TD_PRI, offsetof(struct thread, td_pri));
88ASSYM(TD_MACH, offsetof(struct thread, td_mach));
0cfcada1 89ASSYM(TD_WCHAN, offsetof(struct thread, td_wchan));
46a3f46d 90ASSYM(TD_NEST_COUNT, offsetof(struct thread, td_nest_count));
8a8d5d85
MD
91#ifdef SMP
92ASSYM(TD_MPCOUNT, offsetof(struct thread, td_mpcount));
93#endif
99df837e 94ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
d9eea1a5 95ASSYM(TDF_RUNNING, TDF_RUNNING);
aad81e48
MD
96ASSYM(TDF_USINGFP, TDF_USINGFP);
97ASSYM(TDF_KERNELFP, TDF_KERNELFP);
8a8d5d85
MD
98#ifdef SMP
99ASSYM(MP_FREE_LOCK, MP_FREE_LOCK);
100#endif
46b26c5e 101ASSYM(MACHINTR_INTREN, offsetof(struct machintr_abi, intren));
ae8050a4 102
65d6ce10 103ASSYM(TD_SAVEFPU, offsetof(struct thread, td_mach) + offsetof(struct md_thread, mtd_savefpu));
f1d1c3fa
MD
104
105ASSYM(TDPRI_CRIT, TDPRI_CRIT);
96728c05 106ASSYM(TDPRI_INT_SUPPORT, TDPRI_INT_SUPPORT);
984263bc 107
984263bc
MD
108ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
109ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
a64ba182 110ASSYM(V_SENDSYS, offsetof(struct vmmeter, v_sendsys));
7062f5b4 111ASSYM(V_WAITSYS, offsetof(struct vmmeter, v_waitsys));
984263bc 112ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
b785701b
SZ
113ASSYM(V_IPI, offsetof(struct vmmeter, v_ipi));
114ASSYM(V_TIMER, offsetof(struct vmmeter, v_timer));
545a1cd3 115ASSYM(V_FORWARDED_INTS, offsetof(struct vmmeter, v_forwarded_ints));
8a8d5d85
MD
116ASSYM(V_FORWARDED_HITS, offsetof(struct vmmeter, v_forwarded_hits));
117ASSYM(V_FORWARDED_MISSES, offsetof(struct vmmeter, v_forwarded_misses));
984263bc
MD
118ASSYM(UPAGES, UPAGES);
119ASSYM(PAGE_SIZE, PAGE_SIZE);
120ASSYM(NPTEPG, NPTEPG);
121ASSYM(NPDEPG, NPDEPG);
122ASSYM(PDESIZE, PDESIZE);
123ASSYM(PTESIZE, PTESIZE);
124ASSYM(PAGE_SHIFT, PAGE_SHIFT);
125ASSYM(PAGE_MASK, PAGE_MASK);
126ASSYM(PDRSHIFT, PDRSHIFT);
127ASSYM(USRSTACK, USRSTACK);
88181b08 128ASSYM(VM_MAX_USER_ADDRESS, VM_MAX_USER_ADDRESS);
984263bc
MD
129ASSYM(KERNBASE, KERNBASE);
130ASSYM(MCLBYTES, MCLBYTES);
131ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3));
132ASSYM(PCB_EDI, offsetof(struct pcb, pcb_edi));
133ASSYM(PCB_ESI, offsetof(struct pcb, pcb_esi));
134ASSYM(PCB_EBP, offsetof(struct pcb, pcb_ebp));
135ASSYM(PCB_ESP, offsetof(struct pcb, pcb_esp));
136ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx));
137ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip));
138ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0));
139
984263bc 140ASSYM(PCB_USERLDT, offsetof(struct pcb, pcb_ldt));
984263bc 141
984263bc
MD
142ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0));
143ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1));
144ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2));
145ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3));
146ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6));
147ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7));
148ASSYM(PCB_DBREGS, PCB_DBREGS);
149ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext));
150
984263bc
MD
151ASSYM(PCB_SPARE, offsetof(struct pcb, __pcb_spare));
152ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
153ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save));
154ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu));
155ASSYM(PCB_SAVE87_SIZE, sizeof(struct save87));
156ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
157
984263bc 158ASSYM(PCB_SIZE, sizeof(struct pcb));
984263bc 159
4e7c41c5 160ASSYM(TF_XFLAGS, offsetof(struct trapframe, tf_xflags));
984263bc
MD
161ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
162ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
163ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
164ASSYM(TF_EFLAGS, offsetof(struct trapframe, tf_eflags));
165ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler));
984263bc 166ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
984263bc 167ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_eflags));
984263bc
MD
168ASSYM(ENOENT, ENOENT);
169ASSYM(EFAULT, EFAULT);
170ASSYM(ENAMETOOLONG, ENAMETOOLONG);
171ASSYM(MAXPATHLEN, MAXPATHLEN);
172ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));
173ASSYM(BI_VERSION, offsetof(struct bootinfo, bi_version));
174ASSYM(BI_KERNELNAME, offsetof(struct bootinfo, bi_kernelname));
175ASSYM(BI_NFS_DISKLESS, offsetof(struct bootinfo, bi_nfs_diskless));
176ASSYM(BI_ENDCOMMON, offsetof(struct bootinfo, bi_endcommon));
177ASSYM(NFSDISKLESS_SIZE, sizeof(struct nfs_diskless));
178ASSYM(BI_SIZE, offsetof(struct bootinfo, bi_size));
179ASSYM(BI_SYMTAB, offsetof(struct bootinfo, bi_symtab));
180ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
181ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
85100692
MD
182
183ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread));
85100692 184ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid));
12e4aaff 185ASSYM(GD_CNT, offsetof(struct mdglobaldata, mi.gd_cnt));
a2a5ad0d 186ASSYM(GD_PRIVATE_TSS, offsetof(struct mdglobaldata, gd_private_tss));
ef0fdad1 187ASSYM(GD_INTR_NESTING_LEVEL, offsetof(struct mdglobaldata, mi.gd_intr_nesting_level));
235957ed 188ASSYM(GD_REQFLAGS, offsetof(struct mdglobaldata, mi.gd_reqflags));
984263bc 189
85100692 190ASSYM(GD_CURRENTLDT, offsetof(struct mdglobaldata, gd_currentldt));
984263bc 191
235957ed
MD
192ASSYM(RQF_IPIQ, RQF_IPIQ);
193ASSYM(RQF_INTPEND, RQF_INTPEND);
194ASSYM(RQF_AST_OWEUPC, RQF_AST_OWEUPC);
195ASSYM(RQF_AST_SIGNAL, RQF_AST_SIGNAL);
0a3f9b47
MD
196ASSYM(RQF_AST_USER_RESCHED, RQF_AST_USER_RESCHED);
197ASSYM(RQF_AST_LWKT_RESCHED, RQF_AST_LWKT_RESCHED);
a722be49 198ASSYM(RQF_AST_UPCALL, RQF_AST_UPCALL);
78ea5a2a 199ASSYM(RQF_TIMER, RQF_TIMER);
235957ed
MD
200ASSYM(RQF_AST_MASK, RQF_AST_MASK);
201
5f456c40 202ASSYM(FIRST_SOFTINT, FIRST_SOFTINT);
81c04d07 203ASSYM(MDGLOBALDATA_BASEALLOC_PAGES, MDGLOBALDATA_BASEALLOC_PAGES);
5f456c40 204
ef0fdad1
MD
205ASSYM(GD_FPENDING, offsetof(struct mdglobaldata, gd_fpending));
206ASSYM(GD_IPENDING, offsetof(struct mdglobaldata, gd_ipending));
5f456c40 207ASSYM(GD_SPENDING, offsetof(struct mdglobaldata, gd_spending));
85100692
MD
208ASSYM(GD_COMMON_TSS, offsetof(struct mdglobaldata, gd_common_tss));
209ASSYM(GD_COMMON_TSSD, offsetof(struct mdglobaldata, gd_common_tssd));
210ASSYM(GD_TSS_GDT, offsetof(struct mdglobaldata, gd_tss_gdt));
85100692 211ASSYM(GD_NPXTHREAD, offsetof(struct mdglobaldata, gd_npxthread));
a02705a9
MD
212ASSYM(GD_FPU_LOCK, offsetof(struct mdglobaldata, gd_fpu_lock));
213ASSYM(GD_SAVEFPU, offsetof(struct mdglobaldata, gd_savefpu));
85100692
MD
214ASSYM(GD_OTHER_CPUS, offsetof(struct mdglobaldata, gd_other_cpus));
215ASSYM(GD_SS_EFLAGS, offsetof(struct mdglobaldata, gd_ss_eflags));
216ASSYM(GD_CMAP1, offsetof(struct mdglobaldata, gd_CMAP1));
217ASSYM(GD_CMAP2, offsetof(struct mdglobaldata, gd_CMAP2));
218ASSYM(GD_CMAP3, offsetof(struct mdglobaldata, gd_CMAP3));
219ASSYM(GD_PMAP1, offsetof(struct mdglobaldata, gd_PMAP1));
220ASSYM(GD_CADDR1, offsetof(struct mdglobaldata, gd_CADDR1));
221ASSYM(GD_CADDR2, offsetof(struct mdglobaldata, gd_CADDR2));
222ASSYM(GD_CADDR3, offsetof(struct mdglobaldata, gd_CADDR3));
223ASSYM(GD_PADDR1, offsetof(struct mdglobaldata, gd_PADDR1));
17a9f566 224
984263bc 225ASSYM(PS_IDLESTACK, offsetof(struct privatespace, idlestack));
17a9f566 226ASSYM(PS_IDLESTACK_PAGE, offsetof(struct privatespace, idlestack) / PAGE_SIZE);
984263bc 227ASSYM(PS_IDLESTACK_TOP, sizeof(struct privatespace));
8ad65e08 228ASSYM(PS_SIZEOF, sizeof(struct privatespace));
984263bc
MD
229
230ASSYM(KCSEL, GSEL(GCODE_SEL, SEL_KPL));
231ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL));
984263bc 232ASSYM(KPSEL, GSEL(GPRIV_SEL, SEL_KPL));
984263bc
MD
233
234ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL));
984263bc 235ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame));
3d911e0a
SZ
236
237#ifdef SMP
238ASSYM(IOAPIC_IM_ADDR, offsetof(struct apic_intmapinfo, apic_address));
239ASSYM(IOAPIC_IM_ENTIDX, offsetof(struct apic_intmapinfo, redirindex));
0f546930 240ASSYM(IOAPIC_IM_FLAGS, offsetof(struct apic_intmapinfo, flags));
3d911e0a 241ASSYM(IOAPIC_IM_SIZE, sizeof(struct apic_intmapinfo));
0f546930
SZ
242ASSYM(IOAPIC_IM_SZSHIFT, IOAPIC_IM_SZSHIFT);
243ASSYM(IOAPIC_IM_FLAG_LEVEL, IOAPIC_IM_FLAG_LEVEL);
ea689d1c 244ASSYM(IOAPIC_IM_FLAG_MASKED, IOAPIC_IM_FLAG_MASKED);
3d911e0a 245#endif