f03010953f
from doc/BRANCHES: idle lwp, and some changes depending on it. 1. separate context switching and thread scheduling. (cf. gmcgarry_ctxsw) 2. implement idle lwp. 3. clean up related MD/MI interfaces. 4. make scheduler(s) modular.
357 lines
13 KiB
CFEngine3
357 lines
13 KiB
CFEngine3
# $NetBSD: genassym.cf,v 1.12 2007/05/17 14:51:35 yamt Exp $
|
|
# NetBSD: genassym.cf,v 1.40 2004/02/20 17:35:01 yamt Exp
|
|
|
|
#
|
|
# Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This code is derived from software contributed to The NetBSD Foundation
|
|
# by Charles M. Hannum.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
# must display the following acknowledgement:
|
|
# This product includes software developed by the NetBSD
|
|
# Foundation, Inc. and its contributors.
|
|
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
# contributors may be used to endorse or promote products derived
|
|
# from this software without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
|
|
#
|
|
# Copyright (c) 1982, 1990 The Regents of the University of California.
|
|
# All rights reserved.
|
|
#
|
|
# This code is derived from software contributed to Berkeley by
|
|
# William Jolitz.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
# must display the following acknowledgement:
|
|
# This product includes software developed by the University of
|
|
# California, Berkeley and its contributors.
|
|
# 4. Neither the name of the University nor the names of its contributors
|
|
# may be used to endorse or promote products derived from this software
|
|
# without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
#
|
|
# @(#)genassym.c 5.11 (Berkeley) 5/10/91
|
|
#
|
|
|
|
if defined(_KERNEL_OPT)
|
|
include "opt_compat_svr4.h"
|
|
include "opt_compat_freebsd.h"
|
|
include "opt_compat_linux.h"
|
|
include "opt_multiprocessor.h"
|
|
include "opt_xen.h"
|
|
endif
|
|
|
|
quote #define __MUTEX_PRIVATE
|
|
quote #define __RWLOCK_PRIVATE
|
|
|
|
include <sys/param.h>
|
|
include <sys/proc.h>
|
|
include <sys/resourcevar.h>
|
|
include <sys/device.h>
|
|
include <sys/user.h>
|
|
include <sys/mbuf.h>
|
|
include <sys/mutex.h>
|
|
include <sys/rwlock.h>
|
|
|
|
include <netinet/in.h>
|
|
include <netinet/in_systm.h>
|
|
include <netinet/ip.h>
|
|
include <netinet/ip6.h>
|
|
include <netinet/ip_var.h>
|
|
|
|
include <uvm/uvm.h>
|
|
|
|
include <machine/trap.h>
|
|
include <machine/pmap.h>
|
|
include <machine/vmparam.h>
|
|
include <machine/intr.h>
|
|
include <machine/types.h>
|
|
|
|
ifdef XEN3
|
|
include <machine/xen3-public/sched.h>
|
|
else
|
|
include <machine/xen-public/xen.h>
|
|
endif
|
|
|
|
ifdef COMPAT_SVR4
|
|
include <compat/svr4/svr4_ucontext.h>
|
|
endif
|
|
|
|
ifdef COMPAT_LINUX
|
|
include <compat/linux/common/linux_signal.h>
|
|
include <compat/linux/common/linux_machdep.h>
|
|
endif
|
|
|
|
ifdef COMPAT_FREEBSD
|
|
include <machine/freebsd_machdep.h>
|
|
endif
|
|
|
|
ifdef MULTIPROCESSOR
|
|
include <machine/cpu.h>
|
|
endif
|
|
|
|
include <machine/tlog.h>
|
|
|
|
define PAGE_SIZE PAGE_SIZE
|
|
|
|
define LSRUN LSRUN
|
|
define LSONPROC LSONPROC
|
|
|
|
define PTE_BASE PTE_BASE
|
|
define UPAGES UPAGES
|
|
define USPACE USPACE
|
|
define KSTACK_SIZE KSTACK_SIZE
|
|
define KERNBASE KERNBASE
|
|
define KERNTEXTOFF KERNTEXTOFF
|
|
|
|
define PGSHIFT PGSHIFT
|
|
define PGOFSET PGOFSET
|
|
define PDSHIFT PDSHIFT
|
|
define PDOFSET PDOFSET
|
|
define NBPD NBPD
|
|
|
|
define PG_RW PG_RW
|
|
define PG_V PG_V
|
|
define PG_KW PG_KW
|
|
define PG_KR PG_KR
|
|
|
|
define PDSLOT_PTE PDSLOT_PTE
|
|
define PDSLOT_APTE PDSLOT_APTE
|
|
define PDSLOT_KERN PDSLOT_KERN
|
|
define NKPTP_MIN NKPTP_MIN
|
|
define NKPTP_MAX NKPTP_MAX
|
|
|
|
define VM_MAXUSER_ADDRESS (int)VM_MAXUSER_ADDRESS
|
|
|
|
define UVM_PAGE_IDLE_ZERO offsetof(struct uvm, page_idle_zero)
|
|
|
|
define L_ADDR offsetof(struct lwp, l_addr)
|
|
define L_FLAG offsetof(struct lwp, l_flag)
|
|
define L_PRIORITY offsetof(struct lwp, l_priority)
|
|
define L_STAT offsetof(struct lwp, l_stat)
|
|
define L_WCHAN offsetof(struct lwp, l_wchan)
|
|
define L_PROC offsetof(struct lwp, l_proc)
|
|
define L_MD_TSS_SEL offsetof(struct lwp, l_md.md_tss_sel)
|
|
define L_MD_REGS offsetof(struct lwp, l_md.md_regs)
|
|
define L_CPU offsetof(struct lwp, l_cpu)
|
|
define L_MUTEX offsetof(struct lwp, l_mutex)
|
|
define L_MD_ASTPENDING offsetof(struct lwp, l_md.md_astpending)
|
|
define P_FLAG offsetof(struct proc, p_flag)
|
|
define P_RASLIST offsetof(struct proc, p_raslist)
|
|
define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
|
|
|
|
define PK_SYSTEM PK_SYSTEM
|
|
|
|
define M_DATA offsetof(struct mbuf, m_data)
|
|
define M_LEN offsetof(struct mbuf, m_len)
|
|
define M_NEXT offsetof(struct mbuf, m_next)
|
|
|
|
define IP_SRC offsetof(struct ip, ip_src)
|
|
define IP_DST offsetof(struct ip, ip_dst)
|
|
|
|
define IP6_SRC offsetof(struct ip6_hdr, ip6_src)
|
|
define IP6_DST offsetof(struct ip6_hdr, ip6_dst)
|
|
|
|
define V_TRAP offsetof(struct uvmexp, traps)
|
|
define V_INTR offsetof(struct uvmexp, intrs)
|
|
|
|
define PCB_CR3 offsetof(struct pcb, pcb_cr3)
|
|
define PCB_EBP offsetof(struct pcb, pcb_ebp)
|
|
define PCB_ESP offsetof(struct pcb, pcb_esp)
|
|
define PCB_CR0 offsetof(struct pcb, pcb_cr0)
|
|
define PCB_LDT_SEL offsetof(struct pcb, pcb_ldt_sel)
|
|
define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
|
|
define PCB_FPCPU offsetof(struct pcb, pcb_fpcpu)
|
|
define PCB_TSS_SS0 offsetof(struct pcb, pcb_tss.tss_ss0)
|
|
define PCB_TSS_ESP0 offsetof(struct pcb, pcb_tss.tss_esp0)
|
|
|
|
define TF_CS offsetof(struct trapframe, tf_cs)
|
|
define TF_EIP offsetof(struct trapframe, tf_eip)
|
|
define TF_ERR offsetof(struct trapframe, tf_err)
|
|
define TF_TRAPNO offsetof(struct trapframe, tf_trapno)
|
|
define TF_EFLAGS offsetof(struct trapframe, tf_eflags)
|
|
|
|
define TF_GS offsetof(struct trapframe, tf_gs)
|
|
define TF_FS offsetof(struct trapframe, tf_fs)
|
|
define TF_ES offsetof(struct trapframe, tf_es)
|
|
define TF_DS offsetof(struct trapframe, tf_ds)
|
|
define TF_EDI offsetof(struct trapframe, tf_edi)
|
|
define TF_ESI offsetof(struct trapframe, tf_esi)
|
|
define TF_EBP offsetof(struct trapframe, tf_ebp)
|
|
define TF_EBX offsetof(struct trapframe, tf_ebx)
|
|
define TF_EDX offsetof(struct trapframe, tf_edx)
|
|
define TF_ECX offsetof(struct trapframe, tf_ecx)
|
|
define TF_EAX offsetof(struct trapframe, tf_eax)
|
|
|
|
define TF_PUSHSIZE offsetof(struct trapframe, tf_trapno)
|
|
|
|
define FRAMESIZE sizeof(struct trapframe)
|
|
|
|
ifdef COMPAT_SVR4
|
|
define SVR4_SIGF_HANDLER offsetof(struct svr4_sigframe, sf_handler)
|
|
define SVR4_SIGF_UC offsetof(struct svr4_sigframe, sf_uc)
|
|
endif
|
|
|
|
ifdef COMPAT_LINUX
|
|
define LINUX_SIGF_HANDLER offsetof(struct linux_sigframe, sf_handler)
|
|
define LINUX_SIGF_SC offsetof(struct linux_sigframe, sf_sc)
|
|
define LINUX_RT_SIGF_HANDLER offsetof(struct linux_rt_sigframe, sf_handler)
|
|
define LINUX_RT_SIGF_UC offsetof(struct linux_rt_sigframe, sf_uc)
|
|
endif
|
|
|
|
ifdef COMPAT_FREEBSD
|
|
define FREEBSD_SIGF_HANDLER offsetof(struct freebsd_sigframe, sf_handler)
|
|
define FREEBSD_SIGF_SC offsetof(struct freebsd_sigframe, sf_sc)
|
|
endif
|
|
|
|
define IH_FUN offsetof(struct intrhand, ih_fun)
|
|
define IH_ARG offsetof(struct intrhand, ih_arg)
|
|
define IH_LEVEL offsetof(struct intrhand, ih_level)
|
|
define IH_IPL_NEXT offsetof(struct intrhand, ih_ipl_next)
|
|
|
|
define CPU_INFO_SELF offsetof(struct cpu_info, ci_self)
|
|
define CPU_INFO_SELF150 offsetof(struct cpu_info, ci_self150)
|
|
define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched)
|
|
define CPU_INFO_WANT_PMAPLOAD offsetof(struct cpu_info, ci_want_pmapload)
|
|
define CPU_INFO_TLBSTATE offsetof(struct cpu_info, ci_tlbstate)
|
|
define TLBSTATE_VALID TLBSTATE_VALID
|
|
define CPU_INFO_CURLWP offsetof(struct cpu_info, ci_curlwp)
|
|
define CPU_INFO_ASTPENDING offsetof(struct cpu_info, ci_astpending)
|
|
define CPU_INFO_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
|
|
|
|
define CPU_INFO_LEVEL offsetof(struct cpu_info, ci_cpuid_level)
|
|
define CPU_INFO_VENDOR offsetof(struct cpu_info, ci_vendor[0])
|
|
define CPU_INFO_SIGNATURE offsetof(struct cpu_info, ci_signature)
|
|
define CPU_INFO_FEATURES offsetof(struct cpu_info, ci_feature_flags)
|
|
define CPU_INFO_BRAND offsetof(struct cpu_info, ci_brand_id)
|
|
|
|
define CPU_TLOG_OFFSET offsetof(struct cpu_info, ci_tlog_offset)
|
|
define CPU_TLOG_BASE offsetof(struct cpu_info, ci_tlog_base)
|
|
|
|
define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt)
|
|
define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending)
|
|
define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask)
|
|
define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel)
|
|
define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth)
|
|
define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources)
|
|
define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
|
|
define CPU_INFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl)
|
|
define CPU_INFO_INTRSTACK offsetof(struct cpu_info, ci_intrstack)
|
|
|
|
define SIZEOF_CPU_INFO sizeof(struct cpu_info)
|
|
|
|
define SIZEOF_IPLSOURCE sizeof(struct iplsource)
|
|
define SIZEOF_ISTUB sizeof(struct intrstub)
|
|
|
|
define IS_RECURSE offsetof(struct iplsource, ipl_recurse)
|
|
define IS_RESUME offsetof(struct iplsource, ipl_resume)
|
|
define IS_HANDLERS offsetof(struct iplsource, ipl_handlers)
|
|
|
|
define EV_EVCNTLO offsetof(struct evcnt, ev_count)
|
|
define EV_EVCNTHI offsetof(struct evcnt, ev_count)+4
|
|
|
|
define TREC_SP offsetof(struct trec, tr_sp)
|
|
define TREC_HPC offsetof(struct trec, tr_hpc)
|
|
define TREC_IPC offsetof(struct trec, tr_ipc)
|
|
define TREC_TSC offsetof(struct trec, tr_tsc)
|
|
define TREC_LBF offsetof(struct trec, tr_lbf)
|
|
define TREC_LBT offsetof(struct trec, tr_lbt)
|
|
define TREC_IBF offsetof(struct trec, tr_ibf)
|
|
define TREC_IBT offsetof(struct trec, tr_ibt)
|
|
|
|
define SIZEOF_TREC sizeof(struct trec)
|
|
define SIZEOF_TLOG sizeof(struct tlog)
|
|
|
|
define IPL_NONE IPL_NONE
|
|
define IPL_SCHED IPL_SCHED
|
|
define IPL_HIGH IPL_HIGH
|
|
|
|
define IPL_SOFTNET IPL_SOFTNET
|
|
define IPL_SOFTCLOCK IPL_SOFTCLOCK
|
|
define IPL_SOFTSERIAL IPL_SOFTSERIAL
|
|
define IPL_SOFTXENEVT IPL_SOFTXENEVT
|
|
|
|
define IREENT_MAGIC IREENT_MAGIC
|
|
|
|
define X86_SOFTINTR_SOFTSERIAL X86_SOFTINTR_SOFTSERIAL
|
|
define X86_SOFTINTR_SOFTNET X86_SOFTINTR_SOFTNET
|
|
define X86_SOFTINTR_SOFTCLOCK X86_SOFTINTR_SOFTCLOCK
|
|
|
|
define PSL_MBO PSL_MBO
|
|
|
|
define MTX_IPL offsetof(struct kmutex, u.s.mtxs_ipl)
|
|
define MTX_LOCK offsetof(struct kmutex, mtx_lock)
|
|
define MTX_OWNER offsetof(struct kmutex, u.mtxa_owner)
|
|
|
|
define RW_OWNER offsetof(struct krwlock, rw_owner)
|
|
define RW_WRITE_LOCKED RW_WRITE_LOCKED
|
|
define RW_WRITE_WANTED RW_WRITE_WANTED
|
|
define RW_READ_INCR RW_READ_INCR
|
|
define RW_HAS_WAITERS RW_HAS_WAITERS
|
|
define RW_THREAD RW_THREAD
|
|
define RW_READER RW_READER
|
|
define RW_WRITER RW_WRITER
|
|
|
|
ifdef XEN3
|
|
define START_INFO_SHARED_INFO offsetof(struct start_info, shared_info)
|
|
define START_INFO_FLAGS offsetof(struct start_info, flags)
|
|
define START_INFO_CONSOLE_MFN offsetof(struct start_info, console_mfn)
|
|
define START_INFO_STORE_MFN offsetof(struct start_info, store_mfn)
|
|
else
|
|
define START_INFO_SHARED_INFO offsetof(start_info_t, shared_info)
|
|
endif
|
|
define SIF_INITDOMAIN SIF_INITDOMAIN
|
|
|
|
ifdef XEN3
|
|
define EVTCHN_UPCALL_PENDING offsetof(struct shared_info, vcpu_data[0].evtchn_upcall_pending)
|
|
define EVTCHN_UPCALL_MASK offsetof(struct shared_info, vcpu_data[0].evtchn_upcall_mask)
|
|
else
|
|
define EVTCHN_UPCALL_PENDING offsetof(struct shared_info_st, vcpu_data[0].evtchn_upcall_pending)
|
|
define EVTCHN_UPCALL_MASK offsetof(struct shared_info_st, vcpu_data[0].evtchn_upcall_mask)
|
|
endif
|
|
|
|
define HYPERVISOR_sched_op __HYPERVISOR_sched_op
|
|
define SCHEDOP_yield SCHEDOP_yield
|