genassym.cf revision 1.6
1# $NetBSD: genassym.cf,v 1.6 1998/02/06 07:21:53 mrg Exp $ 2 3# 4# Copyright (c) 1995, 1997 Charles M. Hannum. All rights reserved. 5# Copyright (c) 1982, 1990 The Regents of the University of California. 6# All rights reserved. 7# 8# This code is derived from software contributed to Berkeley by 9# William Jolitz. 10# 11# Redistribution and use in source and binary forms, with or without 12# modification, are permitted provided that the following conditions 13# are met: 14# 1. Redistributions of source code must retain the above copyright 15# notice, this list of conditions and the following disclaimer. 16# 2. Redistributions in binary form must reproduce the above copyright 17# notice, this list of conditions and the following disclaimer in the 18# documentation and/or other materials provided with the distribution. 19# 3. All advertising materials mentioning features or use of this software 20# must display the following acknowledgement: 21# This product includes software developed by the University of 22# California, Berkeley and its contributors. 23# 4. Neither the name of the University nor the names of its contributors 24# may be used to endorse or promote products derived from this software 25# without specific prior written permission. 26# 27# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37# SUCH DAMAGE. 38# 39# @(#)genassym.c 5.11 (Berkeley) 5/10/91 40# 41 42include <sys/param.h> 43include <sys/proc.h> 44include <sys/resourcevar.h> 45include <sys/device.h> 46include <sys/user.h> 47include <sys/mbuf.h> 48 49include <vm/vm.h> 50 51ifdef UVM 52include <uvm/uvm_extern.h> 53endif 54 55include <machine/trap.h> 56include <machine/pmap.h> 57include <machine/vmparam.h> 58 59include "apm.h" 60if NAPM > 0 61include <machine/bioscall.h> 62include <machine/apmvar.h> 63endif 64 65ifdef COMPAT_SVR4 66include <compat/svr4/svr4_ucontext.h> 67endif 68 69ifdef COMPAT_LINUX 70include <machine/linux_machdep.h> 71endif 72 73ifdef COMPAT_FREEBSD 74include <machine/freebsd_machdep.h> 75endif 76 77include "isa.h" 78if NISA > 0 79include <i386/isa/isa_machdep.h> 80endif 81 82define SRUN SRUN 83 84if PMAP_NEW 85define PDSLOT_PTE PDSLOT_PTE 86define PDSLOT_APTE PDSLOT_APTE 87define PDSLOT_KERN PDSLOT_KERN 88define NKPTP_MIN NKPTP_MIN 89define NKPTP_MAX NKPTP_MAX 90else 91define PTDPTDI PTDPTDI 92define KPTDI KPTDI 93define NKPDE_BASE NKPDE_BASE 94define NKPDE_MAX NKPDE_MAX 95define NKPDE_SCALE NKPDE_SCALE 96define APTDPTDI APTDPTDI 97endif 98 99define VM_MAXUSER_ADDRESS (int)VM_MAXUSER_ADDRESS 100 101define P_ADDR offsetof(struct proc, p_addr) 102define P_BACK offsetof(struct proc, p_back) 103define P_FORW offsetof(struct proc, p_forw) 104define P_PRIORITY offsetof(struct proc, p_priority) 105define P_STAT offsetof(struct proc, p_stat) 106define P_WCHAN offsetof(struct proc, p_wchan) 107define P_VMSPACE offsetof(struct proc, p_vmspace) 108define P_FLAG offsetof(struct proc, p_flag) 109 110define P_SYSTEM P_SYSTEM 111 112define M_DATA offsetof(struct mbuf, m_data) 113define M_LEN offsetof(struct mbuf, m_len) 114define M_NEXT offsetof(struct mbuf, m_next) 115 116ifdef UVM 117define V_TRAP offsetof(struct uvmexp, traps) 118define V_INTR offsetof(struct uvmexp, intrs) 119else 120define V_TRAP offsetof(struct vmmeter, v_trap) 121define V_INTR offsetof(struct vmmeter, v_intr) 122endif 123 124define PCB_CR3 offsetof(struct pcb, pcb_cr3) 125define PCB_EBP offsetof(struct pcb, pcb_ebp) 126define PCB_ESP offsetof(struct pcb, pcb_esp) 127define PCB_FS offsetof(struct pcb, pcb_fs) 128define PCB_GS offsetof(struct pcb, pcb_gs) 129define PCB_CR0 offsetof(struct pcb, pcb_cr0) 130define PCB_LDT_SEL offsetof(struct pcb, pcb_ldt_sel) 131define PCB_TSS_SEL offsetof(struct pcb, pcb_tss_sel) 132define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 133 134define TF_CS offsetof(struct trapframe, tf_cs) 135define TF_EIP offsetof(struct trapframe, tf_eip) 136define TF_ERR offsetof(struct trapframe, tf_err) 137define TF_TRAPNO offsetof(struct trapframe, tf_trapno) 138define TF_EFLAGS offsetof(struct trapframe, tf_eflags) 139 140define FRAMESIZE sizeof(struct trapframe) 141 142define SIGF_HANDLER offsetof(struct sigframe, sf_handler) 143define SIGF_SC offsetof(struct sigframe, sf_sc) 144define SC_FS offsetof(struct sigcontext, sc_fs) 145define SC_GS offsetof(struct sigcontext, sc_gs) 146define SC_EFLAGS offsetof(struct sigcontext, sc_eflags) 147 148ifdef COMPAT_SVR4 149define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler) 150define SVR4_SIGF_UC offsetof(struct svr4_sigframe, sf_uc) 151define SVR4_UC_FS offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_FS]) 152define SVR4_UC_GS offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_GS]) 153define SVR4_UC_EFLAGS offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_EFL]) 154endif 155 156ifdef COMPAT_LINUX 157define LINUX_SIGF_HANDLER offsetof(struct linux_sigframe, sf_handler) 158define LINUX_SIGF_SC offsetof(struct linux_sigframe, sf_sc) 159define LINUX_SC_FS offsetof(struct linux_sigcontext, sc_fs) 160define LINUX_SC_GS offsetof(struct linux_sigcontext, sc_gs) 161define LINUX_SC_EFLAGS offsetof(struct linux_sigcontext, sc_eflags) 162endif 163 164ifdef COMPAT_FREEBSD 165define FREEBSD_SIGF_HANDLER offsetof(struct freebsd_sigframe, sf_handler) 166define FREEBSD_SIGF_SC offsetof(struct freebsd_sigframe, sf_sc) 167endif 168 169if NISA > 0 170define IH_FUN offsetof(struct intrhand, ih_fun) 171define IH_ARG offsetof(struct intrhand, ih_arg) 172define IH_COUNT offsetof(struct intrhand, ih_count) 173define IH_NEXT offsetof(struct intrhand, ih_next) 174endif 175 176if NAPM > 0 177define APM_CODE32 offsetof(struct apm_connect_info, apm_code32_seg_base) 178define APM_CODE16 offsetof(struct apm_connect_info, apm_code16_seg_base) 179define APM_DATA offsetof(struct apm_connect_info, apm_data_seg_base) 180define APM_CODE32_LEN offsetof(struct apm_connect_info, apm_code32_seg_len) 181define APM_DATA_LEN offsetof(struct apm_connect_info, apm_data_seg_len) 182define APM_ENTRY offsetof(struct apm_connect_info, apm_entrypt) 183define APM_DETAIL offsetof(struct apm_connect_info, apm_detail) 184define APM_SIZE sizeof(struct apm_connect_info) 185define BIOSCALLREG_AX offsetof(struct bioscallregs, ax) 186define BIOSCALLREG_BX offsetof(struct bioscallregs, bx) 187define BIOSCALLREG_CX offsetof(struct bioscallregs, cx) 188define BIOSCALLREG_DX offsetof(struct bioscallregs, dx) 189define BIOSCALLREG_SI offsetof(struct bioscallregs, si) 190define BIOSCALLREG_DI offsetof(struct bioscallregs, di) 191define BIOSCALLREG_FLAGS offsetof(struct bioscallregs, flags) 192endif 193