genassym.cf revision 1.44
1#	$NetBSD: genassym.cf,v 1.44 2006/05/22 13:44:53 yamt Exp $
2
3#
4# Copyright (c) 1998 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Charles M. Hannum.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions
12# are met:
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18# 3. All advertising materials mentioning features or use of this software
19#    must display the following acknowledgement:
20#        This product includes software developed by the NetBSD
21#        Foundation, Inc. and its contributors.
22# 4. Neither the name of The NetBSD Foundation nor the names of its
23#    contributors may be used to endorse or promote products derived
24#    from this software without specific prior written permission.
25#
26# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36# POSSIBILITY OF SUCH DAMAGE.
37#
38
39#
40# Copyright (c) 1982, 1990 The Regents of the University of California.
41# All rights reserved.
42#
43# This code is derived from software contributed to Berkeley by
44# William Jolitz.
45#
46# Redistribution and use in source and binary forms, with or without
47# modification, are permitted provided that the following conditions
48# are met:
49# 1. Redistributions of source code must retain the above copyright
50#    notice, this list of conditions and the following disclaimer.
51# 2. Redistributions in binary form must reproduce the above copyright
52#    notice, this list of conditions and the following disclaimer in the
53#    documentation and/or other materials provided with the distribution.
54# 3. All advertising materials mentioning features or use of this software
55#    must display the following acknowledgement:
56#	This product includes software developed by the University of
57#	California, Berkeley and its contributors.
58# 4. Neither the name of the University nor the names of its contributors
59#    may be used to endorse or promote products derived from this software
60#    without specific prior written permission.
61#
62# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72# SUCH DAMAGE.
73#
74#	@(#)genassym.c	5.11 (Berkeley) 5/10/91
75#
76
77if defined(_KERNEL_OPT)
78include "opt_compat_svr4.h"
79include "opt_compat_freebsd.h"
80include "opt_compat_linux.h"
81include "opt_compat_netbsd.h"
82include "opt_multiprocessor.h"
83endif
84
85include <sys/param.h>
86include <sys/proc.h>
87include <sys/resourcevar.h>
88include <sys/device.h>
89include <sys/user.h>
90include <sys/mbuf.h>
91include <netinet/in.h>
92include <netinet/in_systm.h>
93include <netinet/ip.h>
94include <netinet/ip6.h>
95include <netinet/ip_var.h>
96
97include <uvm/uvm.h>
98
99include <machine/trap.h>
100include <machine/pmap.h>
101include <machine/vmparam.h>
102include <machine/intr.h>
103include <machine/types.h>
104
105if defined(_KERNEL) && !defined(_LKM)
106include "ioapic.h"
107include "apm.h"
108endif
109if NAPM > 0
110include <machine/bioscall.h>
111include <machine/apmvar.h>
112endif
113
114include <compat/sys/signal.h>
115
116ifdef COMPAT_SVR4
117include <compat/svr4/svr4_ucontext.h>
118endif
119
120ifdef COMPAT_LINUX
121include <compat/linux/common/linux_signal.h>
122include <compat/linux/common/linux_machdep.h>
123endif
124
125ifdef COMPAT_FREEBSD
126include <machine/freebsd_machdep.h>
127endif
128
129ifdef MULTIPROCESSOR
130include <machine/cpu.h>
131endif
132
133if NIOAPIC > 0
134include <machine/i82093reg.h>
135include <machine/i82093var.h>
136endif
137
138if defined(_KERNEL) && !defined(_LKM)
139include "isa.h"
140endif
141if NISA > 0
142include <machine/isa_machdep.h>
143endif
144
145include <machine/tlog.h>
146
147define	PAGE_SIZE		PAGE_SIZE
148
149define	LSRUN			LSRUN
150define	LSONPROC		LSONPROC
151
152define	PTE_BASE		PTE_BASE
153define	UPAGES			UPAGES
154define	USPACE			USPACE
155define	KSTACK_SIZE		KSTACK_SIZE
156define	KERNBASE		KERNBASE
157define	KERNTEXTOFF		KERNTEXTOFF
158
159define	PGSHIFT			PGSHIFT
160define	PGOFSET			PGOFSET
161define	PDSHIFT			PDSHIFT
162define	PDOFSET			PDOFSET
163define	NBPD			NBPD
164
165define	PG_RW			PG_RW
166define	PG_V			PG_V
167define	PG_KW			PG_KW
168define	PG_KR			PG_KR
169
170define	PDSLOT_PTE		PDSLOT_PTE
171define	PDSLOT_APTE		PDSLOT_APTE
172define	PDSLOT_KERN		PDSLOT_KERN
173define	NKPTP_MIN		NKPTP_MIN
174define	NKPTP_MAX		NKPTP_MAX
175
176define	VM_MAXUSER_ADDRESS	(int)VM_MAXUSER_ADDRESS
177
178define	UVM_PAGE_IDLE_ZERO	offsetof(struct uvm, page_idle_zero)
179
180define	L_ADDR			offsetof(struct lwp, l_addr)
181define	L_BACK			offsetof(struct lwp, l_back)
182define	L_FORW			offsetof(struct lwp, l_forw)
183define	L_PRIORITY		offsetof(struct lwp, l_priority)
184define	L_STAT			offsetof(struct lwp, l_stat)
185define	L_WCHAN			offsetof(struct lwp, l_wchan)
186define	L_PROC			offsetof(struct lwp, l_proc)
187define	L_MD_TSS_SEL		offsetof(struct lwp, l_md.md_tss_sel)
188define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
189define	L_CPU			offsetof(struct lwp, l_cpu)
190define	P_FLAG			offsetof(struct proc, p_flag)
191define	P_RASLIST		offsetof(struct proc, p_raslist)
192define	P_MD_SYSCALL		offsetof(struct proc, p_md.md_syscall)
193define	P_MD_ASTPENDING		offsetof(struct proc, p_md.md_astpending)
194
195define	P_SYSTEM		P_SYSTEM
196
197define	M_DATA			offsetof(struct mbuf, m_data)
198define	M_LEN			offsetof(struct mbuf, m_len)
199define	M_NEXT			offsetof(struct mbuf, m_next)
200
201define	IP_SRC			offsetof(struct ip, ip_src)
202define	IP_DST			offsetof(struct ip, ip_dst)
203
204define	IP6_SRC			offsetof(struct ip6_hdr, ip6_src)
205define	IP6_DST			offsetof(struct ip6_hdr, ip6_dst)
206
207define	V_TRAP			offsetof(struct uvmexp, traps)
208define	V_INTR			offsetof(struct uvmexp, intrs)
209
210define	PCB_CR3			offsetof(struct pcb, pcb_cr3)
211define	PCB_EBP			offsetof(struct pcb, pcb_ebp)
212define	PCB_ESP			offsetof(struct pcb, pcb_esp)
213define	PCB_CR0			offsetof(struct pcb, pcb_cr0)
214define	PCB_LDT_SEL		offsetof(struct pcb, pcb_ldt_sel)
215define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
216define	PCB_FPCPU		offsetof(struct pcb, pcb_fpcpu)
217
218define	TF_CS			offsetof(struct trapframe, tf_cs)
219define	TF_EIP			offsetof(struct trapframe, tf_eip)
220define	TF_ERR			offsetof(struct trapframe, tf_err)
221define	TF_TRAPNO		offsetof(struct trapframe, tf_trapno)
222define	TF_EFLAGS		offsetof(struct trapframe, tf_eflags)
223
224define	TF_GS			offsetof(struct trapframe, tf_gs)
225define	TF_FS			offsetof(struct trapframe, tf_fs)
226define	TF_ES			offsetof(struct trapframe, tf_es)
227define	TF_DS			offsetof(struct trapframe, tf_ds)
228define	TF_EDI			offsetof(struct trapframe, tf_edi)
229define	TF_ESI			offsetof(struct trapframe, tf_esi)
230define	TF_EBP			offsetof(struct trapframe, tf_ebp)
231define	TF_EBX			offsetof(struct trapframe, tf_ebx)
232define	TF_EDX			offsetof(struct trapframe, tf_edx)
233define	TF_ECX			offsetof(struct trapframe, tf_ecx)
234define	TF_EAX			offsetof(struct trapframe, tf_eax)
235
236define	TF_PUSHSIZE		offsetof(struct trapframe, tf_trapno)
237
238define	FRAMESIZE		sizeof(struct trapframe)
239
240ifdef COMPAT_SVR4
241define	SVR4_SIGF_HANDLER	offsetof(struct svr4_sigframe, sf_handler)
242define	SVR4_SIGF_UC		offsetof(struct svr4_sigframe, sf_uc)
243endif
244
245ifdef COMPAT_LINUX
246define	LINUX_SIGF_HANDLER	offsetof(struct linux_sigframe, sf_handler)
247define	LINUX_SIGF_SC		offsetof(struct linux_sigframe, sf_sc)
248define	LINUX_RT_SIGF_HANDLER	offsetof(struct linux_rt_sigframe, sf_handler)
249define	LINUX_RT_SIGF_UC	offsetof(struct linux_rt_sigframe, sf_uc)
250endif
251
252ifdef COMPAT_FREEBSD
253define	FREEBSD_SIGF_HANDLER	offsetof(struct freebsd_sigframe, sf_handler)
254define	FREEBSD_SIGF_SC		offsetof(struct freebsd_sigframe, sf_sc)
255endif
256
257define	IH_FUN			offsetof(struct intrhand, ih_fun)
258define	IH_ARG			offsetof(struct intrhand, ih_arg)
259define	IH_LEVEL		offsetof(struct intrhand, ih_level)
260define	IH_NEXT			offsetof(struct intrhand, ih_next)
261
262if NAPM > 0
263define	APM_CODE32		offsetof(struct apm_connect_info, apm_code32_seg_base)
264define	APM_CODE16		offsetof(struct apm_connect_info, apm_code16_seg_base)
265define	APM_DATA		offsetof(struct apm_connect_info, apm_data_seg_base)
266define	APM_CODE32_LEN		offsetof(struct apm_connect_info, apm_code32_seg_len)
267define	APM_DATA_LEN		offsetof(struct apm_connect_info, apm_data_seg_len)
268define	APM_ENTRY		offsetof(struct apm_connect_info, apm_entrypt)
269define	APM_DETAIL		offsetof(struct apm_connect_info, apm_detail)
270define	APM_SIZE		sizeof(struct apm_connect_info)
271define	BIOSCALLREG_EAX		offsetof(struct bioscallregs, EAX)
272define	BIOSCALLREG_EBX		offsetof(struct bioscallregs, EBX)
273define	BIOSCALLREG_ECX		offsetof(struct bioscallregs, ECX)
274define	BIOSCALLREG_EDX		offsetof(struct bioscallregs, EDX)
275define	BIOSCALLREG_ESI		offsetof(struct bioscallregs, ESI)
276define	BIOSCALLREG_EDI		offsetof(struct bioscallregs, EDI)
277define	BIOSCALLREG_EFLAGS	offsetof(struct bioscallregs, EFLAGS)
278endif
279
280define	CPU_INFO_SELF		offsetof(struct cpu_info, ci_self)
281define	CPU_INFO_RESCHED	offsetof(struct cpu_info, ci_want_resched)
282define	CPU_INFO_WANT_PMAPLOAD	offsetof(struct cpu_info, ci_want_pmapload)
283define	CPU_INFO_TLBSTATE	offsetof(struct cpu_info, ci_tlbstate)
284define	TLBSTATE_VALID		TLBSTATE_VALID
285define	CPU_INFO_CURLWP		offsetof(struct cpu_info, ci_curlwp)
286define	CPU_INFO_CURPCB		offsetof(struct cpu_info, ci_curpcb)
287define	CPU_INFO_IDLE_PCB	offsetof(struct cpu_info, ci_idle_pcb)
288define  CPU_INFO_IDLE_TSS_SEL	offsetof(struct cpu_info, ci_idle_tss_sel)
289define	CPU_INFO_ASTPENDING	offsetof(struct cpu_info, ci_astpending)
290
291define	CPU_INFO_LEVEL		offsetof(struct cpu_info, ci_cpuid_level)
292define	CPU_INFO_VENDOR		offsetof(struct cpu_info, ci_vendor[0])
293define	CPU_INFO_SIGNATURE	offsetof(struct cpu_info, ci_signature)
294define	CPU_INFO_FEATURES	offsetof(struct cpu_info, ci_feature_flags)
295define	CPU_INFO_BRAND		offsetof(struct cpu_info, ci_brand_id)
296
297define	CPU_TLOG_OFFSET		offsetof(struct cpu_info, ci_tlog_offset)
298define	CPU_TLOG_BASE		offsetof(struct cpu_info, ci_tlog_base)
299
300define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
301define	CPU_INFO_IPENDING	offsetof(struct cpu_info, ci_ipending)
302define	CPU_INFO_IMASK		offsetof(struct cpu_info, ci_imask)
303define	CPU_INFO_IUNMASK	offsetof(struct cpu_info, ci_iunmask)
304define	CPU_INFO_ILEVEL		offsetof(struct cpu_info, ci_ilevel)
305define	CPU_INFO_IDEPTH		offsetof(struct cpu_info, ci_idepth)
306define	CPU_INFO_ISOURCES	offsetof(struct cpu_info, ci_isources)
307
308if NIOAPIC > 0
309define		IOAPIC_SC_REG		offsetof(struct ioapic_softc, sc_reg)
310define		IOAPIC_SC_DATA		offsetof(struct ioapic_softc, sc_data)
311define		PIC_LOCK		offsetof(struct pic, pic_lock)
312endif
313
314define	SIZEOF_CPU_INFO		sizeof(struct cpu_info)
315
316define        SIZEOF_ISOURCE          sizeof(struct intrsource)
317define        SIZEOF_ISTUB            sizeof(struct intrstub)
318
319define		IS_RECURSE	offsetof(struct intrsource, is_recurse)
320define		IS_RESUME	offsetof(struct intrsource, is_resume)
321define		IS_EVCNTLO	offsetof(struct intrsource, is_evcnt.ev_count)
322define		IS_EVCNTHI	offsetof(struct intrsource, is_evcnt.ev_count)+4
323define		IS_HANDLERS	offsetof(struct intrsource, is_handlers)
324define		IS_PIC		offsetof(struct intrsource, is_pic)
325define		IS_FLAGS	offsetof(struct intrsource, is_flags)
326define		IS_PIN		offsetof(struct intrsource, is_pin)
327define		IS_TYPE		offsetof(struct intrsource, is_type)
328define		IS_MAXLEVEL	offsetof(struct intrsource, is_maxlevel)
329
330define	TREC_SP			offsetof(struct trec, tr_sp)
331define	TREC_HPC		offsetof(struct trec, tr_hpc)
332define	TREC_IPC		offsetof(struct trec, tr_ipc)
333define	TREC_TSC		offsetof(struct trec, tr_tsc)
334define	TREC_LBF		offsetof(struct trec, tr_lbf)
335define	TREC_LBT		offsetof(struct trec, tr_lbt)
336define	TREC_IBF		offsetof(struct trec, tr_ibf)
337define	TREC_IBT		offsetof(struct trec, tr_ibt)
338
339define	SIZEOF_TREC		sizeof(struct trec)
340define	SIZEOF_TLOG		sizeof(struct tlog)
341
342define	IPL_NONE		IPL_NONE
343define	IPL_SCHED		IPL_SCHED
344define	IPL_CLOCK		IPL_CLOCK
345define	IPL_HIGH		IPL_HIGH
346define	IPL_IPI			IPL_IPI
347
348define	IPL_SOFTNET		IPL_SOFTNET
349define	IPL_SOFTCLOCK		IPL_SOFTCLOCK
350define	IPL_SOFTSERIAL		IPL_SOFTSERIAL
351
352define	LIR_IPI			LIR_IPI
353define	LIR_TIMER		LIR_TIMER
354
355define	SIR_NET			SIR_NET
356define	SIR_CLOCK		SIR_CLOCK
357define	SIR_SERIAL		SIR_SERIAL
358
359define	IREENT_MAGIC		IREENT_MAGIC
360
361define	X86_SOFTINTR_SOFTSERIAL	X86_SOFTINTR_SOFTSERIAL
362define	X86_SOFTINTR_SOFTNET	X86_SOFTINTR_SOFTNET
363define	X86_SOFTINTR_SOFTCLOCK	X86_SOFTINTR_SOFTCLOCK
364
365define	PSL_AC			PSL_AC
366define	PSL_MBO			PSL_MBO
367define	PSL_ID			PSL_ID
368define	PSL_VM			PSL_VM
369