genassym.cf revision 1.8
1#	$NetBSD: genassym.cf,v 1.8 1998/06/26 06:54:08 thorpej Exp $
2
3#
4# Copyright (c) 1995, 1997 Charles M. Hannum.  All rights reserved.
5# Copyright (c) 1982, 1990 The Regents of the University of California.
6# All rights reserved.
7#
8# This code is derived from software contributed to Berkeley by
9# William Jolitz.
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
14# 1. Redistributions of source code must retain the above copyright
15#    notice, this list of conditions and the following disclaimer.
16# 2. Redistributions in binary form must reproduce the above copyright
17#    notice, this list of conditions and the following disclaimer in the
18#    documentation and/or other materials provided with the distribution.
19# 3. All advertising materials mentioning features or use of this software
20#    must display the following acknowledgement:
21#	This product includes software developed by the University of
22#	California, Berkeley and its contributors.
23# 4. Neither the name of the University nor the names of its contributors
24#    may be used to endorse or promote products derived from this software
25#    without specific prior written permission.
26#
27# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37# SUCH DAMAGE.
38#
39#	@(#)genassym.c	5.11 (Berkeley) 5/10/91
40#
41
42include "opt_uvm.h"
43include "opt_pmap_new.h"
44include "opt_compat_svr4.h"
45include "opt_compat_freebsd.h"
46include "opt_compat_linux.h"
47
48include <sys/param.h>
49include <sys/proc.h>
50include <sys/resourcevar.h>
51include <sys/device.h>
52include <sys/user.h>
53include <sys/mbuf.h>
54
55include <vm/vm.h>
56
57ifdef UVM
58include <uvm/uvm_extern.h>
59endif
60
61include <machine/trap.h>
62include <machine/pmap.h>
63include <machine/vmparam.h>
64
65include "apm.h"
66if NAPM > 0
67include <machine/bioscall.h>
68include <machine/apmvar.h>
69endif
70
71ifdef COMPAT_SVR4
72include <compat/svr4/svr4_ucontext.h>
73endif
74
75ifdef COMPAT_LINUX
76include <machine/linux_machdep.h>
77endif
78
79ifdef COMPAT_FREEBSD
80include <machine/freebsd_machdep.h>
81endif
82
83include "isa.h"
84if NISA > 0
85include <i386/isa/isa_machdep.h>
86endif
87
88define	SRUN			SRUN
89
90ifdef PMAP_NEW
91define	PDSLOT_PTE		PDSLOT_PTE
92define	PDSLOT_APTE		PDSLOT_APTE
93define	PDSLOT_KERN		PDSLOT_KERN
94define	NKPTP_MIN		NKPTP_MIN
95define	NKPTP_MAX		NKPTP_MAX
96else
97define	PTDPTDI			PTDPTDI
98define	KPTDI			KPTDI
99define	NKPDE_BASE		NKPDE_BASE
100define	NKPDE_MAX		NKPDE_MAX
101define	NKPDE_SCALE		NKPDE_SCALE
102define	APTDPTDI		APTDPTDI
103endif
104
105define	VM_MAXUSER_ADDRESS	(int)VM_MAXUSER_ADDRESS
106
107define	P_ADDR			offsetof(struct proc, p_addr)
108define	P_BACK			offsetof(struct proc, p_back)
109define	P_FORW			offsetof(struct proc, p_forw)
110define	P_PRIORITY		offsetof(struct proc, p_priority)
111define	P_STAT			offsetof(struct proc, p_stat)
112define	P_WCHAN			offsetof(struct proc, p_wchan)
113define	P_VMSPACE		offsetof(struct proc, p_vmspace)
114define	P_FLAG			offsetof(struct proc, p_flag)
115
116define	P_SYSTEM		P_SYSTEM
117
118define	M_DATA			offsetof(struct mbuf, m_data)
119define	M_LEN			offsetof(struct mbuf, m_len)
120define	M_NEXT			offsetof(struct mbuf, m_next)
121
122ifdef UVM
123define	V_TRAP			offsetof(struct uvmexp, traps)
124define	V_INTR			offsetof(struct uvmexp, intrs)
125else
126define	V_TRAP			offsetof(struct vmmeter, v_trap)
127define	V_INTR			offsetof(struct vmmeter, v_intr)
128endif
129
130define	PCB_CR3			offsetof(struct pcb, pcb_cr3)
131define	PCB_EBP			offsetof(struct pcb, pcb_ebp)
132define	PCB_ESP			offsetof(struct pcb, pcb_esp)
133define	PCB_FS			offsetof(struct pcb, pcb_fs)
134define	PCB_GS			offsetof(struct pcb, pcb_gs)
135define	PCB_CR0			offsetof(struct pcb, pcb_cr0)
136define	PCB_LDT_SEL		offsetof(struct pcb, pcb_ldt_sel)
137define	PCB_TSS_SEL		offsetof(struct pcb, pcb_tss_sel)
138define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
139
140define	TF_CS			offsetof(struct trapframe, tf_cs)
141define	TF_EIP			offsetof(struct trapframe, tf_eip)
142define	TF_ERR			offsetof(struct trapframe, tf_err)
143define	TF_TRAPNO		offsetof(struct trapframe, tf_trapno)
144define	TF_EFLAGS		offsetof(struct trapframe, tf_eflags)
145
146define	FRAMESIZE		sizeof(struct trapframe)
147
148define	SIGF_HANDLER		offsetof(struct sigframe, sf_handler)
149define	SIGF_SC			offsetof(struct sigframe, sf_sc)
150define	SC_FS			offsetof(struct sigcontext, sc_fs)
151define	SC_GS			offsetof(struct sigcontext, sc_gs)
152define	SC_EFLAGS		offsetof(struct sigcontext, sc_eflags)
153
154ifdef COMPAT_SVR4
155define	SVR4_SIGF_HANDLER	offsetof(struct svr4_sigframe, sf_handler)
156define	SVR4_SIGF_UC		offsetof(struct svr4_sigframe, sf_uc)
157define	SVR4_UC_FS		offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_FS])
158define	SVR4_UC_GS		offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_GS])
159define	SVR4_UC_EFLAGS		offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_EFL])
160endif
161
162ifdef COMPAT_LINUX
163define	LINUX_SIGF_HANDLER	offsetof(struct linux_sigframe, sf_handler)
164define	LINUX_SIGF_SC		offsetof(struct linux_sigframe, sf_sc)
165define	LINUX_SC_FS		offsetof(struct linux_sigcontext, sc_fs)
166define	LINUX_SC_GS		offsetof(struct linux_sigcontext, sc_gs)
167define	LINUX_SC_EFLAGS		offsetof(struct linux_sigcontext, sc_eflags)
168endif
169
170ifdef COMPAT_FREEBSD
171define	FREEBSD_SIGF_HANDLER	offsetof(struct freebsd_sigframe, sf_handler)
172define	FREEBSD_SIGF_SC		offsetof(struct freebsd_sigframe, sf_sc)
173endif
174
175if NISA > 0
176define	IH_FUN			offsetof(struct intrhand, ih_fun)
177define	IH_ARG			offsetof(struct intrhand, ih_arg)
178define	IH_COUNT		offsetof(struct intrhand, ih_count)
179define	IH_NEXT			offsetof(struct intrhand, ih_next)
180endif
181
182if NAPM > 0
183define	APM_CODE32		offsetof(struct apm_connect_info, apm_code32_seg_base)
184define	APM_CODE16		offsetof(struct apm_connect_info, apm_code16_seg_base)
185define	APM_DATA		offsetof(struct apm_connect_info, apm_data_seg_base)
186define	APM_CODE32_LEN		offsetof(struct apm_connect_info, apm_code32_seg_len)
187define	APM_DATA_LEN		offsetof(struct apm_connect_info, apm_data_seg_len)
188define	APM_ENTRY		offsetof(struct apm_connect_info, apm_entrypt)
189define	APM_DETAIL		offsetof(struct apm_connect_info, apm_detail)
190define	APM_SIZE		sizeof(struct apm_connect_info)
191define	BIOSCALLREG_AX		offsetof(struct bioscallregs, ax)
192define	BIOSCALLREG_BX		offsetof(struct bioscallregs, bx)
193define	BIOSCALLREG_CX		offsetof(struct bioscallregs, cx)
194define	BIOSCALLREG_DX		offsetof(struct bioscallregs, dx)
195define	BIOSCALLREG_SI		offsetof(struct bioscallregs, si)
196define	BIOSCALLREG_DI		offsetof(struct bioscallregs, di)
197define	BIOSCALLREG_FLAGS	offsetof(struct bioscallregs, flags)
198endif
199