1# $NetBSD: genassym.cf,v 1.95 2020/08/28 13:36:52 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 33if defined(_KERNEL_OPT) 34include "opt_arm_start.h" 35include "opt_execfmt.h" 36include "opt_multiprocessor.h" 37endif 38 39include <sys/param.h> 40 41include <sys/device.h> 42include <sys/mbuf.h> 43include <sys/proc.h> 44include <sys/resourcevar.h> 45include <sys/signal.h> 46include <sys/systm.h> 47 48include <netinet/in.h> 49include <netinet/in_systm.h> 50include <netinet/ip.h> 51include <netinet/ip6.h> 52include <netinet/ip_var.h> 53 54include <uvm/uvm_extern.h> 55 56include <arm/fiq.h> 57include <arm/locore.h> 58include <arm/vfpreg.h> 59include <arm/undefined.h> 60 61include <arm/arm32/machdep.h> 62include <arm/arm32/pte.h> 63 64include <machine/pmap.h> 65include <machine/pcb.h> 66include <machine/vmparam.h> 67 68define __PROG32 1 69ifdef __ARM_FIQ_INDIRECT 70define __ARM_FIQ_INDIRECT 1 71endif 72 73ifdef __HAVE_FAST_SOFTINTS 74define __HAVE_FAST_SOFTINTS 1 75endif 76 77ifdef __HAVE_GENERIC_START 78define __HAVE_GENERIC_START 1 79endif 80 81ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS 82define __HAVE_MM_MD_DIRECT_MAPPED_PHYS 1 83endif 84 85ifdef __HAVE_PIC_FAST_SOFTINTS 86define __HAVE_PIC_FAST_SOFTINTS 1 87endif 88 89ifdef __HAVE_PREEMPTION 90define __HAVE_PREEMPTION 1 91endif 92 93ifdef ARM_MMU_EXTENDED 94define ARM_MMU_EXTENDED 1 95endif 96 97ifdef VERBOSE_INIT_ARM 98define VERBOSE_INIT_ARM 1 99endif 100 101define KERNEL_BASE KERNEL_BASE 102define VM_MIN_ADDRESS VM_MIN_ADDRESS 103define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS 104 105define PMAP_DOMAIN_KERNEL PMAP_DOMAIN_KERNEL 106define DOMAIN_CLIENT DOMAIN_CLIENT 107define DOMAIN_DEFAULT DOMAIN_DEFAULT 108 109define L1_S_PROTO_generic L1_S_PROTO_generic 110define L1_S_PROTO_armv7 L1_S_PROTO_armv7 111 112define L1_S_PROTO_xscale L1_S_PROTO_xscale 113if ARM_NMMUS == 1 114define L1_S_PROTO L1_S_PROTO 115endif 116define L1_S_FRAME L1_S_FRAME 117define L1_S_SHIFT L1_S_SHIFT 118define L1_S_SIZE L1_S_SIZE 119define L1_S_CACHEABLE L1_S_C|L1_S_B|L1_S_V6_S 120define L1_S_NOCACHE L1_S_XS_TEX(1) 121define L1_S_B L1_S_B 122define L1_S_C L1_S_C 123define L1_S_V6_S L1_S_V6_S 124define L1_S_V6_XN L1_S_V6_XN 125define L1_S_AP_KR L1_S_AP(AP_KR) 126define L1_S_AP_KRW L1_S_AP(AP_KRW) 127define L1_S_APv7_KRW L1_S_AP(AP7_KRW) 128define L1_S_DOM_MASK L1_S_DOM_MASK 129define L1_TABLE_SIZE L1_TABLE_SIZE 130define L1_TYPE_S L1_TYPE_S 131define L1_S_DOM_KERNEL L1_S_DOM(PMAP_DOMAIN_KERNEL) 132define L2_S_SIZE L2_S_SIZE 133 134define L1_C_PROTO_generic L1_C_PROTO_generic 135 136define L2_S_PROTO_generic L2_S_PROTO_generic 137define L2_S_SHIFT L2_S_SHIFT 138define L2_S_SIZE L2_S_SIZE 139define L2_C L2_C 140define L2_AP_KRW L2_AP(AP_KRW) 141 142define TTBCR_S_N_1 __SHIFTIN(1, TTBCR_S_N) 143 144define TTBR_UPATTR TTBR_UPATTR 145define TTBR_MPATTR TTBR_MPATTR 146 147ifdef PMAP_INCLUDE_PTE_SYNC 148define PMAP_INCLUDE_PTE_SYNC 1 149endif 150 151define PAGE_MASK PAGE_MASK 152define PAGE_SIZE PAGE_SIZE 153define UPAGES UPAGES 154define PGSHIFT PGSHIFT 155 156define MAXCPUS MAXCPUS 157 158#define PSR_HYP32_MODE PSR_HYP32_MODE 159#define PSR_SVC32_MODE PSR_SVC32_MODE 160#define PSR_MODE PSR_MODE 161#define CPU_CONTROL_DC_ENABLE CPU_CONTROL_DC_ENABLE 162#define TTBCR_S_PD0 TTBCR_S_PD0 163 164define INIT_ARM_STACK_SHIFT INIT_ARM_STACK_SHIFT 165define INIT_ARM_STACK_SIZE INIT_ARM_STACK_SIZE 166define INIT_ARM_TOTAL_STACK INIT_ARM_TOTAL_STACK 167 168# Important offsets into the lwp and proc structs & associated constants 169define L_PCB offsetof(struct lwp, l_addr) 170define L_CPU offsetof(struct lwp, l_cpu) 171define L_PROC offsetof(struct lwp, l_proc) 172define L_PRIVATE offsetof(struct lwp, l_private) 173define L_FLAG offsetof(struct lwp, l_flag) 174define L_MD_ASTPENDING offsetof(struct lwp, l_md.md_astpending) 175define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags) 176define L_MD_TF offsetof(struct lwp, l_md.md_tf) 177define MDLWP_NOALIGNFLT MDLWP_NOALIGNFLT 178 179define LW_SYSTEM LW_SYSTEM 180 181define P_RASLIST offsetof(struct proc, p_raslist) 182 183define PCB_R8 offsetof(struct pcb, pcb_r8) 184define PCB_R9 offsetof(struct pcb, pcb_r9) 185define PCB_R10 offsetof(struct pcb, pcb_r10) 186define PCB_R11 offsetof(struct pcb, pcb_r11) 187define PCB_R12 offsetof(struct pcb, pcb_r12) 188define PCB_KSP offsetof(struct pcb, pcb_sp) 189define PCB_LR offsetof(struct pcb, pcb_lr) 190define PCB_PC offsetof(struct pcb, pcb_pc) 191define PCB_USER_PID_RW offsetof(struct pcb, pcb_user_pid_rw) 192define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 193define PCB_VFP_FPEXC offsetof(struct pcb, pcb_vfp.vfp_fpexc) 194 195define PCB_SIZE sizeof(struct pcb) 196 197define VM_MAP offsetof(struct vmspace, vm_map) 198define VM_PMAP offsetof(struct vmspace, vm_map.pmap) 199 200define PR_BASE offsetof(struct uprof, pr_base) 201define PR_SIZE offsetof(struct uprof, pr_size) 202define PR_OFF offsetof(struct uprof, pr_off) 203define PR_SCALE offsetof(struct uprof, pr_scale) 204 205define SIGTRAP SIGTRAP 206define SIGEMT SIGEMT 207 208define TF_SPSR offsetof(struct trapframe, tf_spsr) 209define TF_FILL offsetof(struct trapframe, tf_fill) 210define TF_R0 offsetof(struct trapframe, tf_r0) 211define TF_R4 offsetof(struct trapframe, tf_r4) 212define TF_R6 offsetof(struct trapframe, tf_r6) 213define TF_R8 offsetof(struct trapframe, tf_r8) 214define TF_R10 offsetof(struct trapframe, tf_r10) 215define TF_R12 offsetof(struct trapframe, tf_r12) 216define TF_USR_SP offsetof(struct trapframe, tf_usr_sp) 217define TF_USR_LR offsetof(struct trapframe, tf_usr_lr) 218define TF_SVC_SP offsetof(struct trapframe, tf_svc_sp) 219define TF_SVC_LR offsetof(struct trapframe, tf_svc_lr) 220define TF_PC offsetof(struct trapframe, tf_pc) 221 222define PROCSIZE sizeof(struct proc) 223define TRAPFRAMESIZE sizeof(struct trapframe) 224 225define CF_IDCACHE_WBINV_ALL offsetof(struct cpu_functions, cf_idcache_wbinv_all) 226define CF_DCACHE_WB_RANGE offsetof(struct cpu_functions, cf_dcache_wb_range) 227define CF_TLB_FLUSHID_SE offsetof(struct cpu_functions, cf_tlb_flushID_SE) 228define CF_CONTEXT_SWITCH offsetof(struct cpu_functions, cf_context_switch) 229define CF_SLEEP offsetof(struct cpu_functions, cf_sleep) 230define CF_CONTROL offsetof(struct cpu_functions, cf_control) 231 232define CPU_INFO_SIZE sizeof(struct cpu_info) 233define CI_ARM_CPUID offsetof(struct cpu_info, ci_arm_cpuid) 234define CI_CPL offsetof(struct cpu_info, ci_cpl) 235define CI_CURLWP offsetof(struct cpu_info, ci_curlwp) 236define CI_INTR_DEPTH offsetof(struct cpu_info, ci_intr_depth) 237define CI_MIDR offsetof(struct cpu_info, ci_midr) 238define CI_MPIDR offsetof(struct cpu_info, ci_mpidr) 239define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) 240define CI_LASTLWP offsetof(struct cpu_info, ci_lastlwp) 241define CI_UNDEFSAVE offsetof(struct cpu_info, ci_undefsave[0]) 242define CI_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp) 243define CI_CC_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr) 244if defined(EXEC_AOUT) 245define CI_CTRL offsetof(struct cpu_info, ci_ctrl) 246endif 247ifdef __HAVE_FAST_SOFTINTS 248define CI_SOFTINTS offsetof(struct cpu_info, ci_softints) 249endif 250ifdef FPU_VFP 251define CI_VFP_ID offsetof(struct cpu_info, ci_vfp_id) 252endif 253 254define VFP_FPEXC_EN VFP_FPEXC_EN 255 256define NSACR_VFPCP NSACR_CPn(VFP_COPROC)|NSACR_CPn(VFP_COPROC2) 257 258# Constants required for in_cksum() and friends. 259define M_LEN offsetof(struct mbuf, m_len) 260define M_DATA offsetof(struct mbuf, m_data) 261define M_NEXT offsetof(struct mbuf, m_next) 262define IP_SRC offsetof(struct ip, ip_src) 263define IP_DST offsetof(struct ip, ip_dst) 264 265# Cache information 266define DCACHE_LINE_SIZE offsetof(struct arm_cache_info, dcache_line_size) 267define DCACHE_SIZE offsetof(struct arm_cache_info, dcache_size) 268