示例#1
0
/*
 * Enter debugger.  Called when the user types ctrl-alt-d or whenever
 * code wants to enter the debugger and possibly resume later.
 *
 * msg:	message to print, possibly NULL.
 */
void
debug_enter(char *msg)
{
	if (dtrace_debugger_init != NULL)
		(*dtrace_debugger_init)();

	if (msg != NULL || (boothowto & RB_DEBUG))
		prom_printf("\n");

	if (msg != NULL)
		prom_printf("%s\n", msg);

	if (boothowto & RB_DEBUG)
		kmdb_enter();

	if (dtrace_debugger_fini != NULL)
		(*dtrace_debugger_fini)();
}
示例#2
0
/*
 * Drop the prom lock if it is held by the current CPU.  If the lock is held
 * recursively, return without clearing prom_cpu.  If the hold count is now
 * zero, clear prom_cpu and cv_signal any waiting CPU.
 */
void
kern_postprom(void)
{
	processorid_t cpuid = getprocessorid();
	cpu_t *cp = cpu[cpuid];

	if (panicstr)
		return; /* do not modify lock further if we have panicked */

	if (prom_cpu != cp)
		panic("kern_postprom: not owner, cp=%p owner=%p",
		    (void *)cp, (void *)prom_cpu);

	if (prom_holdcnt == 0)
		panic("kern_postprom: prom_holdcnt == 0, owner=%p",
		    (void *)prom_cpu);

	if (atomic_dec_32_nv(&prom_holdcnt) != 0)
		return; /* prom lock is held recursively by this CPU */

	if ((boothowto & RB_DEBUG) && prom_exit_enter_debugger)
		kmdb_enter();

	prom_thread = NULL;
	membar_producer();

	prom_cpu = NULL;
	membar_producer();

	if (CPU_IN_SET(cpu_ready_set, cpuid) && cp->cpu_m.mutex_ready) {
		mutex_enter(&prom_mutex);
		cv_signal(&prom_cv);
		mutex_exit(&prom_mutex);
		kpreempt_enable();
	}
}