xref: /netbsd/sys/arch/alpha/alpha/genassym.cf (revision c4a72b64)
1# $NetBSD: genassym.cf,v 1.6 2002/09/26 18:54:30 thorpej Exp $
2
3#
4# Copyright (c) 1994, 1995 Gordon W. Ross
5# Copyright (c) 1993 Adam Glass
6# Copyright (c) 1982, 1990, 1993
7#	The Regents of the University of California.  All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
12# 1. Redistributions of source code must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright
15#    notice, this list of conditions and the following disclaimer in the
16#    documentation and/or other materials provided with the distribution.
17# 3. All advertising materials mentioning features or use of this software
18#    must display the following acknowledgement:
19#	This product includes software developed by the University of
20#	California, Berkeley and its contributors.
21# 4. Neither the name of the University nor the names of its contributors
22#    may be used to endorse or promote products derived from this software
23#    without specific prior written permission.
24#
25# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35# SUCH DAMAGE.
36#
37#	from: @(#)genassym.c	8.3 (Berkeley) 1/4/94
38#
39
40include <sys/param.h>
41include <sys/buf.h>
42include <sys/proc.h>
43include <sys/sched.h>
44include <sys/mbuf.h>
45include <sys/msgbuf.h>
46include <sys/user.h>
47include <sys/syscall.h>
48
49include <machine/cpu.h>
50include <machine/reg.h>
51include <machine/frame.h>
52include <machine/rpb.h>
53include <machine/vmparam.h>
54
55include <uvm/uvm.h>
56include <uvm/uvm_extern.h>
57
58# general constants
59define	NBPG			NBPG
60define	PGSHIFT			PGSHIFT
61define	VM_MAX_ADDRESS		VM_MAX_ADDRESS
62
63# Register offsets, for stack frames.
64define	FRAME_V0		FRAME_V0
65define	FRAME_T0		FRAME_T0
66define	FRAME_T1		FRAME_T1
67define	FRAME_T2		FRAME_T2
68define	FRAME_T3		FRAME_T3
69define	FRAME_T4		FRAME_T4
70define	FRAME_T5		FRAME_T5
71define	FRAME_T6		FRAME_T6
72define	FRAME_T7		FRAME_T7
73define	FRAME_S0		FRAME_S0
74define	FRAME_S1		FRAME_S1
75define	FRAME_S2		FRAME_S2
76define	FRAME_S3		FRAME_S3
77define	FRAME_S4		FRAME_S4
78define	FRAME_S5		FRAME_S5
79define	FRAME_S6		FRAME_S6
80define	FRAME_A3		FRAME_A3
81define	FRAME_A4		FRAME_A4
82define	FRAME_A5		FRAME_A5
83define	FRAME_T8		FRAME_T8
84define	FRAME_T9		FRAME_T9
85define	FRAME_T10		FRAME_T10
86define	FRAME_T11		FRAME_T11
87define	FRAME_RA		FRAME_RA
88define	FRAME_T12		FRAME_T12
89define	FRAME_AT		FRAME_AT
90define	FRAME_SP		FRAME_SP
91
92define	FRAME_SW_SIZE		FRAME_SW_SIZE
93
94define	FRAME_PS		FRAME_PS
95define	FRAME_PC		FRAME_PC
96define	FRAME_GP		FRAME_GP
97define	FRAME_A0		FRAME_A0
98define	FRAME_A1		FRAME_A1
99define	FRAME_A2		FRAME_A2
100
101define	FRAME_SIZE		FRAME_SIZE
102
103# bits of the PS register
104define	ALPHA_PSL_USERMODE	ALPHA_PSL_USERMODE
105define	ALPHA_PSL_IPL_MASK	ALPHA_PSL_IPL_MASK
106define	ALPHA_PSL_IPL_0		ALPHA_PSL_IPL_0
107define	ALPHA_PSL_IPL_SOFT	ALPHA_PSL_IPL_SOFT
108define	ALPHA_PSL_IPL_HIGH	ALPHA_PSL_IPL_HIGH
109
110# pte bits
111define	ALPHA_PTE_VALID		ALPHA_PTE_VALID
112define	ALPHA_PTE_ASM		ALPHA_PTE_ASM
113define	ALPHA_PTE_KR		ALPHA_PTE_KR
114define	ALPHA_PTE_KW		ALPHA_PTE_KW
115
116# Important offsets into the proc struct & associated constants
117define	P_FORW			offsetof(struct proc, p_forw)
118define	P_BACK			offsetof(struct proc, p_back)
119define	P_ADDR			offsetof(struct proc, p_addr)
120define	P_VMSPACE		offsetof(struct proc, p_vmspace)
121define	P_STAT			offsetof(struct proc, p_stat)
122define	P_CPU			offsetof(struct proc, p_cpu)
123define	P_NRAS			offsetof(struct proc, p_nras)
124define	P_MD_FLAGS		offsetof(struct proc, p_md.md_flags)
125define	P_MD_PCBPADDR		offsetof(struct proc, p_md.md_pcbpaddr)
126define	P_MD_SYSCALL		offsetof(struct proc, p_md.md_syscall)
127define	P_MD_ASTPENDING		offsetof(struct proc, p_md.md_astpending)
128define	P_MD_TF			offsetof(struct proc, p_md.md_tf)
129define	PH_LINK			offsetof(struct prochd, ph_link)
130define	PH_RLINK		offsetof(struct prochd, ph_rlink)
131
132# Process status constants
133define	SONPROC			SONPROC
134
135# offsets needed by cpu_switch() to switch mappings.
136define	VM_MAP_PMAP		offsetof(struct vmspace, vm_map.pmap)
137define	UVM_PAGE_IDLE_ZERO	offsetof(struct uvm, page_idle_zero)
138
139# Important offsets into the user struct & associated constants
140define	UPAGES			UPAGES
141define	U_PCB			offsetof(struct user, u_pcb)
142define	U_PCB_HWPCB		offsetof(struct user, u_pcb.pcb_hw)
143define	U_PCB_HWPCB_KSP		offsetof(struct user, u_pcb.pcb_hw.apcb_ksp)
144define	U_PCB_CONTEXT		offsetof(struct user, u_pcb.pcb_context[0])
145define	U_PCB_ONFAULT		offsetof(struct user, u_pcb.pcb_onfault)
146define	U_PCB_ACCESSADDR	offsetof(struct user, u_pcb.pcb_accessaddr)
147
148# Offsets into struct fpstate, for save, restore
149define	FPREG_FPR_REGS		offsetof(struct fpreg, fpr_regs[0])
150define	FPREG_FPR_CR		offsetof(struct fpreg, fpr_cr)
151
152# Important other addresses
153define	HWRPB_ADDR		HWRPB_ADDR	/* Restart parameter block */
154define	VPTBASE			VPTBASE		/* Virtual Page Table base */
155
156# Offsets into the HWRPB.
157define	RPB_PRIMARY_CPU_ID	offsetof(struct rpb, rpb_primary_cpu_id)
158
159# Kernel entries
160define	ALPHA_KENTRY_ARITH	ALPHA_KENTRY_ARITH
161define	ALPHA_KENTRY_MM		ALPHA_KENTRY_MM
162define	ALPHA_KENTRY_IF		ALPHA_KENTRY_IF
163define	ALPHA_KENTRY_UNA	ALPHA_KENTRY_UNA
164
165# errno values
166define	ENAMETOOLONG		ENAMETOOLONG
167define	EFAULT			EFAULT
168
169# Syscalls called from sigreturn.
170define	SYS___sigreturn14	SYS___sigreturn14
171define	SYS_exit		SYS_exit
172
173# CPU info
174define	CPU_INFO_CURPROC	offsetof(struct cpu_info, ci_curproc)
175define	CPU_INFO_FPCURPROC	offsetof(struct cpu_info, ci_fpcurproc)
176define	CPU_INFO_CURPCB		offsetof(struct cpu_info, ci_curpcb)
177define	CPU_INFO_IDLE_PCB_PADDR	offsetof(struct cpu_info, ci_idle_pcb_paddr)
178define	CPU_INFO_WANT_RESCHED	offsetof(struct cpu_info, ci_want_resched)
179define	CPU_INFO_SIZEOF		sizeof(struct cpu_info)
180