1 /*- 2 * Copyright (c) 1982, 1990 The Regents of the University of California. 3 * Copyright (c) 2008 The DragonFly Project. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 34 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ 35 * $DragonFly: src/sys/platform/pc64/amd64/genassym.c,v 1.2 2008/08/29 17:07:10 dillon Exp $ 36 */ 37 38 #include <sys/param.h> 39 #include <sys/systm.h> 40 #include <sys/assym.h> 41 #include <sys/interrupt.h> 42 #include <sys/buf.h> 43 #include <sys/proc.h> 44 #include <sys/errno.h> 45 #include <sys/mount.h> 46 #include <sys/socket.h> 47 #include <sys/lock.h> 48 #include <sys/resourcevar.h> 49 #include <machine/frame.h> 50 /*#include <machine/bootinfo.h>*/ 51 #include <machine/tss.h> 52 #include <sys/vmmeter.h> 53 #include <sys/machintr.h> 54 #include <vm/vm.h> 55 #include <vm/vm_param.h> 56 #include <vm/pmap.h> 57 #include <vm/vm_map.h> 58 #include <net/if.h> 59 #include <netinet/in.h> 60 #include <vfs/nfs/nfsv2.h> 61 #include <vfs/nfs/rpcv2.h> 62 #include <vfs/nfs/nfs.h> 63 #include <vfs/nfs/nfsdiskless.h> 64 65 #include <machine/segments.h> 66 #include <machine/sigframe.h> 67 #include <machine/globaldata.h> 68 #include <machine/specialreg.h> 69 #include <machine/pcb.h> 70 #include <machine/smp.h> 71 72 ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); 73 ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); 74 ASSYM(PM_ACTIVE_LOCK, offsetof(struct pmap, pm_active_lock)); 75 76 ASSYM(LWP_VMSPACE, offsetof(struct lwp, lwp_vmspace)); 77 ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread)); 78 ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid)); 79 ASSYM(GD_CPUMASK, offsetof(struct mdglobaldata, mi.gd_cpumask)); 80 ASSYM(GD_OTHER_CPUS, offsetof(struct mdglobaldata, mi.gd_other_cpus)); 81 82 ASSYM(CPULOCK_EXCLBIT, CPULOCK_EXCLBIT); 83 ASSYM(CPULOCK_EXCL, CPULOCK_EXCL); 84 ASSYM(CPULOCK_INCR, CPULOCK_INCR); 85 ASSYM(CPULOCK_CNTMASK, CPULOCK_CNTMASK); 86 87 ASSYM(PCB_R15, offsetof(struct pcb, pcb_r15)); 88 ASSYM(PCB_R14, offsetof(struct pcb, pcb_r14)); 89 ASSYM(PCB_R13, offsetof(struct pcb, pcb_r13)); 90 ASSYM(PCB_R12, offsetof(struct pcb, pcb_r12)); 91 ASSYM(PCB_RBP, offsetof(struct pcb, pcb_rbp)); 92 ASSYM(PCB_RSP, offsetof(struct pcb, pcb_rsp)); 93 ASSYM(PCB_RBX, offsetof(struct pcb, pcb_rbx)); 94 ASSYM(PCB_RIP, offsetof(struct pcb, pcb_rip)); 95 ASSYM(TSS_RSP0, offsetof(struct x86_64tss, tss_rsp0)); 96 97 ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0)); 98 ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1)); 99 ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2)); 100 ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3)); 101 ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6)); 102 ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7)); 103 ASSYM(PCB_DBREGS, PCB_DBREGS); 104 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); 105 ASSYM(PCB_FSBASE, offsetof(struct pcb, pcb_fsbase)); 106 ASSYM(PCB_GSBASE, offsetof(struct pcb, pcb_gsbase)); 107 ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save)); 108 109 ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu)); 110 ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler)); 111 ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); 112 113 ASSYM(TD_LWP, offsetof(struct thread, td_lwp)); 114 ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); 115 ASSYM(TD_SP, offsetof(struct thread, td_sp)); 116 ASSYM(TD_PRI, offsetof(struct thread, td_pri)); 117 ASSYM(TD_CRITCOUNT, offsetof(struct thread, td_critcount)); 118 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); 119 ASSYM(TD_SAVEFPU, offsetof(struct thread, td_savefpu)); 120 ASSYM(TDF_RUNNING, TDF_RUNNING); 121 ASSYM(GD_NPXTHREAD, offsetof(struct mdglobaldata, gd_npxthread)); 122