2 * Copyright (c) 1982, 1990 The Regents of the University of California.
5 * This code is derived from software contributed to Berkeley by
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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.
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
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 $
38 * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.15 2003/06/27 20:27:15 dillon Exp $
41 #include "opt_user_ldt.h"
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <sys/assym.h>
50 #include <sys/errno.h>
51 #include <sys/mount.h>
52 #include <sys/socket.h>
53 #include <sys/resourcevar.h>
54 #include <machine/frame.h>
55 #include <machine/bootinfo.h>
56 #include <machine/tss.h>
57 #include <sys/vmmeter.h>
59 #include <vm/vm_param.h>
61 #include <vm/vm_map.h>
64 #include <netinet/in.h>
65 #include <nfs/nfsv2.h>
66 #include <nfs/rpcv2.h>
68 #include <nfs/nfsdiskless.h>
70 #include <machine/apic.h>
72 #include <machine/segments.h>
73 #include <machine/sigframe.h>
74 #include <machine/vm86.h>
76 ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
77 ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
78 ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
79 ASSYM(P_ADDR, offsetof(struct proc, p_addr));
80 ASSYM(P_STAT, offsetof(struct proc, p_stat));
81 ASSYM(P_THREAD, offsetof(struct proc, p_thread));
83 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
84 ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
85 ASSYM(TD_SP, offsetof(struct thread, td_sp));
86 ASSYM(TD_PRI, offsetof(struct thread, td_pri));
87 ASSYM(TD_MACH, offsetof(struct thread, td_mach));
88 ASSYM(TD_WCHAN, offsetof(struct thread, td_wchan));
89 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
90 ASSYM(TDF_EXITED, TDF_EXITED);
92 ASSYM(RW_OWNER, offsetof(struct lwkt_rwlock, rw_owner));
94 ASSYM(MTD_CPL, offsetof(struct mi_thread, mtd_cpl));
96 ASSYM(TDPRI_CRIT, TDPRI_CRIT);
99 ASSYM(P_ONCPU, offsetof(struct proc, p_oncpu));
100 ASSYM(P_LASTCPU, offsetof(struct proc, p_lastcpu));
103 ASSYM(SSLEEP, SSLEEP);
105 ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
106 ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
107 ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
108 ASSYM(UPAGES, UPAGES);
109 ASSYM(PAGE_SIZE, PAGE_SIZE);
110 ASSYM(NPTEPG, NPTEPG);
111 ASSYM(NPDEPG, NPDEPG);
112 ASSYM(PDESIZE, PDESIZE);
113 ASSYM(PTESIZE, PTESIZE);
114 ASSYM(PAGE_SHIFT, PAGE_SHIFT);
115 ASSYM(PAGE_MASK, PAGE_MASK);
116 ASSYM(PDRSHIFT, PDRSHIFT);
117 ASSYM(USRSTACK, USRSTACK);
118 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
119 ASSYM(KERNBASE, KERNBASE);
120 ASSYM(MCLBYTES, MCLBYTES);
121 ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3));
122 ASSYM(PCB_EDI, offsetof(struct pcb, pcb_edi));
123 ASSYM(PCB_ESI, offsetof(struct pcb, pcb_esi));
124 ASSYM(PCB_EBP, offsetof(struct pcb, pcb_ebp));
125 ASSYM(PCB_ESP, offsetof(struct pcb, pcb_esp));
126 ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx));
127 ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip));
128 ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0));
131 ASSYM(PCB_USERLDT, offsetof(struct pcb, pcb_ldt));
134 ASSYM(PCB_GS, offsetof(struct pcb, pcb_gs));
135 ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0));
136 ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1));
137 ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2));
138 ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3));
139 ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6));
140 ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7));
141 ASSYM(PCB_DBREGS, PCB_DBREGS);
142 ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext));
145 ASSYM(PCB_MPNEST, offsetof(struct pcb, pcb_mpnest));
148 ASSYM(PCB_SPARE, offsetof(struct pcb, __pcb_spare));
149 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
150 ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save));
151 ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu));
152 ASSYM(PCB_SAVE87_SIZE, sizeof(struct save87));
153 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
155 ASSYM(PCB_SIZE, sizeof(struct pcb));
157 ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
158 ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
159 ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
160 ASSYM(TF_EFLAGS, offsetof(struct trapframe, tf_eflags));
161 ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler));
162 ASSYM(SIGF_SC, offsetof(struct osigframe, sf_siginfo.si_sc));
163 ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
164 ASSYM(SC_PS, offsetof(struct osigcontext, sc_ps));
165 ASSYM(SC_FS, offsetof(struct osigcontext, sc_fs));
166 ASSYM(SC_GS, offsetof(struct osigcontext, sc_gs));
167 ASSYM(SC_TRAPNO, offsetof(struct osigcontext, sc_trapno));
168 ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_eflags));
169 ASSYM(UC_GS, offsetof(ucontext_t, uc_mcontext.mc_gs));
170 ASSYM(B_READ, B_READ);
171 ASSYM(ENOENT, ENOENT);
172 ASSYM(EFAULT, EFAULT);
173 ASSYM(ENAMETOOLONG, ENAMETOOLONG);
174 ASSYM(MAXPATHLEN, MAXPATHLEN);
175 ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));
176 ASSYM(BI_VERSION, offsetof(struct bootinfo, bi_version));
177 ASSYM(BI_KERNELNAME, offsetof(struct bootinfo, bi_kernelname));
178 ASSYM(BI_NFS_DISKLESS, offsetof(struct bootinfo, bi_nfs_diskless));
179 ASSYM(BI_ENDCOMMON, offsetof(struct bootinfo, bi_endcommon));
180 ASSYM(NFSDISKLESS_SIZE, sizeof(struct nfs_diskless));
181 ASSYM(BI_SIZE, offsetof(struct bootinfo, bi_size));
182 ASSYM(BI_SYMTAB, offsetof(struct bootinfo, bi_symtab));
183 ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
184 ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
185 ASSYM(GD_SIZEOF, sizeof(struct globaldata));
186 ASSYM(GD_CURTHREAD, offsetof(struct globaldata, gd_curthread));
187 ASSYM(GD_NPXTHREAD, offsetof(struct globaldata, gd_npxthread));
188 ASSYM(GD_COMMON_TSS, offsetof(struct globaldata, gd_common_tss));
189 ASSYM(GD_IDLETHREAD, offsetof(struct globaldata, gd_idlethread));
190 ASSYM(GD_COMMON_TSSD, offsetof(struct globaldata, gd_common_tssd));
191 ASSYM(GD_TSS_GDT, offsetof(struct globaldata, gd_tss_gdt));
192 ASSYM(GD_ASTPENDING, offsetof(struct globaldata, gd_astpending));
193 ASSYM(GD_REQPRI, offsetof(struct globaldata, gd_reqpri));
196 ASSYM(GD_CURRENTLDT, offsetof(struct globaldata, gd_currentldt));
200 ASSYM(GD_CPUID, offsetof(struct globaldata, gd_cpuid));
201 ASSYM(GD_CPU_LOCKID, offsetof(struct globaldata, gd_cpu_lockid));
202 ASSYM(GD_OTHER_CPUS, offsetof(struct globaldata, gd_other_cpus));
203 ASSYM(GD_SS_EFLAGS, offsetof(struct globaldata, gd_ss_eflags));
204 ASSYM(GD_INSIDE_INTR, offsetof(struct globaldata, gd_inside_intr));
205 ASSYM(GD_PRV_CMAP1, offsetof(struct globaldata, gd_prv_CMAP1));
206 ASSYM(GD_PRV_CMAP2, offsetof(struct globaldata, gd_prv_CMAP2));
207 ASSYM(GD_PRV_CMAP3, offsetof(struct globaldata, gd_prv_CMAP3));
208 ASSYM(GD_PRV_PMAP1, offsetof(struct globaldata, gd_prv_PMAP1));
209 ASSYM(GD_PRV_CADDR1, offsetof(struct globaldata, gd_prv_CADDR1));
210 ASSYM(GD_PRV_CADDR2, offsetof(struct globaldata, gd_prv_CADDR2));
211 ASSYM(GD_PRV_CADDR3, offsetof(struct globaldata, gd_prv_CADDR3));
212 ASSYM(GD_PRV_PADDR1, offsetof(struct globaldata, gd_prv_PADDR1));
214 ASSYM(PS_IDLESTACK, offsetof(struct privatespace, idlestack));
215 ASSYM(PS_IDLESTACK_TOP, sizeof(struct privatespace));
216 ASSYM(PS_SIZEOF, sizeof(struct privatespace));
218 ASSYM(KCSEL, GSEL(GCODE_SEL, SEL_KPL));
219 ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL));
222 ASSYM(KPSEL, GSEL(GPRIV_SEL, SEL_KPL));
225 ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL));
226 ASSYM(GPROC0_SEL, GPROC0_SEL);
227 ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame));
230 #include <machine/bus.h>
232 ASSYM(BUS_SPACE_HANDLE_BASE, offsetof(struct bus_space_handle, bsh_base));
233 ASSYM(BUS_SPACE_HANDLE_IAT, offsetof(struct bus_space_handle, bsh_iat));