示例#1
0
/*
 * switch to another cpu
 */
void
db_on(int cpu)
{
	/*
	 * Save ddb global variables
	 */
	DB_SAVE_CTXT();

	/*
	 * Don`t do if bad CPU number.
	 * CPU must also be spinning in db_entry.
	 */
	if (cpu < 0 || cpu >= NCPUS || !db_active[cpu])
	    return;

	/*
	 * Give debugger to that CPU
	 */
	db_cpu = cpu;
	unlock_db();

	/*
	 * Wait for it to come back again
	 */
	lock_db();

	/*
	 * Restore ddb globals
	 */
	DB_RESTORE_CTXT();

	if (db_cpu == -1) /* someone continued */
	    db_continue_cmd(0, 0, 0, "");
}
void
db_switch_cpu_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
{
	if (addr >= maxcpus) {
		db_printf("cpu %"DDB_EXPR_FMT"d out of range", addr);
		return;
	}
	struct cpu_info *new_ci = cpu_lookup(addr);
	if (new_ci == NULL) {
		db_printf("cpu %"DDB_EXPR_FMT"d does not exist", addr);
		return;
	}
	if (DDB_REGS->tf_spsr & PSR_T_bit) {
		DDB_REGS->tf_pc -= 2; /* XXX */
	} else {
		DDB_REGS->tf_pc -= 4;
	}
	db_newcpu = new_ci;
	db_continue_cmd(0, false, 0, "");
}
示例#3
0
/*
 * switch to another cpu
 */
void
kdb_on(
	int		cpu)
{
	KDB_SAVE_CTXT();
	if (cpu < 0 || cpu >= NCPUS || !debugger_active[cpu])
		return;
	db_set_breakpoints();
	db_set_watchpoints();
	debugger_cpu = cpu;
	unlock_debugger();
	lock_debugger();
	db_clear_breakpoints();
	db_clear_watchpoints();
	KDB_RESTORE_CTXT();
	if (debugger_cpu == -1)  {/* someone continued */
		debugger_cpu = cpu_number();
		db_continue_cmd(0, 0, 0, "");
	}
}