Exemplo n.º 1
0
/*
 * Pause cpu.  This is called from locore.s after setting up a trapframe.
 */
void
sparc64_ipi_pause_thiscpu(void *arg)
{
	int s;
#if defined(DDB)
	extern void fill_ddb_regs_from_tf(struct trapframe64 *tf);
	extern void ddb_restore_state(void);
	
	if (arg)
		fill_ddb_regs_from_tf(arg);
#endif

	s = intr_disable();
	sparc64_do_pause();

#if defined(DDB)
	if (arg) {
		ddb_restore_state();
		curcpu()->ci_ddb_regs = NULL;
	}
#endif

	intr_restore(s);
}
Exemplo n.º 2
0
/*
 *  kdb_trap - field a TRACE or BPT trap
 */
int
kdb_trap(int type, struct trapframe64 *tf)
{
    int s;
    extern int trap_trace_dis;
    extern int doing_shutdown;

    trap_trace_dis++;
    doing_shutdown++;
#if NFB > 0
    fb_unblank();
#endif
    switch (type) {
    case T_BREAKPOINT:	/* breakpoint */
        break;
    case -1:		/* keyboard interrupt */
        printf("kdb tf=%p\n", tf);
        break;
    default:
        if (!db_onpanic && db_recover==0)
            return (0);

        printf("kernel trap %x: %s\n", type, trap_type[type & 0x1ff]);
        if (db_recover != 0) {
            prom_abort();
            db_error("Faulted in DDB; continuing...\n");
            prom_abort();
            /*NOTREACHED*/
        }
        db_recover = (label_t *)1;
    }

    /* Should switch to kdb`s own stack here. */
    write_all_windows();

#if defined(MULTIPROCESSOR)
    if (!db_suspend_others()) {
        ddb_suspend(tf);
        return 1;
    }
#endif

    /* Initialise local dbregs storage from trap frame */
    fill_ddb_regs_from_tf(tf);

    s = splhigh();
    db_active++;
    cnpollc(TRUE);
    /* Need to do spl stuff till cnpollc works */
    db_dump_ts(0, 0, 0, 0);
    db_trap(type, 0/*code*/);
    ddb_restore_state();
    cnpollc(FALSE);
    db_active--;

    splx(s);

    *tf = DDB_REGS->db_tf;
    curcpu()->ci_ddb_regs = NULL;

    trap_trace_dis--;
    doing_shutdown--;

#if defined(MULTIPROCESSOR)
    db_resume_others();
#endif

    return (1);
}