genassym.cf revision 1.32
1#	$NetBSD: genassym.cf,v 1.32 2002/10/01 12:56:51 fvdl 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_multiprocessor.h"
82endif
83
84include <sys/param.h>
85include <sys/proc.h>
86include <sys/resourcevar.h>
87include <sys/device.h>
88include <sys/user.h>
89include <sys/mbuf.h>
90include <netinet/in.h>
91include <netinet/in_systm.h>
92include <netinet/ip.h>
93include <netinet/ip6.h>
94include <netinet/ip_var.h>
95
96include <uvm/uvm.h>
97
98include <machine/trap.h>
99include <machine/pmap.h>
100include <machine/vmparam.h>
101
102if defined(_KERNEL) && !defined(_LKM)
103include "apm.h"
104endif
105if NAPM > 0
106include <machine/bioscall.h>
107include <machine/apmvar.h>
108endif
109
110ifdef COMPAT_SVR4
111include <compat/svr4/svr4_ucontext.h>
112endif
113
114ifdef COMPAT_LINUX
115include <compat/linux/common/linux_signal.h>
116include <compat/linux/common/linux_machdep.h>
117endif
118
119ifdef COMPAT_FREEBSD
120include <machine/freebsd_machdep.h>
121endif
122
123ifdef MULTIPROCESSOR
124include <machine/cpu.h>
125endif
126
127if defined(_KERNEL) && !defined(_LKM)
128include "isa.h"
129endif
130if NISA > 0
131include <machine/isa_machdep.h>
132endif
133
134include <machine/tlog.h>
135
136define	SRUN			SRUN
137define	SONPROC			SONPROC
138
139define	PDSLOT_PTE		PDSLOT_PTE
140define	PDSLOT_APTE		PDSLOT_APTE
141define	PDSLOT_KERN		PDSLOT_KERN
142define	NKPTP_MIN		NKPTP_MIN
143define	NKPTP_MAX		NKPTP_MAX
144
145define	VM_MAXUSER_ADDRESS	(int)VM_MAXUSER_ADDRESS
146
147define	UVM_PAGE_IDLE_ZERO	offsetof(struct uvm, page_idle_zero)
148
149define	P_ADDR			offsetof(struct proc, p_addr)
150define	P_BACK			offsetof(struct proc, p_back)
151define	P_FORW			offsetof(struct proc, p_forw)
152define	P_PRIORITY		offsetof(struct proc, p_priority)
153define	P_STAT			offsetof(struct proc, p_stat)
154define	P_WCHAN			offsetof(struct proc, p_wchan)
155define	P_FLAG			offsetof(struct proc, p_flag)
156define	P_CPU			offsetof(struct proc, p_cpu)
157define	P_NRAS			offsetof(struct proc, p_nras)
158define	P_MD_TSS_SEL		offsetof(struct proc, p_md.md_tss_sel)
159define	P_MD_REGS		offsetof(struct proc, p_md.md_regs)
160define	P_MD_SYSCALL		offsetof(struct proc, p_md.md_syscall)
161
162define	P_SYSTEM		P_SYSTEM
163
164define	M_DATA			offsetof(struct mbuf, m_data)
165define	M_LEN			offsetof(struct mbuf, m_len)
166define	M_NEXT			offsetof(struct mbuf, m_next)
167
168define	IP_SRC			offsetof(struct ip, ip_src)
169define	IP_DST			offsetof(struct ip, ip_dst)
170
171define	IP6_SRC			offsetof(struct ip6_hdr, ip6_src)
172define	IP6_DST			offsetof(struct ip6_hdr, ip6_dst)
173
174define	V_TRAP			offsetof(struct uvmexp, traps)
175define	V_INTR			offsetof(struct uvmexp, intrs)
176
177define	PCB_CR3			offsetof(struct pcb, pcb_cr3)
178define	PCB_EBP			offsetof(struct pcb, pcb_ebp)
179define	PCB_ESP			offsetof(struct pcb, pcb_esp)
180define	PCB_CR0			offsetof(struct pcb, pcb_cr0)
181define	PCB_LDT_SEL		offsetof(struct pcb, pcb_ldt_sel)
182define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
183define	PCB_FPCPU		offsetof(struct pcb, pcb_fpcpu)
184
185define	TF_CS			offsetof(struct trapframe, tf_cs)
186define	TF_EIP			offsetof(struct trapframe, tf_eip)
187define	TF_ERR			offsetof(struct trapframe, tf_err)
188define	TF_TRAPNO		offsetof(struct trapframe, tf_trapno)
189define	TF_EFLAGS		offsetof(struct trapframe, tf_eflags)
190
191define	FRAMESIZE		sizeof(struct trapframe)
192
193ifdef COMPAT_SVR4
194define	SVR4_SIGF_HANDLER	offsetof(struct svr4_sigframe, sf_handler)
195define	SVR4_SIGF_UC		offsetof(struct svr4_sigframe, sf_uc)
196endif
197
198ifdef COMPAT_LINUX
199define	LINUX_SIGF_HANDLER	offsetof(struct linux_sigframe, sf_handler)
200define	LINUX_SIGF_SC		offsetof(struct linux_sigframe, sf_sc)
201endif
202
203ifdef COMPAT_FREEBSD
204define	FREEBSD_SIGF_HANDLER	offsetof(struct freebsd_sigframe, sf_handler)
205define	FREEBSD_SIGF_SC		offsetof(struct freebsd_sigframe, sf_sc)
206endif
207
208if NISA > 0
209define	IH_FUN			offsetof(struct intrhand, ih_fun)
210define	IH_ARG			offsetof(struct intrhand, ih_arg)
211define	IH_COUNT		offsetof(struct intrhand, ih_count)
212define	IH_NEXT			offsetof(struct intrhand, ih_next)
213endif
214
215if NAPM > 0
216define	APM_CODE32		offsetof(struct apm_connect_info, apm_code32_seg_base)
217define	APM_CODE16		offsetof(struct apm_connect_info, apm_code16_seg_base)
218define	APM_DATA		offsetof(struct apm_connect_info, apm_data_seg_base)
219define	APM_CODE32_LEN		offsetof(struct apm_connect_info, apm_code32_seg_len)
220define	APM_DATA_LEN		offsetof(struct apm_connect_info, apm_data_seg_len)
221define	APM_ENTRY		offsetof(struct apm_connect_info, apm_entrypt)
222define	APM_DETAIL		offsetof(struct apm_connect_info, apm_detail)
223define	APM_SIZE		sizeof(struct apm_connect_info)
224define	BIOSCALLREG_EAX		offsetof(struct bioscallregs, EAX)
225define	BIOSCALLREG_EBX		offsetof(struct bioscallregs, EBX)
226define	BIOSCALLREG_ECX		offsetof(struct bioscallregs, ECX)
227define	BIOSCALLREG_EDX		offsetof(struct bioscallregs, EDX)
228define	BIOSCALLREG_ESI		offsetof(struct bioscallregs, ESI)
229define	BIOSCALLREG_EDI		offsetof(struct bioscallregs, EDI)
230define	BIOSCALLREG_EFLAGS	offsetof(struct bioscallregs, EFLAGS)
231endif
232
233define	CPU_INFO_SELF		offsetof(struct cpu_info, ci_self)
234define	CPU_INFO_RESCHED	offsetof(struct cpu_info, ci_want_resched)
235define	CPU_INFO_CURPROC	offsetof(struct cpu_info, ci_curproc)
236define	CPU_INFO_CURPCB		offsetof(struct cpu_info, ci_curpcb)
237define	CPU_INFO_IDLE_PCB	offsetof(struct cpu_info, ci_idle_pcb)
238define  CPU_INFO_IDLE_TSS_SEL	offsetof(struct cpu_info, ci_idle_tss_sel)
239define	CPU_INFO_ASTPENDING	offsetof(struct cpu_info, ci_astpending)
240
241define	CPU_INFO_LEVEL		offsetof(struct cpu_info, ci_cpuid_level)
242define	CPU_INFO_VENDOR		offsetof(struct cpu_info, ci_vendor[0])
243define	CPU_INFO_SIGNATURE	offsetof(struct cpu_info, ci_signature)
244define	CPU_INFO_FEATURES	offsetof(struct cpu_info, ci_feature_flags)
245define	CPU_INFO_BRAND		offsetof(struct cpu_info, ci_brand_id)
246
247define	CPU_TLOG_OFFSET		offsetof(struct cpu_info, ci_tlog_offset)
248define	CPU_TLOG_BASE		offsetof(struct cpu_info, ci_tlog_base)
249
250define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
251
252define	SIZEOF_CPU_INFO		sizeof(struct cpu_info)
253
254define	TREC_SP			offsetof(struct trec, tr_sp)
255define	TREC_HPC		offsetof(struct trec, tr_hpc)
256define	TREC_IPC		offsetof(struct trec, tr_ipc)
257define	TREC_TSC		offsetof(struct trec, tr_tsc)
258define	TREC_LBF		offsetof(struct trec, tr_lbf)
259define	TREC_LBT		offsetof(struct trec, tr_lbt)
260define	TREC_IBF		offsetof(struct trec, tr_ibf)
261define	TREC_IBT		offsetof(struct trec, tr_ibt)
262
263define	SIZEOF_TREC		sizeof(struct trec)
264define	SIZEOF_TLOG		sizeof(struct tlog)
265
266
267if defined(__HAVE_GENERIC_SOFT_INTERRUPTS)
268define	__HAVE_GENERIC_SOFT_INTERRUPTS 1
269endif
270