genassym.cf revision 1.7
1#	$NetBSD: genassym.cf,v 1.7 1998/02/11 03:05:35 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"
44
45include <sys/param.h>
46include <sys/proc.h>
47include <sys/resourcevar.h>
48include <sys/device.h>
49include <sys/user.h>
50include <sys/mbuf.h>
51
52include <vm/vm.h>
53
54ifdef UVM
55include <uvm/uvm_extern.h>
56endif
57
58include <machine/trap.h>
59include <machine/pmap.h>
60include <machine/vmparam.h>
61
62include "apm.h"
63if NAPM > 0
64include <machine/bioscall.h>
65include <machine/apmvar.h>
66endif
67
68ifdef COMPAT_SVR4
69include <compat/svr4/svr4_ucontext.h>
70endif
71
72ifdef COMPAT_LINUX
73include <machine/linux_machdep.h>
74endif
75
76ifdef COMPAT_FREEBSD
77include <machine/freebsd_machdep.h>
78endif
79
80include "isa.h"
81if NISA > 0
82include <i386/isa/isa_machdep.h>
83endif
84
85define	SRUN			SRUN
86
87ifdef PMAP_NEW
88define	PDSLOT_PTE		PDSLOT_PTE
89define	PDSLOT_APTE		PDSLOT_APTE
90define	PDSLOT_KERN		PDSLOT_KERN
91define	NKPTP_MIN		NKPTP_MIN
92define	NKPTP_MAX		NKPTP_MAX
93else
94define	PTDPTDI			PTDPTDI
95define	KPTDI			KPTDI
96define	NKPDE_BASE		NKPDE_BASE
97define	NKPDE_MAX		NKPDE_MAX
98define	NKPDE_SCALE		NKPDE_SCALE
99define	APTDPTDI		APTDPTDI
100endif
101
102define	VM_MAXUSER_ADDRESS	(int)VM_MAXUSER_ADDRESS
103
104define	P_ADDR			offsetof(struct proc, p_addr)
105define	P_BACK			offsetof(struct proc, p_back)
106define	P_FORW			offsetof(struct proc, p_forw)
107define	P_PRIORITY		offsetof(struct proc, p_priority)
108define	P_STAT			offsetof(struct proc, p_stat)
109define	P_WCHAN			offsetof(struct proc, p_wchan)
110define	P_VMSPACE		offsetof(struct proc, p_vmspace)
111define	P_FLAG			offsetof(struct proc, p_flag)
112
113define	P_SYSTEM		P_SYSTEM
114
115define	M_DATA			offsetof(struct mbuf, m_data)
116define	M_LEN			offsetof(struct mbuf, m_len)
117define	M_NEXT			offsetof(struct mbuf, m_next)
118
119ifdef UVM
120define	V_TRAP			offsetof(struct uvmexp, traps)
121define	V_INTR			offsetof(struct uvmexp, intrs)
122else
123define	V_TRAP			offsetof(struct vmmeter, v_trap)
124define	V_INTR			offsetof(struct vmmeter, v_intr)
125endif
126
127define	PCB_CR3			offsetof(struct pcb, pcb_cr3)
128define	PCB_EBP			offsetof(struct pcb, pcb_ebp)
129define	PCB_ESP			offsetof(struct pcb, pcb_esp)
130define	PCB_FS			offsetof(struct pcb, pcb_fs)
131define	PCB_GS			offsetof(struct pcb, pcb_gs)
132define	PCB_CR0			offsetof(struct pcb, pcb_cr0)
133define	PCB_LDT_SEL		offsetof(struct pcb, pcb_ldt_sel)
134define	PCB_TSS_SEL		offsetof(struct pcb, pcb_tss_sel)
135define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
136
137define	TF_CS			offsetof(struct trapframe, tf_cs)
138define	TF_EIP			offsetof(struct trapframe, tf_eip)
139define	TF_ERR			offsetof(struct trapframe, tf_err)
140define	TF_TRAPNO		offsetof(struct trapframe, tf_trapno)
141define	TF_EFLAGS		offsetof(struct trapframe, tf_eflags)
142
143define	FRAMESIZE		sizeof(struct trapframe)
144
145define	SIGF_HANDLER		offsetof(struct sigframe, sf_handler)
146define	SIGF_SC			offsetof(struct sigframe, sf_sc)
147define	SC_FS			offsetof(struct sigcontext, sc_fs)
148define	SC_GS			offsetof(struct sigcontext, sc_gs)
149define	SC_EFLAGS		offsetof(struct sigcontext, sc_eflags)
150
151ifdef COMPAT_SVR4
152define	SVR4_SIGF_HANDLER	offsetof(struct svr4_sigframe, sf_handler)
153define	SVR4_SIGF_UC		offsetof(struct svr4_sigframe, sf_uc)
154define	SVR4_UC_FS		offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_FS])
155define	SVR4_UC_GS		offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_GS])
156define	SVR4_UC_EFLAGS		offsetof(struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_EFL])
157endif
158
159ifdef COMPAT_LINUX
160define	LINUX_SIGF_HANDLER	offsetof(struct linux_sigframe, sf_handler)
161define	LINUX_SIGF_SC		offsetof(struct linux_sigframe, sf_sc)
162define	LINUX_SC_FS		offsetof(struct linux_sigcontext, sc_fs)
163define	LINUX_SC_GS		offsetof(struct linux_sigcontext, sc_gs)
164define	LINUX_SC_EFLAGS		offsetof(struct linux_sigcontext, sc_eflags)
165endif
166
167ifdef COMPAT_FREEBSD
168define	FREEBSD_SIGF_HANDLER	offsetof(struct freebsd_sigframe, sf_handler)
169define	FREEBSD_SIGF_SC		offsetof(struct freebsd_sigframe, sf_sc)
170endif
171
172if NISA > 0
173define	IH_FUN			offsetof(struct intrhand, ih_fun)
174define	IH_ARG			offsetof(struct intrhand, ih_arg)
175define	IH_COUNT		offsetof(struct intrhand, ih_count)
176define	IH_NEXT			offsetof(struct intrhand, ih_next)
177endif
178
179if NAPM > 0
180define	APM_CODE32		offsetof(struct apm_connect_info, apm_code32_seg_base)
181define	APM_CODE16		offsetof(struct apm_connect_info, apm_code16_seg_base)
182define	APM_DATA		offsetof(struct apm_connect_info, apm_data_seg_base)
183define	APM_CODE32_LEN		offsetof(struct apm_connect_info, apm_code32_seg_len)
184define	APM_DATA_LEN		offsetof(struct apm_connect_info, apm_data_seg_len)
185define	APM_ENTRY		offsetof(struct apm_connect_info, apm_entrypt)
186define	APM_DETAIL		offsetof(struct apm_connect_info, apm_detail)
187define	APM_SIZE		sizeof(struct apm_connect_info)
188define	BIOSCALLREG_AX		offsetof(struct bioscallregs, ax)
189define	BIOSCALLREG_BX		offsetof(struct bioscallregs, bx)
190define	BIOSCALLREG_CX		offsetof(struct bioscallregs, cx)
191define	BIOSCALLREG_DX		offsetof(struct bioscallregs, dx)
192define	BIOSCALLREG_SI		offsetof(struct bioscallregs, si)
193define	BIOSCALLREG_DI		offsetof(struct bioscallregs, di)
194define	BIOSCALLREG_FLAGS	offsetof(struct bioscallregs, flags)
195endif
196