genassym.cf revision 1.18
11.18Smatt#	$NetBSD: genassym.cf,v 1.18 2011/01/18 01:02:54 matt Exp $
21.1Smatt
31.1Smatt#
41.1Smatt# Copyright (C) 1995, 1996 Wolfgang Solfrank.
51.1Smatt# Copyright (C) 1995, 1996 TooLs GmbH.
61.1Smatt# All rights reserved.
71.1Smatt#
81.1Smatt# Redistribution and use in source and binary forms, with or without
91.1Smatt# modification, are permitted provided that the following conditions
101.1Smatt# are met:
111.1Smatt# 1. Redistributions of source code must retain the above copyright
121.1Smatt#    notice, this list of conditions and the following disclaimer.
131.1Smatt# 2. Redistributions in binary form must reproduce the above copyright
141.1Smatt#    notice, this list of conditions and the following disclaimer in the
151.1Smatt#    documentation and/or other materials provided with the distribution.
161.1Smatt# 3. All advertising materials mentioning features or use of this software
171.1Smatt#    must display the following acknowledgement:
181.1Smatt#	This product includes software developed by TooLs GmbH.
191.1Smatt# 4. The name of TooLs GmbH may not be used to endorse or promote products
201.1Smatt#    derived from this software without specific prior written permission.
211.1Smatt#
221.1Smatt# THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
231.1Smatt# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
241.1Smatt# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
251.1Smatt# IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
261.1Smatt# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
271.1Smatt# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
281.1Smatt# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
291.1Smatt# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
301.1Smatt# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
311.1Smatt# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
321.1Smatt#
331.1Smatt
341.15Smattquote #define __MUTEX_PRIVATE
351.15Smattquote #define __RWLOCK_PRIVATE
361.15Smatt
371.1Smattinclude <sys/param.h>
381.1Smattinclude <sys/time.h>
391.1Smattinclude <sys/proc.h>
401.18Smattinclude <sys/bitops.h>
411.1Smatt
421.1Smattinclude <uvm/uvm_extern.h>
431.1Smatt
441.1Smattinclude <machine/pcb.h>
451.1Smattinclude <machine/pmap.h>
461.1Smatt
471.1Smattdefine	FRAMELEN	FRAMELEN
481.18Smattdefine	FRAME_TF	offsetof(struct ktrapframe, ktf_tf)
491.18Smattdefine	FRAME_R0	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[0])
501.18Smattdefine	FRAME_R1	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[1])
511.18Smattdefine	FRAME_R2	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[2])
521.18Smattdefine	FRAME_R3	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[3])
531.18Smattdefine	FRAME_R4	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[4])
541.18Smattdefine	FRAME_R5	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[5])
551.18Smattdefine	FRAME_R6	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[6])
561.18Smattdefine	FRAME_R7	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[7])
571.18Smattdefine	FRAME_R8	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[8])
581.18Smattdefine	FRAME_R9	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[9])
591.18Smattdefine	FRAME_R10	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[10])
601.18Smattdefine	FRAME_R11	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[11])
611.18Smattdefine	FRAME_R12	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[12])
621.18Smattdefine	FRAME_R13	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[13])
631.18Smattdefine	FRAME_R14	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[14])
641.18Smattdefine	FRAME_R15	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[15])
651.18Smattdefine	FRAME_R16	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[16])
661.18Smattdefine	FRAME_R17	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[17])
671.18Smattdefine	FRAME_R18	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[18])
681.18Smattdefine	FRAME_R19	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[19])
691.18Smattdefine	FRAME_R20	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[20])
701.18Smattdefine	FRAME_R21	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[21])
711.18Smattdefine	FRAME_R22	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[22])
721.18Smattdefine	FRAME_R23	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[23])
731.18Smattdefine	FRAME_R24	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[24])
741.18Smattdefine	FRAME_R25	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[25])
751.18Smattdefine	FRAME_R26	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[26])
761.18Smattdefine	FRAME_R27	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[27])
771.18Smattdefine	FRAME_R28	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[28])
781.18Smattdefine	FRAME_R29	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[29])
791.18Smattdefine	FRAME_R30	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[30])
801.18Smattdefine	FRAME_R31	offsetof(struct ktrapframe, ktf_tf.tf_fixreg[31])
811.18Smattdefine	FRAME_LR	offsetof(struct ktrapframe, ktf_tf.tf_lr)
821.18Smattdefine	FRAME_CR	offsetof(struct ktrapframe, ktf_tf.tf_cr)
831.18Smattdefine	FRAME_CTR	offsetof(struct ktrapframe, ktf_tf.tf_ctr)
841.18Smattdefine	FRAME_XER	offsetof(struct ktrapframe, ktf_tf.tf_xer)
851.18Smattdefine	FRAME_CF	offsetof(struct ktrapframe, ktf_tf.tf_cf)
861.18Smattdefine	FRAME_IDEPTH	offsetof(struct ktrapframe, ktf_tf.tf_idepth)
871.18Smattdefine	FRAME_SRR0	offsetof(struct ktrapframe, ktf_tf.tf_srr0)
881.18Smattdefine	FRAME_SRR1	offsetof(struct ktrapframe, ktf_tf.tf_srr1)
891.18Smattdefine	FRAME_DEAR	offsetof(struct ktrapframe, ktf_tf.tf_dear)
901.18Smattdefine	FRAME_EXC	offsetof(struct ktrapframe, ktf_tf.tf_exc)
911.18Smattdefine	FRAME_ESR	offsetof(struct ktrapframe, ktf_tf.tf_esr)
921.18Smattdefine	FRAME_PID	offsetof(struct ktrapframe, ktf_tf.tf_pid)
931.1Smatt
941.1Smattdefine	CALLFRAMELEN	CALLFRAMELEN
951.18Smattdefine	CFRAME_SP	offsetof(struct callframe, cf_sp)
961.18Smattdefine	CFRAME_LR	offsetof(struct callframe, cf_lr)
971.18Smattdefine	CFRAME_R30	offsetof(struct callframe, cf_r30)
981.18Smattdefine	CFRAME_R31	offsetof(struct callframe, cf_r31)
991.1Smatt
1001.8Smattdefine	SFRAMELEN	SFRAMELEN
1011.18Smattdefine	SFRAME_SP	offsetof(struct switchframe, sf_sp)
1021.18Smattdefine	SFRAME_LR	offsetof(struct switchframe, sf_lr)
1031.18Smattdefine	SFRAME_USER_SR	offsetof(struct switchframe, sf_user_sr)
1041.18Smattdefine	SFRAME_CR	offsetof(struct switchframe, sf_cr)
1051.18Smattdefine	SFRAME_R2	offsetof(struct switchframe, sf_fixreg2)
1061.18Smattdefine	SFRAME_R13	offsetof(struct switchframe, sf_fixreg[0])
1071.18Smattdefine	SFRAME_R14	offsetof(struct switchframe, sf_fixreg[1])
1081.18Smattdefine	SFRAME_R15	offsetof(struct switchframe, sf_fixreg[2])
1091.18Smattdefine	SFRAME_R16	offsetof(struct switchframe, sf_fixreg[3])
1101.18Smattdefine	SFRAME_R17	offsetof(struct switchframe, sf_fixreg[4])
1111.18Smattdefine	SFRAME_R18	offsetof(struct switchframe, sf_fixreg[5])
1121.18Smattdefine	SFRAME_R19	offsetof(struct switchframe, sf_fixreg[6])
1131.18Smattdefine	SFRAME_R20	offsetof(struct switchframe, sf_fixreg[7])
1141.18Smattdefine	SFRAME_R21	offsetof(struct switchframe, sf_fixreg[8])
1151.18Smattdefine	SFRAME_R22	offsetof(struct switchframe, sf_fixreg[9])
1161.18Smattdefine	SFRAME_R23	offsetof(struct switchframe, sf_fixreg[10])
1171.18Smattdefine	SFRAME_R24	offsetof(struct switchframe, sf_fixreg[11])
1181.18Smattdefine	SFRAME_R25	offsetof(struct switchframe, sf_fixreg[12])
1191.18Smattdefine	SFRAME_R26	offsetof(struct switchframe, sf_fixreg[13])
1201.18Smattdefine	SFRAME_R27	offsetof(struct switchframe, sf_fixreg[14])
1211.18Smattdefine	SFRAME_R28	offsetof(struct switchframe, sf_fixreg[15])
1221.18Smattdefine	SFRAME_R29	offsetof(struct switchframe, sf_fixreg[16])
1231.18Smattdefine	SFRAME_R30	offsetof(struct switchframe, sf_fixreg[17])
1241.18Smattdefine	SFRAME_R31	offsetof(struct switchframe, sf_fixreg[18])
1251.1Smatt
1261.6Smattdefine	PCB_PM		offsetof(struct pcb, pcb_pm)
1271.1Smattdefine	PCB_SP		offsetof(struct pcb, pcb_sp)
1281.17Schsdefine	PCB_ONFAULT	offsetof(struct pcb, pcb_onfault)
1291.1Smatt
1301.1Smattdefine	PM_CTX		offsetof(struct pmap, pm_ctx)
1311.1Smatt
1321.18Smattdefine	MSR_PR		31-ilog2(PSL_PR)
1331.18Smatt
1341.18Smattdefine	L_CPU		offsetof(struct lwp, l_cpu)
1351.18Smattdefine	L_MD_UTF	offsetof(struct lwp, l_md.md_utf)
1361.16Srminddefine	L_PCB		offsetof(struct lwp, l_addr)
1371.1Smattdefine	L_PROC		offsetof(struct lwp, l_proc)
1381.1Smatt
1391.1Smattdefine	P_MD_SYSCALL	offsetof(struct proc, p_md.md_syscall)
1401.1Smatt
1411.1Smattdefine	CI_SIZE		sizeof(struct cpu_info)
1421.1Smattdefine	CI_CURLWP	offsetof(struct cpu_info, ci_curlwp)
1431.1Smattdefine	CI_CURPCB	offsetof(struct cpu_info, ci_curpcb)
1441.9Ssimonbdefine	CI_CURPM	offsetof(struct cpu_info, ci_curpm)
1451.1Smattdefine	CI_ASTPENDING	offsetof(struct cpu_info, ci_astpending)
1461.13Srjsdefine	CI_WANT_RESCHED	offsetof(struct cpu_info, ci_want_resched)
1471.1Smattdefine	CI_CPL		offsetof(struct cpu_info, ci_cpl)
1481.18Smattdefine	CI_IDEPTH	offsetof(struct cpu_info, ci_idepth)
1491.1Smattdefine	CI_INTSTK	offsetof(struct cpu_info, ci_intstk)
1501.1Smattdefine	CI_TEMPSAVE	offsetof(struct cpu_info, ci_tempsave)
1511.1Smattdefine	CI_DDBSAVE	offsetof(struct cpu_info, ci_ddbsave)
1521.1Smattdefine	CI_IPKDBSAVE	offsetof(struct cpu_info, ci_ipkdbsave)
1531.18Smattdefine	CI_TLBMISSSAVE	offsetof(struct cpu_info, ci_tlbmisssave)
1541.10Smattdefine	CI_IDLESPIN	offsetof(struct cpu_info, ci_idlespin)
1551.18Smattdefine	CI_NINTR	offsetof(struct cpu_info, ci_data.cpu_nintr)
1561.1Smatt
1571.3Smattdefine	CPUSAVE_R28	CPUSAVE_R28*sizeof(register_t)
1581.3Smattdefine	CPUSAVE_R29	CPUSAVE_R29*sizeof(register_t)
1591.3Smattdefine	CPUSAVE_R30	CPUSAVE_R30*sizeof(register_t)
1601.3Smattdefine	CPUSAVE_R31	CPUSAVE_R31*sizeof(register_t)
1611.18Smattdefine	CPUSAVE_DEAR	CPUSAVE_DEAR*sizeof(register_t)
1621.18Smattdefine	CPUSAVE_ESR	CPUSAVE_ESR*sizeof(register_t)
1631.3Smattdefine	CPUSAVE_SRR0	CPUSAVE_SRR0*sizeof(register_t)
1641.3Smattdefine	CPUSAVE_SRR1	CPUSAVE_SRR1*sizeof(register_t)
1651.3Smatt
1661.1Smattdefine	FB_PC		offsetof(struct faultbuf, fb_pc)
1671.1Smattdefine	FB_SP		offsetof(struct faultbuf, fb_sp)
1681.1Smattdefine	FB_R2		offsetof(struct faultbuf, fb_r2)
1691.1Smattdefine	FB_CR		offsetof(struct faultbuf, fb_cr)
1701.3Smattdefine	FB_R13		offsetof(struct faultbuf, fb_fixreg[0])
1711.3Smattdefine	FB_R14		offsetof(struct faultbuf, fb_fixreg[1])
1721.3Smattdefine	FB_R15		offsetof(struct faultbuf, fb_fixreg[2])
1731.3Smattdefine	FB_R16		offsetof(struct faultbuf, fb_fixreg[3])
1741.3Smattdefine	FB_R17		offsetof(struct faultbuf, fb_fixreg[4])
1751.3Smattdefine	FB_R18		offsetof(struct faultbuf, fb_fixreg[5])
1761.3Smattdefine	FB_R19		offsetof(struct faultbuf, fb_fixreg[6])
1771.3Smattdefine	FB_R20		offsetof(struct faultbuf, fb_fixreg[7])
1781.3Smattdefine	FB_R21		offsetof(struct faultbuf, fb_fixreg[8])
1791.3Smattdefine	FB_R22		offsetof(struct faultbuf, fb_fixreg[9])
1801.3Smattdefine	FB_R23		offsetof(struct faultbuf, fb_fixreg[10])
1811.3Smattdefine	FB_R24		offsetof(struct faultbuf, fb_fixreg[11])
1821.3Smattdefine	FB_R25		offsetof(struct faultbuf, fb_fixreg[12])
1831.3Smattdefine	FB_R26		offsetof(struct faultbuf, fb_fixreg[13])
1841.3Smattdefine	FB_R27		offsetof(struct faultbuf, fb_fixreg[14])
1851.3Smattdefine	FB_R28		offsetof(struct faultbuf, fb_fixreg[15])
1861.3Smattdefine	FB_R29		offsetof(struct faultbuf, fb_fixreg[16])
1871.3Smattdefine	FB_R30		offsetof(struct faultbuf, fb_fixreg[17])
1881.3Smattdefine	FB_R31		offsetof(struct faultbuf, fb_fixreg[18])
1891.1Smatt
1901.18Smattdefine	PAGE_SIZE	PAGE_SIZE
1911.18Smattdefine	PAGE_MASK	PAGE_MASK
1921.1Smattdefine	CACHELINESIZE	CACHELINESIZE
1931.1Smatt
1941.1Smattdefine	CPU_CI		offsetof(struct cpu_info, ci_ci)
1951.15Smatt
1961.15Smattifdef	__HAVE_MUTEX_STUBS
1971.15Smattdefine	__HAVE_MUTEX_STUBS	__HAVE_MUTEX_STUBS
1981.15Smattendif
1991.15Smattifdef	__HAVE_MUTEX_SPIN_STUBS
2001.15Smattdefine	__HAVE_MUTEX_SPIN_STUBS	__HAVE_MUTEX_SPIN_STUBS
2011.15Smattendif
2021.15Smattdefine	MTX_OWNER	offsetof(struct kmutex, mtx_owner)
2031.15Smattdefine	MTX_LOCK	offsetof(struct kmutex, mtx_lock)
2041.15Smattdefine	MTX_IPL		offsetof(struct kmutex, mtx_ipl)
2051.15Smatt
2061.15Smattifdef	__HAVE_RW_STUBS
2071.15Smattdefine	__HAVE_RW_STUBS	__HAVE_RW_STUBS
2081.15Smattendif
2091.15Smattdefine	RW_OWNER	offsetof(struct krwlock, rw_owner)
2101.15Smattdefine	RW_WRITE_LOCKED	RW_WRITE_LOCKED
2111.15Smattdefine	RW_READ_INCR	RW_READ_INCR
2121.15Smattdefine	RW_READER	RW_READER
213