示例#1
0
int
kdb_trap(int type, int code, db_regs_t *regs)
{
	int s;

	switch (type) {
	case EXPEVT_TRAPA:	/* FALLTHROUGH */
	case EXPEVT_BREAK:
		break;

	default:
		if (!db_onpanic && db_recover == NULL)
			return 0;

		kdb_printtrap(type, code);
		if (db_recover != NULL) {
			db_printf("[pc %x, pr %x]: ",
				  regs->tf_spc, regs->tf_pr);
			db_error("Faulted in DDB; continuing...\n");
			/*NOTREACHED*/
		}
	}

	/* XXX: Should switch to ddb's own stack here. */

	ddb_regs = *regs;

	s = splhigh();
	db_active++;
	cnpollc(true);

	db_trap(type, code);

	cnpollc(false);
	db_active--;
	splx(s);

	*regs = ddb_regs;

	return 1;
}
示例#2
0
int
kdb_trap(int type, int code, db_regs_t *regs)
{
	extern label_t *db_recover;
	int s;

	switch (type) {
	case EXPEVT_TRAPA:	/* trapa instruction */
	case EXPEVT_BREAK:	/* UBC */
	case -1:		/* keyboard interrupt */
		break;
	default:
		if (!db_panic && db_recover == NULL)
			return 0;

		kdb_printtrap(type, code);
		if (db_recover != NULL) {
			db_error("Faulted in DDB; continuing...\n");
			/*NOTREACHED*/
		}
	}

	/* XXX Should switch to kdb's own stack here. */

	ddb_regs = *regs;

	s = splhigh();
	db_active++;
	cnpollc(TRUE);
	db_trap(type, code);
	cnpollc(FALSE);
	db_active--;
	splx(s);

	*regs = ddb_regs;

	return 1;
}