# $NetBSD: genassym.cf,v 1.85 2021/04/03 17:01:24 palle Exp $ # # Copyright (c) 1997 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation # by Christos Zoulas. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. # # This software was developed by the Computer Systems Engineering group # at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and # contributed to Berkeley. # # All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Lawrence Berkeley Laboratory. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)genassym.c 8.1 (Berkeley) 6/11/93 # if defined(_KERNEL_OPT) include "opt_multiprocessor.h" endif include include include include include include include include include include include include include include include include include #include ifdef notyet include include endif ifdef notyet include include include include endif # general constants define BSD BSD define USRSTACK USRSTACK define PAGE_SIZE PAGE_SIZE # Important offsets into the lwp and proc structs & associated constants define L_PCB offsetof(struct lwp, l_addr) define L_PROC offsetof(struct lwp, l_proc) define L_TF offsetof(struct lwp, l_md.md_tf) define L_FPSTATE offsetof(struct lwp, l_md.md_fpstate) # proc fields and values define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall) define P_STAT offsetof(struct proc, p_stat) define P_VMSPACE offsetof(struct proc, p_vmspace) define P_PID offsetof(struct proc, p_pid) define P_RASLIST offsetof(struct proc, p_raslist) # VM structure fields define VM_PMAP offsetof(struct vmspace, vm_map.pmap) # pmap structure fields define PM_PHYS offsetof(struct pmap, pm_physaddr) define PM_RESIDENT offsetof(struct pmap, pm_stats.resident_count) define PM_WIRED offsetof(struct pmap, pm_stats.wired_count) # TLB/TTE defines export SUN4U_TLB_TSB_LOCK export SUN4U_TTE_MODIFY export SUN4U_TTE_ACCESS export SUN4U_TTE_REAL_W export SUN4U_TTE_W export SUN4U_TTE_L export SUN4U_TTE_CP export SUN4U_TTE_CV export SUN4U_TTE_P export SUN4U_TTE_EXEC export SUN4V_TLB_ACCESS export SUN4V_TLB_MODIFY export SUN4V_TLB_EXEC export SUN4V_TLB_W export SUN4V_TLB_TSB_LOCK export PG_SHIFT4U export CTX_MASK # CPU info structure define CI_SELF offsetof(struct cpu_info, ci_self) define CI_CURLWP offsetof(struct cpu_info, ci_curlwp) define CI_CPCB offsetof(struct cpu_info, ci_cpcb) define CI_NEXT offsetof(struct cpu_info, ci_next) define CI_NUMBER offsetof(struct cpu_info, ci_data.cpu_index) define CI_FPLWP offsetof(struct cpu_info, ci_fplwp) define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) define CI_SPINUP offsetof(struct cpu_info, ci_spinup) define CI_PADDR offsetof(struct cpu_info, ci_paddr) define CI_CPUID offsetof(struct cpu_info, ci_cpuid) define CI_WANT_AST offsetof(struct cpu_info, ci_want_ast) define CI_EINTSTACK offsetof(struct cpu_info, ci_eintstack) define CI_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp) define CI_NFAULT offsetof(struct cpu_info, ci_data.cpu_nfault) define CI_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr) define CI_CLOCKRATE offsetof(struct cpu_info, ci_cpu_clockrate) define CI_IDEPTH offsetof(struct cpu_info, ci_idepth) define CI_INTRPENDING offsetof(struct cpu_info, ci_intrpending) define CI_TICK_IH offsetof(struct cpu_info, ci_tick_ih) define CI_CTXBUSY offsetof(struct cpu_info, ci_ctxbusy) define CI_TSB_DMMU offsetof(struct cpu_info, ci_tsb_dmmu) define CI_TSB_IMMU offsetof(struct cpu_info, ci_tsb_immu) define CI_MMUFSA offsetof(struct cpu_info, ci_mmufsa) define CI_TSB_DESC offsetof(struct cpu_info, ci_tsb_desc) define CI_CPUMQ offsetof(struct cpu_info, ci_cpumq) define CI_DEVMQ offsetof(struct cpu_info, ci_devmq) ifdef MULTIPROCESSOR define CI_IPIEVC offsetof(struct cpu_info, ci_ipi_evcnt[0].ev_count) endif define CI_IDLESPIN offsetof(struct cpu_info, ci_idlespin) # CPU boot arguments structure define CBA_NODE offsetof(struct cpu_bootargs, cb_node) define CBA_KTEXT offsetof(struct cpu_bootargs, cb_ktext) define CBA_KTEXTP offsetof(struct cpu_bootargs, cb_ktextp) define CBA_EKTEXT offsetof(struct cpu_bootargs, cb_ektext) define CBA_KDATA offsetof(struct cpu_bootargs, cb_kdata) define CBA_KDATAP offsetof(struct cpu_bootargs, cb_kdatap) define CBA_EKDATA offsetof(struct cpu_bootargs, cb_ekdata) define CBA_CPUINFO offsetof(struct cpu_bootargs, cb_cpuinfo) define CBA_CPUTYP offsetof(struct cpu_bootargs, cb_cputyp) # FPU state define FS_REGS offsetof(struct fpstate64, fs_regs) define FS_FSR offsetof(struct fpstate64, fs_fsr) define FS_GSR offsetof(struct fpstate64, fs_gsr) define FS_QSIZE offsetof(struct fpstate64, fs_qsize) define FS_QUEUE offsetof(struct fpstate64, fs_queue) define FS_SIZE sizeof(struct fpstate64) define FSR_QNE FSR_QNE define FPRS_FEF FPRS_FEF define FPRS_DU FPRS_DU define FPRS_DL FPRS_DL # system calls define SYS_execve SYS_execve define SYS_exit SYS_exit # errno define EFAULT EFAULT define ENAMETOOLONG ENAMETOOLONG # PCB fields and size define PCB_NSAVED offsetof(struct pcb, pcb_nsaved) define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) define PCB_PSTATE offsetof(struct pcb, pcb_pstate) define PCB_CWP offsetof(struct pcb, pcb_cwp) define PCB_PIL offsetof(struct pcb, pcb_pil) define PCB_RW offsetof(struct pcb, pcb_rw) define PCB_SP offsetof(struct pcb, pcb_sp) define PCB_PC offsetof(struct pcb, pcb_pc) define PCB_LASTCALL offsetof(struct pcb, lastcall) define PCB_SIZE sizeof(struct pcb) # trapframe64 fields define TF_TSTATE offsetof(struct trapframe64, tf_tstate) define TF_PC offsetof(struct trapframe64, tf_pc) define TF_NPC offsetof(struct trapframe64, tf_npc) define TF_FAULT offsetof(struct trapframe64, tf_fault) define TF_KSTACK offsetof(struct trapframe64, tf_kstack) define TF_Y offsetof(struct trapframe64, tf_y) define TF_PIL offsetof(struct trapframe64, tf_pil) define TF_OLDPIL offsetof(struct trapframe64, tf_oldpil) define TF_TT offsetof(struct trapframe64, tf_tt) define TF_GLOBAL offsetof(struct trapframe64, tf_global) define TF_OUT offsetof(struct trapframe64, tf_out) ifdef DEBUG define TF_LOCAL offsetof(struct trapframe64, tf_local) define TF_IN offsetof(struct trapframe64, tf_in) endif define TF_SIZE sizeof(struct trapframe64) ifdef notyet # clockframe fields define CF_TSTATE offsetof(struct clockframe, tstate) define CF_PC offsetof(struct clockframe, pc) define CF_NPC offsetof(struct clockframe, npc) define CF_PIL offsetof(struct clockframe, pil) define CF_OLDPIL offsetof(struct clockframe, oldpil) define CF_FP offsetof(struct clockframe, fp) endif # interrupt handler fields define IH_FUN offsetof(struct intrhand, ih_fun) define IH_ARG offsetof(struct intrhand, ih_arg) define IH_NUMBER offsetof(struct intrhand, ih_number) define IH_PIL offsetof(struct intrhand, ih_pil) define IH_PEND offsetof(struct intrhand, ih_pending) define IH_NEXT offsetof(struct intrhand, ih_next) define IH_MAP offsetof(struct intrhand, ih_map) define IH_CLR offsetof(struct intrhand, ih_clr) define IH_ACK offsetof(struct intrhand, ih_ack) define IH_CNT offsetof(struct intrhand, ih_cnt) # mbuf fields of import define M_NEXT offsetof(struct mbuf, m_next) define M_DATA offsetof(struct mbuf, m_data) define M_LEN offsetof(struct mbuf, m_len) # event counters define EVC_SIZE sizeof(struct evcnt) ifdef notyet # floppy trap handler fields define FDC_REG_MSR offsetof(struct fdcio, fdcio_reg_msr) define FDC_REG_FIFO offsetof(struct fdcio, fdcio_reg_fifo) define FDC_ISTATE offsetof(struct fdcio, fdcio_istate) define FDC_STATUS offsetof(struct fdcio, fdcio_status) define FDC_NSTAT offsetof(struct fdcio, fdcio_nstat) define FDC_DATA offsetof(struct fdcio, fdcio_data) define FDC_TC offsetof(struct fdcio, fdcio_tc) define FDC_EVCNT offsetof(struct fdcio, fdcio_intrcnt.ev_count) # db_regs structure so we can save all registers define DBR_TRAPS offsetof(struct db_regs, dbr_traps) define DBR_Y offsetof(struct db_regs, dbr_y) define DBR_TL offsetof(struct db_regs, dbr_tl) define DBR_CANRESTORE offsetof(struct db_regs, dbr_canrestore) define DBR_CANSAVE offsetof(struct db_regs, dbr_cansave) define DBR_CLEANWIN offsetof(struct db_regs, dbr_cleanwin) define DBR_CWP offsetof(struct db_regs, dbr_cwp) define DBR_WSTATE offsetof(struct db_regs, dbr_wstate) define DBR_G offsetof(struct db_regs, dbr_g) define DBR_AG offsetof(struct db_regs, dbr_ag) define DBR_IG offsetof(struct db_regs, dbr_ig) define DBR_MG offsetof(struct db_regs, dbr_mg) define DBR_OUT offsetof(struct db_regs, dbr_out) define DBR_LOCAL offsetof(struct db_regs, dbr_local) define DBR_IN offsetof(struct db_regs, dbr_in) endif # pte_t structure. define TTE_VPN offsetof(pte_t, tag) define TTE_DATA offsetof(pte_t, data) define PTE_SIZE sizeof(pte_t)