/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <sys/lockstat.h>
/*
* We check CPU_ON_INTR(CPU) when exiting a disp lock, rather than when
* entering it, for a purely pragmatic reason: when exiting a disp lock
* we know that we must be at PIL 10, and thus not preemptible; therefore
* we can safely load the CPU pointer without worrying about it changing.
*/
static void
disp_onintr_panic(void)
{
panic("dispatcher invoked from high-level interrupt handler");
}
/* ARGSUSED */
void
{
}
/* ARGSUSED */
void
{
}
void
{
}
void
{
if (CPU_ON_INTR(CPU) != 0)
lock_clear(lp);
}
void
{
}
void
{
if (CPU_ON_INTR(CPU) != 0)
if (CPU->cpu_kprunrun) {
} else {
}
}
void
{
if (CPU_ON_INTR(CPU) != 0)
}
/*
* Thread_lock() - get the correct dispatcher lock for the thread.
*/
void
{
int s = splhigh();
if (CPU_ON_INTR(CPU) != 0)
for (;;) {
return;
}
lock_clear(lp);
} else {
/*
* Lower spl and spin on lock with non-atomic load
* to avoid cache activity. Spin until the lock
* becomes available or spontaneously changes.
*/
splx(s);
if (panicstr) {
return;
}
SMT_PAUSE();
}
s = splhigh();
}
}
}
/*
* Thread_lock_high() - get the correct dispatcher lock for the thread.
* This version is called when already at high spl.
*/
void
{
if (CPU_ON_INTR(CPU) != 0)
for (;;) {
return;
lock_clear(lp);
} else {
if (panicstr)
return;
SMT_PAUSE();
}
}
}
}
/*
* Called by THREAD_TRANSITION macro to change the thread state to
* the intermediate state-in-transititon state.
*/
void
{
ASSERT(THREAD_LOCK_HELD(t));
t->t_lockp = &transition_lock;
}
/*
* Put thread in stop state, and set the lock pointer to the stop_lock.
* This effectively drops the lock on the thread, since the stop_lock
* isn't held.
* Eventually, stop_lock could be hashed if there is too much contention.
*/
void
{
ASSERT(THREAD_LOCK_HELD(t));
t->t_state = TS_STOPPED;
/*
* Ensure that t_state reaches global visibility before t_lockp
*/
}