genassym.cf revision 1.137
11.137Sriastrad#	$NetBSD: genassym.cf,v 1.137 2025/04/24 01:50:39 riastradh Exp $
21.9Smycroft
31.9Smycroft#
41.135Sad# Copyright (c) 1998, 2006, 2007, 2008, 2023 The NetBSD Foundation, Inc.
51.9Smycroft# All rights reserved.
61.9Smycroft#
71.9Smycroft# This code is derived from software contributed to The NetBSD Foundation
81.58Sad# by Charles M. Hannum, and by Andrew Doran.
91.9Smycroft#
101.9Smycroft# Redistribution and use in source and binary forms, with or without
111.9Smycroft# modification, are permitted provided that the following conditions
121.9Smycroft# are met:
131.9Smycroft# 1. Redistributions of source code must retain the above copyright
141.9Smycroft#    notice, this list of conditions and the following disclaimer.
151.9Smycroft# 2. Redistributions in binary form must reproduce the above copyright
161.9Smycroft#    notice, this list of conditions and the following disclaimer in the
171.9Smycroft#    documentation and/or other materials provided with the distribution.
181.9Smycroft#
191.9Smycroft# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.9Smycroft# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.9Smycroft# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.9Smycroft# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.9Smycroft# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.9Smycroft# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.9Smycroft# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.9Smycroft# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.9Smycroft# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.9Smycroft# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.9Smycroft# POSSIBILITY OF SUCH DAMAGE.
301.9Smycroft#
311.1Smycroft
321.1Smycroft#
331.1Smycroft# Copyright (c) 1982, 1990 The Regents of the University of California.
341.1Smycroft# All rights reserved.
351.1Smycroft#
361.1Smycroft# This code is derived from software contributed to Berkeley by
371.1Smycroft# William Jolitz.
381.1Smycroft#
391.1Smycroft# Redistribution and use in source and binary forms, with or without
401.1Smycroft# modification, are permitted provided that the following conditions
411.1Smycroft# are met:
421.1Smycroft# 1. Redistributions of source code must retain the above copyright
431.1Smycroft#    notice, this list of conditions and the following disclaimer.
441.1Smycroft# 2. Redistributions in binary form must reproduce the above copyright
451.1Smycroft#    notice, this list of conditions and the following disclaimer in the
461.1Smycroft#    documentation and/or other materials provided with the distribution.
471.76Stsutsui# 3. Neither the name of the University nor the names of its contributors
481.1Smycroft#    may be used to endorse or promote products derived from this software
491.1Smycroft#    without specific prior written permission.
501.1Smycroft#
511.1Smycroft# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
521.1Smycroft# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
531.1Smycroft# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
541.1Smycroft# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
551.1Smycroft# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
561.1Smycroft# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
571.1Smycroft# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
581.1Smycroft# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
591.1Smycroft# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
601.1Smycroft# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
611.1Smycroft# SUCH DAMAGE.
621.1Smycroft#
631.1Smycroft#	@(#)genassym.c	5.11 (Berkeley) 5/10/91
641.1Smycroft#
651.1Smycroft
661.29Sjdolecekif defined(_KERNEL_OPT)
671.8Sthorpejinclude "opt_compat_freebsd.h"
681.8Sthorpejinclude "opt_compat_linux.h"
691.41Schristosinclude "opt_compat_netbsd.h"
701.128Smsaitohinclude "opt_xen.h"
711.22Sjdolecekendif
721.7Sthorpej
731.130Smsaitohif defined(_KERNEL) && defined(_KERNEL_OPT)
741.130Smsaitohinclude "isa.h"
751.130Smsaitohinclude "ioapic.h"
761.130Smsaitohendif
771.130Smsaitoh
781.47Sadquote #define __MUTEX_PRIVATE
791.47Sadquote #define __RWLOCK_PRIVATE
801.47Sad
811.1Smycroftinclude <sys/param.h>
821.1Smycroftinclude <sys/proc.h>
831.1Smycroftinclude <sys/resourcevar.h>
841.1Smycroftinclude <sys/device.h>
851.1Smycroftinclude <sys/mbuf.h>
861.47Sadinclude <sys/mutex.h>
871.47Sadinclude <sys/rwlock.h>
881.79Sadinclude <sys/cpu.h>
891.47Sad
901.25Sfvdlinclude <netinet/in.h>
911.25Sfvdlinclude <netinet/in_systm.h>
921.25Sfvdlinclude <netinet/ip.h>
931.27Ssommerfeinclude <netinet/ip6.h>
941.25Sfvdlinclude <netinet/ip_var.h>
951.1Smycroft
961.18Sthorpejinclude <uvm/uvm.h>
971.6Smrg
981.1Smycroftinclude <machine/trap.h>
991.1Smycroftinclude <machine/pmap.h>
1001.125Sriastradinclude <machine/pmap_private.h>
1011.1Smycroftinclude <machine/vmparam.h>
1021.33Sfvdlinclude <machine/intr.h>
1031.33Sfvdlinclude <machine/types.h>
1041.55Sadinclude <machine/segments.h>
1051.1Smycroft
1061.41Schristosinclude <compat/sys/signal.h>
1071.41Schristos
1081.1Smycroftifdef COMPAT_LINUX
1091.13Sfvdlinclude <compat/linux/common/linux_signal.h>
1101.13Sfvdlinclude <compat/linux/common/linux_machdep.h>
1111.1Smycroftendif
1121.1Smycroft
1131.1Smycroftifdef COMPAT_FREEBSD
1141.102Smaxvinclude <compat/freebsd/freebsd_machdep.h>
1151.1Smycroftendif
1161.1Smycroft
1171.130Smsaitohif NISA > 0
1181.130Smsaitohinclude <machine/isa_machdep.h>
1191.130Smsaitohendif
1201.130Smsaitoh
1211.33Sfvdlif NIOAPIC > 0
1221.37Sfvdlinclude <machine/i82093reg.h>
1231.33Sfvdlinclude <machine/i82093var.h>
1241.33Sfvdlendif
1251.33Sfvdl
1261.130Smsaitohifdef XEN
1271.130Smsaitohinclude <xen/include/public/sched.h>
1281.130Smsaitohinclude <xen/include/public/arch-x86/hvm/start_info.h>
1291.1Smycroftendif
1301.1Smycroft
1311.90Sdyounginclude <sys/bus.h>
1321.52Sad
1331.129Smsaitoh# general constants
1341.36Sthorpejdefine	PAGE_SIZE		PAGE_SIZE
1351.42Syamtdefine	UPAGES			UPAGES
1361.42Syamtdefine	USPACE			USPACE
1371.128Smsaitohdefine	PGOFSET			PGOFSET
1381.128Smsaitohdefine	PGSHIFT			PGSHIFT
1391.128Smsaitoh
1401.44Syamtdefine	KSTACK_SIZE		KSTACK_SIZE
1411.42Syamtdefine	KERNBASE		KERNBASE
1421.42Syamtdefine	KERNTEXTOFF		KERNTEXTOFF
1431.42Syamt
1441.113Smaxvdefine	PTE_P			PTE_P
1451.113Smaxvdefine	PTE_W			PTE_W
1461.57Saddefine	PGEX_U			PGEX_U
1471.42Syamt
1481.54Syamtdefine	L2_SLOT_KERNBASE	pl2_pi(KERNBASE)
1491.54Syamtdefine	L1_SLOT_KERNBASE	pl1_pi(KERNBASE)
1501.54Syamt
1511.54Syamtdefine	PDIR_SLOT_PTE		PDIR_SLOT_PTE
1521.54Syamtdefine	PTE_BASE		PTE_BASE
1531.1Smycroft
1541.85Sjymdefine	PDP_SIZE		PDP_SIZE
1551.85Sjymdefine	PDE_SIZE		sizeof(pd_entry_t)
1561.85Sjym
1571.131Smsaitohdefine	GUFS_SEL		GUFS_SEL
1581.131Smsaitohdefine	GUGS_SEL		GUGS_SEL
1591.131Smsaitoh
1601.60Syamtdefine	IOMAPSIZE		IOMAPSIZE
1611.60Syamt
1621.1Smycroftdefine	VM_MAXUSER_ADDRESS	(int)VM_MAXUSER_ADDRESS
1631.18Sthorpej
1641.129Smsaitoh# lwp & proc fields and values
1651.84Srminddefine	L_PCB			offsetof(struct lwp, l_addr)
1661.128Smsaitohdefine	L_CPU			offsetof(struct lwp, l_cpu)
1671.49Syamtdefine	L_FLAG			offsetof(struct lwp, l_flag)
1681.35Sthorpejdefine	L_PROC			offsetof(struct lwp, l_proc)
1691.135Saddefine	L_RU			offsetof(struct lwp, l_ru)
1701.66Saddefine	L_NOPREEMPT		offsetof(struct lwp, l_nopreempt)
1711.66Saddefine	L_DOPREEMPT		offsetof(struct lwp, l_dopreempt)
1721.128Smsaitohdefine	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
1731.128Smsaitohdefine	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
1741.128Smsaitohdefine	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)
1751.128Smsaitoh
1761.135Saddefine	RU_NIVCSW		offsetof(struct rusage, ru_nivcsw)
1771.135Sad
1781.131Smsaitohdefine	LW_SYSTEM		LW_SYSTEM
1791.128Smsaitohdefine	MDL_FPU_IN_CPU		MDL_FPU_IN_CPU
1801.128Smsaitoh
1811.1Smycroftdefine	P_FLAG			offsetof(struct proc, p_flag)
1821.39Sdsldefine	P_RASLIST		offsetof(struct proc, p_raslist)
1831.24Smycroftdefine	P_MD_SYSCALL		offsetof(struct proc, p_md.md_syscall)
1841.1Smycroft
1851.129Smsaitoh# pcb fields
1861.1Smycroftdefine	PCB_CR3			offsetof(struct pcb, pcb_cr3)
1871.128Smsaitohdefine	PCB_CR0			offsetof(struct pcb, pcb_cr0)
1881.128Smsaitohdefine	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)
1891.1Smycroftdefine	PCB_EBP			offsetof(struct pcb, pcb_ebp)
1901.1Smycroftdefine	PCB_ESP			offsetof(struct pcb, pcb_esp)
1911.50Saddefine	PCB_ESP0		offsetof(struct pcb, pcb_esp0)
1921.56Saddefine	PCB_FSD			offsetof(struct pcb, pcb_fsd)
1931.56Saddefine	PCB_GSD			offsetof(struct pcb, pcb_gsd)
1941.60Syamtdefine	PCB_IOMAP		offsetof(struct pcb, pcb_iomap)
1951.1Smycroft
1961.1Smycroftdefine	TF_CS			offsetof(struct trapframe, tf_cs)
1971.5Smycroftdefine	TF_EIP			offsetof(struct trapframe, tf_eip)
1981.4Smycroftdefine	TF_ERR			offsetof(struct trapframe, tf_err)
1991.1Smycroftdefine	TF_TRAPNO		offsetof(struct trapframe, tf_trapno)
2001.1Smycroftdefine	TF_EFLAGS		offsetof(struct trapframe, tf_eflags)
2011.1Smycroft
2021.33Sfvdldefine	TF_GS			offsetof(struct trapframe, tf_gs)
2031.33Sfvdldefine	TF_FS			offsetof(struct trapframe, tf_fs)
2041.33Sfvdldefine	TF_ES			offsetof(struct trapframe, tf_es)
2051.33Sfvdldefine	TF_DS			offsetof(struct trapframe, tf_ds)
2061.33Sfvdldefine	TF_EDI			offsetof(struct trapframe, tf_edi)
2071.33Sfvdldefine	TF_ESI			offsetof(struct trapframe, tf_esi)
2081.33Sfvdldefine	TF_EBP			offsetof(struct trapframe, tf_ebp)
2091.33Sfvdldefine	TF_EBX			offsetof(struct trapframe, tf_ebx)
2101.33Sfvdldefine	TF_EDX			offsetof(struct trapframe, tf_edx)
2111.33Sfvdldefine	TF_ECX			offsetof(struct trapframe, tf_ecx)
2121.33Sfvdldefine	TF_EAX			offsetof(struct trapframe, tf_eax)
2131.33Sfvdl
2141.33Sfvdldefine	TF_PUSHSIZE		offsetof(struct trapframe, tf_trapno)
2151.33Sfvdl
2161.1Smycroftdefine	FRAMESIZE		sizeof(struct trapframe)
2171.1Smycroft
2181.1Smycroftifdef COMPAT_LINUX
2191.1Smycroftdefine	LINUX_SIGF_HANDLER	offsetof(struct linux_sigframe, sf_handler)
2201.1Smycroftdefine	LINUX_SIGF_SC		offsetof(struct linux_sigframe, sf_sc)
2211.34Schristosdefine	LINUX_RT_SIGF_HANDLER	offsetof(struct linux_rt_sigframe, sf_handler)
2221.38Schristosdefine	LINUX_RT_SIGF_UC	offsetof(struct linux_rt_sigframe, sf_uc)
2231.1Smycroftendif
2241.1Smycroft
2251.1Smycroftifdef COMPAT_FREEBSD
2261.1Smycroftdefine	FREEBSD_SIGF_HANDLER	offsetof(struct freebsd_sigframe, sf_handler)
2271.1Smycroftdefine	FREEBSD_SIGF_SC		offsetof(struct freebsd_sigframe, sf_sc)
2281.1Smycroftendif
2291.1Smycroft
2301.106Smaxvdefine	TSS_TSS			offsetof(struct cpu_tss, tss)
2311.106Smaxvdefine	TSS_ESP0		offsetof(struct cpu_tss, tss.tss_esp0)
2321.106Smaxvdefine	TSS_IOBASE		offsetof(struct cpu_tss, tss.tss_iobase)
2331.106Smaxvdefine	TSS_IOMAP		offsetof(struct cpu_tss, iomap)
2341.106Smaxv
2351.129Smsaitoh# CPU info structure
2361.32Sfvdldefine	CPU_INFO_SELF		offsetof(struct cpu_info, ci_self)
2371.32Sfvdldefine	CPU_INFO_RESCHED	offsetof(struct cpu_info, ci_want_resched)
2381.40Syamtdefine	CPU_INFO_WANT_PMAPLOAD	offsetof(struct cpu_info, ci_want_pmapload)
2391.40Syamtdefine	CPU_INFO_TLBSTATE	offsetof(struct cpu_info, ci_tlbstate)
2401.40Syamtdefine	TLBSTATE_VALID		TLBSTATE_VALID
2411.35Sthorpejdefine	CPU_INFO_CURLWP		offsetof(struct cpu_info, ci_curlwp)
2421.72Saddefine	CPU_INFO_CURLDT		offsetof(struct cpu_info, ci_curldt)
2431.49Syamtdefine	CPU_INFO_IDLELWP	offsetof(struct cpu_info, ci_data.cpu_idlelwp)
2441.50Saddefine	CPU_INFO_PMAP		offsetof(struct cpu_info, ci_pmap)
2451.106Smaxvdefine	CPU_INFO_TSS		offsetof(struct cpu_info, ci_tss)
2461.63Saddefine	IOMAP_INVALOFF		IOMAP_INVALOFF
2471.107Smaxvdefine	IOMAP_VALIDOFF		IOMAP_VALIDOFF
2481.63Saddefine	CPU_INFO_NSYSCALL	offsetof(struct cpu_info, ci_data.cpu_nsyscall)
2491.74Saddefine	CPU_INFO_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
2501.88Smattdefine	CPU_INFO_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
2511.128Smsaitohdefine	CPU_INFO_CC_SKEW	offsetof(struct cpu_info, ci_data.cpu_cc_skew)
2521.68Saddefine	CPU_INFO_CURPRIORITY	offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
2531.88Smatt
2541.32Sfvdldefine	CPU_INFO_VENDOR		offsetof(struct cpu_info, ci_vendor[0])
2551.32Sfvdldefine	CPU_INFO_SIGNATURE	offsetof(struct cpu_info, ci_signature)
2561.32Sfvdl
2571.32Sfvdldefine	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
2581.128Smsaitohdefine	CPU_INFO_ILEVEL		(offsetof(struct cpu_info, ci_istate) + 7)
2591.128Smsaitohdefine	CPU_INFO_IDEPTH		offsetof(struct cpu_info, ci_idepth)
2601.126Sknakahardefine	CPU_INFO_IPENDING	offsetof(struct cpu_info, ci_istate)
2611.117Sthorpejdefine	CPU_INFO_IMASKED	offsetof(struct cpu_info, ci_imasked)
2621.33Sfvdldefine	CPU_INFO_IMASK		offsetof(struct cpu_info, ci_imask)
2631.128Smsaitohdefine	CPU_INFO_IUNMASK	offsetof(struct cpu_info, ci_iunmask)
2641.108Scherrydefine	CPU_INFO_ISOURCES	offsetof(struct cpu_info, ci_isources)
2651.47Saddefine	CPU_INFO_MTX_COUNT	offsetof(struct cpu_info, ci_mtx_count)
2661.47Saddefine	CPU_INFO_MTX_OLDSPL	offsetof(struct cpu_info, ci_mtx_oldspl)
2671.46Syamtdefine	CPU_INFO_INTRSTACK	offsetof(struct cpu_info, ci_intrstack)
2681.47Saddefine	CPU_INFO_ISTATE		offsetof(struct cpu_info, ci_istate)
2691.33Sfvdl
2701.71Saddefine	ACPI_SUSPEND_GDT	offsetof(struct cpu_info, ci_suspend_gdt)
2711.71Saddefine	ACPI_SUSPEND_IDT	offsetof(struct cpu_info, ci_suspend_idt)
2721.71Saddefine	ACPI_SUSPEND_TR		offsetof(struct cpu_info, ci_suspend_tr)
2731.71Saddefine	ACPI_SUSPEND_LDT	offsetof(struct cpu_info, ci_suspend_ldt)
2741.71Saddefine	ACPI_SUSPEND_FS		offsetof(struct cpu_info, ci_suspend_fs)
2751.71Saddefine	ACPI_SUSPEND_GS		offsetof(struct cpu_info, ci_suspend_gs)
2761.71Saddefine	ACPI_SUSPEND_KGS	offsetof(struct cpu_info, ci_suspend_kgs)
2771.71Saddefine	ACPI_SUSPEND_EFER	offsetof(struct cpu_info, ci_suspend_efer)
2781.71Saddefine	ACPI_SUSPEND_REG	offsetof(struct cpu_info, ci_suspend_reg)
2791.71Saddefine	ACPI_SUSPEND_CR0	offsetof(struct cpu_info, ci_suspend_cr0)
2801.71Saddefine	ACPI_SUSPEND_CR2	offsetof(struct cpu_info, ci_suspend_cr2)
2811.71Saddefine	ACPI_SUSPEND_CR3	offsetof(struct cpu_info, ci_suspend_cr3)
2821.71Saddefine	ACPI_SUSPEND_CR4	offsetof(struct cpu_info, ci_suspend_cr4)
2831.71Saddefine	ACPI_SUSPEND_CR8	offsetof(struct cpu_info, ci_suspend_cr8)
2841.59Sjoerg
2851.33Sfvdlif NIOAPIC > 0
2861.75Sdrochnerdefine		PIC_IOAPIC		offsetof(struct pic, pic_ioapic)
2871.33Sfvdldefine		IOAPIC_SC_REG		offsetof(struct ioapic_softc, sc_reg)
2881.33Sfvdldefine		IOAPIC_SC_DATA		offsetof(struct ioapic_softc, sc_data)
2891.33Sfvdldefine		PIC_LOCK		offsetof(struct pic, pic_lock)
2901.33Sfvdlendif
2911.32Sfvdl
2921.129Smsaitoh# interrupt handler fields
2931.128Smsaitohdefine	IH_FUN			offsetof(struct intrhand, ih_fun)
2941.128Smsaitohdefine	IH_ARG			offsetof(struct intrhand, ih_arg)
2951.128Smsaitohdefine	IH_LEVEL		offsetof(struct intrhand, ih_level)
2961.128Smsaitohdefine	IH_NEXT			offsetof(struct intrhand, ih_next)
2971.128Smsaitoh
2981.32Sfvdldefine	SIZEOF_CPU_INFO		sizeof(struct cpu_info)
2991.61Sbouyerdefine	SIZEOF_ISTUB		sizeof(struct intrstub)
3001.32Sfvdl
3011.128Smsaitohdefine	SIZEOF_ISOURCE	sizeof(struct intrsource)
3021.128Smsaitohdefine	IS_RECURSE	offsetof(struct intrsource, is_recurse)
3031.128Smsaitohdefine	IS_RESUME	offsetof(struct intrsource, is_resume)
3041.128Smsaitohdefine	IS_EVCNTLO	offsetof(struct intrsource, is_evcnt.ev_count)
3051.128Smsaitohdefine	IS_EVCNTHI	offsetof(struct intrsource, is_evcnt.ev_count)+4
3061.128Smsaitohdefine	IS_HANDLERS	offsetof(struct intrsource, is_handlers)
3071.128Smsaitohdefine	IS_PIC		offsetof(struct intrsource, is_pic)
3081.128Smsaitohdefine	IS_FLAGS	offsetof(struct intrsource, is_flags)
3091.128Smsaitohdefine	IS_PIN		offsetof(struct intrsource, is_pin)
3101.128Smsaitohdefine	IS_TYPE		offsetof(struct intrsource, is_type)
3111.128Smsaitohdefine	IS_MAXLEVEL	offsetof(struct intrsource, is_maxlevel)
3121.128Smsaitohdefine	IS_LWP		offsetof(struct intrsource, is_lwp)
3131.128Smsaitohdefine	IS_MASK_COUNT	offsetof(struct intrsource, is_mask_count)
3141.33Sfvdl
3151.42Syamtdefine	IPL_NONE		IPL_NONE
3161.68Saddefine	IPL_PREEMPT		IPL_PREEMPT
3171.111Snonakadefine	IPL_NET			IPL_NET
3181.42Syamtdefine	IPL_CLOCK		IPL_CLOCK
3191.121Sbouyerdefine	IPL_VM			IPL_VM
3201.121Sbouyerdefine	IPL_SCHED		IPL_SCHED
3211.42Syamtdefine	IPL_HIGH		IPL_HIGH
3221.42Syamt
3231.42Syamtdefine	IPL_SOFTNET		IPL_SOFTNET
3241.42Syamtdefine	IPL_SOFTCLOCK		IPL_SOFTCLOCK
3251.42Syamtdefine	IPL_SOFTSERIAL		IPL_SOFTSERIAL
3261.42Syamt
3271.42Syamtdefine	LIR_IPI			LIR_IPI
3281.42Syamtdefine	LIR_TIMER		LIR_TIMER
3291.111Snonakadefine	LIR_HV			LIR_HV
3301.42Syamt
3311.42Syamtdefine	SIR_NET			SIR_NET
3321.42Syamtdefine	SIR_CLOCK		SIR_CLOCK
3331.42Syamtdefine	SIR_SERIAL		SIR_SERIAL
3341.42Syamt
3351.42Syamtdefine	IREENT_MAGIC		IREENT_MAGIC
3361.42Syamt
3371.42Syamtdefine	PSL_AC			PSL_AC
3381.42Syamtdefine	PSL_MBO			PSL_MBO
3391.42Syamtdefine	PSL_ID			PSL_ID
3401.46Syamtdefine	PSL_I			PSL_I
3411.47Sad
3421.129Smsaitoh# Constants required for in_cksum() and friends.
3431.129Smsaitohdefine	M_DATA			offsetof(struct mbuf, m_data)
3441.129Smsaitohdefine	M_LEN			offsetof(struct mbuf, m_len)
3451.129Smsaitohdefine	M_NEXT			offsetof(struct mbuf, m_next)
3461.129Smsaitohdefine	IP_SRC			offsetof(struct ip, ip_src)
3471.129Smsaitohdefine	IP_DST			offsetof(struct ip, ip_dst)
3481.131Smsaitohdefine	IP6_SRC			offsetof(struct ip6_hdr, ip6_src)
3491.131Smsaitohdefine	IP6_DST			offsetof(struct ip6_hdr, ip6_dst)
3501.129Smsaitoh
3511.131Smsaitoh# Locking
3521.47Saddefine	MTX_IPL			offsetof(struct kmutex, u.s.mtxs_ipl)
3531.47Saddefine	MTX_LOCK		offsetof(struct kmutex, mtx_lock)
3541.47Saddefine	MTX_OWNER		offsetof(struct kmutex, u.mtxa_owner)
3551.47Sad
3561.47Saddefine	RW_OWNER		offsetof(struct krwlock, rw_owner)
3571.47Saddefine	RW_WRITE_LOCKED		RW_WRITE_LOCKED
3581.47Saddefine	RW_WRITE_WANTED		RW_WRITE_WANTED
3591.47Saddefine	RW_READ_INCR		RW_READ_INCR
3601.47Saddefine	RW_HAS_WAITERS		RW_HAS_WAITERS
3611.47Saddefine	RW_THREAD		RW_THREAD
3621.47Saddefine	RW_READER		RW_READER
3631.47Saddefine	RW_WRITER		RW_WRITER
3641.50Sad
3651.50Saddefine	EV_COUNT		offsetof(struct evcnt, ev_count)
3661.52Sad
3671.52Saddefine	OPTERON_MSR_PASSCODE	OPTERON_MSR_PASSCODE
3681.52Sad
3691.52Saddefine	X86_BUS_SPACE_IO	X86_BUS_SPACE_IO
3701.54Syamt
3711.87Sdyoungdefine	BST_TYPE		offsetof(struct bus_space_tag, bst_type)
3721.87Sdyoung
3731.54Syamtdefine	L1_SHIFT		L1_SHIFT
3741.54Syamtdefine	L2_SHIFT		L2_SHIFT
3751.54Syamtdefine	L2_FRAME		L2_FRAME
3761.61Sbouyer
3771.121Sbouyerdefine	VM_GUEST_XENPV		VM_GUEST_XENPV
3781.122Sbouyerdefine	VM_GUEST_XENPVH		VM_GUEST_XENPVH
3791.136Simildefine	VM_GUEST_GENPVH		VM_GUEST_GENPVH
3801.121Sbouyer
3811.61Sbouyerifdef XEN
3821.65Sceggerdefine CPU_INFO_VCPU		offsetof(struct cpu_info, ci_vcpu)
3831.123Sbouyerdefine IH_PENDING		offsetof(struct intrhand, ih_pending)
3841.121Sbouyerdefine SIR_XENIPL_VM		SIR_XENIPL_VM
3851.121Sbouyerdefine SIR_XENIPL_SCHED		SIR_XENIPL_SCHED
3861.121Sbouyerdefine SIR_XENIPL_HIGH		SIR_XENIPL_HIGH
3871.61Sbouyerdefine START_INFO_SHARED_INFO	offsetof(struct start_info, shared_info)
3881.61Sbouyerdefine START_INFO_FLAGS		offsetof(struct start_info, flags)
3891.78Sceggerdefine START_INFO_CONSOLE_MFN	offsetof(struct start_info, console.domU.mfn)
3901.61Sbouyerdefine START_INFO_STORE_MFN	offsetof(struct start_info, store_mfn)
3911.61Sbouyerdefine SIF_INITDOMAIN		SIF_INITDOMAIN
3921.65Sceggerdefine EVTCHN_UPCALL_PENDING	offsetof(struct vcpu_info, evtchn_upcall_pending)
3931.65Sceggerdefine EVTCHN_UPCALL_MASK	offsetof(struct vcpu_info, evtchn_upcall_mask)
3941.136Simildefine HVM_START_INFO_SIZE	sizeof(struct hvm_start_info)
3951.136Simildefine START_INFO_VERSION	offsetof(struct hvm_start_info, version)
3961.136Simildefine MMAP_PADDR		offsetof(struct hvm_start_info, memmap_paddr)
3971.136Simildefine MMAP_ENTRIES		offsetof(struct hvm_start_info, memmap_entries)
3981.136Simildefine MMAP_ENTRY_SIZE		sizeof(struct hvm_memmap_table_entry)
3991.136Simildefine CMDLINE_PADDR		offsetof(struct hvm_start_info, cmdline_paddr)
4001.61Sbouyerdefine HYPERVISOR_sched_op	__HYPERVISOR_sched_op
4011.61Sbouyerdefine SCHEDOP_yield		SCHEDOP_yield
4021.122Sbouyerendif /* XEN */
4031.124Sbouyer
4041.124Sbouyerifdef XENPV
4051.124Sbouyerdefine CPU_INFO_XEN_CLOCKF_USERMODE offsetof(struct cpu_info, ci_xen_clockf_usermode)
4061.124Sbouyerdefine CPU_INFO_XEN_CLOCKF_PC	offsetof(struct cpu_info, ci_xen_clockf_pc)
4071.124Sbouyerendif /* XENPV */
408