| Commit | Line | Data |
|---|---|---|
| 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 $ | |
| 38 | */ | |
| 39 | ||
| 984263bc MD |
40 | #include <sys/param.h> |
| 41 | #include <sys/systm.h> | |
| 42 | #include <sys/assym.h> | |
| 5f456c40 | 43 | #include <sys/interrupt.h> |
| 984263bc MD |
44 | #include <sys/buf.h> |
| 45 | #include <sys/proc.h> | |
| 46 | #include <sys/errno.h> | |
| 47 | #include <sys/mount.h> | |
| 48 | #include <sys/socket.h> | |
| 8a8d5d85 | 49 | #include <sys/lock.h> |
| 984263bc MD |
50 | #include <sys/resourcevar.h> |
| 51 | #include <machine/frame.h> | |
| 52 | #include <machine/bootinfo.h> | |
| 53 | #include <machine/tss.h> | |
| 54 | #include <sys/vmmeter.h> | |
| 46b26c5e | 55 | #include <sys/machintr.h> |
| 984263bc MD |
56 | #include <vm/vm.h> |
| 57 | #include <vm/vm_param.h> | |
| 58 | #include <vm/pmap.h> | |
| 59 | #include <vm/vm_map.h> | |
| 60 | #include <sys/user.h> | |
| 61 | #include <net/if.h> | |
| 62 | #include <netinet/in.h> | |
| 1f2de5d4 MD |
63 | #include <vfs/nfs/nfsv2.h> |
| 64 | #include <vfs/nfs/rpcv2.h> | |
| 65 | #include <vfs/nfs/nfs.h> | |
| 66 | #include <vfs/nfs/nfsdiskless.h> | |
| a9295349 | 67 | #include <machine_base/apic/apicreg.h> |
| fa6eddaf | 68 | #include <machine_base/apic/ioapic_abi.h> |
| 984263bc MD |
69 | #include <machine/segments.h> |
| 70 | #include <machine/sigframe.h> | |
| 984263bc | 71 | #include <machine/vm86.h> |
| 85100692 | 72 | #include <machine/globaldata.h> |
| c2fb025d | 73 | #include <machine/pmap.h> |
| 984263bc MD |
74 | |
| 75 | ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); | |
| 76 | ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); | |
| 77 | ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); | |
| 84b592ba | 78 | |
| 287ebb09 MD |
79 | ASSYM(LWP_VMSPACE, offsetof(struct lwp, lwp_vmspace)); |
| 80 | ||
| 84b592ba | 81 | ASSYM(TD_PROC, offsetof(struct thread, td_proc)); |
| 287ebb09 | 82 | ASSYM(TD_LWP, offsetof(struct thread, td_lwp)); |
| b7c628e4 | 83 | ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); |
| 8ad65e08 | 84 | ASSYM(TD_SP, offsetof(struct thread, td_sp)); |
| f1d1c3fa MD |
85 | ASSYM(TD_PRI, offsetof(struct thread, td_pri)); |
| 86 | ASSYM(TD_MACH, offsetof(struct thread, td_mach)); | |
| 0cfcada1 | 87 | ASSYM(TD_WCHAN, offsetof(struct thread, td_wchan)); |
| 46a3f46d | 88 | ASSYM(TD_NEST_COUNT, offsetof(struct thread, td_nest_count)); |
| f9235b6d | 89 | ASSYM(TD_CRITCOUNT, offsetof(struct thread, td_critcount)); |
| 99df837e | 90 | ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); |
| d9eea1a5 | 91 | ASSYM(TDF_RUNNING, TDF_RUNNING); |
| aad81e48 MD |
92 | ASSYM(TDF_USINGFP, TDF_USINGFP); |
| 93 | ASSYM(TDF_KERNELFP, TDF_KERNELFP); | |
| 35b2edcb | 94 | ASSYM(MACHINTR_INTREN, offsetof(struct machintr_abi, intr_enable)); |
| ae8050a4 | 95 | |
| 65d6ce10 | 96 | ASSYM(TD_SAVEFPU, offsetof(struct thread, td_mach) + offsetof(struct md_thread, mtd_savefpu)); |
| f1d1c3fa | 97 | |
| 96728c05 | 98 | ASSYM(TDPRI_INT_SUPPORT, TDPRI_INT_SUPPORT); |
| c2fb025d | 99 | ASSYM(CPUMASK_LOCK, CPUMASK_LOCK); |
| da23a592 | 100 | ASSYM(CPUMASK_BIT, CPUMASK_BIT); |
| 984263bc | 101 | |
| 984263bc MD |
102 | ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap)); |
| 103 | ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall)); | |
| a64ba182 | 104 | ASSYM(V_SENDSYS, offsetof(struct vmmeter, v_sendsys)); |
| 7062f5b4 | 105 | ASSYM(V_WAITSYS, offsetof(struct vmmeter, v_waitsys)); |
| 984263bc | 106 | ASSYM(V_INTR, offsetof(struct vmmeter, v_intr)); |
| b785701b SZ |
107 | ASSYM(V_IPI, offsetof(struct vmmeter, v_ipi)); |
| 108 | ASSYM(V_TIMER, offsetof(struct vmmeter, v_timer)); | |
| 545a1cd3 | 109 | ASSYM(V_FORWARDED_INTS, offsetof(struct vmmeter, v_forwarded_ints)); |
| 8a8d5d85 MD |
110 | ASSYM(V_FORWARDED_HITS, offsetof(struct vmmeter, v_forwarded_hits)); |
| 111 | ASSYM(V_FORWARDED_MISSES, offsetof(struct vmmeter, v_forwarded_misses)); | |
| 984263bc MD |
112 | ASSYM(UPAGES, UPAGES); |
| 113 | ASSYM(PAGE_SIZE, PAGE_SIZE); | |
| 114 | ASSYM(NPTEPG, NPTEPG); | |
| 115 | ASSYM(NPDEPG, NPDEPG); | |
| 116 | ASSYM(PDESIZE, PDESIZE); | |
| 117 | ASSYM(PTESIZE, PTESIZE); | |
| c1692ddf | 118 | ASSYM(SMP_MAXCPU, SMP_MAXCPU); |
| 984263bc MD |
119 | ASSYM(PAGE_SHIFT, PAGE_SHIFT); |
| 120 | ASSYM(PAGE_MASK, PAGE_MASK); | |
| 121 | ASSYM(PDRSHIFT, PDRSHIFT); | |
| 122 | ASSYM(USRSTACK, USRSTACK); | |
| 88181b08 | 123 | ASSYM(VM_MAX_USER_ADDRESS, VM_MAX_USER_ADDRESS); |
| 984263bc MD |
124 | ASSYM(KERNBASE, KERNBASE); |
| 125 | ASSYM(MCLBYTES, MCLBYTES); | |
| 126 | ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3)); | |
| 127 | ASSYM(PCB_EDI, offsetof(struct pcb, pcb_edi)); | |
| 128 | ASSYM(PCB_ESI, offsetof(struct pcb, pcb_esi)); | |
| 129 | ASSYM(PCB_EBP, offsetof(struct pcb, pcb_ebp)); | |
| 130 | ASSYM(PCB_ESP, offsetof(struct pcb, pcb_esp)); | |
| 131 | ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx)); | |
| 132 | ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip)); | |
| 133 | ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0)); | |
| 134 | ||
| 984263bc | 135 | ASSYM(PCB_USERLDT, offsetof(struct pcb, pcb_ldt)); |
| 984263bc | 136 | |
| 984263bc MD |
137 | ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0)); |
| 138 | ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1)); | |
| 139 | ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2)); | |
| 140 | ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3)); | |
| 141 | ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6)); | |
| 142 | ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7)); | |
| 143 | ASSYM(PCB_DBREGS, PCB_DBREGS); | |
| 144 | ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext)); | |
| 145 | ||
| 984263bc MD |
146 | ASSYM(PCB_SPARE, offsetof(struct pcb, __pcb_spare)); |
| 147 | ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); | |
| 148 | ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save)); | |
| 149 | ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu)); | |
| 150 | ASSYM(PCB_SAVE87_SIZE, sizeof(struct save87)); | |
| 151 | ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); | |
| 93ad6da2 | 152 | ASSYM(PCB_ONFAULT_SP, offsetof(struct pcb, pcb_onfault_sp)); |
| 984263bc | 153 | |
| 984263bc | 154 | ASSYM(PCB_SIZE, sizeof(struct pcb)); |
| 984263bc | 155 | |
| 4e7c41c5 | 156 | ASSYM(TF_XFLAGS, offsetof(struct trapframe, tf_xflags)); |
| 984263bc MD |
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)); | |
| 984263bc | 162 | ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); |
| 984263bc | 163 | ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_eflags)); |
| 984263bc MD |
164 | ASSYM(ENOENT, ENOENT); |
| 165 | ASSYM(EFAULT, EFAULT); | |
| 166 | ASSYM(ENAMETOOLONG, ENAMETOOLONG); | |
| 167 | ASSYM(MAXPATHLEN, MAXPATHLEN); | |
| 168 | ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo)); | |
| 169 | ASSYM(BI_VERSION, offsetof(struct bootinfo, bi_version)); | |
| 170 | ASSYM(BI_KERNELNAME, offsetof(struct bootinfo, bi_kernelname)); | |
| 171 | ASSYM(BI_NFS_DISKLESS, offsetof(struct bootinfo, bi_nfs_diskless)); | |
| 172 | ASSYM(BI_ENDCOMMON, offsetof(struct bootinfo, bi_endcommon)); | |
| 173 | ASSYM(NFSDISKLESS_SIZE, sizeof(struct nfs_diskless)); | |
| 174 | ASSYM(BI_SIZE, offsetof(struct bootinfo, bi_size)); | |
| 175 | ASSYM(BI_SYMTAB, offsetof(struct bootinfo, bi_symtab)); | |
| 176 | ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab)); | |
| 177 | ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend)); | |
| 85100692 MD |
178 | |
| 179 | ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread)); | |
| 85100692 | 180 | ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid)); |
| c2fb025d | 181 | ASSYM(GD_CPUMASK, offsetof(struct mdglobaldata, mi.gd_cpumask)); |
| 12e4aaff | 182 | ASSYM(GD_CNT, offsetof(struct mdglobaldata, mi.gd_cnt)); |
| a2a5ad0d | 183 | ASSYM(GD_PRIVATE_TSS, offsetof(struct mdglobaldata, gd_private_tss)); |
| ef0fdad1 | 184 | ASSYM(GD_INTR_NESTING_LEVEL, offsetof(struct mdglobaldata, mi.gd_intr_nesting_level)); |
| 235957ed | 185 | ASSYM(GD_REQFLAGS, offsetof(struct mdglobaldata, mi.gd_reqflags)); |
| 984263bc | 186 | |
| 85100692 | 187 | ASSYM(GD_CURRENTLDT, offsetof(struct mdglobaldata, gd_currentldt)); |
| 984263bc | 188 | |
| 235957ed MD |
189 | ASSYM(RQF_IPIQ, RQF_IPIQ); |
| 190 | ASSYM(RQF_INTPEND, RQF_INTPEND); | |
| 191 | ASSYM(RQF_AST_OWEUPC, RQF_AST_OWEUPC); | |
| 192 | ASSYM(RQF_AST_SIGNAL, RQF_AST_SIGNAL); | |
| 0a3f9b47 MD |
193 | ASSYM(RQF_AST_USER_RESCHED, RQF_AST_USER_RESCHED); |
| 194 | ASSYM(RQF_AST_LWKT_RESCHED, RQF_AST_LWKT_RESCHED); | |
| 78ea5a2a | 195 | ASSYM(RQF_TIMER, RQF_TIMER); |
| 235957ed MD |
196 | ASSYM(RQF_AST_MASK, RQF_AST_MASK); |
| 197 | ||
| 5f456c40 | 198 | ASSYM(FIRST_SOFTINT, FIRST_SOFTINT); |
| 81c04d07 | 199 | ASSYM(MDGLOBALDATA_BASEALLOC_PAGES, MDGLOBALDATA_BASEALLOC_PAGES); |
| 5f456c40 | 200 | |
| c263294b | 201 | ASSYM(GD_IPENDING, offsetof(struct mdglobaldata, gd_ipending)); |
| 5f456c40 | 202 | ASSYM(GD_SPENDING, offsetof(struct mdglobaldata, gd_spending)); |
| 85100692 MD |
203 | ASSYM(GD_COMMON_TSS, offsetof(struct mdglobaldata, gd_common_tss)); |
| 204 | ASSYM(GD_COMMON_TSSD, offsetof(struct mdglobaldata, gd_common_tssd)); | |
| 205 | ASSYM(GD_TSS_GDT, offsetof(struct mdglobaldata, gd_tss_gdt)); | |
| 85100692 | 206 | ASSYM(GD_NPXTHREAD, offsetof(struct mdglobaldata, gd_npxthread)); |
| a02705a9 MD |
207 | ASSYM(GD_FPU_LOCK, offsetof(struct mdglobaldata, gd_fpu_lock)); |
| 208 | ASSYM(GD_SAVEFPU, offsetof(struct mdglobaldata, gd_savefpu)); | |
| da23a592 | 209 | ASSYM(GD_OTHER_CPUS, offsetof(struct mdglobaldata, mi.gd_other_cpus)); |
| 85100692 MD |
210 | ASSYM(GD_SS_EFLAGS, offsetof(struct mdglobaldata, gd_ss_eflags)); |
| 211 | ASSYM(GD_CMAP1, offsetof(struct mdglobaldata, gd_CMAP1)); | |
| 212 | ASSYM(GD_CMAP2, offsetof(struct mdglobaldata, gd_CMAP2)); | |
| 213 | ASSYM(GD_CMAP3, offsetof(struct mdglobaldata, gd_CMAP3)); | |
| 214 | ASSYM(GD_PMAP1, offsetof(struct mdglobaldata, gd_PMAP1)); | |
| 215 | ASSYM(GD_CADDR1, offsetof(struct mdglobaldata, gd_CADDR1)); | |
| 216 | ASSYM(GD_CADDR2, offsetof(struct mdglobaldata, gd_CADDR2)); | |
| 217 | ASSYM(GD_CADDR3, offsetof(struct mdglobaldata, gd_CADDR3)); | |
| 218 | ASSYM(GD_PADDR1, offsetof(struct mdglobaldata, gd_PADDR1)); | |
| 17a9f566 | 219 | |
| 984263bc | 220 | ASSYM(PS_IDLESTACK, offsetof(struct privatespace, idlestack)); |
| 17a9f566 | 221 | ASSYM(PS_IDLESTACK_PAGE, offsetof(struct privatespace, idlestack) / PAGE_SIZE); |
| 984263bc | 222 | ASSYM(PS_IDLESTACK_TOP, sizeof(struct privatespace)); |
| 8ad65e08 | 223 | ASSYM(PS_SIZEOF, sizeof(struct privatespace)); |
| 984263bc MD |
224 | |
| 225 | ASSYM(KCSEL, GSEL(GCODE_SEL, SEL_KPL)); | |
| 226 | ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL)); | |
| 984263bc | 227 | ASSYM(KPSEL, GSEL(GPRIV_SEL, SEL_KPL)); |
| 984263bc MD |
228 | |
| 229 | ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL)); | |
| 984263bc | 230 | ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame)); |
| 3d911e0a | 231 | |
| cb7d6921 SZ |
232 | ASSYM(LA_EOI, offsetof(struct LAPIC, eoi)); |
| 233 | ||
| 7a54dec9 SZ |
234 | ASSYM(IOAPIC_IRQI_ADDR, offsetof(struct ioapic_irqinfo, io_addr)); |
| 235 | ASSYM(IOAPIC_IRQI_IDX, offsetof(struct ioapic_irqinfo, io_idx)); | |
| 236 | ASSYM(IOAPIC_IRQI_FLAGS, offsetof(struct ioapic_irqinfo, io_flags)); | |
| 237 | ASSYM(IOAPIC_IRQI_SIZE, sizeof(struct ioapic_irqinfo)); | |
| 238 | ASSYM(IOAPIC_IRQI_SZSHIFT, IOAPIC_IRQI_SZSHIFT); | |
| 239 | ASSYM(IOAPIC_IRQI_FLAG_LEVEL, IOAPIC_IRQI_FLAG_LEVEL); | |
| 240 | ASSYM(IOAPIC_IRQI_FLAG_MASKED, IOAPIC_IRQI_FLAG_MASKED); |