genassym.cf revision 1.36
1# $NetBSD: genassym.cf,v 1.36 2003/04/02 07:35:58 thorpej Exp $ 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 77if defined(_KERNEL_OPT) 78include "opt_compat_svr4.h" 79include "opt_compat_freebsd.h" 80include "opt_compat_linux.h" 81include "opt_multiprocessor.h" 82endif 83 84include <sys/param.h> 85include <sys/proc.h> 86include <sys/resourcevar.h> 87include <sys/device.h> 88include <sys/user.h> 89include <sys/mbuf.h> 90include <netinet/in.h> 91include <netinet/in_systm.h> 92include <netinet/ip.h> 93include <netinet/ip6.h> 94include <netinet/ip_var.h> 95 96include <uvm/uvm.h> 97 98include <machine/trap.h> 99include <machine/pmap.h> 100include <machine/vmparam.h> 101include <machine/intr.h> 102include <machine/types.h> 103 104if defined(_KERNEL) && !defined(_LKM) 105include "ioapic.h" 106include "apm.h" 107endif 108if NAPM > 0 109include <machine/bioscall.h> 110include <machine/apmvar.h> 111endif 112 113ifdef COMPAT_SVR4 114include <compat/svr4/svr4_ucontext.h> 115endif 116 117ifdef COMPAT_LINUX 118include <compat/linux/common/linux_signal.h> 119include <compat/linux/common/linux_machdep.h> 120endif 121 122ifdef COMPAT_FREEBSD 123include <machine/freebsd_machdep.h> 124endif 125 126ifdef MULTIPROCESSOR 127include <machine/cpu.h> 128endif 129 130if NIOAPIC > 0 131include <machine/i82093var.h> 132endif 133 134if defined(_KERNEL) && !defined(_LKM) 135include "isa.h" 136endif 137if NISA > 0 138include <machine/isa_machdep.h> 139endif 140 141include <machine/tlog.h> 142 143define PAGE_SIZE PAGE_SIZE 144 145define LSRUN LSRUN 146define LSONPROC LSONPROC 147 148define PDSLOT_PTE PDSLOT_PTE 149define PDSLOT_APTE PDSLOT_APTE 150define PDSLOT_KERN PDSLOT_KERN 151define NKPTP_MIN NKPTP_MIN 152define NKPTP_MAX NKPTP_MAX 153 154define VM_MAXUSER_ADDRESS (int)VM_MAXUSER_ADDRESS 155 156define UVM_PAGE_IDLE_ZERO offsetof(struct uvm, page_idle_zero) 157 158define L_ADDR offsetof(struct lwp, l_addr) 159define L_BACK offsetof(struct lwp, l_back) 160define L_FORW offsetof(struct lwp, l_forw) 161define L_PRIORITY offsetof(struct lwp, l_priority) 162define L_STAT offsetof(struct lwp, l_stat) 163define L_WCHAN offsetof(struct lwp, l_wchan) 164define L_PROC offsetof(struct lwp, l_proc) 165define L_MD_TSS_SEL offsetof(struct lwp, l_md.md_tss_sel) 166define L_MD_REGS offsetof(struct lwp, l_md.md_regs) 167define L_CPU offsetof(struct lwp, l_cpu) 168define P_FLAG offsetof(struct proc, p_flag) 169define P_NRAS offsetof(struct proc, p_nras) 170define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall) 171define P_MD_ASTPENDING offsetof(struct proc, p_md.md_astpending) 172 173define P_SYSTEM P_SYSTEM 174 175define M_DATA offsetof(struct mbuf, m_data) 176define M_LEN offsetof(struct mbuf, m_len) 177define M_NEXT offsetof(struct mbuf, m_next) 178 179define IP_SRC offsetof(struct ip, ip_src) 180define IP_DST offsetof(struct ip, ip_dst) 181 182define IP6_SRC offsetof(struct ip6_hdr, ip6_src) 183define IP6_DST offsetof(struct ip6_hdr, ip6_dst) 184 185define V_TRAP offsetof(struct uvmexp, traps) 186define V_INTR offsetof(struct uvmexp, intrs) 187 188define PCB_CR3 offsetof(struct pcb, pcb_cr3) 189define PCB_EBP offsetof(struct pcb, pcb_ebp) 190define PCB_ESP offsetof(struct pcb, pcb_esp) 191define PCB_CR0 offsetof(struct pcb, pcb_cr0) 192define PCB_LDT_SEL offsetof(struct pcb, pcb_ldt_sel) 193define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 194define PCB_FPCPU offsetof(struct pcb, pcb_fpcpu) 195 196define TF_CS offsetof(struct trapframe, tf_cs) 197define TF_EIP offsetof(struct trapframe, tf_eip) 198define TF_ERR offsetof(struct trapframe, tf_err) 199define TF_TRAPNO offsetof(struct trapframe, tf_trapno) 200define TF_EFLAGS offsetof(struct trapframe, tf_eflags) 201 202define TF_GS offsetof(struct trapframe, tf_gs) 203define TF_FS offsetof(struct trapframe, tf_fs) 204define TF_ES offsetof(struct trapframe, tf_es) 205define TF_DS offsetof(struct trapframe, tf_ds) 206define TF_EDI offsetof(struct trapframe, tf_edi) 207define TF_ESI offsetof(struct trapframe, tf_esi) 208define TF_EBP offsetof(struct trapframe, tf_ebp) 209define TF_EBX offsetof(struct trapframe, tf_ebx) 210define TF_EDX offsetof(struct trapframe, tf_edx) 211define TF_ECX offsetof(struct trapframe, tf_ecx) 212define TF_EAX offsetof(struct trapframe, tf_eax) 213 214define TF_PUSHSIZE offsetof(struct trapframe, tf_trapno) 215 216define FRAMESIZE sizeof(struct trapframe) 217 218ifdef COMPAT_SVR4 219define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler) 220define SVR4_SIGF_UC offsetof(struct svr4_sigframe, sf_uc) 221endif 222 223ifdef COMPAT_LINUX 224define LINUX_SIGF_HANDLER offsetof(struct linux_sigframe, sf_handler) 225define LINUX_SIGF_SC offsetof(struct linux_sigframe, sf_sc) 226define LINUX_RT_SIGF_HANDLER offsetof(struct linux_rt_sigframe, sf_handler) 227define LINUX_RT_SIGF_SC offsetof(struct linux_rt_sigframe, sf_sc) 228endif 229 230ifdef COMPAT_FREEBSD 231define FREEBSD_SIGF_HANDLER offsetof(struct freebsd_sigframe, sf_handler) 232define FREEBSD_SIGF_SC offsetof(struct freebsd_sigframe, sf_sc) 233endif 234 235define IH_FUN offsetof(struct intrhand, ih_fun) 236define IH_ARG offsetof(struct intrhand, ih_arg) 237define IH_LEVEL offsetof(struct intrhand, ih_level) 238define IH_NEXT offsetof(struct intrhand, ih_next) 239 240if NAPM > 0 241define APM_CODE32 offsetof(struct apm_connect_info, apm_code32_seg_base) 242define APM_CODE16 offsetof(struct apm_connect_info, apm_code16_seg_base) 243define APM_DATA offsetof(struct apm_connect_info, apm_data_seg_base) 244define APM_CODE32_LEN offsetof(struct apm_connect_info, apm_code32_seg_len) 245define APM_DATA_LEN offsetof(struct apm_connect_info, apm_data_seg_len) 246define APM_ENTRY offsetof(struct apm_connect_info, apm_entrypt) 247define APM_DETAIL offsetof(struct apm_connect_info, apm_detail) 248define APM_SIZE sizeof(struct apm_connect_info) 249define BIOSCALLREG_EAX offsetof(struct bioscallregs, EAX) 250define BIOSCALLREG_EBX offsetof(struct bioscallregs, EBX) 251define BIOSCALLREG_ECX offsetof(struct bioscallregs, ECX) 252define BIOSCALLREG_EDX offsetof(struct bioscallregs, EDX) 253define BIOSCALLREG_ESI offsetof(struct bioscallregs, ESI) 254define BIOSCALLREG_EDI offsetof(struct bioscallregs, EDI) 255define BIOSCALLREG_EFLAGS offsetof(struct bioscallregs, EFLAGS) 256endif 257 258define CPU_INFO_SELF offsetof(struct cpu_info, ci_self) 259define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched) 260define CPU_INFO_CURLWP offsetof(struct cpu_info, ci_curlwp) 261define CPU_INFO_CURPCB offsetof(struct cpu_info, ci_curpcb) 262define CPU_INFO_IDLE_PCB offsetof(struct cpu_info, ci_idle_pcb) 263define CPU_INFO_IDLE_TSS_SEL offsetof(struct cpu_info, ci_idle_tss_sel) 264define CPU_INFO_ASTPENDING offsetof(struct cpu_info, ci_astpending) 265 266define CPU_INFO_LEVEL offsetof(struct cpu_info, ci_cpuid_level) 267define CPU_INFO_VENDOR offsetof(struct cpu_info, ci_vendor[0]) 268define CPU_INFO_SIGNATURE offsetof(struct cpu_info, ci_signature) 269define CPU_INFO_FEATURES offsetof(struct cpu_info, ci_feature_flags) 270define CPU_INFO_BRAND offsetof(struct cpu_info, ci_brand_id) 271 272define CPU_TLOG_OFFSET offsetof(struct cpu_info, ci_tlog_offset) 273define CPU_TLOG_BASE offsetof(struct cpu_info, ci_tlog_base) 274 275define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt) 276define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending) 277define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask) 278define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask) 279define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel) 280define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth) 281define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources) 282 283if NIOAPIC > 0 284define IOAPIC_SC_REG offsetof(struct ioapic_softc, sc_reg) 285define IOAPIC_SC_DATA offsetof(struct ioapic_softc, sc_data) 286define PIC_LOCK offsetof(struct pic, pic_lock) 287endif 288 289define SIZEOF_CPU_INFO sizeof(struct cpu_info) 290 291define SIZEOF_ISOURCE sizeof(struct intrsource) 292define SIZEOF_ISTUB sizeof(struct intrstub) 293 294define IS_RECURSE offsetof(struct intrsource, is_recurse) 295define IS_RESUME offsetof(struct intrsource, is_resume) 296define IS_EVCNTLO offsetof(struct intrsource, is_evcnt.ev_count) 297define IS_EVCNTHI offsetof(struct intrsource, is_evcnt.ev_count)+4 298define IS_HANDLERS offsetof(struct intrsource, is_handlers) 299define IS_PIC offsetof(struct intrsource, is_pic) 300define IS_FLAGS offsetof(struct intrsource, is_flags) 301define IS_PIN offsetof(struct intrsource, is_pin) 302define IS_TYPE offsetof(struct intrsource, is_type) 303define IS_MAXLEVEL offsetof(struct intrsource, is_maxlevel) 304 305define TREC_SP offsetof(struct trec, tr_sp) 306define TREC_HPC offsetof(struct trec, tr_hpc) 307define TREC_IPC offsetof(struct trec, tr_ipc) 308define TREC_TSC offsetof(struct trec, tr_tsc) 309define TREC_LBF offsetof(struct trec, tr_lbf) 310define TREC_LBT offsetof(struct trec, tr_lbt) 311define TREC_IBF offsetof(struct trec, tr_ibf) 312define TREC_IBT offsetof(struct trec, tr_ibt) 313 314define SIZEOF_TREC sizeof(struct trec) 315define SIZEOF_TLOG sizeof(struct tlog) 316