genassym.cf revision 1.2
11.2Smatt#	$NetBSD: genassym.cf,v 1.2 2011/01/18 01:02:52 matt Exp $
21.2Smatt
31.2Smatt#-
41.2Smatt# Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
51.2Smatt# All rights reserved.
61.2Smatt#
71.2Smatt# This code is derived from software contributed to The NetBSD Foundation
81.2Smatt# by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
91.2Smatt# Agency and which was developed by Matt Thomas of 3am Software Foundry.
101.2Smatt#
111.2Smatt# This material is based upon work supported by the Defense Advanced Research
121.2Smatt# Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
131.2Smatt# Contract No. N66001-09-C-2073.
141.2Smatt# Approved for Public Release, Distribution Unlimited
151.2Smatt#
161.2Smatt# Copyright (c) 2010 The NetBSD Foundation, Inc.
171.2Smatt# All rights reserved.
181.2Smatt#
191.2Smatt# This code is derived from software contributed to The NetBSD Foundation
201.2Smatt# by Matt Thomas of 3am Software Foundry.
211.2Smatt#
221.2Smatt# Redistribution and use in source and binary forms, with or without
231.2Smatt# modification, are permitted provided that the following conditions
241.2Smatt# are met:
251.2Smatt# 1. Redistributions of source code must retain the above copyright
261.2Smatt#    notice, this list of conditions and the following disclaimer.
271.2Smatt# 2. Redistributions in binary form must reproduce the above copyright
281.2Smatt#    notice, this list of conditions and the following disclaimer in the
291.2Smatt#    documentation and/or other materials provided with the distribution.
301.2Smatt#
311.2Smatt# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
321.2Smatt# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
331.2Smatt# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
341.2Smatt# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
351.2Smatt# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
361.2Smatt# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
371.2Smatt# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
381.2Smatt# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
391.2Smatt# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
401.2Smatt# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
411.2Smatt# POSSIBILITY OF SUCH DAMAGE.
421.2Smatt#+
431.2Smatt
441.2Smattinclude "opt_ppcarch.h"
451.2Smatt
461.2Smattquote #define __MUTEX_PRIVATE
471.2Smattquote #define __RWLOCK_PRIVATE
481.2Smattquote #define __INTR_PRIVATE
491.2Smatt
501.2Smattinclude <sys/param.h>
511.2Smattinclude <sys/time.h>
521.2Smattinclude <sys/mutex.h>
531.2Smattinclude <sys/rwlock.h>
541.2Smattinclude <sys/proc.h>
551.2Smattinclude <sys/bitops.h>
561.2Smatt
571.2Smattinclude <uvm/uvm_extern.h>
581.2Smatt
591.2Smattinclude <machine/pcb.h>
601.2Smattinclude <machine/frame.h>
611.2Smattinclude <machine/pmap.h>
621.2Smatt
631.2Smattinclude <powerpc/cpu.h>
641.2Smattinclude <powerpc/booke/trap.h>
651.2Smattinclude <powerpc/booke/pte.h>
661.2Smatt
671.2Smattdefine	FRAMELEN	FRAMELEN
681.2Smattdefine	FRAME_TF	offsetof(struct ktrapframe, ktf_tf)
691.2Smattdefine	FRAME_0		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[0])
701.2Smattdefine	FRAME_1		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[1])
711.2Smattdefine	FRAME_2		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[2])
721.2Smattdefine	FRAME_3		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[3])
731.2Smattdefine	FRAME_4		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[4])
741.2Smattdefine	FRAME_5		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[5])
751.2Smattdefine	FRAME_6		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[6])
761.2Smattdefine	FRAME_7		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[7])
771.2Smattdefine	FRAME_8		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[8])
781.2Smattdefine	FRAME_9		offsetof(struct ktrapframe, ktf_tf.tf_fixreg[9])
791.2Smattdefine	FRAME_10	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[10])
801.2Smattdefine	FRAME_11	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[11])
811.2Smattdefine	FRAME_12	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[12])
821.2Smattdefine	FRAME_13	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[13])
831.2Smattdefine	FRAME_14	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[14])
841.2Smattdefine	FRAME_15	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[15])
851.2Smattdefine	FRAME_16	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[16])
861.2Smattdefine	FRAME_17	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[17])
871.2Smattdefine	FRAME_18	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[18])
881.2Smattdefine	FRAME_19	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[19])
891.2Smattdefine	FRAME_20	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[20])
901.2Smattdefine	FRAME_21	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[21])
911.2Smattdefine	FRAME_22	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[22])
921.2Smattdefine	FRAME_23	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[23])
931.2Smattdefine	FRAME_24	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[24])
941.2Smattdefine	FRAME_25	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[25])
951.2Smattdefine	FRAME_26	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[26])
961.2Smattdefine	FRAME_27	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[27])
971.2Smattdefine	FRAME_28	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[28])
981.2Smattdefine	FRAME_29	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[29])
991.2Smattdefine	FRAME_30	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[30])
1001.2Smattdefine	FRAME_31	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[31])
1011.2Smattdefine	FRAME_LR	offsetof(struct ktrapframe, ktf_tf.tf_lr)
1021.2Smattdefine	FRAME_CR	offsetof(struct ktrapframe, ktf_tf.tf_cr)
1031.2Smattdefine	FRAME_CTR	offsetof(struct ktrapframe, ktf_tf.tf_ctr)
1041.2Smattdefine	FRAME_XER	offsetof(struct ktrapframe, ktf_tf.tf_xer)
1051.2Smattdefine	FRAME_CF	offsetof(struct ktrapframe, ktf_tf.tf_cf)
1061.2Smattdefine	FRAME_SRR0	offsetof(struct ktrapframe, ktf_tf.tf_srr0)
1071.2Smattdefine	FRAME_SRR1	offsetof(struct ktrapframe, ktf_tf.tf_srr1)
1081.2Smattdefine	FRAME_IDEPTH	offsetof(struct ktrapframe, ktf_tf.tf_idepth)
1091.2Smattdefine	FRAME_DEAR	offsetof(struct ktrapframe, ktf_tf.tf_dear)
1101.2Smattdefine	FRAME_ESR	offsetof(struct ktrapframe, ktf_tf.tf_esr)
1111.2Smattdefine	FRAME_EXC	offsetof(struct ktrapframe, ktf_tf.tf_exc)
1121.2Smattdefine	FRAME_MCSR	offsetof(struct ktrapframe, ktf_tf.tf_mcsr)
1131.2Smattdefine	FRAME_MCAR	offsetof(struct ktrapframe, ktf_tf.tf_mcar)
1141.2Smattdefine	FRAME_SPRG1	offsetof(struct ktrapframe, ktf_tf.tf_sprg1)
1151.2Smattdefine	FRAME_SPEFSCR	offsetof(struct ktrapframe, ktf_tf.tf_spefscr)
1161.2Smatt
1171.2Smattdefine	CALLFRAMELEN	CALLFRAMELEN
1181.2Smattdefine	CFRAME_SP	offsetof(struct callframe, cf_sp)
1191.2Smattdefine	CFRAME_LR	offsetof(struct callframe, cf_lr)
1201.2Smattdefine	CFRAME_R30	offsetof(struct callframe, cf_r30)
1211.2Smattdefine	CFRAME_R31	offsetof(struct callframe, cf_r31)
1221.2Smatt
1231.2Smattdefine	SFRAMELEN	SFRAMELEN
1241.2Smattdefine	SFRAME_SP	offsetof(struct switchframe, sf_sp)
1251.2Smattdefine	SFRAME_LR	offsetof(struct switchframe, sf_lr)
1261.2Smattdefine	SFRAME_USER_SR	offsetof(struct switchframe, sf_user_sr)
1271.2Smattdefine	SFRAME_CR	offsetof(struct switchframe, sf_cr)
1281.2Smattdefine	SFRAME_R2	offsetof(struct switchframe, sf_fixreg2)
1291.2Smattdefine	SFRAME_R13	offsetof(struct switchframe, sf_fixreg[0])
1301.2Smattdefine	SFRAME_R14	offsetof(struct switchframe, sf_fixreg[1])
1311.2Smattdefine	SFRAME_R15	offsetof(struct switchframe, sf_fixreg[2])
1321.2Smattdefine	SFRAME_R16	offsetof(struct switchframe, sf_fixreg[3])
1331.2Smattdefine	SFRAME_R17	offsetof(struct switchframe, sf_fixreg[4])
1341.2Smattdefine	SFRAME_R18	offsetof(struct switchframe, sf_fixreg[5])
1351.2Smattdefine	SFRAME_R19	offsetof(struct switchframe, sf_fixreg[6])
1361.2Smattdefine	SFRAME_R20	offsetof(struct switchframe, sf_fixreg[7])
1371.2Smattdefine	SFRAME_R21	offsetof(struct switchframe, sf_fixreg[8])
1381.2Smattdefine	SFRAME_R22	offsetof(struct switchframe, sf_fixreg[9])
1391.2Smattdefine	SFRAME_R23	offsetof(struct switchframe, sf_fixreg[10])
1401.2Smattdefine	SFRAME_R24	offsetof(struct switchframe, sf_fixreg[11])
1411.2Smattdefine	SFRAME_R25	offsetof(struct switchframe, sf_fixreg[12])
1421.2Smattdefine	SFRAME_R26	offsetof(struct switchframe, sf_fixreg[13])
1431.2Smattdefine	SFRAME_R27	offsetof(struct switchframe, sf_fixreg[14])
1441.2Smattdefine	SFRAME_R28	offsetof(struct switchframe, sf_fixreg[15])
1451.2Smattdefine	SFRAME_R29	offsetof(struct switchframe, sf_fixreg[16])
1461.2Smattdefine	SFRAME_R30	offsetof(struct switchframe, sf_fixreg[17])
1471.2Smattdefine	SFRAME_R31	offsetof(struct switchframe, sf_fixreg[18])
1481.2Smatt
1491.2Smattdefine	PCB_PM		offsetof(struct pcb, pcb_pm)
1501.2Smattdefine	PCB_SP		offsetof(struct pcb, pcb_sp)
1511.2Smattdefine	PCB_ONFAULT	offsetof(struct pcb, pcb_onfault)
1521.2Smattdefine	PCB_USPRG0	offsetof(struct pcb, pcb_usprg0)
1531.2Smatt
1541.2Smattdefine	L_PCB		offsetof(struct lwp, l_addr)
1551.2Smattdefine	L_CPU		offsetof(struct lwp, l_cpu)
1561.2Smattdefine	L_CTXSWTCH	offsetof(struct lwp, l_ctxswtch)
1571.2Smattdefine	L_MD_UTF	offsetof(struct lwp, l_md.md_utf)
1581.2Smattdefine	L_PROC		offsetof(struct lwp, l_proc)
1591.2Smatt
1601.2Smattdefine	P_MD_SYSCALL	offsetof(struct proc, p_md.md_syscall)
1611.2Smatt
1621.2Smattdefine	CI_SIZE		sizeof(struct cpu_info)
1631.2Smattdefine	CI_CURLWP	offsetof(struct cpu_info, ci_curlwp)
1641.2Smattdefine	CI_CURPCB	offsetof(struct cpu_info, ci_curpcb)
1651.2Smattdefine	CI_CURPM	offsetof(struct cpu_info, ci_curpm)
1661.2Smattdefine	CI_ASTPENDING	offsetof(struct cpu_info, ci_astpending)
1671.2Smattdefine	CI_WANT_RESCHED	offsetof(struct cpu_info, ci_want_resched)
1681.2Smattdefine	CI_CPL		offsetof(struct cpu_info, ci_cpl)
1691.2Smattdefine	CI_IDEPTH	offsetof(struct cpu_info, ci_idepth)
1701.2Smattdefine	CI_IDLESPIN	offsetof(struct cpu_info, ci_idlespin)
1711.2Smattdefine	CI_MTX_COUNT	offsetof(struct cpu_info, ci_mtx_count)
1721.2Smattdefine	CI_MTX_OLDSPL	offsetof(struct cpu_info, ci_mtx_oldspl)
1731.2Smattdefine	CI_SAVELIFO	offsetof(struct cpu_info, ci_savelifo)
1741.2Smattdefine	CI_PMAP_SEGTAB	offsetof(struct cpu_info, ci_pmap_segtabs[0])
1751.2Smattdefine	CI_EV_TLBMISS_SOFT offsetof(struct cpu_info, ci_ev_tlbmiss_soft.ev_count)
1761.2Smatt
1771.2Smattdefine	FB_PC		offsetof(struct faultbuf, fb_pc)
1781.2Smattdefine	FB_MSR		offsetof(struct faultbuf, fb_msr)
1791.2Smattdefine	FB_SP		offsetof(struct faultbuf, fb_sp)
1801.2Smattdefine	FB_R2		offsetof(struct faultbuf, fb_r2)
1811.2Smattdefine	FB_CR		offsetof(struct faultbuf, fb_cr)
1821.2Smattdefine	FB_R13		offsetof(struct faultbuf, fb_fixreg[0])
1831.2Smattdefine	FB_R14		offsetof(struct faultbuf, fb_fixreg[1])
1841.2Smattdefine	FB_R15		offsetof(struct faultbuf, fb_fixreg[2])
1851.2Smattdefine	FB_R16		offsetof(struct faultbuf, fb_fixreg[3])
1861.2Smattdefine	FB_R17		offsetof(struct faultbuf, fb_fixreg[4])
1871.2Smattdefine	FB_R18		offsetof(struct faultbuf, fb_fixreg[5])
1881.2Smattdefine	FB_R19		offsetof(struct faultbuf, fb_fixreg[6])
1891.2Smattdefine	FB_R20		offsetof(struct faultbuf, fb_fixreg[7])
1901.2Smattdefine	FB_R21		offsetof(struct faultbuf, fb_fixreg[8])
1911.2Smattdefine	FB_R22		offsetof(struct faultbuf, fb_fixreg[9])
1921.2Smattdefine	FB_R23		offsetof(struct faultbuf, fb_fixreg[10])
1931.2Smattdefine	FB_R24		offsetof(struct faultbuf, fb_fixreg[11])
1941.2Smattdefine	FB_R25		offsetof(struct faultbuf, fb_fixreg[12])
1951.2Smattdefine	FB_R26		offsetof(struct faultbuf, fb_fixreg[13])
1961.2Smattdefine	FB_R27		offsetof(struct faultbuf, fb_fixreg[14])
1971.2Smattdefine	FB_R28		offsetof(struct faultbuf, fb_fixreg[15])
1981.2Smattdefine	FB_R29		offsetof(struct faultbuf, fb_fixreg[16])
1991.2Smattdefine	FB_R30		offsetof(struct faultbuf, fb_fixreg[17])
2001.2Smattdefine	FB_R31		offsetof(struct faultbuf, fb_fixreg[18])
2011.2Smatt
2021.2Smattdefine	CACHELINESIZE	CACHELINESIZE
2031.2Smatt
2041.2Smattdefine	CPU_CI		offsetof(struct cpu_info, ci_ci)
2051.2Smatt
2061.2Smattdefine	PAGE_SIZE	PAGE_SIZE
2071.2Smattdefine	PAGE_MASK	PAGE_MASK
2081.2Smattdefine	PAGE_SHIFT	PAGE_SHIFT
2091.2Smattdefine	KERNEL_PID	KERNEL_PID
2101.2Smattdefine	USPACE		USPACE
2111.2Smatt
2121.2Smattdefine	T_CRITIAL_INPUT		T_CRITIAL_INPUT
2131.2Smattdefine	T_MACHINE_CHECK		T_MACHINE_CHECK
2141.2Smattdefine	T_DSI			T_DSI
2151.2Smattdefine	T_ISI			T_ISI
2161.2Smattdefine	T_EXTERNAL_INPUT	T_EXTERNAL_INPUT
2171.2Smattdefine	T_ALIGNMENT		T_ALIGNMENT
2181.2Smattdefine	T_PROGRAM		T_PROGRAM
2191.2Smattdefine	T_FP_UNAVAILABLE	T_FP_UNAVAILABLE
2201.2Smattdefine	T_SYSTEM_CALL		T_SYSTEM_CALL
2211.2Smattdefine	T_AP_UNAVAILABLE	T_AP_UNAVAILABLE
2221.2Smattdefine	T_DECREMENTER		T_DECREMENTER
2231.2Smattdefine	T_FIXED_INTERVAL	T_FIXED_INTERVAL
2241.2Smattdefine	T_WATCHDOG		T_WATCHDOG
2251.2Smattdefine	T_DATA_TLB_ERROR	T_DATA_TLB_ERROR
2261.2Smattdefine	T_INSTRUCTION_TLB_ERROR	T_INSTRUCTION_TLB_ERROR
2271.2Smattdefine	T_DEBUG			T_DEBUG
2281.2Smattdefine	T_SPE_UNAVAILABLE	T_SPE_UNAVAILABLE
2291.2Smattdefine	T_EMBEDDED_FP_DATA	T_EMBEDDED_FP_DATA
2301.2Smattdefine	T_EMBEDDED_FP_ROUND	T_EMBEDDED_FP_ROUND
2311.2Smattdefine	T_EMBEDDED_PERF_MONITOR	T_EMBEDDED_PERF_MONITOR
2321.2Smattdefine	T_AST			T_AST
2331.2Smatt
2341.2Smattifdef	__HAVE_FAST_SOFTINTS
2351.2Smattdefine	__HAVE_FAST_SOFTINTS	__HAVE_FAST_SOFTINTS
2361.2Smattendif
2371.2Smatt
2381.2Smattdefine	INTRSW_CRITINTR		offsetof(struct intrsw, intrsw_critintr)
2391.2Smattdefine	INTRSW_DECRINTR		offsetof(struct intrsw, intrsw_decrintr)
2401.2Smattdefine	INTRSW_FITINTR		offsetof(struct intrsw, intrsw_fitintr)
2411.2Smattdefine	INTRSW_WDOGINTR		offsetof(struct intrsw, intrsw_wdogintr)
2421.2Smattdefine	INTRSW_EXTINTR		offsetof(struct intrsw, intrsw_extintr)
2431.2Smatt
2441.2Smattdefine	IPL_HIGH		IPL_HIGH
2451.2Smattdefine	IPL_SCHED		IPL_SCHED
2461.2Smattdefine	IPL_VM			IPL_VM
2471.2Smatt
2481.2Smattifdef	__HAVE_MUTEX_STUBS
2491.2Smattdefine	__HAVE_MUTEX_STUBS	__HAVE_MUTEX_STUBS
2501.2Smattendif
2511.2Smattifdef	__HAVE_MUTEX_SPIN_STUBS
2521.2Smattdefine	__HAVE_MUTEX_SPIN_STUBS	__HAVE_MUTEX_SPIN_STUBS
2531.2Smattendif
2541.2Smattdefine	MTX_OWNER	offsetof(struct kmutex, mtx_owner)
2551.2Smattdefine	MTX_LOCK	offsetof(struct kmutex, mtx_lock)
2561.2Smattdefine	MTX_IPL		offsetof(struct kmutex, mtx_ipl)
2571.2Smatt
2581.2Smattifdef	__HAVE_RW_STUBS
2591.2Smattdefine	__HAVE_RW_STUBS	__HAVE_RW_STUBS
2601.2Smattendif
2611.2Smattdefine	RW_OWNER	offsetof(struct krwlock, rw_owner)
2621.2Smattdefine	RW_WRITE_LOCKED	RW_WRITE_LOCKED
2631.2Smattdefine	RW_READ_INCR	RW_READ_INCR
2641.2Smattdefine	RW_READER	RW_READER
2651.2Smatt
2661.2Smatt##define	USPACE		USPACE
2671.2Smatt
2681.2Smattdefine	PTE_SCALESHIFT	ilog2(sizeof(pt_entry_t))
2691.2Smattdefine	PTR_SCALESHIFT	ilog2(sizeof(void *))
2701.2Smattdefine	PSL_CE		PSL_CE
2711.2Smattdefine	PSL_DE		PSL_DE
2721.2Smattdefine	PSL_EE		PSL_EE
2731.2Smattdefine	PSL_ME		PSL_ME
2741.2Smattdefine	PSL_PR		PSL_PR
2751.2Smattdefine	MSR_PR		31 - ilog2(PSL_PR)
2761.2Smattdefine	PSL_DS		PSL_DS
2771.2Smattdefine	MSR_DS		31 - ilog2(PSL_DS)
2781.2Smattdefine	PSL_IS		PSL_IS
2791.2Smattdefine	MSR_IS		31 - ilog2(PSL_IS)
2801.2Smatt
2811.2Smattdefine	NSEGPG_SCALESHIFT	PAGE_SHIFT - ilog2(sizeof(void *))
2821.2Smattdefine	NPTEPG_SCALESHIFT	PAGE_SHIFT - ilog2(sizeof(pt_entry_t))
283