Beispiel #1
0
/*
 * Called on an individual CPU.  Tries to send it off to the state saver if it
 * hasn't already entered the debugger.  Returns non-zero if it *fails* to stop
 * the CPU.
 */
static int
kdi_halt_cpu(int cpuid, void *state_saverp)
{
    void (*state_saver)(void) = (void (*)(void))state_saverp;
    int state = kmdb_dpi_get_cpu_state(cpuid);
    const char *msg;
    int rc = 0;
    int res;

    if (state != DPI_CPU_STATE_MASTER && state != DPI_CPU_STATE_SLAVE) {
        res = kdi_xc_one(cpuid, state_saver);
        rc = 1;

        if (res == KDI_XC_RES_OK)
            msg = "accepted the";
        else {
            if (res == KDI_XC_RES_BUSY)
                msg = "too busy for";
            else if (res == KDI_XC_RES_NACK)
                msg = "NACKED the";
            else
                msg = "errored the";
        }
        mdb_dprintf(MDB_DBG_KDI, "CPU %d %s halt\n", cpuid, msg);
    }

    return (rc);
}
Beispiel #2
0
/*ARGSUSED1*/
static int
kdi_report_unhalted(int cpuid, void *junk)
{
    int state = kmdb_dpi_get_cpu_state(cpuid);

    if (state != DPI_CPU_STATE_MASTER && state != DPI_CPU_STATE_SLAVE)
        mdb_warn("CPU %d: stop failed\n", cpuid);

    return (0);
}
Beispiel #3
0
int
kmdb_dpi_switch_master(int tgt_cpuid)
{
	if (kmdb_dpi_get_cpu_state(tgt_cpuid) < 0)
		return (-1); /* errno is set for us */

	kmdb_dpi_switch_target = tgt_cpuid;
	kmdb_dpi_resume_common(KMDB_DPI_CMD_SWITCH_CPU);

	return (0);
}