genassym.cf revision 1.65
1#	$NetBSD: genassym.cf,v 1.65 2013/08/18 07:55:28 matt 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
33include <sys/param.h>
34include <sys/systm.h>
35include <sys/mbuf.h>
36include <sys/proc.h>
37include <sys/resourcevar.h>
38include <sys/device.h>
39include <sys/signal.h>
40include <netinet/in.h>
41include <netinet/in_systm.h>
42include <netinet/ip.h>
43include <netinet/ip6.h>
44include <netinet/ip_var.h>
45
46include <uvm/uvm_extern.h>
47
48include <arm/fiq.h>
49include <arm/vfpreg.h>
50include <arm/locore.h>
51
52include <arm/arm32/pte.h>
53include <machine/pmap.h>
54include <machine/pcb.h>
55include <machine/vmparam.h>
56
57include "opt_multiprocessor.h"
58include "opt_compat_netbsd.h"
59include "opt_execfmt.h"
60
61define	__PROG32		1
62ifdef __ARM_FIQ_INDIRECT
63define	__ARM_FIQ_INDIRECT	1
64endif
65
66ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
67define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS	1
68endif
69
70ifdef __HAVE_FAST_SOFTINTS
71define	__HAVE_FAST_SOFTINTS	1
72endif
73
74ifdef __HAVE_PIC_FAST_SOFTINTS
75define	__HAVE_PIC_FAST_SOFTINTS	1
76endif
77
78ifdef __HAVE_UNNESTED_INTRS
79define	__HAVE_UNNESTED_INTRS	1
80endif
81
82define	KERNEL_BASE		KERNEL_BASE
83define	VM_MIN_ADDRESS		VM_MIN_ADDRESS
84define	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS
85
86define	DCACHE_LINE_SIZE	offsetof(struct arm_cache_info, dcache_line_size)
87
88define	PV_PA			offsetof(pv_addr_t, pv_pa)
89define	PMAP_DOMAIN_KERNEL	PMAP_DOMAIN_KERNEL
90define	DOMAIN_CLIENT		DOMAIN_CLIENT
91define	L1_S_PROTO_generic	L1_S_PROTO_generic
92define	L1_S_PROTO_armv7	L1_S_PROTO_armv7
93define	L1_S_PROTO_xscale	L1_S_PROTO_xscale
94if ARM_NMMUS == 1
95define	L1_S_PROTO		L1_S_PROTO
96endif
97define	L1_S_FRAME		L1_S_FRAME
98define	L1_S_SHIFT		L1_S_SHIFT
99define	L1_S_SIZE		L1_S_SIZE
100define	L1_S_B			L1_S_B
101define	L1_S_C			L1_S_C
102define	L1_S_V6_S		L1_S_V6_S
103define	L1_S_AP_KR		L1_S_AP(AP_KR)
104define	L1_S_AP_KRW		L1_S_AP(AP_KRW)
105define	L1_S_APv7_KRW		L1_S_AP(AP7_KRW)
106define	L1_TABLE_SIZE		L1_TABLE_SIZE
107define	L1_TYPE_S		L1_TYPE_S
108define	L1_S_DOM_KERNEL		L1_S_DOM(PMAP_DOMAIN_KERNEL)
109define	L2_S_SIZE		L2_S_SIZE
110
111define	L1_C_PROTO_generic	L1_C_PROTO_generic
112
113define	L2_S_PROTO_generic	L2_S_PROTO_generic
114define	L2_S_SHIFT		L2_S_SHIFT
115define	L2_S_SIZE		L2_S_SIZE
116define	L2_C			L2_C
117define	L2_AP_KRW		L2_AP(AP_KRW)
118
119ifdef PMAP_INCLUDE_PTE_SYNC
120define	PMAP_INCLUDE_PTE_SYNC	1
121endif
122
123define	PAGE_MASK		PAGE_MASK
124define	PAGE_SIZE		PAGE_SIZE
125define	UPAGES			UPAGES
126define	PGSHIFT			PGSHIFT
127
128# Important offsets into the lwp and proc structs & associated constants
129define	L_PCB			offsetof(struct lwp, l_addr)
130define	L_CPU			offsetof(struct lwp, l_cpu)
131define	L_PRIORITY		offsetof(struct lwp, l_priority)
132define	L_WCHAN			offsetof(struct lwp, l_wchan)
133define	L_STAT			offsetof(struct lwp, l_stat)
134define	L_PROC			offsetof(struct lwp, l_proc)
135define	L_CTXSWTCH		offsetof(struct lwp, l_ctxswtch)
136define	L_PRIVATE		offsetof(struct lwp, l_private)
137define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
138define	L_MD_TF			offsetof(struct lwp, l_md.md_tf)
139define	MDLWP_NOALIGNFLT	MDLWP_NOALIGNFLT
140
141define	P_RASLIST		offsetof(struct proc, p_raslist)
142
143define	PCB_R8			offsetof(struct pcb, pcb_un.un_32.pcb32_r8)
144define	PCB_R9			offsetof(struct pcb, pcb_un.un_32.pcb32_r9)
145define	PCB_R10			offsetof(struct pcb, pcb_un.un_32.pcb32_r10)
146define	PCB_R11			offsetof(struct pcb, pcb_un.un_32.pcb32_r11)
147define	PCB_R12			offsetof(struct pcb, pcb_un.un_32.pcb32_r12)
148define	PCB_KSP			offsetof(struct pcb, pcb_un.un_32.pcb32_sp)
149define	PCB_LR			offsetof(struct pcb, pcb_un.un_32.pcb32_lr)
150define	PCB_PC			offsetof(struct pcb, pcb_un.un_32.pcb32_pc)
151define	PCB_USER_PID_RW		offsetof(struct pcb, pcb_un.un_32.pcb32_user_pid_rw)
152define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
153define	PCB_VFP_FPEXC		offsetof(struct pcb, pcb_vfp.vfp_fpexc)
154
155define	PCB_SIZE		sizeof(struct pcb)
156
157define	VM_MAP			offsetof(struct vmspace, vm_map)
158define	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
159
160define	PR_BASE			offsetof(struct uprof, pr_base)
161define	PR_SIZE			offsetof(struct uprof, pr_size)
162define	PR_OFF			offsetof(struct uprof, pr_off)
163define	PR_SCALE		offsetof(struct uprof, pr_scale)
164
165define	SIGTRAP			SIGTRAP
166define	SIGEMT			SIGEMT
167
168define	TF_SPSR			offsetof(struct trapframe, tf_spsr)
169define	TF_FILL			offsetof(struct trapframe, tf_fill)
170define	TF_R0			offsetof(struct trapframe, tf_r0)
171define	TF_R4			offsetof(struct trapframe, tf_r4)
172define	TF_R6			offsetof(struct trapframe, tf_r6)
173define	TF_R8			offsetof(struct trapframe, tf_r8)
174define	TF_R10			offsetof(struct trapframe, tf_r10)
175define	TF_R12			offsetof(struct trapframe, tf_r12)
176define	TF_USR_SP		offsetof(struct trapframe, tf_usr_sp)
177define	TF_USR_LR		offsetof(struct trapframe, tf_usr_lr)
178define	TF_SVC_SP		offsetof(struct trapframe, tf_svc_sp)
179define	TF_SVC_LR		offsetof(struct trapframe, tf_svc_lr)
180define	TF_PC			offsetof(struct trapframe, tf_pc)
181
182define	PROCSIZE		sizeof(struct proc)
183define	TRAPFRAMESIZE		sizeof(struct trapframe)
184
185define	CF_IDCACHE_WBINV_ALL	offsetof(struct cpu_functions, cf_idcache_wbinv_all)
186define	CF_DCACHE_WB_RANGE	offsetof(struct cpu_functions, cf_dcache_wb_range)
187define	CF_TLB_FLUSHID_SE	offsetof(struct cpu_functions, cf_tlb_flushID_SE)
188define	CF_CONTEXT_SWITCH	offsetof(struct cpu_functions, cf_context_switch)
189define	CF_SLEEP		offsetof(struct cpu_functions, cf_sleep)
190define	CF_CONTROL		offsetof(struct cpu_functions, cf_control)
191
192define	CI_CURPRIORITY		offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
193define	CI_ARM_CPUID		offsetof(struct cpu_info, ci_arm_cpuid)
194define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
195define	CI_CPL			offsetof(struct cpu_info, ci_cpl)
196define	CI_ASTPENDING		offsetof(struct cpu_info, ci_astpending)
197define	CI_WANT_RESCHED		offsetof(struct cpu_info, ci_want_resched)
198define	CI_INTR_DEPTH		offsetof(struct cpu_info, ci_intr_depth)
199define	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
200define	CI_UNDEFSAVE		offsetof(struct cpu_info, ci_undefsave[0])
201if defined(EXEC_AOUT)
202define	CI_CTRL			offsetof(struct cpu_info, ci_ctrl)
203endif
204ifdef __HAVE_FAST_SOFTINTS
205define	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
206endif
207define	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
208define	CI_CC_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
209define	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
210define	CI_CC_NSOFT		offsetof(struct cpu_info, ci_data.cpu_nsoft)
211ifdef FPU_VFP
212define	CI_VFP_ID		offsetof(struct cpu_info, ci_vfp_id)
213endif
214
215define	VFP_FPEXC_EN		VFP_FPEXC_EN
216
217# Constants required for in_cksum() and friends.
218define	M_LEN				offsetof(struct mbuf, m_len)
219define	M_DATA				offsetof(struct mbuf, m_data)
220define	M_NEXT				offsetof(struct mbuf, m_next)
221define	IP_SRC				offsetof(struct ip, ip_src)
222define	IP_DST				offsetof(struct ip, ip_dst)
223