Annotation of src/sys/arch/aarch64/aarch64/genassym.cf, Revision 1.24
1.24 ! ryo 1: # $NetBSD: genassym.cf,v 1.23 2020/04/12 07:49:58 maxv Exp $
1.1 matt 2: #-
3: # Copyright (c) 2014 The NetBSD Foundation, Inc.
4: # All rights reserved.
5: #
6: # This code is derived from software contributed to The NetBSD Foundation
7: # by Matt Thomas of 3am Software Foundry.
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: #
18: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21: # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28: # POSSIBILITY OF SUCH DAMAGE.
29: #-
30:
1.15 skrll 31: if defined(_KERNEL_OPT)
32: include "opt_multiprocessor.h"
33: include "opt_compat_netbsd.h"
34: include "opt_execfmt.h"
35: endif
36:
1.1 matt 37: include <sys/param.h>
38: include <sys/systm.h>
39: include <sys/bitops.h>
40: include <sys/cpu.h>
41: include <sys/mbuf.h>
42: include <sys/proc.h>
43: include <sys/resourcevar.h>
44: include <sys/device.h>
45: include <sys/signal.h>
46: include <netinet/in.h>
47: include <netinet/in_systm.h>
48: include <netinet/ip.h>
49: include <netinet/ip6.h>
50: include <netinet/ip_var.h>
51:
52: include <uvm/uvm_extern.h>
53:
1.2 ryo 54: include <arm/bus_defs.h>
55:
1.1 matt 56: include <aarch64/vmparam.h>
1.2 ryo 57: include <aarch64/frame.h>
58: include <aarch64/armreg.h>
1.5 ryo 59: include <aarch64/pte.h>
1.1 matt 60:
61: define __HAVE_FAST_SOFTINTS 1
62:
63: #ifdef __HAVE_PIC_FAST_SOFTINTS
64: #define __HAVE_PIC_FAST_SOFTINTS 1
65: #endif
66:
1.2 ryo 67: define MAXCPUS MAXCPUS
68: define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS
69: define VM_MAX_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS
70: define VM_KERNEL_IO_ADDRESS VM_KERNEL_IO_ADDRESS
1.8 ryo 71: define VM_KERNEL_IO_SIZE VM_KERNEL_IO_SIZE
1.2 ryo 72: define AARCH64_KSEG_START AARCH64_KSEG_START
1.14 ryo 73: define AARCH64_KSEG_MASK AARCH64_KSEG_MASK
1.2 ryo 74: define UPAGES UPAGES
75: define USPACE (UPAGES * PAGE_SIZE)
1.1 matt 76:
77: #define PV_PA offsetof(pv_addr_t, pv_pa)
78:
1.5 ryo 79: define L0_ADDR_BITS L0_ADDR_BITS
80: define L0_SHIFT L0_SHIFT
81: define L0_TABLE L0_TABLE
82: define L1_ADDR_BITS L1_ADDR_BITS
83: define L1_BLOCK L1_BLOCK
84: define L1_SHIFT L1_SHIFT
85: define L1_SIZE L1_SIZE
86: define L1_TABLE L1_TABLE
87: define L2_ADDR_BITS L2_ADDR_BITS
88: define L2_BLK_OA L2_BLK_OA
89: define L2_BLOCK L2_BLOCK
90: define L2_BLOCK_MASK L2_BLOCK_MASK
91: define L2_SHIFT L2_SHIFT
92: define L2_SIZE L2_SIZE
93: define LX_BLKPAG_UXN LX_BLKPAG_UXN
94: define LX_BLKPAG_PXN LX_BLKPAG_PXN
95: define LX_BLKPAG_AF LX_BLKPAG_AF
1.6 ryo 96: define LX_BLKPAG_AP LX_BLKPAG_AP
97: define LX_BLKPAG_AP_RO LX_BLKPAG_AP_RO
1.5 ryo 98: define LX_BLKPAG_AP_RW LX_BLKPAG_AP_RW
99: define LX_BLKPAG_SH_IS LX_BLKPAG_SH_IS
1.8 ryo 100: define LX_BLKPAG_ATTR_NORMAL_WB LX_BLKPAG_ATTR_NORMAL_WB
101: define LX_BLKPAG_ATTR_NORMAL_NC LX_BLKPAG_ATTR_NORMAL_NC
102: define LX_BLKPAG_ATTR_NORMAL_WT LX_BLKPAG_ATTR_NORMAL_WT
103: define LX_BLKPAG_ATTR_DEVICE_MEM LX_BLKPAG_ATTR_DEVICE_MEM
1.5 ryo 104: define Ln_ENTRIES Ln_ENTRIES
105:
106: define TCR_AS64K TCR_AS64K
107: define TCR_TG1_16KB TCR_TG1_16KB
108: define TCR_TG1_4KB TCR_TG1_4KB
109: define TCR_TG1_64KB TCR_TG1_64KB
110: define TCR_TG0_16KB TCR_TG0_16KB
111: define TCR_TG0_4KB TCR_TG0_4KB
112: define TCR_TG0_64KB TCR_TG0_64KB
1.10 ryo 113: define TCR_SH1_NONE TCR_SH1_NONE
1.5 ryo 114: define TCR_SH1_OUTER TCR_SH1_OUTER
115: define TCR_SH1_INNER TCR_SH1_INNER
116: define TCR_ORGN1_NC TCR_ORGN1_NC
117: define TCR_ORGN1_WB_WA TCR_ORGN1_WB_WA
118: define TCR_ORGN1_WT TCR_ORGN1_WT
119: define TCR_ORGN1_WB TCR_ORGN1_WB
120: define TCR_IRGN1_NC TCR_IRGN1_NC
121: define TCR_IRGN1_WB_WA TCR_IRGN1_WB_WA
122: define TCR_IRGN1_WT TCR_IRGN1_WT
123: define TCR_IRGN1_WB TCR_IRGN1_WB
124: define TCR_T1SZ TCR_T1SZ
1.10 ryo 125: define TCR_SH0_NONE TCR_SH0_NONE
1.5 ryo 126: define TCR_SH0_OUTER TCR_SH0_OUTER
127: define TCR_SH0_INNER TCR_SH0_INNER
128: define TCR_ORGN0_NC TCR_ORGN0_NC
129: define TCR_ORGN0_WB_WA TCR_ORGN0_WB_WA
130: define TCR_ORGN0_WT TCR_ORGN0_WT
131: define TCR_ORGN0_WB TCR_ORGN0_WB
132: define TCR_IRGN0_NC TCR_IRGN0_NC
133: define TCR_IRGN0_WB_WA TCR_IRGN0_WB_WA
134: define TCR_IRGN0_WT TCR_IRGN0_WT
135: define TCR_IRGN0_WB TCR_IRGN0_WB
136: define TCR_T0SZ TCR_T0SZ
137:
1.1 matt 138: define EFAULT EFAULT
139:
1.2 ryo 140: define PAGE_SIZE PAGE_SIZE
1.1 matt 141: define PAGE_MASK PAGE_MASK
142: define PGSHIFT PGSHIFT
143:
144: # Important offsets into the lwp and proc structs & associated constants
145: define L_PCB offsetof(struct lwp, l_addr)
146: define L_CPU offsetof(struct lwp, l_cpu)
147: define L_PROC offsetof(struct lwp, l_proc)
148: define L_PRIVATE offsetof(struct lwp, l_private)
149: define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags)
150: define L_MD_UTF offsetof(struct lwp, l_md.md_utf)
151: define L_MD_CPACR offsetof(struct lwp, l_md.md_cpacr)
152: define L_MD_ONFAULT offsetof(struct lwp, l_md.md_onfault)
1.23 maxv 153: define L_MD_IA_KERN_LO offsetof(struct lwp, l_md.md_ia_kern_lo)
154: define L_MD_IA_KERN_HI offsetof(struct lwp, l_md.md_ia_kern_hi)
155: define L_MD_IA_USER_LO offsetof(struct lwp, l_md.md_ia_user_lo)
156: define L_MD_IA_USER_HI offsetof(struct lwp, l_md.md_ia_user_hi)
1.1 matt 157:
1.2 ryo 158: define FB_X19 FB_X19
159: define FB_X20 FB_X20
160: define FB_X21 FB_X21
161: define FB_X22 FB_X22
162: define FB_X23 FB_X23
163: define FB_X24 FB_X24
164: define FB_X25 FB_X25
165: define FB_X26 FB_X26
166: define FB_X27 FB_X27
167: define FB_X28 FB_X28
168: define FB_X29 FB_X29
169: define FB_LR FB_LR
170: define FB_SP FB_SP
171: define FB_MAX FB_MAX
172: define FB_T_SIZE roundup(sizeof(struct faultbuf), 16)
173:
174: define LBL_X19 LBL_X19
175: define LBL_X20 LBL_X20
176: define LBL_X21 LBL_X21
177: define LBL_X22 LBL_X22
178: define LBL_X23 LBL_X23
179: define LBL_X24 LBL_X24
180: define LBL_X25 LBL_X25
181: define LBL_X26 LBL_X26
182: define LBL_X27 LBL_X27
183: define LBL_X28 LBL_X28
184: define LBL_X29 LBL_X29
185: define LBL_LR LBL_LR
186: define LBL_SP LBL_SP
187: define LBL_MAX LBL_MAX
188:
1.1 matt 189: define P_RASLIST offsetof(struct proc, p_raslist)
190: define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
191:
192: define VM_MAP offsetof(struct vmspace, vm_map)
193: define VM_PMAP offsetof(struct vmspace, vm_map.pmap)
194:
195: #define PR_BASE offsetof(struct uprof, pr_base)
196: #define PR_SIZE offsetof(struct uprof, pr_size)
197: #define PR_OFF offsetof(struct uprof, pr_off)
198: #define PR_SCALE offsetof(struct uprof, pr_scale)
199:
200: define SIGTRAP SIGTRAP
201: define SIGEMT SIGEMT
202:
1.12 mrg 203: define PCB_TF offsetof(struct pcb, pcb_tf)
204:
1.1 matt 205: define TF_X0 offsetof(struct trapframe, tf_reg[0])
206: define TF_X1 offsetof(struct trapframe, tf_reg[1])
207: define TF_X2 offsetof(struct trapframe, tf_reg[2])
208: define TF_X3 offsetof(struct trapframe, tf_reg[3])
209: define TF_X4 offsetof(struct trapframe, tf_reg[4])
210: define TF_X5 offsetof(struct trapframe, tf_reg[5])
211: define TF_X6 offsetof(struct trapframe, tf_reg[6])
212: define TF_X7 offsetof(struct trapframe, tf_reg[7])
213: define TF_X8 offsetof(struct trapframe, tf_reg[8])
214: define TF_X9 offsetof(struct trapframe, tf_reg[9])
215: define TF_X10 offsetof(struct trapframe, tf_reg[10])
216: define TF_X11 offsetof(struct trapframe, tf_reg[11])
217: define TF_X12 offsetof(struct trapframe, tf_reg[12])
218: define TF_X13 offsetof(struct trapframe, tf_reg[13])
219: define TF_X14 offsetof(struct trapframe, tf_reg[14])
220: define TF_X15 offsetof(struct trapframe, tf_reg[15])
221: define TF_X16 offsetof(struct trapframe, tf_reg[16])
222: define TF_X17 offsetof(struct trapframe, tf_reg[17])
223: define TF_X18 offsetof(struct trapframe, tf_reg[18])
224: define TF_X19 offsetof(struct trapframe, tf_reg[19])
225: define TF_X20 offsetof(struct trapframe, tf_reg[20])
226: define TF_X21 offsetof(struct trapframe, tf_reg[21])
227: define TF_X22 offsetof(struct trapframe, tf_reg[22])
228: define TF_X23 offsetof(struct trapframe, tf_reg[23])
229: define TF_X24 offsetof(struct trapframe, tf_reg[24])
230: define TF_X25 offsetof(struct trapframe, tf_reg[25])
231: define TF_X26 offsetof(struct trapframe, tf_reg[26])
232: define TF_X27 offsetof(struct trapframe, tf_reg[27])
233: define TF_X28 offsetof(struct trapframe, tf_reg[28])
234: define TF_X29 offsetof(struct trapframe, tf_reg[29])
235: define TF_X30 offsetof(struct trapframe, tf_reg[30])
236: define TF_SP offsetof(struct trapframe, tf_sp)
237: define TF_PC offsetof(struct trapframe, tf_pc)
238: define TF_SPSR offsetof(struct trapframe, tf_spsr)
239: define TF_ESR offsetof(struct trapframe, tf_esr)
240: define TF_FAR offsetof(struct trapframe, tf_far)
1.2 ryo 241: define TF_SIZE TF_SIZE
1.1 matt 242:
1.2 ryo 243: define FPREG_Q0 offsetof(struct fpreg, fp_reg[0])
244: define FPREG_Q1 offsetof(struct fpreg, fp_reg[1])
245: define FPREG_Q2 offsetof(struct fpreg, fp_reg[2])
246: define FPREG_Q3 offsetof(struct fpreg, fp_reg[3])
247: define FPREG_Q4 offsetof(struct fpreg, fp_reg[4])
248: define FPREG_Q5 offsetof(struct fpreg, fp_reg[5])
249: define FPREG_Q6 offsetof(struct fpreg, fp_reg[6])
250: define FPREG_Q7 offsetof(struct fpreg, fp_reg[7])
251: define FPREG_Q8 offsetof(struct fpreg, fp_reg[8])
252: define FPREG_Q9 offsetof(struct fpreg, fp_reg[9])
253: define FPREG_Q10 offsetof(struct fpreg, fp_reg[10])
254: define FPREG_Q11 offsetof(struct fpreg, fp_reg[11])
255: define FPREG_Q12 offsetof(struct fpreg, fp_reg[12])
256: define FPREG_Q13 offsetof(struct fpreg, fp_reg[13])
257: define FPREG_Q14 offsetof(struct fpreg, fp_reg[14])
258: define FPREG_Q15 offsetof(struct fpreg, fp_reg[15])
259: define FPREG_Q16 offsetof(struct fpreg, fp_reg[16])
260: define FPREG_Q17 offsetof(struct fpreg, fp_reg[17])
261: define FPREG_Q18 offsetof(struct fpreg, fp_reg[18])
262: define FPREG_Q19 offsetof(struct fpreg, fp_reg[19])
263: define FPREG_Q20 offsetof(struct fpreg, fp_reg[20])
264: define FPREG_Q21 offsetof(struct fpreg, fp_reg[21])
265: define FPREG_Q22 offsetof(struct fpreg, fp_reg[22])
266: define FPREG_Q23 offsetof(struct fpreg, fp_reg[23])
267: define FPREG_Q24 offsetof(struct fpreg, fp_reg[24])
268: define FPREG_Q25 offsetof(struct fpreg, fp_reg[25])
269: define FPREG_Q26 offsetof(struct fpreg, fp_reg[26])
270: define FPREG_Q27 offsetof(struct fpreg, fp_reg[27])
271: define FPREG_Q28 offsetof(struct fpreg, fp_reg[28])
272: define FPREG_Q29 offsetof(struct fpreg, fp_reg[29])
273: define FPREG_Q30 offsetof(struct fpreg, fp_reg[30])
274: define FPREG_Q31 offsetof(struct fpreg, fp_reg[31])
275: define FPREG_FPCR offsetof(struct fpreg, fpcr)
276: define FPREG_FPSR offsetof(struct fpreg, fpsr)
1.1 matt 277:
1.7 ryo 278: define CPU_INFO_SIZE sizeof(struct cpu_info)
1.1 matt 279: define CI_CURLWP offsetof(struct cpu_info, ci_curlwp)
280: define CI_CPL offsetof(struct cpu_info, ci_cpl)
1.2 ryo 281: define CI_CPUID offsetof(struct cpu_info, ci_cpuid)
1.9 mrg 282: define CI_MIDR offsetof(struct cpu_info, ci_id.ac_midr)
283: define CI_MPIDR offsetof(struct cpu_info, ci_id.ac_mpidr)
1.1 matt 284: define CI_ASTPENDING offsetof(struct cpu_info, ci_astpending)
285: define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched)
286: define CI_INTR_DEPTH offsetof(struct cpu_info, ci_intr_depth)
287: define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
1.2 ryo 288: define CI_SOFTINTS offsetof(struct cpu_info, ci_softints)
1.1 matt 289: define CI_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
290: define CI_CC_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr)
291:
292: define V_RESCHED_KPREEMPT ilog2(RESCHED_KPREEMPT)
293:
294: define SPSR_M_EL1T SPSR_M_EL1T
295: define DAIF_I DAIF_I
296: define DAIF_F DAIF_F
1.2 ryo 297: define DAIF_SETCLR_SHIFT DAIF_SETCLR_SHIFT
298:
299: define CNTHCTL_EL1PCTEN CNTHCTL_EL1PCTEN
300: define CNTHCTL_EL1PCEN CNTHCTL_EL1PCEN
1.4 ryo 301: define CNTKCTL_EL0VCTEN CNTKCTL_EL0VCTEN
1.11 ryo 302: define SPSR_SS_SHIFT SPSR_SS_SHIFT
1.2 ryo 303: define SPSR_F SPSR_F
304: define SPSR_I SPSR_I
305: define SPSR_A SPSR_A
306: define SPSR_A64_D SPSR_A64_D
307: define SPSR_M_EL1H SPSR_M_EL1H
308:
309: define CPACR_FPEN CPACR_FPEN
310: define CPACR_TTA CPACR_TTA
311: define CPACR_FPEN CPACR_FPEN
312: define CPACR_FPEN_NONE CPACR_FPEN_NONE
313: define CPACR_FPEN_EL1 CPACR_FPEN_EL1
314: define CPACR_FPEN_NONE_2 CPACR_FPEN_NONE_2
315: define CPACR_FPEN_ALL CPACR_FPEN_ALL
316:
317: define ID_AA64PFR0_EL1_GIC ID_AA64PFR0_EL1_GIC
318: define ID_AA64PFR0_EL1_GIC_SHIFT ID_AA64PFR0_EL1_GIC_SHIFT
319: define ID_AA64PFR0_EL1_GIC_CPUIF_EN ID_AA64PFR0_EL1_GIC_CPUIF_EN
320:
1.3 ryo 321: define MPIDR_AFF0 MPIDR_AFF0
322: define MPIDR_AFF1 MPIDR_AFF1
323: define MPIDR_AFF2 MPIDR_AFF2
324: define MPIDR_AFF3 MPIDR_AFF3
325:
1.11 ryo 326: define MDSCR_MDE MDSCR_MDE
327: define MDSCR_KDE MDSCR_KDE
328: define MDSCR_TDCC MDSCR_TDCC
329: define MDSCR_SS MDSCR_SS
330:
1.2 ryo 331: define MAIR_ATTR0 MAIR_ATTR0
332: define MAIR_ATTR1 MAIR_ATTR1
333: define MAIR_ATTR2 MAIR_ATTR2
334: define MAIR_ATTR3 MAIR_ATTR3
1.17 jmcneill 335: define MAIR_ATTR4 MAIR_ATTR4
1.2 ryo 336: define MAIR_DEVICE_nGnRnE MAIR_DEVICE_nGnRnE
1.16 jmcneill 337: define MAIR_DEVICE_nGnRE MAIR_DEVICE_nGnRE
1.2 ryo 338: define MAIR_NORMAL_NC MAIR_NORMAL_NC
339: define MAIR_NORMAL_WT MAIR_NORMAL_WT
340: define MAIR_NORMAL_WB MAIR_NORMAL_WB
341:
342: define SCTLR_RES1 SCTLR_RES1
343: define SCTLR_M SCTLR_M
344: define SCTLR_A SCTLR_A
345: define SCTLR_C SCTLR_C
346: define SCTLR_SA SCTLR_SA
347: define SCTLR_SA0 SCTLR_SA0
348: define SCTLR_CP15BEN SCTLR_CP15BEN
1.19 maxv 349: define SCTLR_nAA SCTLR_nAA
1.2 ryo 350: define SCTLR_ITD SCTLR_ITD
351: define SCTLR_SED SCTLR_SED
352: define SCTLR_UMA SCTLR_UMA
353: define SCTLR_I SCTLR_I
354: define SCTLR_DZE SCTLR_DZE
355: define SCTLR_UCT SCTLR_UCT
356: define SCTLR_nTWI SCTLR_nTWI
357: define SCTLR_nTWE SCTLR_nTWE
358: define SCTLR_WXN SCTLR_WXN
359: define SCTLR_IESB SCTLR_IESB
360: define SCTLR_SPAN SCTLR_SPAN
361: define SCTLR_EOE SCTLR_EOE
362: define SCTLR_EE SCTLR_EE
363: define SCTLR_UCI SCTLR_UCI
364: define SCTLR_nTLSMD SCTLR_nTLSMD
365: define SCTLR_LSMAOE SCTLR_LSMAOE
1.24 ! ryo 366: define SCTLR_EnIA SCTLR_EnIA
1.2 ryo 367:
368: define ICC_SRE_EL2_EN ICC_SRE_EL2_EN
369: define ICC_SRE_EL2_SRE ICC_SRE_EL2_SRE
370:
371:
372: # for bus_space_asm
373: define BS_STRIDE offsetof(struct bus_space, bs_stride)
1.1 matt 374:
375: # Constants required for in_cksum() and friends.
376: define M_LEN offsetof(struct mbuf, m_len)
377: define M_DATA offsetof(struct mbuf, m_data)
378: define M_NEXT offsetof(struct mbuf, m_next)
379: define IP_SRC offsetof(struct ip, ip_src)
380: define IP_DST offsetof(struct ip, ip_dst)
CVSweb <webmaster@jp.NetBSD.org>