genassym.cf revision 1.20 1 # $NetBSD: genassym.cf,v 1.20 2011/11/05 15:37:17 tsutsui Exp $
2
3 #
4 # Copyright (c) 1982, 1990, 1993
5 # The Regents of the University of California. All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. Neither the name of the University nor the names of its contributors
16 # may be used to endorse or promote products derived from this software
17 # without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 # SUCH DAMAGE.
30 #
31 # @(#)genassym.c 8.3 (Berkeley) 1/4/94
32 #
33
34 ifdef _KERNEL_OPT
35 include "opt_compat_svr4.h"
36 endif
37
38 include <sys/param.h>
39 include <sys/buf.h>
40 include <sys/proc.h>
41 include <sys/mbuf.h>
42 include <sys/msgbuf.h>
43 include <sys/syscall.h>
44
45 include <uvm/uvm_extern.h>
46
47 ifdef COMPAT_SVR4
48 include <compat/svr4/svr4_syscall.h>
49 include <compat/svr4/svr4_ucontext.h>
50 endif
51
52 include <machine/cpu.h>
53 include <machine/psl.h>
54 include <machine/pcb.h>
55 include <machine/pte.h>
56
57 # values for mmutype
58 define MMU_68030 MMU_68030
59 define MMU_68851 MMU_68851
60 define MMU_68040 MMU_68040
61
62 # values for cputype
63 define CPU_68020 CPU_68020
64 define CPU_68030 CPU_68030
65 define CPU_68040 CPU_68040
66
67 # CPU configuration options
68 ifdef M68020
69 define M68020 1
70 endif
71 ifdef M68030
72 define M68030 1
73 endif
74 ifdef M68040
75 define M68040 1
76 endif
77
78 # values for fputype
79 define FPU_NONE FPU_NONE
80 define FPU_68881 FPU_68881
81 define FPU_68882 FPU_68882
82 define FPU_68040 FPU_68040
83
84 # values for ectype
85 define EC_PHYS EC_PHYS
86 define EC_NONE EC_NONE
87 define EC_VIRT EC_VIRT
88
89 # general constants
90 define UPAGES UPAGES
91 define USPACE USPACE
92 define PAGE_SIZE PAGE_SIZE
93 define PGSHIFT PGSHIFT
94 define USRSTACK USRSTACK
95
96 # lwp & proc fields and values
97 define L_PCB offsetof(struct lwp, l_addr)
98 define L_PRIORITY offsetof(struct lwp, l_priority)
99 define L_STAT offsetof(struct lwp, l_stat)
100 define L_WCHAN offsetof(struct lwp, l_wchan)
101 define L_PROC offsetof(struct lwp, l_proc)
102 define L_MD_REGS offsetof(struct lwp, l_md.md_regs)
103 define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags)
104 define P_FLAG offsetof(struct proc, p_flag)
105 define P_RASLIST offsetof(struct proc, p_raslist)
106 define P_VMSPACE offsetof(struct proc, p_vmspace)
107
108 # lwp fields and values
109
110 define LSSLEEP LSSLEEP
111 define LSRUN LSRUN
112 define LSONPROC LSONPROC
113
114 # interrupt/fault metering
115 define CI_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr)
116
117 define T_BUSERR T_BUSERR
118 define T_ADDRERR T_ADDRERR
119 define T_ILLINST T_ILLINST
120 define T_ZERODIV T_ZERODIV
121 define T_CHKINST T_CHKINST
122 define T_TRAPVINST T_TRAPVINST
123 define T_PRIVINST T_PRIVINST
124 define T_TRACE T_TRACE
125 define T_MMUFLT T_MMUFLT
126 define T_SSIR T_SSIR
127 define T_FMTERR T_FMTERR
128 define T_COPERR T_COPERR
129 define T_FPERR T_FPERR
130 define T_ASTFLT T_ASTFLT
131 define T_TRAP15 T_TRAP15
132 define T_FPEMULI T_FPEMULI
133 define T_FPEMULD T_FPEMULD
134
135 # PSL values (should just include psl.h?)
136 define PSL_S PSL_S
137 define PSL_IPL7 PSL_IPL7
138 define PSL_LOWIPL PSL_LOWIPL
139 define PSL_HIGHIPL PSL_HIGHIPL
140 define PSL_USER PSL_USER
141 define PSL_TS PSL_T | PSL_S
142 define SPL1 PSL_S | PSL_IPL1
143 define SPL2 PSL_S | PSL_IPL2
144 define SPL3 PSL_S | PSL_IPL3
145 define SPL4 PSL_S | PSL_IPL4
146 define SPL5 PSL_S | PSL_IPL5
147 define SPL6 PSL_S | PSL_IPL6
148
149 # magic
150 define FC_USERD FC_USERD
151 define FC_SUPERD FC_SUPERD
152 define DC_FREEZE DC_FREEZE
153 define CACHE40_ON CACHE40_ON
154 define CACHE_ON CACHE_ON
155 define CACHE_OFF CACHE_OFF
156 define CACHE_CLR CACHE_CLR
157 define IC_CLEAR IC_CLEAR
158 define DC_CLEAR DC_CLEAR
159
160 # pte/ste bits
161 define PG_V PG_V
162 define PG_NV PG_NV
163 define PG_RO PG_RO
164 define PG_RW PG_RW
165 define PG_CI PG_CI
166 define PG_PROT PG_PROT
167 define PG_FRAME PG_FRAME
168 define SG_V SG_V
169 define SG_NV SG_NV
170 define SG_RW SG_RW
171 define SG_FRAME SG_FRAME
172 define SG_ISHIFT SG_ISHIFT
173
174 # pcb fields
175 define PCB_PS offsetof(struct pcb, pcb_ps)
176 define PCB_USP offsetof(struct pcb, pcb_usp)
177 define PCB_REGS offsetof(struct pcb, pcb_regs)
178 define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
179 define PCB_FPCTX offsetof(struct pcb, pcb_fpregs)
180 define SIZEOF_PCB sizeof(struct pcb)
181
182 # frame offsets
183 define TF_PC offsetof(struct frame, f_pc)
184
185 # exception frame offset/sizes
186 define FR_SP offsetof(struct frame, f_regs[15])
187 define FR_HW offsetof(struct frame, f_sr)
188 define FR_ADJ offsetof(struct frame, f_stackadj)
189 define FR_SIZE sizeof(struct trapframe)
190
191 # FP frame offsets
192 define FPF_REGS offsetof(struct fpframe, fpf_regs[0])
193 define FPF_FPCR offsetof(struct fpframe, fpf_fpcr)
194
195 # system calls
196 define SYS_exit SYS_exit
197 define SYS_execve SYS_execve
198 define SYS_compat_16___sigreturn14 SYS_compat_16___sigreturn14
199 define SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13
200
201 # errno
202 define EFAULT EFAULT
203 define ENAMETOOLONG ENAMETOOLONG
204
205 # SVR4 binary compatibility
206 ifdef COMPAT_SVR4
207 define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler)
208 define SVR4_SIGF_UC offsetof(struct svr4_sigframe, sf_uc)
209 define SVR4_SYS_context SVR4_SYS_context
210 define SVR4_SYS_exit SVR4_SYS_exit
211 define SVR4_SETCONTEXT SVR4_SETCONTEXT
212 endif
213