genassym.cf revision 1.55
1#	$NetBSD: genassym.cf,v 1.55 2012/10/21 09:25:16 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>
49
50include <arm/arm32/pte.h>
51include <machine/pmap.h>
52include <machine/frame.h>
53include <machine/pcb.h>
54include <machine/vmparam.h>
55
56include "opt_multiprocessor.h"
57include "opt_compat_netbsd.h"
58include "opt_execfmt.h"
59
60define	__PROG32		1
61ifdef __ARM_FIQ_INDIRECT
62define	__ARM_FIQ_INDIRECT	1
63endif
64
65ifdef __HAVE_FAST_SOFTINTS
66define	__HAVE_FAST_SOFTINTS	1
67endif
68
69ifdef __HAVE_PIC_FAST_SOFTINTS
70define	__HAVE_PIC_FAST_SOFTINTS	1
71endif
72
73ifdef __HAVE_UNNESTED_INTRS
74define	__HAVE_UNNESTED_INTRS	1
75endif
76
77define	KERNEL_BASE		KERNEL_BASE
78define	VM_MIN_ADDRESS		VM_MIN_ADDRESS
79define	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS
80
81define	DCACHE_LINE_SIZE	offsetof(struct arm_cache_info, dcache_line_size)
82
83define	PV_PA			offsetof(pv_addr_t, pv_pa)
84define	PMAP_DOMAIN_KERNEL	PMAP_DOMAIN_KERNEL
85define	DOMAIN_CLIENT		DOMAIN_CLIENT
86define	L1_S_PROTO_generic	L1_S_PROTO_generic
87define	L1_S_PROTO_armv7	L1_S_PROTO_armv7
88define	L1_S_PROTO_xscale	L1_S_PROTO_xscale
89if ARM_NMMUS == 1
90define	L1_S_PROTO		L1_S_PROTO
91endif
92define	L1_S_FRAME		L1_S_FRAME
93define	L1_S_SHIFT		L1_S_SHIFT
94define	L1_S_SIZE		L1_S_SIZE
95define	L1_S_B			L1_S_B
96define	L1_S_C			L1_S_C
97define	L1_S_AP_KR		L1_S_AP(AP_KR)
98define	L1_S_AP_KRW		L1_S_AP(AP_KRW)
99define	L1_S_APv7_KRW		L1_S_AP(AP7_KRW)
100define	L1_TABLE_SIZE		L1_TABLE_SIZE
101define	L1_TYPE_S		L1_TYPE_S
102define	L1_S_DOM_KERNEL		L1_S_DOM(PMAP_DOMAIN_KERNEL)
103
104ifdef PMAP_INCLUDE_PTE_SYNC
105define	PMAP_INCLUDE_PTE_SYNC	1
106endif
107
108define	PAGE_MASK		PAGE_MASK
109define	PAGE_SIZE		PAGE_SIZE
110define	UPAGES			UPAGES
111define	PGSHIFT			PGSHIFT
112
113# Important offsets into the lwp and proc structs & associated constants
114define	L_PCB			offsetof(struct lwp, l_addr)
115define	L_CPU			offsetof(struct lwp, l_cpu)
116define	L_PRIORITY		offsetof(struct lwp, l_priority)
117define	L_WCHAN			offsetof(struct lwp, l_wchan)
118define	L_STAT			offsetof(struct lwp, l_stat)
119define	L_PROC			offsetof(struct lwp, l_proc)
120define	L_CTXSWTCH		offsetof(struct lwp, l_ctxswtch)
121define	L_PRIVATE		offsetof(struct lwp, l_private)
122define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
123define	L_MD_TF			offsetof(struct lwp, l_md.md_tf)
124define	MDLWP_NOALIGNFLT	MDLWP_NOALIGNFLT
125
126define	P_RASLIST		offsetof(struct proc, p_raslist)
127
128define	PCB_R8			offsetof(struct pcb, pcb_un.un_32.pcb32_r8)
129define	PCB_R9			offsetof(struct pcb, pcb_un.un_32.pcb32_r9)
130define	PCB_R10			offsetof(struct pcb, pcb_un.un_32.pcb32_r10)
131define	PCB_R11			offsetof(struct pcb, pcb_un.un_32.pcb32_r11)
132define	PCB_R12			offsetof(struct pcb, pcb_un.un_32.pcb32_r12)
133define	PCB_SP			offsetof(struct pcb, pcb_un.un_32.pcb32_sp)
134define	PCB_LR			offsetof(struct pcb, pcb_un.un_32.pcb32_lr)
135define	PCB_PC			offsetof(struct pcb, pcb_un.un_32.pcb32_pc)
136define	PCB_USER_PID_RW		offsetof(struct pcb, pcb_un.un_32.pcb32_user_pid_rw)
137define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
138
139define	PCB_SIZE		sizeof(struct pcb)
140
141define	VM_MAP			offsetof(struct vmspace, vm_map)
142define	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
143
144define	PR_BASE			offsetof(struct uprof, pr_base)
145define	PR_SIZE			offsetof(struct uprof, pr_size)
146define	PR_OFF			offsetof(struct uprof, pr_off)
147define	PR_SCALE		offsetof(struct uprof, pr_scale)
148
149define	SIGTRAP			SIGTRAP
150define	SIGEMT			SIGEMT
151
152define	TF_FILL			offsetof(struct trapframe, tf_fill)
153define	TF_R0			offsetof(struct trapframe, tf_r0)
154define	TF_R4			offsetof(struct trapframe, tf_r4)
155define	TF_R6			offsetof(struct trapframe, tf_r6)
156define	TF_R10			offsetof(struct trapframe, tf_r10)
157define	TF_PC			offsetof(struct trapframe, tf_pc)
158
159define	PROCSIZE		sizeof(struct proc)
160define	TRAPFRAMESIZE		sizeof(struct trapframe)
161
162define	CF_IDCACHE_WBINV_ALL	offsetof(struct cpu_functions, cf_idcache_wbinv_all)
163define	CF_DCACHE_WB_RANGE	offsetof(struct cpu_functions, cf_dcache_wb_range)
164define	CF_TLB_FLUSHID_SE	offsetof(struct cpu_functions, cf_tlb_flushID_SE)
165define	CF_CONTEXT_SWITCH	offsetof(struct cpu_functions, cf_context_switch)
166define	CF_SLEEP		offsetof(struct cpu_functions, cf_sleep)
167define	CF_CONTROL		offsetof(struct cpu_functions, cf_control)
168
169define	CI_CURPRIORITY		offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
170define	CI_ARM_CPUID		offsetof(struct cpu_info, ci_arm_cpuid)
171define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
172define	CI_CPL			offsetof(struct cpu_info, ci_cpl)
173define	CI_ASTPENDING		offsetof(struct cpu_info, ci_astpending)
174define	CI_WANT_RESCHED		offsetof(struct cpu_info, ci_want_resched)
175define	CI_INTR_DEPTH		offsetof(struct cpu_info, ci_intr_depth)
176define	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
177define	CI_UNDEFSAVE		offsetof(struct cpu_info, ci_undefsave[0])
178if defined(EXEC_AOUT)
179define	CI_CTRL			offsetof(struct cpu_info, ci_ctrl)
180endif
181ifdef __HAVE_FAST_SOFTINTS
182define	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
183endif
184define	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
185define	CI_CC_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
186define	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
187define	CI_CC_NSOFT		offsetof(struct cpu_info, ci_data.cpu_nsoft)
188
189
190# Constants required for in_cksum() and friends.
191define	M_LEN				offsetof(struct mbuf, m_len)
192define	M_DATA				offsetof(struct mbuf, m_data)
193define	M_NEXT				offsetof(struct mbuf, m_next)
194define	IP_SRC				offsetof(struct ip, ip_src)
195define	IP_DST				offsetof(struct ip, ip_dst)
196