Annotation of src/sys/arch/amd64/amd64/genassym.cf, Revision 1.55
1.55 ! dsl 1: # $NetBSD: genassym.cf,v 1.54 2013/12/01 01:05:16 christos Exp $
1.1 fvdl 2:
3: #
1.28 ad 4: # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
1.1 fvdl 5: # All rights reserved.
6: #
7: # This code is derived from software contributed to The NetBSD Foundation
1.19 ad 8: # by Charles M. Hannum, and by Andrew Doran.
1.1 fvdl 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: #
19: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22: # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29: # POSSIBILITY OF SUCH DAMAGE.
30: #
31:
32: #
33: # Copyright (c) 1982, 1990 The Regents of the University of California.
34: # All rights reserved.
35: #
36: # This code is derived from software contributed to Berkeley by
37: # William Jolitz.
38: #
39: # Redistribution and use in source and binary forms, with or without
40: # modification, are permitted provided that the following conditions
41: # are met:
42: # 1. Redistributions of source code must retain the above copyright
43: # notice, this list of conditions and the following disclaimer.
44: # 2. Redistributions in binary form must reproduce the above copyright
45: # notice, this list of conditions and the following disclaimer in the
46: # documentation and/or other materials provided with the distribution.
1.37 tsutsui 47: # 3. Neither the name of the University nor the names of its contributors
1.1 fvdl 48: # may be used to endorse or promote products derived from this software
49: # without specific prior written permission.
50: #
51: # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
52: # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54: # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
55: # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56: # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57: # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58: # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59: # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60: # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61: # SUCH DAMAGE.
62: #
63: # @(#)genassym.c 5.11 (Berkeley) 5/10/91
64: #
65:
66: if defined(_KERNEL_OPT)
67: include "opt_compat_netbsd32.h"
1.5 manu 68: include "opt_compat_linux32.h"
1.18 bouyer 69: include "opt_xen.h"
1.1 fvdl 70: endif
71:
1.6 ad 72: quote #define __MUTEX_PRIVATE
73: quote #define __RWLOCK_PRIVATE
74:
1.1 fvdl 75: include <sys/param.h>
76: include <sys/proc.h>
77: include <sys/resourcevar.h>
78: include <sys/device.h>
79: include <sys/mbuf.h>
1.6 ad 80: include <sys/mutex.h>
81: include <sys/rwlock.h>
82: include <sys/cpu_data.h>
1.10 ad 83: include <sys/evcnt.h>
1.39 ad 84: include <sys/cpu.h>
1.6 ad 85:
1.1 fvdl 86: include <netinet/in.h>
87: include <netinet/in_systm.h>
88: include <netinet/ip.h>
89: include <netinet/ip_var.h>
90:
91: include <uvm/uvm.h>
92:
93: include <machine/trap.h>
94: include <machine/pmap.h>
95: include <machine/vmparam.h>
96: include <machine/intr.h>
97: include <machine/types.h>
1.12 ad 98: include <machine/cpufunc.h>
1.1 fvdl 99:
100: if defined(COMPAT_NETBSD32)
101: include <machine/netbsd32_machdep.h>
102: endif
103:
1.5 manu 104: if defined(COMPAT_LINUX32)
105: include <machine/linux32_machdep.h>
106: endif
107:
1.40 pooka 108: if defined(_KERNEL) && defined(_KERNEL_OPT)
1.1 fvdl 109: include "isa.h"
110: include "ioapic.h"
111: endif
112: if NISA > 0
113: include <machine/isa_machdep.h>
114: endif
115:
116: if NIOAPIC > 0
1.2 fvdl 117: include <machine/i82093reg.h>
1.1 fvdl 118: include <machine/i82093var.h>
119: endif
120:
1.18 bouyer 121: ifdef XEN
1.49 cegger 122: include <xen/xen-public/xen.h>
1.18 bouyer 123: endif
124:
1.48 dyoung 125: include <sys/bus.h>
1.12 ad 126:
1.1 fvdl 127: define LSRUN LSRUN
128: define LSONPROC LSONPROC
129:
1.14 yamt 130: define UPAGES UPAGES
131: define USPACE USPACE
132:
133: define KERNBASE_LO KERNBASE_LO
134: define KERNBASE_HI KERNBASE_HI
135: define KERNBASE KERNBASE
136: define KERNTEXTOFF_LO KERNTEXTOFF_LO
137: define KERNTEXTOFF KERNTEXTOFF
138:
139: define NBPG NBPG
140:
141: define L4_SLOT_KERNBASE L4_SLOT_KERNBASE
1.1 fvdl 142: define L3_SLOT_KERNBASE pl3_pi(KERNBASE)
143: define L2_SLOT_KERNBASE pl2_pi(KERNBASE)
144: define L1_SLOT_KERNBASE pl1_pi(KERNBASE)
145:
1.14 yamt 146: define PDIR_SLOT_PTE PDIR_SLOT_PTE
147:
1.1 fvdl 148: define VM_MAXUSER_ADDRESS (unsigned long long)VM_MAXUSER_ADDRESS
149:
1.43 rmind 150: define L_PCB offsetof(struct lwp, l_addr)
1.9 yamt 151: define L_FLAG offsetof(struct lwp, l_flag)
1.6 ad 152: define L_PROC offsetof(struct lwp, l_proc)
1.19 ad 153: define L_CTXSWTCH offsetof(struct lwp, l_ctxswtch)
1.24 ad 154: define L_NCSW offsetof(struct lwp, l_ncsw)
1.28 ad 155: define L_NOPREEMPT offsetof(struct lwp, l_nopreempt)
156: define L_DOPREEMPT offsetof(struct lwp, l_dopreempt)
1.24 ad 157: define L_CPU offsetof(struct lwp, l_cpu)
1.39 ad 158: define L_KPRIORITY offsetof(struct lwp, l_kpriority)
1.6 ad 159: define L_MD_REGS offsetof(struct lwp, l_md.md_regs)
160: define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags)
161: define L_MD_ASTPENDING offsetof(struct lwp, l_md.md_astpending)
1.1 fvdl 162:
1.6 ad 163: define PAGE_SIZE PAGE_SIZE
1.1 fvdl 164:
1.52 dsl 165: define MDL_IRET MDL_IRET
166: define MDL_COMPAT32 MDL_COMPAT32
1.1 fvdl 167:
168: define P_FLAG offsetof(struct proc, p_flag)
1.3 dsl 169: define P_RASLIST offsetof(struct proc, p_raslist)
1.1 fvdl 170: define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
171:
1.9 yamt 172: define LW_SYSTEM LW_SYSTEM
173:
1.1 fvdl 174: define M_DATA offsetof(struct mbuf, m_data)
175: define M_LEN offsetof(struct mbuf, m_len)
176: define M_NEXT offsetof(struct mbuf, m_next)
177:
178: define IP_SRC offsetof(struct ip, ip_src)
179: define IP_DST offsetof(struct ip, ip_dst)
180:
181: define PCB_CR3 offsetof(struct pcb, pcb_cr3)
182: define PCB_RBP offsetof(struct pcb, pcb_rbp)
183: define PCB_RSP offsetof(struct pcb, pcb_rsp)
184: define PCB_USERSP offsetof(struct pcb, pcb_usersp)
1.23 yamt 185: define PCB_RSP0 offsetof(struct pcb, pcb_rsp0)
1.1 fvdl 186: define PCB_CR0 offsetof(struct pcb, pcb_cr0)
187: define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
1.45 chs 188: define PCB_FLAGS offsetof(struct pcb, pcb_flags)
189: define PCB_COMPAT32 PCB_COMPAT32
190: define PCB_FS offsetof(struct pcb, pcb_fs)
191: define PCB_GS offsetof(struct pcb, pcb_gs)
1.1 fvdl 192:
193: define TF_RDI offsetof(struct trapframe, tf_rdi)
194: define TF_RSI offsetof(struct trapframe, tf_rsi)
195: define TF_RDX offsetof(struct trapframe, tf_rdx)
196: define TF_RCX offsetof(struct trapframe, tf_rcx)
197: define TF_R8 offsetof(struct trapframe, tf_r8)
198: define TF_R9 offsetof(struct trapframe, tf_r9)
199: define TF_R10 offsetof(struct trapframe, tf_r10)
200: define TF_R11 offsetof(struct trapframe, tf_r11)
201: define TF_R12 offsetof(struct trapframe, tf_r12)
202: define TF_R13 offsetof(struct trapframe, tf_r13)
203: define TF_R14 offsetof(struct trapframe, tf_r14)
204: define TF_R15 offsetof(struct trapframe, tf_r15)
205: define TF_RBP offsetof(struct trapframe, tf_rbp)
206: define TF_RBX offsetof(struct trapframe, tf_rbx)
207: define TF_RAX offsetof(struct trapframe, tf_rax)
208: define TF_GS offsetof(struct trapframe, tf_gs)
209: define TF_FS offsetof(struct trapframe, tf_fs)
210: define TF_ES offsetof(struct trapframe, tf_es)
211: define TF_DS offsetof(struct trapframe, tf_ds)
212: define TF_TRAPNO offsetof(struct trapframe, tf_trapno)
213: define TF_ERR offsetof(struct trapframe, tf_err)
214: define TF_RIP offsetof(struct trapframe, tf_rip)
215: define TF_CS offsetof(struct trapframe, tf_cs)
216: define TF_RFLAGS offsetof(struct trapframe, tf_rflags)
217: define TF_RSP offsetof(struct trapframe, tf_rsp)
218: define TF_SS offsetof(struct trapframe, tf_ss)
219:
1.21 dsl 220: # Size of stack area needed for saving registers
221: define TF_REGSIZE offsetof(struct trapframe, tf_trapno)
222: # Total size includes regsisters pushed by hardware
1.1 fvdl 223: define FRAMESIZE sizeof(struct trapframe)
224:
225: define CPU_INFO_SCRATCH offsetof(struct cpu_info, ci_scratch)
1.14 yamt 226: define CPU_INFO_SELF offsetof(struct cpu_info, ci_self)
227: define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched)
228: define CPU_INFO_WANT_PMAPLOAD offsetof(struct cpu_info, ci_want_pmapload)
229: define CPU_INFO_TLBSTATE offsetof(struct cpu_info, ci_tlbstate)
230: define TLBSTATE_VALID TLBSTATE_VALID
231: define CPU_INFO_CURLWP offsetof(struct cpu_info, ci_curlwp)
1.33 ad 232: define CPU_INFO_CURLDT offsetof(struct cpu_info, ci_curldt)
1.14 yamt 233: define CPU_INFO_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
234: define CPU_INFO_PMAP offsetof(struct cpu_info, ci_pmap)
1.23 yamt 235: define CPU_INFO_RSP0 offsetof(struct cpu_info, ci_tss.tss_rsp0)
1.25 ad 236: define CPU_INFO_NSYSCALL offsetof(struct cpu_info, ci_data.cpu_nsyscall)
1.34 ad 237: define CPU_INFO_NTRAP offsetof(struct cpu_info, ci_data.cpu_ntrap)
1.46 matt 238: define CPU_INFO_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr)
1.30 ad 239: define CPU_INFO_CURPRIORITY offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
1.54 christos 240: define CPU_INFO_FPCURLWP offsetof(struct cpu_info, ci_fpcurlwp)
1.14 yamt 241:
242: define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt)
243: define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending)
244: define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask)
245: define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask)
246: define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel)
247: define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth)
248: define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources)
1.6 ad 249: define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
250: define CPU_INFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl)
1.18 bouyer 251: define CPU_INFO_CPUID offsetof(struct cpu_info, ci_cpuid)
1.14 yamt 252: define CPU_INFO_ISTATE offsetof(struct cpu_info, ci_istate)
1.31 ad 253: define CPU_INFO_CC_SKEW offsetof(struct cpu_info, ci_data.cpu_cc_skew)
1.24 ad 254:
1.32 ad 255: define ACPI_SUSPEND_GDT offsetof(struct cpu_info, ci_suspend_gdt)
256: define ACPI_SUSPEND_IDT offsetof(struct cpu_info, ci_suspend_idt)
257: define ACPI_SUSPEND_TR offsetof(struct cpu_info, ci_suspend_tr)
258: define ACPI_SUSPEND_LDT offsetof(struct cpu_info, ci_suspend_ldt)
259: define ACPI_SUSPEND_FS offsetof(struct cpu_info, ci_suspend_fs)
260: define ACPI_SUSPEND_GS offsetof(struct cpu_info, ci_suspend_gs)
261: define ACPI_SUSPEND_KGS offsetof(struct cpu_info, ci_suspend_kgs)
262: define ACPI_SUSPEND_EFER offsetof(struct cpu_info, ci_suspend_efer)
263: define ACPI_SUSPEND_REG offsetof(struct cpu_info, ci_suspend_reg)
264: define ACPI_SUSPEND_CR0 offsetof(struct cpu_info, ci_suspend_cr0)
265: define ACPI_SUSPEND_CR2 offsetof(struct cpu_info, ci_suspend_cr2)
266: define ACPI_SUSPEND_CR3 offsetof(struct cpu_info, ci_suspend_cr3)
267: define ACPI_SUSPEND_CR4 offsetof(struct cpu_info, ci_suspend_cr4)
268: define ACPI_SUSPEND_CR8 offsetof(struct cpu_info, ci_suspend_cr8)
1.20 joerg 269:
1.2 fvdl 270: if NIOAPIC > 0
1.36 drochner 271: define PIC_IOAPIC offsetof(struct pic, pic_ioapic)
1.2 fvdl 272: define IOAPIC_SC_REG offsetof(struct ioapic_softc, sc_reg)
273: define IOAPIC_SC_DATA offsetof(struct ioapic_softc, sc_data)
274: define PIC_LOCK offsetof(struct pic, pic_lock)
275: endif
1.1 fvdl 276:
277: define IH_FUN offsetof(struct intrhand, ih_fun)
278: define IH_ARG offsetof(struct intrhand, ih_arg)
1.18 bouyer 279: define IH_LEVEL offsetof(struct intrhand, ih_level)
280: ifdef XEN
281: define IH_IPL_NEXT offsetof(struct intrhand, ih_ipl_next)
282: else
1.1 fvdl 283: define IH_NEXT offsetof(struct intrhand, ih_next)
1.18 bouyer 284: endif
1.1 fvdl 285:
286: ifdef COMPAT_NETBSD32
287: define SC_FS32 offsetof(struct netbsd32_sigcontext, sc_fs)
288: define SC_GS32 offsetof(struct netbsd32_sigcontext, sc_gs)
289: endif
290:
1.5 manu 291: ifdef COMPAT_LINUX32
292: define LINUX32_SF_HANDLER offsetof(struct linux32_sigframe, sf_handler)
293: define LINUX32_SF_SC offsetof(struct linux32_sigframe, sf_sc)
294: define LINUX32_RT_SF_HANDLER offsetof(struct linux32_rt_sigframe, sf_handler)
295: define LINUX32_RT_SF_UC offsetof(struct linux32_rt_sigframe, sf_uc)
296: define LINUX32_SYS_rt_sigreturn LINUX32_SYS_rt_sigreturn
297: define LINUX32_SYS_sigreturn LINUX32_SYS_sigreturn
1.45 chs 298: define LINUX32_SYS_exit LINUX32_SYS_exit
1.5 manu 299: endif
300:
1.18 bouyer 301: ifdef XEN
302: define SIZEOF_IPLSOURCE sizeof(struct iplsource)
303: define IS_RECURSE offsetof(struct iplsource, ipl_recurse)
304: define IS_RESUME offsetof(struct iplsource, ipl_resume)
305: define IS_HANDLERS offsetof(struct iplsource, ipl_handlers)
306: define EV_EVCNTL offsetof(struct evcnt, ev_count)
307: else
308: define IS_RECURSE offsetof(struct intrsource, is_recurse)
309: define IS_RESUME offsetof(struct intrsource, is_resume)
310: define IS_EVCNT offsetof(struct intrsource, is_evcnt.ev_count)
311: define IS_HANDLERS offsetof(struct intrsource, is_handlers)
312: define IS_PIC offsetof(struct intrsource, is_pic)
313: define IS_FLAGS offsetof(struct intrsource, is_flags)
314: define IS_PIN offsetof(struct intrsource, is_pin)
315: define IS_TYPE offsetof(struct intrsource, is_type)
316: define IS_MAXLEVEL offsetof(struct intrsource, is_maxlevel)
1.19 ad 317: define IS_LWP offsetof(struct intrsource, is_lwp)
1.18 bouyer 318: endif
1.14 yamt 319:
320: define IPL_NONE IPL_NONE
1.30 ad 321: define IPL_PREEMPT IPL_PREEMPT
1.14 yamt 322: define IPL_CLOCK IPL_CLOCK
1.16 ad 323: define IPL_HIGH IPL_HIGH
1.14 yamt 324:
325: define LIR_IPI LIR_IPI
326: define LIR_TIMER LIR_TIMER
327:
328: define SIR_NET SIR_NET
329: define SIR_CLOCK SIR_CLOCK
330: define SIR_SERIAL SIR_SERIAL
331:
332: define IREENT_MAGIC IREENT_MAGIC
333:
334: define PSL_MBO PSL_MBO
1.6 ad 335:
336: define MTX_IPL offsetof(struct kmutex, u.s.mtxs_ipl)
337: define MTX_LOCK offsetof(struct kmutex, u.s.mtxs_lock)
338: define MTX_OWNER offsetof(struct kmutex, u.mtxa_owner)
339:
1.14 yamt 340: define RW_OWNER offsetof(struct krwlock, rw_owner)
341: define RW_WRITE_LOCKED RW_WRITE_LOCKED
342: define RW_WRITE_WANTED RW_WRITE_WANTED
343: define RW_READ_INCR RW_READ_INCR
344: define RW_HAS_WAITERS RW_HAS_WAITERS
345: define RW_THREAD RW_THREAD
346: define RW_READER RW_READER
347: define RW_WRITER RW_WRITER
1.10 ad 348:
349: define EV_COUNT offsetof(struct evcnt, ev_count)
1.12 ad 350:
351: define OPTERON_MSR_PASSCODE OPTERON_MSR_PASSCODE
352:
353: define X86_BUS_SPACE_IO X86_BUS_SPACE_IO
1.14 yamt 354:
1.44 dyoung 355: define BST_TYPE offsetof(struct bus_space_tag, bst_type)
356:
1.18 bouyer 357: ifdef XEN
1.27 cegger 358: define CPU_INFO_VCPU offsetof(struct cpu_info, ci_vcpu)
1.18 bouyer 359: define EVTCHN_UPCALL_MASK offsetof(struct vcpu_info, evtchn_upcall_mask)
360: define XEN_PT_BASE offsetof(struct start_info, pt_base)
361: define XEN_NR_PT_FRAMES offsetof(struct start_info, nr_pt_frames)
362: define __HYPERVISOR_iret __HYPERVISOR_iret
363: endif
364:
1.14 yamt 365: define NKL4_KIMG_ENTRIES NKL4_KIMG_ENTRIES
366: define NKL3_KIMG_ENTRIES NKL3_KIMG_ENTRIES
367: define NKL2_KIMG_ENTRIES NKL2_KIMG_ENTRIES
368:
369: define PGOFSET PGOFSET
370: define PGSHIFT PGSHIFT
1.22 yamt 371:
372: define VM_MIN_KERNEL_ADDRESS_HIGH32 (VM_MIN_KERNEL_ADDRESS >> 32)
1.39 ad 373:
374: define RESCHED_KPREEMPT RESCHED_KPREEMPT
1.51 chs 375:
376: define SEL_RPL_MASK SEL_RPL
CVSweb <webmaster@jp.NetBSD.org>