xref: /netbsd-src/sys/arch/arm/arm32/genassym.cf (revision a236d6e491494992c3ed85b83b1461aea4eb9fad)
1*a236d6e4Sskrll#	$NetBSD: genassym.cf,v 1.95 2020/08/28 13:36:52 skrll Exp $
24a126d99Schris
34a126d99Schris# Copyright (c) 1982, 1990 The Regents of the University of California.
44a126d99Schris# All rights reserved.
54a126d99Schris#
64a126d99Schris# This code is derived from software contributed to Berkeley by
74a126d99Schris# William Jolitz.
84a126d99Schris#
94a126d99Schris# Redistribution and use in source and binary forms, with or without
104a126d99Schris# modification, are permitted provided that the following conditions
114a126d99Schris# are met:
124a126d99Schris# 1. Redistributions of source code must retain the above copyright
134a126d99Schris#    notice, this list of conditions and the following disclaimer.
144a126d99Schris# 2. Redistributions in binary form must reproduce the above copyright
154a126d99Schris#    notice, this list of conditions and the following disclaimer in the
164a126d99Schris#    documentation and/or other materials provided with the distribution.
171a0c6c8fStsutsui# 3. Neither the name of the University nor the names of its contributors
184a126d99Schris#    may be used to endorse or promote products derived from this software
194a126d99Schris#    without specific prior written permission.
204a126d99Schris#
214a126d99Schris# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
224a126d99Schris# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
234a126d99Schris# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
244a126d99Schris# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
254a126d99Schris# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
264a126d99Schris# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
274a126d99Schris# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
284a126d99Schris# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
294a126d99Schris# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
304a126d99Schris# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
314a126d99Schris# SUCH DAMAGE.
324a126d99Schris
3304c826ddSskrllif defined(_KERNEL_OPT)
3493627d93Sskrllinclude "opt_arm_start.h"
3504c826ddSskrllinclude "opt_execfmt.h"
364164118fSskrllinclude "opt_multiprocessor.h"
3704c826ddSskrllendif
3804c826ddSskrll
394a126d99Schrisinclude <sys/param.h>
40b1eeadb7Sskrll
41b1eeadb7Sskrllinclude <sys/device.h>
42877b3cbeSscwinclude <sys/mbuf.h>
434a126d99Schrisinclude <sys/proc.h>
444a126d99Schrisinclude <sys/resourcevar.h>
454a126d99Schrisinclude <sys/signal.h>
46b1eeadb7Sskrllinclude <sys/systm.h>
47b1eeadb7Sskrll
48877b3cbeSscwinclude <netinet/in.h>
49877b3cbeSscwinclude <netinet/in_systm.h>
50877b3cbeSscwinclude <netinet/ip.h>
51877b3cbeSscwinclude <netinet/ip6.h>
52877b3cbeSscwinclude <netinet/ip_var.h>
534a126d99Schris
544a126d99Schrisinclude <uvm/uvm_extern.h>
554a126d99Schris
5601415786Sthorpejinclude <arm/fiq.h>
579493a154Smattinclude <arm/locore.h>
58b1eeadb7Sskrllinclude <arm/vfpreg.h>
5947494f67Smattinclude <arm/undefined.h>
6001415786Sthorpej
61*a236d6e4Sskrllinclude <arm/arm32/machdep.h>
62076c4ed7Smattinclude <arm/arm32/pte.h>
63b1eeadb7Sskrll
644a126d99Schrisinclude <machine/pmap.h>
65445ebaadSmattinclude <machine/pcb.h>
664a126d99Schrisinclude <machine/vmparam.h>
674a126d99Schris
68926df47eSthorpejdefine	__PROG32		1
6994853273Sthorpejifdef __ARM_FIQ_INDIRECT
7094853273Sthorpejdefine	__ARM_FIQ_INDIRECT	1
7194853273Sthorpejendif
72926df47eSthorpej
730dfc821dSskrllifdef __HAVE_FAST_SOFTINTS
740dfc821dSskrlldefine	__HAVE_FAST_SOFTINTS	1
75ed932c2bSmattendif
76ed932c2bSmatt
7793627d93Sskrllifdef __HAVE_GENERIC_START
7893627d93Sskrlldefine	__HAVE_GENERIC_START	1
7993627d93Sskrllendif
8093627d93Sskrll
8180269dc9Smattifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
8280269dc9Smattdefine	__HAVE_MM_MD_DIRECT_MAPPED_PHYS	1
8380269dc9Smattendif
8480269dc9Smatt
851f4278e1Smattifdef __HAVE_PIC_FAST_SOFTINTS
861f4278e1Smattdefine	__HAVE_PIC_FAST_SOFTINTS	1
871f4278e1Smattendif
881f4278e1Smatt
890dfc821dSskrllifdef __HAVE_PREEMPTION
900dfc821dSskrlldefine	__HAVE_PREEMPTION	1
910dfc821dSskrllendif
920dfc821dSskrll
9347494f67Smattifdef ARM_MMU_EXTENDED
9447494f67Smattdefine  ARM_MMU_EXTENDED	1
9547494f67Smattendif
9647494f67Smatt
9728043ab4Smattifdef VERBOSE_INIT_ARM
9828043ab4Smattdefine	VERBOSE_INIT_ARM	1
9928043ab4Smattendif
10028043ab4Smatt
101499d835eSmattdefine	KERNEL_BASE		KERNEL_BASE
1024a126d99Schrisdefine	VM_MIN_ADDRESS		VM_MIN_ADDRESS
1034a126d99Schrisdefine	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS
10441a1932eSscw
10541a1932eSscwdefine	PMAP_DOMAIN_KERNEL	PMAP_DOMAIN_KERNEL
106076c4ed7Smattdefine	DOMAIN_CLIENT		DOMAIN_CLIENT
107e6c2e807Sskrlldefine	DOMAIN_DEFAULT		DOMAIN_DEFAULT
10847494f67Smatt
109076c4ed7Smattdefine	L1_S_PROTO_generic	L1_S_PROTO_generic
110076c4ed7Smattdefine	L1_S_PROTO_armv7	L1_S_PROTO_armv7
111e6c2e807Sskrll
112076c4ed7Smattdefine	L1_S_PROTO_xscale	L1_S_PROTO_xscale
113076c4ed7Smattif ARM_NMMUS == 1
114076c4ed7Smattdefine	L1_S_PROTO		L1_S_PROTO
115076c4ed7Smattendif
116076c4ed7Smattdefine	L1_S_FRAME		L1_S_FRAME
117076c4ed7Smattdefine	L1_S_SHIFT		L1_S_SHIFT
118076c4ed7Smattdefine	L1_S_SIZE		L1_S_SIZE
11947494f67Smattdefine	L1_S_CACHEABLE		L1_S_C|L1_S_B|L1_S_V6_S
120b2977fcdSskrlldefine	L1_S_NOCACHE		L1_S_XS_TEX(1)
121076c4ed7Smattdefine	L1_S_B			L1_S_B
122076c4ed7Smattdefine	L1_S_C			L1_S_C
123f0e22e00Smattdefine	L1_S_V6_S		L1_S_V6_S
12447494f67Smattdefine	L1_S_V6_XN		L1_S_V6_XN
125be277968Smattdefine	L1_S_AP_KR		L1_S_AP(AP_KR)
126076c4ed7Smattdefine	L1_S_AP_KRW		L1_S_AP(AP_KRW)
127076c4ed7Smattdefine	L1_S_APv7_KRW		L1_S_AP(AP7_KRW)
12847494f67Smattdefine	L1_S_DOM_MASK		L1_S_DOM_MASK
129076c4ed7Smattdefine	L1_TABLE_SIZE		L1_TABLE_SIZE
130076c4ed7Smattdefine	L1_TYPE_S		L1_TYPE_S
131076c4ed7Smattdefine	L1_S_DOM_KERNEL		L1_S_DOM(PMAP_DOMAIN_KERNEL)
1324f70c9acSmattdefine	L2_S_SIZE		L2_S_SIZE
1334a126d99Schris
134ae7a7c18Skiyoharadefine	L1_C_PROTO_generic	L1_C_PROTO_generic
135ae7a7c18Skiyohara
136ae7a7c18Skiyoharadefine	L2_S_PROTO_generic	L2_S_PROTO_generic
137ae7a7c18Skiyoharadefine	L2_S_SHIFT		L2_S_SHIFT
138ae7a7c18Skiyoharadefine	L2_S_SIZE		L2_S_SIZE
139ae7a7c18Skiyoharadefine	L2_C			L2_C
140ae7a7c18Skiyoharadefine	L2_AP_KRW		L2_AP(AP_KRW)
141ae7a7c18Skiyohara
14247494f67Smattdefine	TTBCR_S_N_1		__SHIFTIN(1, TTBCR_S_N)
14347494f67Smatt
1446b30782bSskrlldefine	TTBR_UPATTR		TTBR_UPATTR
1456b30782bSskrlldefine	TTBR_MPATTR		TTBR_MPATTR
1466b30782bSskrll
147bbef46a7Sthorpejifdef PMAP_INCLUDE_PTE_SYNC
148bbef46a7Sthorpejdefine	PMAP_INCLUDE_PTE_SYNC	1
149bbef46a7Sthorpejendif
150bbef46a7Sthorpej
151ce2db8d3Smattdefine	PAGE_MASK		PAGE_MASK
1529a8042f2Sthorpejdefine	PAGE_SIZE		PAGE_SIZE
1534a126d99Schrisdefine	UPAGES			UPAGES
1544a126d99Schrisdefine	PGSHIFT			PGSHIFT
1554a126d99Schris
156c7edb74aSryodefine	MAXCPUS			MAXCPUS
157c7edb74aSryo
158e6c2e807Sskrll#define	PSR_HYP32_MODE		PSR_HYP32_MODE
159e6c2e807Sskrll#define	PSR_SVC32_MODE		PSR_SVC32_MODE
160e6c2e807Sskrll#define	PSR_MODE		PSR_MODE
161e6c2e807Sskrll#define	CPU_CONTROL_DC_ENABLE	CPU_CONTROL_DC_ENABLE
162e6c2e807Sskrll#define	TTBCR_S_PD0		TTBCR_S_PD0
163e6c2e807Sskrll
164*a236d6e4Sskrlldefine	INIT_ARM_STACK_SHIFT	INIT_ARM_STACK_SHIFT
165*a236d6e4Sskrlldefine	INIT_ARM_STACK_SIZE	INIT_ARM_STACK_SIZE
166*a236d6e4Sskrlldefine	INIT_ARM_TOTAL_STACK	INIT_ARM_TOTAL_STACK
167*a236d6e4Sskrll
16823bc2503Sthorpej# Important offsets into the lwp and proc structs & associated constants
169e9f7af26Srminddefine	L_PCB			offsetof(struct lwp, l_addr)
17023bc2503Sthorpejdefine	L_CPU			offsetof(struct lwp, l_cpu)
17123bc2503Sthorpejdefine	L_PROC			offsetof(struct lwp, l_proc)
172b6591ab3Smattdefine	L_PRIVATE		offsetof(struct lwp, l_private)
173c4c41a7eSmattdefine	L_FLAG			offsetof(struct lwp, l_flag)
1743565af6dSskrlldefine	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)
175445ebaadSmattdefine	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
176445ebaadSmattdefine	L_MD_TF			offsetof(struct lwp, l_md.md_tf)
177445ebaadSmattdefine	MDLWP_NOALIGNFLT	MDLWP_NOALIGNFLT
178445ebaadSmatt
179c4c41a7eSmattdefine	LW_SYSTEM		LW_SYSTEM
180c4c41a7eSmatt
1812ffbd2abSdsldefine	P_RASLIST		offsetof(struct proc, p_raslist)
1824a126d99Schris
183ac344355Sskrlldefine	PCB_R8			offsetof(struct pcb, pcb_r8)
184ac344355Sskrlldefine	PCB_R9			offsetof(struct pcb, pcb_r9)
185ac344355Sskrlldefine	PCB_R10			offsetof(struct pcb, pcb_r10)
186ac344355Sskrlldefine	PCB_R11			offsetof(struct pcb, pcb_r11)
187ac344355Sskrlldefine	PCB_R12			offsetof(struct pcb, pcb_r12)
188ac344355Sskrlldefine	PCB_KSP			offsetof(struct pcb, pcb_sp)
189ac344355Sskrlldefine	PCB_LR			offsetof(struct pcb, pcb_lr)
190ac344355Sskrlldefine	PCB_PC			offsetof(struct pcb, pcb_pc)
191ac344355Sskrlldefine	PCB_USER_PID_RW		offsetof(struct pcb, pcb_user_pid_rw)
1924a126d99Schrisdefine	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
193c6f05c9aSmattdefine	PCB_VFP_FPEXC		offsetof(struct pcb, pcb_vfp.vfp_fpexc)
1944a126d99Schris
1957146b2f6Srminddefine	PCB_SIZE		sizeof(struct pcb)
1964a126d99Schris
1974a126d99Schrisdefine	VM_MAP			offsetof(struct vmspace, vm_map)
1984a126d99Schrisdefine	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
1994a126d99Schris
2004a126d99Schrisdefine	PR_BASE			offsetof(struct uprof, pr_base)
2014a126d99Schrisdefine	PR_SIZE			offsetof(struct uprof, pr_size)
2024a126d99Schrisdefine	PR_OFF			offsetof(struct uprof, pr_off)
2034a126d99Schrisdefine	PR_SCALE		offsetof(struct uprof, pr_scale)
2044a126d99Schris
2054a126d99Schrisdefine	SIGTRAP			SIGTRAP
2064a126d99Schrisdefine	SIGEMT			SIGEMT
2074a126d99Schris
20838c21004Smattdefine	TF_SPSR			offsetof(struct trapframe, tf_spsr)
209424810a5Smattdefine	TF_FILL			offsetof(struct trapframe, tf_fill)
2104a126d99Schrisdefine	TF_R0			offsetof(struct trapframe, tf_r0)
2112081417cSmattdefine	TF_R4			offsetof(struct trapframe, tf_r4)
2122081417cSmattdefine	TF_R6			offsetof(struct trapframe, tf_r6)
21338c21004Smattdefine	TF_R8			offsetof(struct trapframe, tf_r8)
2144a126d99Schrisdefine	TF_R10			offsetof(struct trapframe, tf_r10)
21538c21004Smattdefine	TF_R12			offsetof(struct trapframe, tf_r12)
216492b6e5cSmattdefine	TF_USR_SP		offsetof(struct trapframe, tf_usr_sp)
21738c21004Smattdefine	TF_USR_LR		offsetof(struct trapframe, tf_usr_lr)
218492b6e5cSmattdefine	TF_SVC_SP		offsetof(struct trapframe, tf_svc_sp)
21938c21004Smattdefine	TF_SVC_LR		offsetof(struct trapframe, tf_svc_lr)
2204a126d99Schrisdefine	TF_PC			offsetof(struct trapframe, tf_pc)
2214a126d99Schris
2224a126d99Schrisdefine	PROCSIZE		sizeof(struct proc)
2234a126d99Schrisdefine	TRAPFRAMESIZE		sizeof(struct trapframe)
2244a126d99Schris
2254e990d9cSthorpejdefine	CF_IDCACHE_WBINV_ALL	offsetof(struct cpu_functions, cf_idcache_wbinv_all)
22641a1932eSscwdefine	CF_DCACHE_WB_RANGE	offsetof(struct cpu_functions, cf_dcache_wb_range)
22741a1932eSscwdefine	CF_TLB_FLUSHID_SE	offsetof(struct cpu_functions, cf_tlb_flushID_SE)
2284a126d99Schrisdefine	CF_CONTEXT_SWITCH	offsetof(struct cpu_functions, cf_context_switch)
2294a126d99Schrisdefine	CF_SLEEP		offsetof(struct cpu_functions, cf_sleep)
23084c17a81Sscwdefine	CF_CONTROL		offsetof(struct cpu_functions, cf_control)
2314a126d99Schris
232e1281176Sskrlldefine	CPU_INFO_SIZE		sizeof(struct cpu_info)
233424810a5Smattdefine	CI_ARM_CPUID		offsetof(struct cpu_info, ci_arm_cpuid)
234f1c8d331Sskrlldefine	CI_CPL			offsetof(struct cpu_info, ci_cpl)
235f1c8d331Sskrlldefine	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
236825088edSmattdefine	CI_INTR_DEPTH		offsetof(struct cpu_info, ci_intr_depth)
237e1281176Sskrlldefine	CI_MIDR			offsetof(struct cpu_info, ci_midr)
238e1281176Sskrlldefine	CI_MPIDR		offsetof(struct cpu_info, ci_mpidr)
239825088edSmattdefine	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
240f1c8d331Sskrlldefine	CI_LASTLWP		offsetof(struct cpu_info, ci_lastlwp)
24172c1c71eSmattdefine	CI_UNDEFSAVE		offsetof(struct cpu_info, ci_undefsave[0])
242f1c8d331Sskrlldefine	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
243f1c8d331Sskrlldefine	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
244f309b668Smanuif defined(EXEC_AOUT)
24584c17a81Sscwdefine	CI_CTRL			offsetof(struct cpu_info, ci_ctrl)
24684c17a81Sscwendif
247e2da7cebSmattifdef __HAVE_FAST_SOFTINTS
248e2da7cebSmattdefine	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
249e2da7cebSmattendif
250c6f05c9aSmattifdef FPU_VFP
251c6f05c9aSmattdefine	CI_VFP_ID		offsetof(struct cpu_info, ci_vfp_id)
252c6f05c9aSmattendif
2536a66466fSmatt
25401b65f59Smattdefine	VFP_FPEXC_EN		VFP_FPEXC_EN
255877b3cbeSscw
25647494f67Smattdefine	NSACR_VFPCP		NSACR_CPn(VFP_COPROC)|NSACR_CPn(VFP_COPROC2)
25747494f67Smatt
258877b3cbeSscw# Constants required for in_cksum() and friends.
259877b3cbeSscwdefine	M_LEN			offsetof(struct mbuf, m_len)
260877b3cbeSscwdefine	M_DATA			offsetof(struct mbuf, m_data)
261877b3cbeSscwdefine	M_NEXT			offsetof(struct mbuf, m_next)
262877b3cbeSscwdefine	IP_SRC			offsetof(struct ip, ip_src)
263877b3cbeSscwdefine	IP_DST			offsetof(struct ip, ip_dst)
2646dc8ef99Sskrll
2656dc8ef99Sskrll# Cache information
266f7b214beSskrlldefine	DCACHE_LINE_SIZE	offsetof(struct arm_cache_info, dcache_line_size)
2676dc8ef99Sskrlldefine	DCACHE_SIZE		offsetof(struct arm_cache_info, dcache_size)
268