Annotation of src/sys/arch/amd64/amd64/genassym.cf, Revision 1.5.14.3
1.5.14.3! ad 1: # $NetBSD: genassym.cf,v 1.5.14.2 2006/10/20 19:46:53 ad Exp $
1.1 fvdl 2:
3: #
4: # Copyright (c) 1998 The NetBSD Foundation, Inc.
5: # All rights reserved.
6: #
7: # This code is derived from software contributed to The NetBSD Foundation
8: # by Charles M. Hannum.
9: #
10: # Redistribution and use in source and binary forms, with or without
11: # modification, are permitted provided that the following conditions
12: # are met:
13: # 1. Redistributions of source code must retain the above copyright
14: # notice, this list of conditions and the following disclaimer.
15: # 2. Redistributions in binary form must reproduce the above copyright
16: # notice, this list of conditions and the following disclaimer in the
17: # documentation and/or other materials provided with the distribution.
18: # 3. All advertising materials mentioning features or use of this software
19: # must display the following acknowledgement:
20: # This product includes software developed by the NetBSD
21: # Foundation, Inc. and its contributors.
22: # 4. Neither the name of The NetBSD Foundation nor the names of its
23: # contributors may be used to endorse or promote products derived
24: # from this software without specific prior written permission.
25: #
26: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: # POSSIBILITY OF SUCH DAMAGE.
37: #
38:
39: #
40: # Copyright (c) 1982, 1990 The Regents of the University of California.
41: # All rights reserved.
42: #
43: # This code is derived from software contributed to Berkeley by
44: # William Jolitz.
45: #
46: # Redistribution and use in source and binary forms, with or without
47: # modification, are permitted provided that the following conditions
48: # are met:
49: # 1. Redistributions of source code must retain the above copyright
50: # notice, this list of conditions and the following disclaimer.
51: # 2. Redistributions in binary form must reproduce the above copyright
52: # notice, this list of conditions and the following disclaimer in the
53: # documentation and/or other materials provided with the distribution.
54: # 3. All advertising materials mentioning features or use of this software
55: # must display the following acknowledgement:
56: # This product includes software developed by the University of
57: # California, Berkeley and its contributors.
58: # 4. Neither the name of the University nor the names of its contributors
59: # may be used to endorse or promote products derived from this software
60: # without specific prior written permission.
61: #
62: # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63: # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65: # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66: # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67: # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68: # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69: # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70: # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71: # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72: # SUCH DAMAGE.
73: #
74: # @(#)genassym.c 5.11 (Berkeley) 5/10/91
75: #
76:
77: if defined(_KERNEL_OPT)
78: include "opt_compat_netbsd32.h"
1.5 manu 79: include "opt_compat_linux32.h"
1.1 fvdl 80: include "opt_multiprocessor.h"
81: endif
82:
1.5.14.1 ad 83: quote #define __MUTEX_PRIVATE
84: quote #define __RWLOCK_PRIVATE
85:
1.1 fvdl 86: include <sys/param.h>
87: include <sys/proc.h>
88: include <sys/resourcevar.h>
89: include <sys/device.h>
90: include <sys/user.h>
91: include <sys/mbuf.h>
1.5.14.1 ad 92: include <sys/mutex.h>
93: include <sys/rwlock.h>
1.5.14.2 ad 94: include <sys/cpu_data.h>
95:
1.1 fvdl 96: include <netinet/in.h>
97: include <netinet/in_systm.h>
98: include <netinet/ip.h>
99: include <netinet/ip_var.h>
100:
101: include <uvm/uvm.h>
102:
103: include <machine/trap.h>
104: include <machine/pmap.h>
105: include <machine/vmparam.h>
106: include <machine/intr.h>
107: include <machine/types.h>
108:
109: if defined(COMPAT_NETBSD32)
110: include <machine/netbsd32_machdep.h>
111: endif
112:
1.5 manu 113: if defined(COMPAT_LINUX32)
114: include <machine/linux32_machdep.h>
115: endif
116:
1.1 fvdl 117: if defined(_KERNEL) && !defined(_LKM)
118: include "isa.h"
119: include "ioapic.h"
120: endif
121: if NISA > 0
122: include <machine/isa_machdep.h>
123: endif
124:
125: ifdef MULTIPROCESSOR
126: include <machine/cpu.h>
127: endif
128:
129: if NIOAPIC > 0
1.2 fvdl 130: include <machine/i82093reg.h>
1.1 fvdl 131: include <machine/i82093var.h>
132: endif
133:
134: define LSRUN LSRUN
135: define LSONPROC LSONPROC
136:
137: define L3_SLOT_KERNBASE pl3_pi(KERNBASE)
138: define L2_SLOT_KERNBASE pl2_pi(KERNBASE)
139: define L1_SLOT_KERNBASE pl1_pi(KERNBASE)
140:
141: define VM_MAXUSER_ADDRESS (unsigned long long)VM_MAXUSER_ADDRESS
142: define VM_MIN_KERNEL_ADDRESS (unsigned long long)VM_MIN_KERNEL_ADDRESS
143:
144: define UVM_PAGE_IDLE_ZERO offsetof(struct uvm, page_idle_zero)
145:
1.5.14.2 ad 146: define L_ADDR offsetof(struct lwp, l_addr)
147: define L_BACK offsetof(struct lwp, l_back)
148: define L_FORW offsetof(struct lwp, l_forw)
149: define L_PRIORITY offsetof(struct lwp, l_priority)
150: define L_STAT offsetof(struct lwp, l_stat)
151: define L_WCHAN offsetof(struct lwp, l_wchan)
152: define L_PROC offsetof(struct lwp, l_proc)
153: define L_MD_TSS_SEL offsetof(struct lwp, l_md.md_tss_sel)
154: define L_MD_REGS offsetof(struct lwp, l_md.md_regs)
155: define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags)
156: define L_CPU offsetof(struct lwp, l_cpu)
157: define L_MUTEX offsetof(struct lwp, l_mutex)
158: define L_MD_ASTPENDING offsetof(struct lwp, l_md.md_astpending)
1.1 fvdl 159:
1.5.14.2 ad 160: define PAGE_SIZE PAGE_SIZE
1.1 fvdl 161:
1.5.14.2 ad 162: define MDP_IRET MDP_IRET
1.1 fvdl 163:
164: define P_FLAG offsetof(struct proc, p_flag)
1.3 dsl 165: define P_RASLIST offsetof(struct proc, p_raslist)
1.1 fvdl 166: define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
167: define P_MD_FLAGS offsetof(struct proc, p_md.md_flags)
168:
169: define P_SYSTEM P_SYSTEM
170: define P_32 P_32
171:
172: define M_DATA offsetof(struct mbuf, m_data)
173: define M_LEN offsetof(struct mbuf, m_len)
174: define M_NEXT offsetof(struct mbuf, m_next)
175:
176: define IP_SRC offsetof(struct ip, ip_src)
177: define IP_DST offsetof(struct ip, ip_dst)
178:
179: define V_TRAP offsetof(struct uvmexp, traps)
180: define V_INTR offsetof(struct uvmexp, intrs)
181:
182: define PCB_CR3 offsetof(struct pcb, pcb_cr3)
183: define PCB_RBP offsetof(struct pcb, pcb_rbp)
184: define PCB_RSP offsetof(struct pcb, pcb_rsp)
185: define PCB_USERSP offsetof(struct pcb, pcb_usersp)
186: define PCB_RSP0 offsetof(struct pcb, pcb_tss.tss_rsp0)
187: define PCB_CR0 offsetof(struct pcb, pcb_cr0)
188: define PCB_LDT_SEL offsetof(struct pcb, pcb_ldt_sel)
189: define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
190: define PCB_FPCPU offsetof(struct pcb, pcb_fpcpu)
191:
192: define TF_RDI offsetof(struct trapframe, tf_rdi)
193: define TF_RSI offsetof(struct trapframe, tf_rsi)
194: define TF_RDX offsetof(struct trapframe, tf_rdx)
195: define TF_RCX offsetof(struct trapframe, tf_rcx)
196: define TF_R8 offsetof(struct trapframe, tf_r8)
197: define TF_R9 offsetof(struct trapframe, tf_r9)
198: define TF_R10 offsetof(struct trapframe, tf_r10)
199: define TF_R11 offsetof(struct trapframe, tf_r11)
200: define TF_R12 offsetof(struct trapframe, tf_r12)
201: define TF_R13 offsetof(struct trapframe, tf_r13)
202: define TF_R14 offsetof(struct trapframe, tf_r14)
203: define TF_R15 offsetof(struct trapframe, tf_r15)
204: define TF_RBP offsetof(struct trapframe, tf_rbp)
205: define TF_RBX offsetof(struct trapframe, tf_rbx)
206: define TF_RAX offsetof(struct trapframe, tf_rax)
207: define TF_GS offsetof(struct trapframe, tf_gs)
208: define TF_FS offsetof(struct trapframe, tf_fs)
209: define TF_ES offsetof(struct trapframe, tf_es)
210: define TF_DS offsetof(struct trapframe, tf_ds)
211: define TF_TRAPNO offsetof(struct trapframe, tf_trapno)
212: define TF_ERR offsetof(struct trapframe, tf_err)
213: define TF_RIP offsetof(struct trapframe, tf_rip)
214: define TF_CS offsetof(struct trapframe, tf_cs)
215: define TF_RFLAGS offsetof(struct trapframe, tf_rflags)
216: define TF_RSP offsetof(struct trapframe, tf_rsp)
217: define TF_SS offsetof(struct trapframe, tf_ss)
218:
219: define FRAMESIZE sizeof(struct trapframe)
220:
221: define CPU_INFO_SCRATCH offsetof(struct cpu_info, ci_scratch)
222: define CPU_INFO_SELF offsetof(struct cpu_info, ci_self)
223: define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched)
224: define CPU_INFO_CURLWP offsetof(struct cpu_info, ci_curlwp)
225: define CPU_INFO_CURPCB offsetof(struct cpu_info, ci_curpcb)
226: define CPU_INFO_IDLE_PCB offsetof(struct cpu_info, ci_idle_pcb)
227: define CPU_INFO_IDLE_TSS_SEL offsetof(struct cpu_info, ci_idle_tss_sel)
228: define CPU_INFO_ASTPENDING offsetof(struct cpu_info, ci_astpending)
1.5.14.2 ad 229: define CPU_INFO_SCHED_MUTEX offsetof(struct cpu_info, ci_sched_mutex)
1.1 fvdl 230:
231: define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt)
232: define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending)
233: define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask)
234: define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask)
235: define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel)
236: define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth)
237: define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources)
1.5.14.3! ad 238: define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
! 239: define CPU_INFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl)
1.2 fvdl 240:
241: if NIOAPIC > 0
242: define IOAPIC_SC_REG offsetof(struct ioapic_softc, sc_reg)
243: define IOAPIC_SC_DATA offsetof(struct ioapic_softc, sc_data)
244: define PIC_LOCK offsetof(struct pic, pic_lock)
245: endif
1.1 fvdl 246:
247: define IH_FUN offsetof(struct intrhand, ih_fun)
248: define IH_ARG offsetof(struct intrhand, ih_arg)
249: define IH_NEXT offsetof(struct intrhand, ih_next)
250: define IH_LEVEL offsetof(struct intrhand, ih_level)
251:
252: ifdef COMPAT_NETBSD32
253: define SC_FS32 offsetof(struct netbsd32_sigcontext, sc_fs)
254: define SC_GS32 offsetof(struct netbsd32_sigcontext, sc_gs)
255: endif
256:
1.5 manu 257: ifdef COMPAT_LINUX32
258: define LINUX32_SF_HANDLER offsetof(struct linux32_sigframe, sf_handler)
259: define LINUX32_SF_SC offsetof(struct linux32_sigframe, sf_sc)
260: define LINUX32_RT_SF_HANDLER offsetof(struct linux32_rt_sigframe, sf_handler)
261: define LINUX32_RT_SF_UC offsetof(struct linux32_rt_sigframe, sf_uc)
262: define LINUX32_SYS_rt_sigreturn LINUX32_SYS_rt_sigreturn
263: define LINUX32_SYS_sigreturn LINUX32_SYS_sigreturn
264: define LINUX32_SYS_exit LINUX32_SYS_exit
265: endif
266:
1.1 fvdl 267: define IS_RECURSE offsetof(struct intrsource, is_recurse)
268: define IS_RESUME offsetof(struct intrsource, is_resume)
269: define IS_EVCNT offsetof(struct intrsource, is_evcnt.ev_count)
270: define IS_HANDLERS offsetof(struct intrsource, is_handlers)
271: define IS_PIC offsetof(struct intrsource, is_pic)
272: define IS_FLAGS offsetof(struct intrsource, is_flags)
273: define IS_PIN offsetof(struct intrsource, is_pin)
274: define IS_TYPE offsetof(struct intrsource, is_type)
275: define IS_MAXLEVEL offsetof(struct intrsource, is_maxlevel)
1.5.14.1 ad 276:
1.5.14.3! ad 277: define MTX_MINSPL offsetof(struct kmutex, u.s.mtxs_minspl)
! 278: define MTX_FLAGS offsetof(struct kmutex, u.s.mtxs_flags)
! 279: define MTX_OWNER offsetof(struct kmutex, u.mtxa_owner)
! 280: define MUTEX_BIT_SPIN MUTEX_BIT_SPIN
! 281: define MUTEX_SPIN_LOCKED MUTEX_SPIN_LOCKED
! 282: define MUTEX_SPIN_UNLOCKED MUTEX_SPIN_UNLOCKED
1.5.14.1 ad 283:
1.5.14.3! ad 284: define RW_OWNER offsetof(struct krwlock, rw_owner)
1.5.14.1 ad 285: define RW_WRITE_LOCKED RW_WRITE_LOCKED
286: define RW_WRITE_WANTED RW_WRITE_WANTED
287: define RW_READ_INCR RW_READ_INCR
288: define RW_HAS_WAITERS RW_HAS_WAITERS
289: define RW_THREAD RW_THREAD
290: define RW_READER RW_READER
291: define RW_WRITER RW_WRITER
CVSweb <webmaster@jp.NetBSD.org>