Home | History | Annotate | Line # | Download | only in oea
genassym.cf revision 1.14
      1 #	$NetBSD: genassym.cf,v 1.14 2008/02/23 19:34:53 matt Exp $
      2 
      3 #
      4 # Copyright (C) 1995, 1996 Wolfgang Solfrank.
      5 # Copyright (C) 1995, 1996 TooLs GmbH.
      6 # All rights reserved.
      7 #
      8 # Redistribution and use in source and binary forms, with or without
      9 # modification, are permitted provided that the following conditions
     10 # are met:
     11 # 1. Redistributions of source code must retain the above copyright
     12 #    notice, this list of conditions and the following disclaimer.
     13 # 2. Redistributions in binary form must reproduce the above copyright
     14 #    notice, this list of conditions and the following disclaimer in the
     15 #    documentation and/or other materials provided with the distribution.
     16 # 3. All advertising materials mentioning features or use of this software
     17 #    must display the following acknowledgement:
     18 #	This product includes software developed by TooLs GmbH.
     19 # 4. The name of TooLs GmbH may not be used to endorse or promote products
     20 #    derived from this software without specific prior written permission.
     21 #
     22 # THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
     23 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25 # IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     28 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     29 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     30 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     31 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32 #
     33 
     34 include "opt_ppcarch.h"
     35 
     36 quote #define __MUTEX_PRIVATE
     37 quote #define __RWLOCK_PRIVATE
     38 
     39 include <sys/param.h>
     40 include <sys/time.h>
     41 include <sys/mutex.h>
     42 include <sys/rwlock.h>
     43 include <sys/proc.h>
     44 
     45 include <uvm/uvm_extern.h>
     46 
     47 include <machine/pcb.h>
     48 include <machine/pmap.h>
     49 
     50 include <powerpc/cpu.h>
     51 include <powerpc/oea/cpufeat.h>
     52 
     53 define	FRAMELEN	FRAMELEN
     54 define	FRAME_0		offsetof(struct trapframe, fixreg[0])
     55 define	FRAME_1		offsetof(struct trapframe, fixreg[1])
     56 define	FRAME_2		offsetof(struct trapframe, fixreg[2])
     57 define	FRAME_3		offsetof(struct trapframe, fixreg[3])
     58 define	FRAME_4		offsetof(struct trapframe, fixreg[4])
     59 define	FRAME_5		offsetof(struct trapframe, fixreg[5])
     60 define	FRAME_6		offsetof(struct trapframe, fixreg[6])
     61 define	FRAME_7		offsetof(struct trapframe, fixreg[7])
     62 define	FRAME_8		offsetof(struct trapframe, fixreg[8])
     63 define	FRAME_9		offsetof(struct trapframe, fixreg[9])
     64 define	FRAME_10	offsetof(struct trapframe, fixreg[10])
     65 define	FRAME_11	offsetof(struct trapframe, fixreg[11])
     66 define	FRAME_12	offsetof(struct trapframe, fixreg[12])
     67 define	FRAME_13	offsetof(struct trapframe, fixreg[13])
     68 define	FRAME_14	offsetof(struct trapframe, fixreg[14])
     69 define	FRAME_15	offsetof(struct trapframe, fixreg[15])
     70 define	FRAME_16	offsetof(struct trapframe, fixreg[16])
     71 define	FRAME_17	offsetof(struct trapframe, fixreg[17])
     72 define	FRAME_18	offsetof(struct trapframe, fixreg[18])
     73 define	FRAME_19	offsetof(struct trapframe, fixreg[19])
     74 define	FRAME_20	offsetof(struct trapframe, fixreg[20])
     75 define	FRAME_21	offsetof(struct trapframe, fixreg[21])
     76 define	FRAME_22	offsetof(struct trapframe, fixreg[22])
     77 define	FRAME_23	offsetof(struct trapframe, fixreg[23])
     78 define	FRAME_24	offsetof(struct trapframe, fixreg[24])
     79 define	FRAME_25	offsetof(struct trapframe, fixreg[25])
     80 define	FRAME_26	offsetof(struct trapframe, fixreg[26])
     81 define	FRAME_27	offsetof(struct trapframe, fixreg[27])
     82 define	FRAME_28	offsetof(struct trapframe, fixreg[28])
     83 define	FRAME_29	offsetof(struct trapframe, fixreg[29])
     84 define	FRAME_30	offsetof(struct trapframe, fixreg[30])
     85 define	FRAME_31	offsetof(struct trapframe, fixreg[31])
     86 define	FRAME_LR	offsetof(struct trapframe, lr)
     87 define	FRAME_CR	offsetof(struct trapframe, cr)
     88 define	FRAME_CTR	offsetof(struct trapframe, ctr)
     89 define	FRAME_XER	offsetof(struct trapframe, xer)
     90 define	FRAME_SRR0	offsetof(struct trapframe, srr0)
     91 define	FRAME_SRR1	offsetof(struct trapframe, srr1)
     92 define	FRAME_DAR	offsetof(struct trapframe, dar)
     93 define	FRAME_DSISR	offsetof(struct trapframe, dsisr)
     94 define	FRAME_EXC	offsetof(struct trapframe, exc)
     95 define	FRAME_VRSAVE	offsetof(struct trapframe, tf_xtra[TF_VRSAVE])
     96 define	FRAME_MQ	offsetof(struct trapframe, tf_xtra[TF_MQ])
     97 
     98 define	IFRAMELEN		IFRAMELEN
     99 define	IFRAME_R1		offsetof(struct intrframe, r1)
    100 define	IFRAME_SRR1		offsetof(struct intrframe, srr1)
    101 define	IFRAME_SRR0		offsetof(struct intrframe, srr0)
    102 define	IFRAME_PRI		offsetof(struct intrframe, pri)
    103 define	IFRAME_INTR_DEPTH	offsetof(struct intrframe, intrdepth)
    104 define	IFRAME_PID		offsetof(struct intrframe, pid)
    105 define	IFRAME_CTR		offsetof(struct intrframe, ctr)
    106 define	IFRAME_XER		offsetof(struct intrframe, xer)
    107 define	IFRAME_CR		offsetof(struct intrframe, cr)
    108 define	IFRAME_LR		offsetof(struct intrframe, lr)
    109 define	IFRAME_R12		offsetof(struct intrframe, r12)
    110 define	IFRAME_R11		offsetof(struct intrframe, r11)
    111 define	IFRAME_R10		offsetof(struct intrframe, r10)
    112 define	IFRAME_R9		offsetof(struct intrframe, r9)
    113 define	IFRAME_R8		offsetof(struct intrframe, r8)
    114 define	IFRAME_R7		offsetof(struct intrframe, r7)
    115 define	IFRAME_R6		offsetof(struct intrframe, r6)
    116 define	IFRAME_R5		offsetof(struct intrframe, r5)
    117 define	IFRAME_R4		offsetof(struct intrframe, r4)
    118 define	IFRAME_R3		offsetof(struct intrframe, r3)
    119 define	IFRAME_R0		offsetof(struct intrframe, r0)
    120 
    121 ifdef PPC_OEA64
    122 define	PM_STEG		offsetof(struct pmap, pm_steg_table)
    123 else
    124 define	PM_SR		offsetof(struct pmap, pm_sr[0])
    125 define	PM_USRSR	offsetof(struct pmap, pm_sr[USER_SR])
    126 define	PM_KERNELSR	offsetof(struct pmap, pm_sr[KERNEL_SR])
    127 endif
    128 
    129 define	CALLFRAMELEN	CALLFRAMELEN
    130 define	CFRAME_SP	offsetof(struct callframe, sp)
    131 define	CFRAME_LR	offsetof(struct callframe, lr)
    132 define	CFRAME_R30	offsetof(struct callframe, r30)
    133 define	CFRAME_R31	offsetof(struct callframe, r31)
    134 
    135 define	SFRAMELEN	SFRAMELEN
    136 define	SFRAME_SP	offsetof(struct switchframe, sp)
    137 define	SFRAME_LR	offsetof(struct switchframe, lr)
    138 define	SFRAME_USER_SR	offsetof(struct switchframe, user_sr)
    139 define	SFRAME_CR	offsetof(struct switchframe, cr)
    140 define	SFRAME_R2	offsetof(struct switchframe, fixreg2)
    141 define	SFRAME_R13	offsetof(struct switchframe, fixreg[0])
    142 define	SFRAME_R14	offsetof(struct switchframe, fixreg[1])
    143 define	SFRAME_R15	offsetof(struct switchframe, fixreg[2])
    144 define	SFRAME_R16	offsetof(struct switchframe, fixreg[3])
    145 define	SFRAME_R17	offsetof(struct switchframe, fixreg[4])
    146 define	SFRAME_R18	offsetof(struct switchframe, fixreg[5])
    147 define	SFRAME_R19	offsetof(struct switchframe, fixreg[6])
    148 define	SFRAME_R20	offsetof(struct switchframe, fixreg[7])
    149 define	SFRAME_R21	offsetof(struct switchframe, fixreg[8])
    150 define	SFRAME_R22	offsetof(struct switchframe, fixreg[9])
    151 define	SFRAME_R23	offsetof(struct switchframe, fixreg[10])
    152 define	SFRAME_R24	offsetof(struct switchframe, fixreg[11])
    153 define	SFRAME_R25	offsetof(struct switchframe, fixreg[12])
    154 define	SFRAME_R26	offsetof(struct switchframe, fixreg[13])
    155 define	SFRAME_R27	offsetof(struct switchframe, fixreg[14])
    156 define	SFRAME_R28	offsetof(struct switchframe, fixreg[15])
    157 define	SFRAME_R29	offsetof(struct switchframe, fixreg[16])
    158 define	SFRAME_R30	offsetof(struct switchframe, fixreg[17])
    159 define	SFRAME_R31	offsetof(struct switchframe, fixreg[18])
    160 
    161 define	PCB_PM		offsetof(struct pcb, pcb_pm)
    162 define	PCB_SP		offsetof(struct pcb, pcb_sp)
    163 define	PCB_FAULT	offsetof(struct pcb, pcb_onfault)
    164 
    165 define	L_ADDR		offsetof(struct lwp, l_addr)
    166 define	L_STAT		offsetof(struct lwp, l_stat)
    167 define	L_CPU		offsetof(struct lwp, l_cpu)
    168 define	L_PRIORITY	offsetof(struct lwp, l_priority)
    169 define	L_PROC		offsetof(struct lwp, l_proc)
    170 
    171 define	LSRUN		LSRUN
    172 define	LSONPROC	LSONPROC
    173 define	P_MD_SYSCALL	offsetof(struct proc, p_md.md_syscall)
    174 
    175 define	CI_SIZE		sizeof(struct cpu_info)
    176 define	CI_CURLWP	offsetof(struct cpu_info, ci_curlwp)
    177 define	CI_CURPCB	offsetof(struct cpu_info, ci_curpcb)
    178 define	CI_CURPM	offsetof(struct cpu_info, ci_curpm)
    179 define	CI_ASTPENDING	offsetof(struct cpu_info, ci_astpending)
    180 define	CI_WANT_RESCHED	offsetof(struct cpu_info, ci_want_resched)
    181 define	CI_CPL		offsetof(struct cpu_info, ci_cpl)
    182 define	CI_INTRDEPTH	offsetof(struct cpu_info, ci_intrdepth)
    183 define	CI_INTSTK	offsetof(struct cpu_info, ci_intstk)
    184 define	CI_TEMPSAVE	offsetof(struct cpu_info, ci_tempsave)
    185 define	CI_DDBSAVE	offsetof(struct cpu_info, ci_ddbsave)
    186 define	CI_IPKDBSAVE	offsetof(struct cpu_info, ci_ipkdbsave)
    187 define	CI_DISISAVE	offsetof(struct cpu_info, ci_disisave)
    188 define	CI_IDLESPIN	offsetof(struct cpu_info, ci_idlespin)
    189 
    190 define	CPUSAVE_R28	CPUSAVE_R28*sizeof(register_t)
    191 define	CPUSAVE_R29	CPUSAVE_R29*sizeof(register_t)
    192 define	CPUSAVE_R30	CPUSAVE_R30*sizeof(register_t)
    193 define	CPUSAVE_R31	CPUSAVE_R31*sizeof(register_t)
    194 define	CPUSAVE_DAR	CPUSAVE_DAR*sizeof(register_t)
    195 define	CPUSAVE_DSISR	CPUSAVE_DSISR*sizeof(register_t)
    196 define	CPUSAVE_SRR0	CPUSAVE_SRR0*sizeof(register_t)
    197 define	CPUSAVE_SRR1	CPUSAVE_SRR1*sizeof(register_t)
    198 
    199 define	FB_PC		offsetof(struct faultbuf, fb_pc)
    200 define	FB_SP		offsetof(struct faultbuf, fb_sp)
    201 define	FB_R2		offsetof(struct faultbuf, fb_r2)
    202 define	FB_CR		offsetof(struct faultbuf, fb_cr)
    203 define	FB_R13		offsetof(struct faultbuf, fb_fixreg[0])
    204 define	FB_R14		offsetof(struct faultbuf, fb_fixreg[1])
    205 define	FB_R15		offsetof(struct faultbuf, fb_fixreg[2])
    206 define	FB_R16		offsetof(struct faultbuf, fb_fixreg[3])
    207 define	FB_R17		offsetof(struct faultbuf, fb_fixreg[4])
    208 define	FB_R18		offsetof(struct faultbuf, fb_fixreg[5])
    209 define	FB_R19		offsetof(struct faultbuf, fb_fixreg[6])
    210 define	FB_R20		offsetof(struct faultbuf, fb_fixreg[7])
    211 define	FB_R21		offsetof(struct faultbuf, fb_fixreg[8])
    212 define	FB_R22		offsetof(struct faultbuf, fb_fixreg[9])
    213 define	FB_R23		offsetof(struct faultbuf, fb_fixreg[10])
    214 define	FB_R24		offsetof(struct faultbuf, fb_fixreg[11])
    215 define	FB_R25		offsetof(struct faultbuf, fb_fixreg[12])
    216 define	FB_R26		offsetof(struct faultbuf, fb_fixreg[13])
    217 define	FB_R27		offsetof(struct faultbuf, fb_fixreg[14])
    218 define	FB_R28		offsetof(struct faultbuf, fb_fixreg[15])
    219 define	FB_R29		offsetof(struct faultbuf, fb_fixreg[16])
    220 define	FB_R30		offsetof(struct faultbuf, fb_fixreg[17])
    221 define	FB_R31		offsetof(struct faultbuf, fb_fixreg[18])
    222 
    223 define	CACHELINESIZE	CACHELINESIZE
    224 
    225 define	CPU_CI		offsetof(struct cpu_info, ci_ci)
    226 
    227 define	OEACPU_64	OEACPU_64
    228 define	OEACPU_64_BRIDGE	OEACPU_64_BRIDGE
    229 define	OEACPU_NOBAT	OEACPU_NOBAT
    230 define	OEACPU_HIGHBAT	OEACPU_HIGHBAT
    231 define	OEACPU_601	OEACPU_601
    232 define	OEACPU_HIGHSPRG	OEACPU_HIGHSPRG
    233 define	OEACPU_ALTIVEC	OEACPU_ALTIVEC
    234 
    235 ifdef	__HAVE_MUTEX_STUBS
    236 define	__HAVE_MUTEX_STUBS	__HAVE_MUTEX_STUBS
    237 endif
    238 ifdef	__HAVE_MUTEX_SPIN_STUBS
    239 define	__HAVE_MUTEX_SPIN_STUBS	__HAVE_MUTEX_SPIN_STUBS
    240 endif
    241 define	MTX_OWNER	offsetof(struct kmutex, mtx_owner)
    242 define	MTX_LOCK	offsetof(struct kmutex, mtx_lock)
    243 define	MTX_IPL		offsetof(struct kmutex, mtx_ipl)
    244 
    245 ifdef	__HAVE_RW_STUBS
    246 define	__HAVE_RW_STUBS	__HAVE_RW_STUBS
    247 endif
    248 define	RW_OWNER	offsetof(struct krwlock, rw_owner)
    249 define	RW_WRITE_LOCKED	RW_WRITE_LOCKED
    250 define	RW_READ_INCR	RW_READ_INCR
    251 define	RW_READER	RW_READER
    252