1# $NetBSD: genassym.cf,v 1.19 2011/01/14 02:06:27 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 34ifdef _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_68030 MMU_68030 59define MMU_68851 MMU_68851 60define MMU_68040 MMU_68040 61 62# values for cputype 63define CPU_68020 CPU_68020 64define CPU_68030 CPU_68030 65define CPU_68040 CPU_68040 66 67# CPU configuration options 68ifdef M68020 69define M68020 1 70endif 71ifdef M68030 72define M68030 1 73endif 74ifdef M68040 75define M68040 1 76endif 77 78# values for fputype 79define FPU_NONE FPU_NONE 80define FPU_68881 FPU_68881 81define FPU_68882 FPU_68882 82define FPU_68040 FPU_68040 83 84# values for ectype 85define EC_PHYS EC_PHYS 86define EC_NONE EC_NONE 87define EC_VIRT EC_VIRT 88 89# general constants 90define UPAGES UPAGES 91define USPACE USPACE 92define PAGE_SIZE PAGE_SIZE 93define PGSHIFT PGSHIFT 94define USRSTACK USRSTACK 95 96# lwp & proc fields and values 97define L_PCB offsetof(struct lwp, l_addr) 98define L_PRIORITY offsetof(struct lwp, l_priority) 99define L_STAT offsetof(struct lwp, l_stat) 100define L_WCHAN offsetof(struct lwp, l_wchan) 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# lwp fields and values 109 110define LSSLEEP LSSLEEP 111define LSRUN LSRUN 112define LSONPROC LSONPROC 113 114# interrupt/fault metering 115define CI_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr) 116 117define T_BUSERR T_BUSERR 118define T_ADDRERR T_ADDRERR 119define T_ILLINST T_ILLINST 120define T_ZERODIV T_ZERODIV 121define T_CHKINST T_CHKINST 122define T_TRAPVINST T_TRAPVINST 123define T_PRIVINST T_PRIVINST 124define T_TRACE T_TRACE 125define T_MMUFLT T_MMUFLT 126define T_SSIR T_SSIR 127define T_FMTERR T_FMTERR 128define T_COPERR T_COPERR 129define T_FPERR T_FPERR 130define T_ASTFLT T_ASTFLT 131define T_TRAP15 T_TRAP15 132define T_FPEMULI T_FPEMULI 133define T_FPEMULD T_FPEMULD 134 135# PSL values (should just include psl.h?) 136define PSL_S PSL_S 137define PSL_IPL7 PSL_IPL7 138define PSL_LOWIPL PSL_LOWIPL 139define PSL_HIGHIPL PSL_HIGHIPL 140define PSL_USER PSL_USER 141define PSL_TS PSL_T | PSL_S 142define SPL1 PSL_S | PSL_IPL1 143define SPL2 PSL_S | PSL_IPL2 144define SPL3 PSL_S | PSL_IPL3 145define SPL4 PSL_S | PSL_IPL4 146define SPL5 PSL_S | PSL_IPL5 147define SPL6 PSL_S | PSL_IPL6 148 149# magic 150define FC_USERD FC_USERD 151define FC_SUPERD FC_SUPERD 152define CACHE_ON CACHE_ON 153define CACHE_OFF CACHE_OFF 154define CACHE_CLR CACHE_CLR 155define IC_CLEAR IC_CLEAR 156define DC_CLEAR DC_CLEAR 157 158# pte/ste bits 159define PG_V PG_V 160define PG_NV PG_NV 161define PG_RO PG_RO 162define PG_RW PG_RW 163define PG_CI PG_CI 164define PG_PROT PG_PROT 165define PG_FRAME PG_FRAME 166define SG_V SG_V 167define SG_NV SG_NV 168define SG_RW SG_RW 169define SG_FRAME SG_FRAME 170define SG_ISHIFT SG_ISHIFT 171 172# pcb fields 173define PCB_PS offsetof(struct pcb, pcb_ps) 174define PCB_USP offsetof(struct pcb, pcb_usp) 175define PCB_REGS offsetof(struct pcb, pcb_regs) 176define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 177define PCB_FPCTX offsetof(struct pcb, pcb_fpregs) 178define SIZEOF_PCB sizeof(struct pcb) 179 180# frame offsets 181define TF_PC offsetof(struct frame, f_pc) 182 183# exception frame offset/sizes 184define FR_SP offsetof(struct frame, f_regs[15]) 185define FR_HW offsetof(struct frame, f_sr) 186define FR_ADJ offsetof(struct frame, f_stackadj) 187define FR_SIZE sizeof(struct trapframe) 188 189# FP frame offsets 190define FPF_REGS offsetof(struct fpframe, fpf_regs[0]) 191define FPF_FPCR offsetof(struct fpframe, fpf_fpcr) 192 193# system calls 194define SYS_exit SYS_exit 195define SYS_execve SYS_execve 196define SYS_compat_16___sigreturn14 SYS_compat_16___sigreturn14 197define SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13 198 199# errno 200define EFAULT EFAULT 201define ENAMETOOLONG ENAMETOOLONG 202 203# SVR4 binary compatibility 204ifdef COMPAT_SVR4 205define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler) 206define SVR4_SIGF_UC offsetof(struct svr4_sigframe, sf_uc) 207define SVR4_SYS_context SVR4_SYS_context 208define SVR4_SYS_exit SVR4_SYS_exit 209define SVR4_SETCONTEXT SVR4_SETCONTEXT 210endif 211