1#	$NetBSD: genassym.cf,v 1.39 2024/01/09 04:16:23 thorpej Exp $
2
3#-
4# Copyright (c) 1997 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7#  This code is derived from software contributed to The NetBSD Foundation
8#  by Leo Weppelman.
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#
19#  THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20#  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21#  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22#  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23#  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29#  POSSIBILITY OF SUCH DAMAGE.
30#
31
32ifdef _KERNEL_OPT
33include "opt_mbtype.h"
34endif
35
36include <sys/param.h>
37include <sys/buf.h>
38include <sys/proc.h>
39include <sys/mbuf.h>
40include <sys/msgbuf.h>
41include <sys/syscall.h>
42
43include <uvm/uvm_extern.h>
44
45include <machine/cpu.h>
46include <machine/fcode.h>
47include <machine/trap.h>
48include <machine/psl.h>
49include <machine/pcb.h>
50include <machine/vmparam.h>
51include <machine/pte.h>
52include <machine/iomap.h>
53include <machine/scu.h>
54
55define  _XXX_CIRCUMVENT_BUG	1
56
57# CPU options
58ifdef M68020
59define	M68020			1
60endif
61ifdef M68030
62define	M68030			1
63endif
64ifdef M68040
65define	M68040			1
66endif
67ifdef M68060
68define	M68060			1
69endif
70
71# MMU configuration constants (from pmap.h)
72export	MMU51_SRP_BITS
73export	MMU51_CRP_BITS
74export	MMU51_TCR_BITS
75export	MMU40_TCR_BITS
76
77define	M68K_MMU_MOTOROLA	1
78
79# lwp & proc fields and values
80define	L_PCB			offsetof(struct lwp, l_addr)
81define	L_PROC			offsetof(struct lwp, l_proc)
82define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
83define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
84define	P_FLAG			offsetof(struct proc, p_flag)
85define	P_RASLIST		offsetof(struct proc, p_raslist)
86define	P_VMSPACE		offsetof(struct proc, p_vmspace)
87
88# interrupt/fault metering
89define	CI_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
90
91# general constants
92define	UPAGES			UPAGES
93define	USPACE			USPACE
94define	PAGE_SIZE		PAGE_SIZE
95define	PGSHIFT			PGSHIFT
96define	USRSTACK		USRSTACK
97
98define	T_BUSERR		T_BUSERR
99define	T_ADDRERR		T_ADDRERR
100define	T_ILLINST		T_ILLINST
101define	T_ZERODIV		T_ZERODIV
102define	T_CHKINST		T_CHKINST
103define	T_TRAPVINST		T_TRAPVINST
104define	T_PRIVINST		T_PRIVINST
105define	T_TRACE			T_TRACE
106define	T_MMUFLT		T_MMUFLT
107define	T_SSIR			T_SSIR
108define	T_FMTERR		T_FMTERR
109define	T_COPERR		T_COPERR
110define	T_FPERR			T_FPERR
111define	T_ASTFLT		T_ASTFLT
112define	T_TRAP15		T_TRAP15
113define	T_FPEMULI		T_FPEMULI
114define	T_FPEMULD		T_FPEMULD
115
116# PSL values
117define	PSL_S			PSL_S
118define	PSL_IPL7		PSL_IPL7
119define	PSL_LOWIPL		PSL_LOWIPL
120define	PSL_HIGHIPL		PSL_HIGHIPL
121define	PSL_USER		PSL_USER
122define	PSL_TS			PSL_T | PSL_S
123define	SPL1			PSL_S | PSL_IPL1
124define	SPL2			PSL_S | PSL_IPL2
125define	SPL3			PSL_S | PSL_IPL3
126define	SPL4			PSL_S | PSL_IPL4
127define	SPL5			PSL_S | PSL_IPL5
128define	SPL6			PSL_S | PSL_IPL6
129
130# Various MMU/cache related constants
131define	FC_USERD		FC_USERD
132define	FC_SUPERD		FC_SUPERD
133define	CACHE_ON		CACHE_ON
134define	CACHE_OFF		CACHE_OFF
135define	CACHE_CLR		CACHE_CLR
136define	IC_CLEAR		IC_CLEAR
137define	DC_CLEAR		DC_CLEAR
138define	CACHE40_ON		CACHE40_ON
139define	CACHE40_OFF		CACHE40_OFF
140define	CACHE60_ON		CACHE60_ON
141define	IC60_CABC		IC60_CABC
142define	IC60_CUBC		IC60_CUBC
143
144# pte/ste bits
145define	PG_V			PG_V
146define	PG_NV			PG_NV
147define	PG_RO			PG_RO
148define	PG_RW			PG_RW
149define	PG_CI			PG_CI
150define	PG_PROT			PG_PROT
151define	PG_FRAME		PG_FRAME
152define	SG_V			SG_V
153define	SG_NV			SG_NV
154define	SG_RW			SG_RW
155define	SG_FRAME		SG_FRAME
156
157# pcb fields
158define  PCB_FLAGS		offsetof(struct pcb, pcb_flags)
159define	PCB_PS			offsetof(struct pcb, pcb_ps)
160define	PCB_USP			offsetof(struct pcb, pcb_usp)
161define	PCB_REGS		offsetof(struct pcb, pcb_regs)
162define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
163define	PCB_FPCTX		offsetof(struct pcb, pcb_fpregs)
164define	SIZEOF_PCB		sizeof(struct pcb)
165
166# frame offsets
167define	TF_PC			offsetof(struct frame, f_pc)
168
169# exception frame offset/sizes
170define	FR_SP			offsetof(struct frame, f_regs[15])
171define	FR_HW			offsetof(struct frame, f_sr)
172define	FR_ADJ			offsetof(struct frame, f_stackadj)
173define	FR_SIZE			sizeof(struct trapframe)
174define	SP			SP
175
176# FP frame offsets
177define	FPF_REGS		offsetof(struct fpframe, fpf_regs[0])
178define	FPF_FPCR		offsetof(struct fpframe, fpf_fpcr)
179define	FPF_FPSR		offsetof(struct fpframe, fpf_fpsr)
180define	FPF_FPI			offsetof(struct fpframe, fpf_fpiar)
181
182# system calls
183define	SYS_exit		SYS_exit
184define	SYS_execve		SYS_execve
185define	SYS_compat_16___sigreturn14	SYS_compat_16___sigreturn14
186define	SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13
187
188# processor type from loader
189define	ATARI_68020		ATARI_68020
190define	ATARI_68030		ATARI_68030
191define	ATARI_68040		ATARI_68040
192define	ATARI_68060		ATARI_68060
193
194# values for mmutype
195define	MMU_68030		MMU_68030
196define	MMU_68851		MMU_68851
197define	MMU_68040		MMU_68040
198
199# values for cputype
200define	CPU_68020		CPU_68020
201define	CPU_68030		CPU_68030
202define	CPU_68040		CPU_68040
203define	CPU_68060		CPU_68060
204
205# values for fputype
206define	FPU_68881		FPU_68881
207define	FPU_68882		FPU_68882
208define	FPU_68040		FPU_68040
209define	FPU_68060		FPU_68060
210
211ifdef _ATARIHW_
212# AD_SCU definition needs this...
213quote #define stio_addr		0
214
215define	SCU_SOFTINT		AD_SCU + offsetof(struct scu, sys_int)
216define	SCU_SYSMASK		AD_SCU + offsetof(struct scu, sys_mask)
217endif
218