1# $NetBSD: genassym.cf,v 1.26 2011/01/14 02:06:29 rmind 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 34if defined(_KERNEL_OPT) 35include "opt_compat_svr4.h" 36endif 37 38include <sys/param.h> 39include <sys/buf.h> 40include <sys/proc.h> 41include <sys/mbuf.h> 42include <sys/msgbuf.h> 43include <sys/syscall.h> 44 45include <uvm/uvm_extern.h> 46 47ifdef COMPAT_SVR4 48include <compat/svr4/svr4_syscall.h> 49include <compat/svr4/svr4_ucontext.h> 50endif 51 52include <machine/cpu.h> 53include <machine/psl.h> 54include <machine/pcb.h> 55include <machine/pte.h> 56 57# values for mmutype 58define MMU_68060 MMU_68060 59define MMU_68040 MMU_68040 60define MMU_68030 MMU_68030 61define MMU_68851 MMU_68851 62 63# MMU configuration options 64ifdef M68K_MMU_HP 65define M68K_MMU_HP 1 66endif 67ifdef M68K_MMU_MOTOROLA 68define M68K_MMU_MOTOROLA 1 69endif 70 71# values for cputype 72define CPU_68020 CPU_68020 73define CPU_68030 CPU_68030 74define CPU_68040 CPU_68040 75 76# CPU configuration options 77ifdef M68020 78define M68020 1 79endif 80ifdef M68030 81define M68030 1 82endif 83ifdef M68040 84define M68040 1 85endif 86ifdef M68060 87define M68060 1 88endif 89 90define CPU_68060 CPU_68060 91 92# values for fputype 93define FPU_68881 FPU_68881 94define FPU_68882 FPU_68882 95define FPU_68040 FPU_68040 96 97# values for machineid 98# @@@ should probably put NeXT values here 99 100# values for ectype 101define EC_PHYS EC_PHYS 102define EC_NONE EC_NONE 103define EC_VIRT EC_VIRT 104 105# Cache type configuration options 106ifdef CACHE_HAVE_VAC 107define CACHE_HAVE_VAC 1 108endif 109ifdef CACHE_HAVE_PAC 110define CACHE_HAVE_PAC 1 111endif 112 113# general constants 114define UPAGES UPAGES 115define USPACE USPACE 116define PAGE_SIZE PAGE_SIZE 117define PGSHIFT PGSHIFT 118define USRSTACK USRSTACK 119 120define NEXT_RAMBASE NEXT_RAMBASE 121 122# lwp & proc fields and values 123define L_PCB offsetof(struct lwp, l_addr) 124define L_PRIORITY offsetof(struct lwp, l_priority) 125define L_STAT offsetof(struct lwp, l_stat) 126define L_WCHAN offsetof(struct lwp, l_wchan) 127define L_PROC offsetof(struct lwp, l_proc) 128define L_MD_REGS offsetof(struct lwp, l_md.md_regs) 129define L_MD_FLAGS offsetof(struct lwp, l_md.md_flags) 130define P_FLAG offsetof(struct proc, p_flag) 131define P_RASLIST offsetof(struct proc, p_raslist) 132define P_VMSPACE offsetof(struct proc, p_vmspace) 133 134# lwp fields and values 135 136define LSSLEEP LSSLEEP 137define LSRUN LSRUN 138define LSONPROC LSONPROC 139 140# interrupt/fault metering 141define CI_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr) 142 143# PSL values (should just include psl.h?) 144define PSL_S PSL_S 145define PSL_IPL7 PSL_IPL7 146define PSL_LOWIPL PSL_LOWIPL 147define PSL_HIGHIPL PSL_HIGHIPL 148define PSL_USER PSL_USER 149define PSL_TS PSL_T | PSL_S 150define SPL1 PSL_S | PSL_IPL1 151define SPL2 PSL_S | PSL_IPL2 152define SPL3 PSL_S | PSL_IPL3 153define SPL4 PSL_S | PSL_IPL4 154define SPL5 PSL_S | PSL_IPL5 155define SPL6 PSL_S | PSL_IPL6 156 157# magic 158define FC_USERD FC_USERD 159define INTIOBASE INTIOBASE 160define INTIOTOP INTIOTOP 161define IIOMAPSIZE IIOMAPSIZE 162define MONOBASE MONOBASE 163define MONOTOP MONOTOP 164define COLORBASE COLORBASE 165define COLORTOP COLORTOP 166define CACHE_ON CACHE_ON 167define CACHE_OFF CACHE_OFF 168define CACHE_CLR CACHE_CLR 169define IC_CLEAR IC_CLEAR 170define DC_CLEAR DC_CLEAR 171 172# pte/ste bits 173define PG_V PG_V 174define PG_NV PG_NV 175define PG_RO PG_RO 176define PG_RW PG_RW 177define PG_CI PG_CI 178define PG_PROT PG_PROT 179define PG_FRAME PG_FRAME 180define SG_V SG_V 181define SG_NV SG_NV 182define SG_RW SG_RW 183define SG_FRAME SG_FRAME 184define SG_ISHIFT SG_ISHIFT 185 186# pcb fields 187define PCB_PS offsetof(struct pcb, pcb_ps) 188define PCB_USP offsetof(struct pcb, pcb_usp) 189define PCB_REGS offsetof(struct pcb, pcb_regs) 190define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 191define PCB_FPCTX offsetof(struct pcb, pcb_fpregs) 192define SIZEOF_PCB sizeof(struct pcb) 193 194# frame offsets 195define TF_PC offsetof(struct frame, f_pc) 196 197# exception frame offset/sizes 198define FR_SP offsetof(struct frame, f_regs[15]) 199define FR_HW offsetof(struct frame, f_sr) 200define FR_ADJ offsetof(struct frame, f_stackadj) 201define FR_SIZE sizeof(struct trapframe) 202 203# FP frame offsets 204define FPF_REGS offsetof(struct fpframe, fpf_regs[0]) 205define FPF_FPCR offsetof(struct fpframe, fpf_fpcr) 206 207# system calls 208define SYS_exit SYS_exit 209define SYS_execve SYS_execve 210define SYS_compat_16___sigreturn14 SYS_compat_16___sigreturn14 211define SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13 212 213# errno 214define EFAULT EFAULT 215define ENAMETOOLONG ENAMETOOLONG 216 217# SVR4 binary compatibility 218ifdef COMPAT_SVR4 219define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler) 220define SVR4_SIGF_UC offsetof(struct svr4_sigframe, sf_uc) 221define SVR4_SYS_context SVR4_SYS_context 222define SVR4_SYS_exit SVR4_SYS_exit 223define SVR4_SETCONTEXT SVR4_SETCONTEXT 224endif 225