genassym.cf revision 1.75
1# $NetBSD: genassym.cf,v 1.75 2017/07/12 07:22:31 skrll Exp $ 2 3# Copyright (c) 1982, 1990 The Regents of the University of California. 4# All rights reserved. 5# 6# This code is derived from software contributed to Berkeley by 7# William Jolitz. 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions 11# are met: 12# 1. Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 3. Neither the name of the University nor the names of its contributors 18# may be used to endorse or promote products derived from this software 19# without specific prior written permission. 20# 21# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31# SUCH DAMAGE. 32 33include <sys/param.h> 34include <sys/systm.h> 35include <sys/mbuf.h> 36include <sys/proc.h> 37include <sys/resourcevar.h> 38include <sys/device.h> 39include <sys/signal.h> 40include <netinet/in.h> 41include <netinet/in_systm.h> 42include <netinet/ip.h> 43include <netinet/ip6.h> 44include <netinet/ip_var.h> 45 46include <uvm/uvm_extern.h> 47 48include <arm/fiq.h> 49include <arm/vfpreg.h> 50include <arm/locore.h> 51include <arm/undefined.h> 52 53include <arm/arm32/pte.h> 54include <machine/pmap.h> 55include <machine/pcb.h> 56include <machine/vmparam.h> 57 58if defined(_KERNEL_OPT) 59include "opt_multiprocessor.h" 60include "opt_compat_netbsd.h" 61include "opt_execfmt.h" 62endif 63 64define __PROG32 1 65ifdef __ARM_FIQ_INDIRECT 66define __ARM_FIQ_INDIRECT 1 67endif 68 69ifdef __HAVE_PREEMPTION 70define __HAVE_PREEMPTION 1 71endif 72 73ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS 74define __HAVE_MM_MD_DIRECT_MAPPED_PHYS 1 75endif 76 77ifdef __HAVE_FAST_SOFTINTS 78define __HAVE_FAST_SOFTINTS 1 79endif 80 81ifdef __HAVE_PIC_FAST_SOFTINTS 82define __HAVE_PIC_FAST_SOFTINTS 1 83endif 84 85ifdef ARM_MMU_EXTENDED 86define ARM_MMU_EXTENDED 1 87endif 88 89ifdef VERBOSE_INIT_ARM 90define VERBOSE_INIT_ARM 1 91endif 92 93define KERNEL_BASE KERNEL_BASE 94define VM_MIN_ADDRESS VM_MIN_ADDRESS 95define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS 96 97define DCACHE_LINE_SIZE offsetof(struct arm_cache_info, dcache_line_size) 98 99define PV_PA offsetof(pv_addr_t, pv_pa) 100define PMAP_DOMAIN_KERNEL PMAP_DOMAIN_KERNEL 101define DOMAIN_CLIENT DOMAIN_CLIENT 102ifdef ARM_MMU_EXTENDED 103define DOMAIN_DEFAULT ((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | (DOMAIN_CLIENT << (PMAP_DOMAIN_USER*2))) 104else 105define DOMAIN_DEFAULT ((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) 106endif 107 108define L1_S_PROTO_generic L1_S_PROTO_generic 109define L1_S_PROTO_armv7 L1_S_PROTO_armv7 110define L1_S_PROTO_xscale L1_S_PROTO_xscale 111if ARM_NMMUS == 1 112define L1_S_PROTO L1_S_PROTO 113endif 114define L1_S_FRAME L1_S_FRAME 115define L1_S_SHIFT L1_S_SHIFT 116define L1_S_SIZE L1_S_SIZE 117define L1_S_CACHEABLE L1_S_C|L1_S_B|L1_S_V6_S 118define L1_S_B L1_S_B 119define L1_S_C L1_S_C 120define L1_S_V6_S L1_S_V6_S 121define L1_S_V6_XN L1_S_V6_XN 122define L1_S_AP_KR L1_S_AP(AP_KR) 123define L1_S_AP_KRW L1_S_AP(AP_KRW) 124define L1_S_APv7_KRW L1_S_AP(AP7_KRW) 125define L1_S_DOM_MASK L1_S_DOM_MASK 126define L1_TABLE_SIZE L1_TABLE_SIZE 127define L1_TYPE_S L1_TYPE_S 128define L1_S_DOM_KERNEL L1_S_DOM(PMAP_DOMAIN_KERNEL) 129define L2_S_SIZE L2_S_SIZE 130 131define L1_C_PROTO_generic L1_C_PROTO_generic 132 133define L2_S_PROTO_generic L2_S_PROTO_generic 134define L2_S_SHIFT L2_S_SHIFT 135define L2_S_SIZE L2_S_SIZE 136define L2_C L2_C 137define L2_AP_KRW L2_AP(AP_KRW) 138 139define TTBCR_S_N_1 __SHIFTIN(1, TTBCR_S_N) 140 141define TTBR_UPATTR TTBR_UPATTR 142define TTBR_MPATTR TTBR_MPATTR 143 144ifdef PMAP_INCLUDE_PTE_SYNC 145define PMAP_INCLUDE_PTE_SYNC 1 146endif 147 148define PAGE_MASK PAGE_MASK 149define PAGE_SIZE PAGE_SIZE 150define UPAGES UPAGES 151define PGSHIFT PGSHIFT 152 153# Important offsets into the lwp and proc structs & associated constants 154define L_PCB offsetof(struct lwp, l_addr) 155define L_CPU offsetof(struct lwp, l_cpu) 156define L_PRIORITY offsetof(struct lwp, l_priority) 157define L_WCHAN offsetof(struct lwp, l_wchan) 158define L_STAT offsetof(struct lwp, l_stat) 159define L_PROC offsetof(struct lwp, l_proc) 160define L_CTXSWTCH offsetof(struct lwp, l_ctxswtch) 161define L_PRIVATE offsetof(struct lwp, l_private) 162define L_FLAG offsetof(struct lwp, l_flag) 163define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags) 164define L_MD_TF offsetof(struct lwp, l_md.md_tf) 165define MDLWP_NOALIGNFLT MDLWP_NOALIGNFLT 166 167define LW_SYSTEM LW_SYSTEM 168 169define P_RASLIST offsetof(struct proc, p_raslist) 170 171define PCB_R8 offsetof(struct pcb, pcb_un.un_32.pcb32_r8) 172define PCB_R9 offsetof(struct pcb, pcb_un.un_32.pcb32_r9) 173define PCB_R10 offsetof(struct pcb, pcb_un.un_32.pcb32_r10) 174define PCB_R11 offsetof(struct pcb, pcb_un.un_32.pcb32_r11) 175define PCB_R12 offsetof(struct pcb, pcb_un.un_32.pcb32_r12) 176define PCB_KSP offsetof(struct pcb, pcb_un.un_32.pcb32_sp) 177define PCB_LR offsetof(struct pcb, pcb_un.un_32.pcb32_lr) 178define PCB_PC offsetof(struct pcb, pcb_un.un_32.pcb32_pc) 179define PCB_USER_PID_RW offsetof(struct pcb, pcb_un.un_32.pcb32_user_pid_rw) 180define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 181define PCB_VFP_FPEXC offsetof(struct pcb, pcb_vfp.vfp_fpexc) 182 183define PCB_SIZE sizeof(struct pcb) 184 185define VM_MAP offsetof(struct vmspace, vm_map) 186define VM_PMAP offsetof(struct vmspace, vm_map.pmap) 187 188define PR_BASE offsetof(struct uprof, pr_base) 189define PR_SIZE offsetof(struct uprof, pr_size) 190define PR_OFF offsetof(struct uprof, pr_off) 191define PR_SCALE offsetof(struct uprof, pr_scale) 192 193define SIGTRAP SIGTRAP 194define SIGEMT SIGEMT 195 196define TF_SPSR offsetof(struct trapframe, tf_spsr) 197define TF_FILL offsetof(struct trapframe, tf_fill) 198define TF_R0 offsetof(struct trapframe, tf_r0) 199define TF_R4 offsetof(struct trapframe, tf_r4) 200define TF_R6 offsetof(struct trapframe, tf_r6) 201define TF_R8 offsetof(struct trapframe, tf_r8) 202define TF_R10 offsetof(struct trapframe, tf_r10) 203define TF_R12 offsetof(struct trapframe, tf_r12) 204define TF_USR_SP offsetof(struct trapframe, tf_usr_sp) 205define TF_USR_LR offsetof(struct trapframe, tf_usr_lr) 206define TF_SVC_SP offsetof(struct trapframe, tf_svc_sp) 207define TF_SVC_LR offsetof(struct trapframe, tf_svc_lr) 208define TF_PC offsetof(struct trapframe, tf_pc) 209 210define PROCSIZE sizeof(struct proc) 211define TRAPFRAMESIZE sizeof(struct trapframe) 212 213define CF_IDCACHE_WBINV_ALL offsetof(struct cpu_functions, cf_idcache_wbinv_all) 214define CF_DCACHE_WB_RANGE offsetof(struct cpu_functions, cf_dcache_wb_range) 215define CF_TLB_FLUSHID_SE offsetof(struct cpu_functions, cf_tlb_flushID_SE) 216define CF_CONTEXT_SWITCH offsetof(struct cpu_functions, cf_context_switch) 217define CF_SLEEP offsetof(struct cpu_functions, cf_sleep) 218define CF_CONTROL offsetof(struct cpu_functions, cf_control) 219 220define CI_CURPRIORITY offsetof(struct cpu_info, ci_schedstate.spc_curpriority) 221define CI_ARM_CPUID offsetof(struct cpu_info, ci_arm_cpuid) 222define CI_CURLWP offsetof(struct cpu_info, ci_curlwp) 223define CI_CPL offsetof(struct cpu_info, ci_cpl) 224define CI_ASTPENDING offsetof(struct cpu_info, ci_astpending) 225define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched) 226define CI_INTR_DEPTH offsetof(struct cpu_info, ci_intr_depth) 227define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) 228define CI_UNDEFSAVE offsetof(struct cpu_info, ci_undefsave[0]) 229if defined(EXEC_AOUT) 230define CI_CTRL offsetof(struct cpu_info, ci_ctrl) 231endif 232ifdef __HAVE_FAST_SOFTINTS 233define CI_SOFTINTS offsetof(struct cpu_info, ci_softints) 234endif 235define CI_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp) 236define CI_CC_NTRAP offsetof(struct cpu_info, ci_data.cpu_ntrap) 237define CI_CC_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr) 238define CI_CC_NSOFT offsetof(struct cpu_info, ci_data.cpu_nsoft) 239ifdef FPU_VFP 240define CI_VFP_ID offsetof(struct cpu_info, ci_vfp_id) 241endif 242define CI_LASTLWP offsetof(struct cpu_info, ci_lastlwp) 243 244define VFP_FPEXC_EN VFP_FPEXC_EN 245 246define NSACR_VFPCP NSACR_CPn(VFP_COPROC)|NSACR_CPn(VFP_COPROC2) 247 248# Constants required for in_cksum() and friends. 249define M_LEN offsetof(struct mbuf, m_len) 250define M_DATA offsetof(struct mbuf, m_data) 251define M_NEXT offsetof(struct mbuf, m_next) 252define IP_SRC offsetof(struct ip, ip_src) 253define IP_DST offsetof(struct ip, ip_dst) 254 255# Cache information 256define DCACHE_SIZE offsetof(struct arm_cache_info, dcache_size) 257