# $NetBSD: genassym.cf,v 1.80 2018/10/18 09:01:52 skrll Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
#
# This code is derived from software contributed to Berkeley by
# William Jolitz.
#
# 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.
include <sys/param.h>
include <sys/systm.h>
include <sys/mbuf.h>
include <sys/proc.h>
include <sys/resourcevar.h>
include <sys/device.h>
include <sys/signal.h>
include <netinet/in.h>
include <netinet/in_systm.h>
include <netinet/ip.h>
include <netinet/ip6.h>
include <netinet/ip_var.h>
include <uvm/uvm_extern.h>
include <arm/fiq.h>
include <arm/vfpreg.h>
include <arm/locore.h>
include <arm/undefined.h>
include <arm/arm32/pte.h>
include <machine/pmap.h>
include <machine/pcb.h>
include <machine/vmparam.h>
if defined(_KERNEL_OPT)
include "opt_multiprocessor.h"
include "opt_compat_netbsd.h"
include "opt_execfmt.h"
endif
define __PROG32 1
ifdef __ARM_FIQ_INDIRECT
define __ARM_FIQ_INDIRECT 1
endif
ifdef __HAVE_PREEMPTION
define __HAVE_PREEMPTION 1
endif
ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
define __HAVE_MM_MD_DIRECT_MAPPED_PHYS 1
endif
ifdef __HAVE_FAST_SOFTINTS
define __HAVE_FAST_SOFTINTS 1
endif
ifdef __HAVE_PIC_FAST_SOFTINTS
define __HAVE_PIC_FAST_SOFTINTS 1
endif
ifdef ARM_MMU_EXTENDED
define ARM_MMU_EXTENDED 1
endif
ifdef VERBOSE_INIT_ARM
define VERBOSE_INIT_ARM 1
endif
define KERNEL_BASE KERNEL_BASE
define VM_MIN_ADDRESS VM_MIN_ADDRESS
define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS
define PV_PA offsetof(pv_addr_t, pv_pa)
define PMAP_DOMAIN_KERNEL PMAP_DOMAIN_KERNEL
define DOMAIN_CLIENT DOMAIN_CLIENT
define DOMAIN_DEFAULT DOMAIN_DEFAULT
define L1_S_PROTO_generic L1_S_PROTO_generic
define L1_S_PROTO_armv7 L1_S_PROTO_armv7
define L1_S_PROTO_xscale L1_S_PROTO_xscale
if ARM_NMMUS == 1
define L1_S_PROTO L1_S_PROTO
endif
define L1_S_FRAME L1_S_FRAME
define L1_S_SHIFT L1_S_SHIFT
define L1_S_SIZE L1_S_SIZE
define L1_S_CACHEABLE L1_S_C|L1_S_B|L1_S_V6_S
define L1_S_B L1_S_B
define L1_S_C L1_S_C
define L1_S_V6_S L1_S_V6_S
define L1_S_V6_XN L1_S_V6_XN
define L1_S_AP_KR L1_S_AP(AP_KR)
define L1_S_AP_KRW L1_S_AP(AP_KRW)
define L1_S_APv7_KRW L1_S_AP(AP7_KRW)
define L1_S_DOM_MASK L1_S_DOM_MASK
define L1_TABLE_SIZE L1_TABLE_SIZE
define L1_TYPE_S L1_TYPE_S
define L1_S_DOM_KERNEL L1_S_DOM(PMAP_DOMAIN_KERNEL)
define L2_S_SIZE L2_S_SIZE
define L1_C_PROTO_generic L1_C_PROTO_generic
define L2_S_PROTO_generic L2_S_PROTO_generic
define L2_S_SHIFT L2_S_SHIFT
define L2_S_SIZE L2_S_SIZE
define L2_C L2_C
define L2_AP_KRW L2_AP(AP_KRW)
define TTBCR_S_N_1 __SHIFTIN(1, TTBCR_S_N)
define TTBR_UPATTR TTBR_UPATTR
define TTBR_MPATTR TTBR_MPATTR
ifdef PMAP_INCLUDE_PTE_SYNC
define PMAP_INCLUDE_PTE_SYNC 1
endif
define PAGE_MASK PAGE_MASK
define PAGE_SIZE PAGE_SIZE
define UPAGES UPAGES
define PGSHIFT PGSHIFT
define MAXCPUS MAXCPUS
#define PSR_HYP32_MODE PSR_HYP32_MODE
#define PSR_SVC32_MODE PSR_SVC32_MODE
#define PSR_MODE PSR_MODE
#define CPU_CONTROL_DC_ENABLE CPU_CONTROL_DC_ENABLE
#define TTBCR_S_PD0 TTBCR_S_PD0
# Important offsets into the lwp and proc structs & associated constants
define L_PCB offsetof(struct lwp, l_addr)
define L_CPU offsetof(struct lwp, l_cpu)
define L_PRIORITY offsetof(struct lwp, l_priority)
define L_WCHAN offsetof(struct lwp, l_wchan)
define L_STAT offsetof(struct lwp, l_stat)
define L_PROC offsetof(struct lwp, l_proc)
define L_CTXSWTCH offsetof(struct lwp, l_ctxswtch)
define L_PRIVATE offsetof(struct lwp, l_private)
define L_FLAG offsetof(struct lwp, l_flag)
define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags)
define L_MD_TF offsetof(struct lwp, l_md.md_tf)
define MDLWP_NOALIGNFLT MDLWP_NOALIGNFLT
define LW_SYSTEM LW_SYSTEM
define P_RASLIST offsetof(struct proc, p_raslist)
define PCB_R8 offsetof(struct pcb, pcb_r8)
define PCB_R9 offsetof(struct pcb, pcb_r9)
define PCB_R10 offsetof(struct pcb, pcb_r10)
define PCB_R11 offsetof(struct pcb, pcb_r11)
define PCB_R12 offsetof(struct pcb, pcb_r12)
define PCB_KSP offsetof(struct pcb, pcb_sp)
define PCB_LR offsetof(struct pcb, pcb_lr)
define PCB_PC offsetof(struct pcb, pcb_pc)
define PCB_USER_PID_RW offsetof(struct pcb, pcb_user_pid_rw)
define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
define PCB_VFP_FPEXC offsetof(struct pcb, pcb_vfp.vfp_fpexc)
define PCB_SIZE sizeof(struct pcb)
define VM_MAP offsetof(struct vmspace, vm_map)
define VM_PMAP offsetof(struct vmspace, vm_map.pmap)
define PR_BASE offsetof(struct uprof, pr_base)
define PR_SIZE offsetof(struct uprof, pr_size)
define PR_OFF offsetof(struct uprof, pr_off)
define PR_SCALE offsetof(struct uprof, pr_scale)
define SIGTRAP SIGTRAP
define SIGEMT SIGEMT
define TF_SPSR offsetof(struct trapframe, tf_spsr)
define TF_FILL offsetof(struct trapframe, tf_fill)
define TF_R0 offsetof(struct trapframe, tf_r0)
define TF_R4 offsetof(struct trapframe, tf_r4)
define TF_R6 offsetof(struct trapframe, tf_r6)
define TF_R8 offsetof(struct trapframe, tf_r8)
define TF_R10 offsetof(struct trapframe, tf_r10)
define TF_R12 offsetof(struct trapframe, tf_r12)
define TF_USR_SP offsetof(struct trapframe, tf_usr_sp)
define TF_USR_LR offsetof(struct trapframe, tf_usr_lr)
define TF_SVC_SP offsetof(struct trapframe, tf_svc_sp)
define TF_SVC_LR offsetof(struct trapframe, tf_svc_lr)
define TF_PC offsetof(struct trapframe, tf_pc)
define PROCSIZE sizeof(struct proc)
define TRAPFRAMESIZE sizeof(struct trapframe)
define CF_IDCACHE_WBINV_ALL offsetof(struct cpu_functions, cf_idcache_wbinv_all)
define CF_DCACHE_WB_RANGE offsetof(struct cpu_functions, cf_dcache_wb_range)
define CF_TLB_FLUSHID_SE offsetof(struct cpu_functions, cf_tlb_flushID_SE)
define CF_CONTEXT_SWITCH offsetof(struct cpu_functions, cf_context_switch)
define CF_SLEEP offsetof(struct cpu_functions, cf_sleep)
define CF_CONTROL offsetof(struct cpu_functions, cf_control)
define CI_CURPRIORITY offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
define CI_ARM_CPUID offsetof(struct cpu_info, ci_arm_cpuid)
define CI_CURLWP offsetof(struct cpu_info, ci_curlwp)
define CI_CPL offsetof(struct cpu_info, ci_cpl)
define CI_ASTPENDING offsetof(struct cpu_info, ci_astpending)
define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched)
define CI_INTR_DEPTH offsetof(struct cpu_info, ci_intr_depth)
define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
define CI_UNDEFSAVE offsetof(struct cpu_info, ci_undefsave[0])
if defined(EXEC_AOUT)
define CI_CTRL offsetof(struct cpu_info, ci_ctrl)
endif
ifdef __HAVE_FAST_SOFTINTS
define CI_SOFTINTS offsetof(struct cpu_info, ci_softints)
endif
define CI_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
define CI_CC_NTRAP offsetof(struct cpu_info, ci_data.cpu_ntrap)
define CI_CC_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr)
define CI_CC_NSOFT offsetof(struct cpu_info, ci_data.cpu_nsoft)
ifdef FPU_VFP
define CI_VFP_ID offsetof(struct cpu_info, ci_vfp_id)
endif
define CI_LASTLWP offsetof(struct cpu_info, ci_lastlwp)
define VFP_FPEXC_EN VFP_FPEXC_EN
define NSACR_VFPCP NSACR_CPn(VFP_COPROC)|NSACR_CPn(VFP_COPROC2)
# Constants required for in_cksum() and friends.
define M_LEN offsetof(struct mbuf, m_len)
define M_DATA offsetof(struct mbuf, m_data)
define M_NEXT offsetof(struct mbuf, m_next)
define IP_SRC offsetof(struct ip, ip_src)
define IP_DST offsetof(struct ip, ip_dst)
# Cache information
define DCACHE_LINE_SIZE offsetof(struct arm_cache_info, dcache_line_size)
define DCACHE_SIZE offsetof(struct arm_cache_info, dcache_size)