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: releng/5.1/sys/i386/i386/genassym.c 113621 2003-04-17 22:17:28Z jhb $
38 */
39
40 #include "opt_compat.h"
41 #include "opt_kstack_pages.h"
42
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/assym.h>
46 #include <sys/bio.h>
47 #include <sys/buf.h>
48 #include <sys/proc.h>
49 #include <sys/errno.h>
50 #include <sys/mount.h>
51 #include <sys/mutex.h>
52 #include <sys/socket.h>
53 #include <sys/resourcevar.h>
54 #include <sys/ucontext.h>
55 #include <sys/user.h>
56 #include <machine/bootinfo.h>
57 #include <machine/tss.h>
58 #include <sys/vmmeter.h>
59 #include <vm/vm.h>
60 #include <vm/vm_param.h>
61 #include <vm/pmap.h>
62 #include <vm/vm_map.h>
63 #include <sys/user.h>
64 #include <sys/proc.h>
65 #include <net/if.h>
66 #include <netinet/in.h>
67 #include <nfs/nfsproto.h>
68 #include <nfs/rpcv2.h>
69 #include <nfsclient/nfs.h>
70 #include <nfsclient/nfsdiskless.h>
71 #ifdef SMP
72 #include <machine/apic.h>
73 #endif
74 #include <machine/cpu.h>
75 #include <machine/sigframe.h>
76 #include <machine/vm86.h>
77 #include <machine/proc.h>
78
79 ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
80 ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
81 ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
82 ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
83 ASSYM(P_UAREA, offsetof(struct proc, p_uarea));
84
85 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
86 ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
87 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
88 ASSYM(TD_INTR_NESTING_LEVEL, offsetof(struct thread, td_intr_nesting_level));
89 ASSYM(TD_CRITNEST, offsetof(struct thread, td_critnest));
90 ASSYM(TD_SWITCHIN, offsetof(struct thread, td_switchin));
91 ASSYM(TD_MD, offsetof(struct thread, td_md));
92
93 ASSYM(P_MD, offsetof(struct proc, p_md));
94 ASSYM(MD_LDT, offsetof(struct mdproc, md_ldt));
95
96 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
97 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
98
99 ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
100 ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
101 ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
102 /* ASSYM(UPAGES, UPAGES);*/
103 ASSYM(UAREA_PAGES, UAREA_PAGES);
104 ASSYM(KSTACK_PAGES, KSTACK_PAGES);
105 ASSYM(PAGE_SIZE, PAGE_SIZE);
106 ASSYM(NPTEPG, NPTEPG);
107 ASSYM(NPDEPG, NPDEPG);
108 ASSYM(NPDEPTD, NPDEPTD);
109 ASSYM(NPGPTD, NPGPTD);
110 ASSYM(PDESIZE, sizeof(pd_entry_t));
111 ASSYM(PTESIZE, sizeof(pt_entry_t));
112 ASSYM(PTESHIFT, PTESHIFT);
113 ASSYM(PAGE_SHIFT, PAGE_SHIFT);
114 ASSYM(PAGE_MASK, PAGE_MASK);
115 ASSYM(PDRSHIFT, PDRSHIFT);
116 ASSYM(USRSTACK, USRSTACK);
117 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
118 ASSYM(KERNBASE, KERNBASE);
119 ASSYM(MCLBYTES, MCLBYTES);
120 ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3));
121 ASSYM(PCB_EDI, offsetof(struct pcb, pcb_edi));
122 ASSYM(PCB_ESI, offsetof(struct pcb, pcb_esi));
123 ASSYM(PCB_EBP, offsetof(struct pcb, pcb_ebp));
124 ASSYM(PCB_ESP, offsetof(struct pcb, pcb_esp));
125 ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx));
126 ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip));
127 ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0));
128
129 ASSYM(PCB_GS, offsetof(struct pcb, pcb_gs));
130 ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0));
131 ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1));
132 ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2));
133 ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3));
134 ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6));
135 ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7));
136 ASSYM(PCB_PSL, offsetof(struct pcb, pcb_psl));
137 ASSYM(PCB_DBREGS, PCB_DBREGS);
138 ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext));
139
140 ASSYM(PCB_SPARE, offsetof(struct pcb, __pcb_spare));
141 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
142 ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save));
143 ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu));
144 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
145
146 ASSYM(PCB_SIZE, sizeof(struct pcb));
147 ASSYM(PCB_VM86CALL, PCB_VM86CALL);
148
149 ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
150 ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
151 ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
152 ASSYM(TF_EFLAGS, offsetof(struct trapframe, tf_eflags));
153 ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler));
154 #ifdef COMPAT_43
155 ASSYM(SIGF_SC, offsetof(struct osigframe, sf_siginfo.si_sc));
156 #endif
157 ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
158 #ifdef COMPAT_FREEBSD4
159 ASSYM(SIGF_UC4, offsetof(struct sigframe4, sf_uc));
160 #endif
161 #ifdef COMPAT_43
162 ASSYM(SC_PS, offsetof(struct osigcontext, sc_ps));
163 ASSYM(SC_FS, offsetof(struct osigcontext, sc_fs));
164 ASSYM(SC_GS, offsetof(struct osigcontext, sc_gs));
165 ASSYM(SC_TRAPNO, offsetof(struct osigcontext, sc_trapno));
166 #endif
167 #ifdef COMPAT_FREEBSD4
168 ASSYM(UC4_EFLAGS, offsetof(struct ucontext4, uc_mcontext.mc_eflags));
169 ASSYM(UC4_GS, offsetof(struct ucontext4, uc_mcontext.mc_gs));
170 #endif
171 ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_eflags));
172 ASSYM(UC_GS, offsetof(ucontext_t, uc_mcontext.mc_gs));
173 ASSYM(ENOENT, ENOENT);
174 ASSYM(EFAULT, EFAULT);
175 ASSYM(ENAMETOOLONG, ENAMETOOLONG);
176 ASSYM(MAXPATHLEN, MAXPATHLEN);
177 ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));
178 ASSYM(BI_VERSION, offsetof(struct bootinfo, bi_version));
179 ASSYM(BI_KERNELNAME, offsetof(struct bootinfo, bi_kernelname));
180 ASSYM(BI_NFS_DISKLESS, offsetof(struct bootinfo, bi_nfs_diskless));
181 ASSYM(BI_ENDCOMMON, offsetof(struct bootinfo, bi_endcommon));
182 ASSYM(NFSDISKLESS_SIZE, sizeof(struct nfs_diskless));
183 ASSYM(BI_SIZE, offsetof(struct bootinfo, bi_size));
184 ASSYM(BI_SYMTAB, offsetof(struct bootinfo, bi_symtab));
185 ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
186 ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
187 ASSYM(PC_SIZEOF, sizeof(struct pcpu));
188 ASSYM(PC_PRVSPACE, offsetof(struct pcpu, pc_prvspace));
189 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
190 ASSYM(PC_INT_PENDING, offsetof(struct pcpu, pc_int_pending));
191 ASSYM(PC_IPENDING, offsetof(struct pcpu, pc_ipending));
192 ASSYM(PC_FPENDING, offsetof(struct pcpu, pc_fpending));
193 ASSYM(PC_SPENDING, offsetof(struct pcpu, pc_spending));
194 ASSYM(PC_FPCURTHREAD, offsetof(struct pcpu, pc_fpcurthread));
195 ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread));
196 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
197 ASSYM(PC_COMMON_TSS, offsetof(struct pcpu, pc_common_tss));
198 ASSYM(PC_COMMON_TSSD, offsetof(struct pcpu, pc_common_tssd));
199 ASSYM(PC_TSS_GDT, offsetof(struct pcpu, pc_tss_gdt));
200 ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentldt));
201 ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
202
203 #ifdef SMP
204 ASSYM(LA_VER, offsetof(struct LAPIC, version));
205 ASSYM(LA_TPR, offsetof(struct LAPIC, tpr));
206 ASSYM(LA_EOI, offsetof(struct LAPIC, eoi));
207 ASSYM(LA_SVR, offsetof(struct LAPIC, svr));
208 ASSYM(LA_ICR_LO, offsetof(struct LAPIC, icr_lo));
209 ASSYM(LA_ICR_HI, offsetof(struct LAPIC, icr_hi));
210 #endif
211
212 ASSYM(KCSEL, GSEL(GCODE_SEL, SEL_KPL));
213 ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL));
214 ASSYM(KPSEL, GSEL(GPRIV_SEL, SEL_KPL));
215
216 ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL));
217 ASSYM(GPROC0_SEL, GPROC0_SEL);
218 ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame));
219
220 ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));
221 ASSYM(MTX_RECURSECNT, offsetof(struct mtx, mtx_recurse));
222
223 #ifdef PC98
224 #include <machine/bus.h>
225
226 ASSYM(BUS_SPACE_HANDLE_BASE, offsetof(struct bus_space_handle, bsh_base));
227 ASSYM(BUS_SPACE_HANDLE_IAT, offsetof(struct bus_space_handle, bsh_iat));
228 #endif
Cache object: 165a069b811b00b8dc0aca72f7c1dd15
|