1#	$NetBSD: genassym.cf,v 1.23 2024/01/15 19:28:06 thorpej 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
34include <sys/param.h>
35include <sys/buf.h>
36include <sys/proc.h>
37include <sys/mbuf.h>
38include <sys/msgbuf.h>
39include <sys/syscall.h>
40include <sys/device.h>
41include <sys/intr.h>
42
43include <uvm/uvm_extern.h>
44
45include <machine/cpu.h>
46include <machine/fcode.h>
47include <machine/psl.h>
48include <machine/pcb.h>
49include <machine/pte.h>
50
51# values for mmutype
52define	MMU_68040		MMU_68040
53define	MMU_68030		MMU_68030
54define	MMU_HP			MMU_HP
55define	MMU_68851		MMU_68851
56
57# MMU configuration options
58define	M68K_MMU_MOTOROLA	1
59
60# values for cputype
61define	CPU_68020		CPU_68020
62define	CPU_68030		CPU_68030
63define	CPU_68040		CPU_68040
64
65# CPU configuration options
66ifdef M68020
67define	M68020			1
68endif
69ifdef M68030
70define	M68030			1
71endif
72ifdef M68040
73define	M68040			1
74endif
75
76# values for fputype
77define	FPU_68881		FPU_68881
78define	FPU_68040		FPU_68040
79
80# values for ectype
81define	EC_PHYS			EC_PHYS
82define	EC_NONE			EC_NONE
83define	EC_VIRT			EC_VIRT
84
85# general constants
86define	KERNBASE		KERNBASE
87define	UPAGES			UPAGES
88define	USPACE			USPACE
89define	PAGE_SIZE		PAGE_SIZE
90define	PGSHIFT			PGSHIFT
91define	USRSTACK		USRSTACK
92
93# MMU configuration constants (from pmap.h)
94export	MMU51_SRP_BITS
95export	MMU51_CRP_BITS
96export	MMU51_TCR_BITS
97export	MMU40_TCR_BITS
98
99# lwp & proc fields and values
100define	L_PCB			offsetof(struct lwp, l_addr)
101define	L_PROC			offsetof(struct lwp, l_proc)
102define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
103define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
104define	P_FLAG			offsetof(struct proc, p_flag)
105define	P_RASLIST		offsetof(struct proc, p_raslist)
106define	P_VMSPACE		offsetof(struct proc, p_vmspace)
107
108# event counter
109define	EVCNT_COUNT		offsetof(struct evcnt, ev_count)
110
111# interrupt/fault metering
112define	CI_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
113define	CLOCK_INTRCNT		((sizeof(struct evcnt)*6) + offsetof(struct evcnt, ev_count32))
114define	NMI_INTRCNT		((sizeof(struct evcnt)*7) + offsetof(struct evcnt, ev_count32))
115
116# PSL values (should just include psl.h?)
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# magic
131define	FC_USERD		FC_USERD
132define	CACHE_ON		CACHE_ON
133define	CACHE_OFF		CACHE_OFF
134define	CACHE_CLR		CACHE_CLR
135define	IC_CLEAR		IC_CLEAR
136define	DC_CLEAR		DC_CLEAR
137
138# pte/ste bits
139define	PG_V			PG_V
140define	PG_NV			PG_NV
141define	PG_RO			PG_RO
142define	PG_RW			PG_RW
143define	PG_CI			PG_CI
144define	PG_PROT			PG_PROT
145define	PG_FRAME		PG_FRAME
146define	SG_V			SG_V
147define	SG_NV			SG_NV
148define	SG_RW			SG_RW
149define	SG_FRAME		SG_FRAME
150define	SG_ISHIFT		SG_ISHIFT
151
152# pcb fields
153define	PCB_PS			offsetof(struct pcb, pcb_ps)
154define	PCB_USP			offsetof(struct pcb, pcb_usp)
155define	PCB_REGS		offsetof(struct pcb, pcb_regs)
156define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
157define	PCB_FPCTX		offsetof(struct pcb, pcb_fpregs)
158define	SIZEOF_PCB		sizeof(struct pcb)
159
160# frame offsets
161define	TF_PC			offsetof(struct frame, f_pc)
162
163# exception frame offset/sizes
164define	FR_SP			offsetof(struct frame, f_regs[15])
165define	FR_HW			offsetof(struct frame, f_sr)
166define	FR_ADJ			offsetof(struct frame, f_stackadj)
167define	FR_SIZE			sizeof(struct trapframe)
168
169# FP frame offsets
170define	FPF_REGS		offsetof(struct fpframe, fpf_regs[0])
171define	FPF_FPCR		offsetof(struct fpframe, fpf_fpcr)
172define	FPF_FPSR		offsetof(struct fpframe, fpf_fpsr)
173define	FPF_FPI			offsetof(struct fpframe, fpf_fpiar)
174
175# system calls
176define	SYS_exit		SYS_exit
177define	SYS_execve		SYS_execve
178define	SYS_compat_16___sigreturn14	SYS_compat_16___sigreturn14
179define	SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13
180
181# errno
182define	EFAULT			EFAULT
183define	ENAMETOOLONG		ENAMETOOLONG
184