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