genassym.cf revision 1.82
11.82Sskrll#	$NetBSD: genassym.cf,v 1.82 2019/11/24 11:23:16 skrll Exp $
21.1Schris
31.1Schris# Copyright (c) 1982, 1990 The Regents of the University of California.
41.1Schris# All rights reserved.
51.1Schris#
61.1Schris# This code is derived from software contributed to Berkeley by
71.1Schris# William Jolitz.
81.1Schris#
91.1Schris# Redistribution and use in source and binary forms, with or without
101.1Schris# modification, are permitted provided that the following conditions
111.1Schris# are met:
121.1Schris# 1. Redistributions of source code must retain the above copyright
131.1Schris#    notice, this list of conditions and the following disclaimer.
141.1Schris# 2. Redistributions in binary form must reproduce the above copyright
151.1Schris#    notice, this list of conditions and the following disclaimer in the
161.1Schris#    documentation and/or other materials provided with the distribution.
171.41Stsutsui# 3. Neither the name of the University nor the names of its contributors
181.1Schris#    may be used to endorse or promote products derived from this software
191.1Schris#    without specific prior written permission.
201.1Schris#
211.1Schris# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221.1Schris# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231.1Schris# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241.1Schris# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251.1Schris# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261.1Schris# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271.1Schris# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281.1Schris# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291.1Schris# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301.1Schris# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311.1Schris# SUCH DAMAGE.
321.1Schris
331.82Sskrllif defined(_KERNEL_OPT)
341.82Sskrllinclude "opt_multiprocessor.h"
351.82Sskrllinclude "opt_compat_netbsd.h"
361.82Sskrllinclude "opt_execfmt.h"
371.82Sskrllendif
381.82Sskrll
391.1Schrisinclude <sys/param.h>
401.1Schrisinclude <sys/systm.h>
411.25Sscwinclude <sys/mbuf.h>
421.1Schrisinclude <sys/proc.h>
431.1Schrisinclude <sys/resourcevar.h>
441.1Schrisinclude <sys/device.h>
451.1Schrisinclude <sys/signal.h>
461.25Sscwinclude <netinet/in.h>
471.25Sscwinclude <netinet/in_systm.h>
481.25Sscwinclude <netinet/ip.h>
491.25Sscwinclude <netinet/ip6.h>
501.25Sscwinclude <netinet/ip_var.h>
511.1Schris
521.1Schrisinclude <uvm/uvm_extern.h>
531.8Sthorpej
541.8Sthorpejinclude <arm/fiq.h>
551.58Smattinclude <arm/vfpreg.h>
561.65Smattinclude <arm/locore.h>
571.68Smattinclude <arm/undefined.h>
581.1Schris
591.45Smattinclude <arm/arm32/pte.h>
601.1Schrisinclude <machine/pmap.h>
611.49Smattinclude <machine/pcb.h>
621.1Schrisinclude <machine/vmparam.h>
631.6Sthorpej
641.6Sthorpejdefine	__PROG32		1
651.10Sthorpejifdef __ARM_FIQ_INDIRECT
661.10Sthorpejdefine	__ARM_FIQ_INDIRECT	1
671.10Sthorpejendif
681.1Schris
691.72Smattifdef __HAVE_PREEMPTION
701.72Smattdefine	__HAVE_PREEMPTION	1
711.72Smattendif
721.72Smatt
731.59Smattifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
741.59Smattdefine	__HAVE_MM_MD_DIRECT_MAPPED_PHYS	1
751.59Smattendif
761.59Smatt
771.37Smattifdef __HAVE_FAST_SOFTINTS
781.37Smattdefine	__HAVE_FAST_SOFTINTS	1
791.37Smattendif
801.37Smatt
811.52Smattifdef __HAVE_PIC_FAST_SOFTINTS
821.52Smattdefine	__HAVE_PIC_FAST_SOFTINTS	1
831.52Smattendif
841.52Smatt
851.68Smattifdef ARM_MMU_EXTENDED
861.68Smattdefine  ARM_MMU_EXTENDED	1
871.68Smattendif
881.68Smatt
891.69Smattifdef VERBOSE_INIT_ARM
901.69Smattdefine	VERBOSE_INIT_ARM	1
911.69Smattendif
921.69Smatt
931.31Smattdefine	KERNEL_BASE		KERNEL_BASE
941.1Schrisdefine	VM_MIN_ADDRESS		VM_MIN_ADDRESS
951.1Schrisdefine	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS
961.22Sscw
971.51Smattdefine	PV_PA			offsetof(pv_addr_t, pv_pa)
981.22Sscwdefine	PMAP_DOMAIN_KERNEL	PMAP_DOMAIN_KERNEL
991.45Smattdefine	DOMAIN_CLIENT		DOMAIN_CLIENT
1001.80Sskrlldefine	DOMAIN_DEFAULT		DOMAIN_DEFAULT
1011.68Smatt
1021.45Smattdefine	L1_S_PROTO_generic	L1_S_PROTO_generic
1031.45Smattdefine	L1_S_PROTO_armv7	L1_S_PROTO_armv7
1041.80Sskrll
1051.45Smattdefine	L1_S_PROTO_xscale	L1_S_PROTO_xscale
1061.45Smattif ARM_NMMUS == 1
1071.45Smattdefine	L1_S_PROTO		L1_S_PROTO
1081.45Smattendif
1091.45Smattdefine	L1_S_FRAME		L1_S_FRAME
1101.45Smattdefine	L1_S_SHIFT		L1_S_SHIFT
1111.45Smattdefine	L1_S_SIZE		L1_S_SIZE
1121.68Smattdefine	L1_S_CACHEABLE		L1_S_C|L1_S_B|L1_S_V6_S
1131.45Smattdefine	L1_S_B			L1_S_B
1141.45Smattdefine	L1_S_C			L1_S_C
1151.62Smattdefine	L1_S_V6_S		L1_S_V6_S
1161.68Smattdefine	L1_S_V6_XN		L1_S_V6_XN
1171.53Smattdefine	L1_S_AP_KR		L1_S_AP(AP_KR)
1181.45Smattdefine	L1_S_AP_KRW		L1_S_AP(AP_KRW)
1191.45Smattdefine	L1_S_APv7_KRW		L1_S_AP(AP7_KRW)
1201.68Smattdefine	L1_S_DOM_MASK		L1_S_DOM_MASK
1211.45Smattdefine	L1_TABLE_SIZE		L1_TABLE_SIZE
1221.45Smattdefine	L1_TYPE_S		L1_TYPE_S
1231.45Smattdefine	L1_S_DOM_KERNEL		L1_S_DOM(PMAP_DOMAIN_KERNEL)
1241.63Smattdefine	L2_S_SIZE		L2_S_SIZE
1251.23Sthorpej
1261.61Skiyoharadefine	L1_C_PROTO_generic	L1_C_PROTO_generic
1271.61Skiyohara
1281.61Skiyoharadefine	L2_S_PROTO_generic	L2_S_PROTO_generic
1291.61Skiyoharadefine	L2_S_SHIFT		L2_S_SHIFT
1301.61Skiyoharadefine	L2_S_SIZE		L2_S_SIZE
1311.61Skiyoharadefine	L2_C			L2_C
1321.61Skiyoharadefine	L2_AP_KRW		L2_AP(AP_KRW)
1331.61Skiyohara
1341.68Smattdefine	TTBCR_S_N_1		__SHIFTIN(1, TTBCR_S_N)
1351.68Smatt
1361.73Sskrlldefine	TTBR_UPATTR		TTBR_UPATTR
1371.73Sskrlldefine	TTBR_MPATTR		TTBR_MPATTR
1381.73Sskrll
1391.23Sthorpejifdef PMAP_INCLUDE_PTE_SYNC
1401.23Sthorpejdefine	PMAP_INCLUDE_PTE_SYNC	1
1411.22Sscwendif
1421.1Schris
1431.54Smattdefine	PAGE_MASK		PAGE_MASK
1441.21Sthorpejdefine	PAGE_SIZE		PAGE_SIZE
1451.1Schrisdefine	UPAGES			UPAGES
1461.1Schrisdefine	PGSHIFT			PGSHIFT
1471.1Schris
1481.78Sryodefine	MAXCPUS			MAXCPUS
1491.78Sryo
1501.80Sskrll#define	PSR_HYP32_MODE		PSR_HYP32_MODE
1511.80Sskrll#define	PSR_SVC32_MODE		PSR_SVC32_MODE
1521.80Sskrll#define	PSR_MODE		PSR_MODE
1531.80Sskrll#define	CPU_CONTROL_DC_ENABLE	CPU_CONTROL_DC_ENABLE
1541.80Sskrll#define	TTBCR_S_PD0		TTBCR_S_PD0
1551.80Sskrll
1561.20Sthorpej# Important offsets into the lwp and proc structs & associated constants
1571.42Srminddefine	L_PCB			offsetof(struct lwp, l_addr)
1581.20Sthorpejdefine	L_CPU			offsetof(struct lwp, l_cpu)
1591.20Sthorpejdefine	L_PRIORITY		offsetof(struct lwp, l_priority)
1601.20Sthorpejdefine	L_WCHAN			offsetof(struct lwp, l_wchan)
1611.20Sthorpejdefine	L_STAT			offsetof(struct lwp, l_stat)
1621.20Sthorpejdefine	L_PROC			offsetof(struct lwp, l_proc)
1631.39Smattdefine	L_CTXSWTCH		offsetof(struct lwp, l_ctxswtch)
1641.46Smattdefine	L_PRIVATE		offsetof(struct lwp, l_private)
1651.70Smattdefine	L_FLAG			offsetof(struct lwp, l_flag)
1661.49Smattdefine	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
1671.49Smattdefine	L_MD_TF			offsetof(struct lwp, l_md.md_tf)
1681.49Smattdefine	MDLWP_NOALIGNFLT	MDLWP_NOALIGNFLT
1691.49Smatt
1701.70Smattdefine	LW_SYSTEM		LW_SYSTEM
1711.70Smatt
1721.27Sdsldefine	P_RASLIST		offsetof(struct proc, p_raslist)
1731.1Schris
1741.77Sskrlldefine	PCB_R8			offsetof(struct pcb, pcb_r8)
1751.77Sskrlldefine	PCB_R9			offsetof(struct pcb, pcb_r9)
1761.77Sskrlldefine	PCB_R10			offsetof(struct pcb, pcb_r10)
1771.77Sskrlldefine	PCB_R11			offsetof(struct pcb, pcb_r11)
1781.77Sskrlldefine	PCB_R12			offsetof(struct pcb, pcb_r12)
1791.77Sskrlldefine	PCB_KSP			offsetof(struct pcb, pcb_sp)
1801.77Sskrlldefine	PCB_LR			offsetof(struct pcb, pcb_lr)
1811.77Sskrlldefine	PCB_PC			offsetof(struct pcb, pcb_pc)
1821.77Sskrlldefine	PCB_USER_PID_RW		offsetof(struct pcb, pcb_user_pid_rw)
1831.1Schrisdefine	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
1841.60Smattdefine	PCB_VFP_FPEXC		offsetof(struct pcb, pcb_vfp.vfp_fpexc)
1851.1Schris
1861.44Srminddefine	PCB_SIZE		sizeof(struct pcb)
1871.1Schris
1881.1Schrisdefine	VM_MAP			offsetof(struct vmspace, vm_map)
1891.1Schrisdefine	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
1901.1Schris
1911.1Schrisdefine	PR_BASE			offsetof(struct uprof, pr_base)
1921.1Schrisdefine	PR_SIZE			offsetof(struct uprof, pr_size)
1931.1Schrisdefine	PR_OFF			offsetof(struct uprof, pr_off)
1941.1Schrisdefine	PR_SCALE		offsetof(struct uprof, pr_scale)
1951.1Schris
1961.1Schrisdefine	SIGTRAP			SIGTRAP
1971.1Schrisdefine	SIGEMT			SIGEMT
1981.1Schris
1991.64Smattdefine	TF_SPSR			offsetof(struct trapframe, tf_spsr)
2001.50Smattdefine	TF_FILL			offsetof(struct trapframe, tf_fill)
2011.1Schrisdefine	TF_R0			offsetof(struct trapframe, tf_r0)
2021.55Smattdefine	TF_R4			offsetof(struct trapframe, tf_r4)
2031.55Smattdefine	TF_R6			offsetof(struct trapframe, tf_r6)
2041.64Smattdefine	TF_R8			offsetof(struct trapframe, tf_r8)
2051.1Schrisdefine	TF_R10			offsetof(struct trapframe, tf_r10)
2061.64Smattdefine	TF_R12			offsetof(struct trapframe, tf_r12)
2071.56Smattdefine	TF_USR_SP		offsetof(struct trapframe, tf_usr_sp)
2081.64Smattdefine	TF_USR_LR		offsetof(struct trapframe, tf_usr_lr)
2091.56Smattdefine	TF_SVC_SP		offsetof(struct trapframe, tf_svc_sp)
2101.64Smattdefine	TF_SVC_LR		offsetof(struct trapframe, tf_svc_lr)
2111.1Schrisdefine	TF_PC			offsetof(struct trapframe, tf_pc)
2121.1Schris
2131.1Schrisdefine	PROCSIZE		sizeof(struct proc)
2141.1Schrisdefine	TRAPFRAMESIZE		sizeof(struct trapframe)
2151.1Schris
2161.9Sthorpejdefine	CF_IDCACHE_WBINV_ALL	offsetof(struct cpu_functions, cf_idcache_wbinv_all)
2171.22Sscwdefine	CF_DCACHE_WB_RANGE	offsetof(struct cpu_functions, cf_dcache_wb_range)
2181.22Sscwdefine	CF_TLB_FLUSHID_SE	offsetof(struct cpu_functions, cf_tlb_flushID_SE)
2191.1Schrisdefine	CF_CONTEXT_SWITCH	offsetof(struct cpu_functions, cf_context_switch)
2201.1Schrisdefine	CF_SLEEP		offsetof(struct cpu_functions, cf_sleep)
2211.26Sscwdefine	CF_CONTROL		offsetof(struct cpu_functions, cf_control)
2221.1Schris
2231.1Schrisdefine	CI_CURPRIORITY		offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
2241.50Smattdefine	CI_ARM_CPUID		offsetof(struct cpu_info, ci_arm_cpuid)
2251.20Sthorpejdefine	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
2261.39Smattdefine	CI_CPL			offsetof(struct cpu_info, ci_cpl)
2271.39Smattdefine	CI_ASTPENDING		offsetof(struct cpu_info, ci_astpending)
2281.39Smattdefine	CI_INTR_DEPTH		offsetof(struct cpu_info, ci_intr_depth)
2291.39Smattdefine	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
2301.51Smattdefine	CI_UNDEFSAVE		offsetof(struct cpu_info, ci_undefsave[0])
2311.29Smanuif defined(EXEC_AOUT)
2321.26Sscwdefine	CI_CTRL			offsetof(struct cpu_info, ci_ctrl)
2331.16Sbjh21endif
2341.40Smattifdef __HAVE_FAST_SOFTINTS
2351.40Smattdefine	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
2361.40Smattendif
2371.51Smattdefine	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
2381.43Smattdefine	CI_CC_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
2391.43Smattdefine	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
2401.43Smattdefine	CI_CC_NSOFT		offsetof(struct cpu_info, ci_data.cpu_nsoft)
2411.60Smattifdef FPU_VFP
2421.60Smattdefine	CI_VFP_ID		offsetof(struct cpu_info, ci_vfp_id)
2431.60Smattendif
2441.67Smattdefine	CI_LASTLWP		offsetof(struct cpu_info, ci_lastlwp)
2451.43Smatt
2461.58Smattdefine	VFP_FPEXC_EN		VFP_FPEXC_EN
2471.25Sscw
2481.68Smattdefine	NSACR_VFPCP		NSACR_CPn(VFP_COPROC)|NSACR_CPn(VFP_COPROC2)
2491.68Smatt
2501.25Sscw# Constants required for in_cksum() and friends.
2511.76Sskrlldefine	M_LEN			offsetof(struct mbuf, m_len)
2521.76Sskrlldefine	M_DATA			offsetof(struct mbuf, m_data)
2531.76Sskrlldefine	M_NEXT			offsetof(struct mbuf, m_next)
2541.76Sskrlldefine	IP_SRC			offsetof(struct ip, ip_src)
2551.76Sskrlldefine	IP_DST			offsetof(struct ip, ip_dst)
2561.75Sskrll
2571.75Sskrll# Cache information
2581.79Sskrlldefine	DCACHE_LINE_SIZE	offsetof(struct arm_cache_info, dcache_line_size)
2591.75Sskrlldefine	DCACHE_SIZE		offsetof(struct arm_cache_info, dcache_size)
260