@@ -106,6 +106,8 @@ static tf_cursor_t termteken_cursor;
static tf_putchar_t termteken_putchar;
static tf_fill_t termteken_fill;
static tf_copy_t termteken_copy;
static tf_pre_input_t termteken_pre_input;
static tf_post_input_t termteken_post_input;
static tf_param_t termteken_param;
static tf_respond_t termteken_respond;

@@ -115,6 +117,8 @@ static teken_funcs_t terminal_drawmethods = {
.tf_putchar = termteken_putchar,
.tf_fill = termteken_fill,
.tf_copy = termteken_copy,
.tf_pre_input = termteken_pre_input,
.tf_post_input = termteken_post_input,
.tf_param = termteken_param,
.tf_respond = termteken_respond,
};
@@ -626,6 +630,22 @@ termteken_copy(void *softc, const teken_rect_t *r, const teken_pos_t *p)
tm->tm_class->tc_copy(tm, r, p);
}

static void
termteken_pre_input(void *softc)
{
struct terminal *tm = softc;

tm->tm_class->tc_pre_input(tm);
}

static void
termteken_post_input(void *softc)
{
struct terminal *tm = softc;

tm->tm_class->tc_post_input(tm);
}

static void
termteken_param(void *softc, int cmd, unsigned int arg)
{
@@ -530,7 +530,12 @@ trap(struct trapframe *trapframe)
register_t *frame_regs;

trapdebug_enter(trapframe, 0);

#ifdef KDB
if (kdb_active) {
kdb_reenter();
return (0);
}
#endif
type = (trapframe->cause & MIPS_CR_EXC_CODE) >> MIPS_CR_EXC_CODE_SHIFT;
if (TRAPF_USERMODE(trapframe)) {
type |= T_USER;
@@ -1095,8 +1100,10 @@ trap(struct trapframe *trapframe)
#endif

#ifdef KDB
if (debugger_on_panic || kdb_active) {
if (debugger_on_panic) {
kdb_why = KDB_WHY_TRAP;
kdb_trap(type, 0, trapframe);
kdb_why = KDB_WHY_UNSET;
}
#endif
panic("trap");
@@ -151,6 +151,8 @@ typedef void tc_fill_t(struct terminal *tm, const term_rect_t *r,
term_char_t c);
typedef void tc_copy_t(struct terminal *tm, const term_rect_t *r,
const term_pos_t *p);
typedef void tc_pre_input_t(struct terminal *tm);
typedef void tc_post_input_t(struct terminal *tm);
typedef void tc_param_t(struct terminal *tm, int cmd, unsigned int arg);
typedef void tc_done_t(struct terminal *tm);

@@ -173,6 +175,8 @@ struct terminal_class {
tc_putchar_t *tc_putchar;
tc_fill_t *tc_fill;
tc_copy_t *tc_copy;
tc_pre_input_t *tc_pre_input;
tc_post_input_t *tc_post_input;
tc_param_t *tc_param;
tc_done_t *tc_done;

@@ -132,6 +132,22 @@ teken_funcs_copy(const teken_t *t, const teken_rect_t *r, const teken_pos_t *p)
t->t_funcs->tf_copy(t->t_softc, r, p);
}

static inline void
teken_funcs_pre_input(const teken_t *t)
{

teken_assert(t->t_funcs->tf_pre_input != NULL);
t->t_funcs->tf_pre_input(t->t_softc);
}

static inline void
teken_funcs_post_input(const teken_t *t)
{

teken_assert(t->t_funcs->tf_post_input != NULL);
t->t_funcs->tf_post_input(t->t_softc);
}

static inline void
teken_funcs_param(const teken_t *t, int cmd, unsigned int value)
{
@@ -292,8 +308,10 @@ teken_input(teken_t *t, const void *buf, size_t len)
{
const char *c = buf;

teken_funcs_pre_input(t);
while (len-- > 0)
teken_input_byte(t, *c++);
teken_funcs_post_input(t);
}

const teken_pos_t *
@@ -93,6 +93,8 @@ typedef void tf_putchar_t(void *, const teken_pos_t *, teken_char_t,
typedef void tf_fill_t(void *, const teken_rect_t *, teken_char_t,
const teken_attr_t *);
typedef void tf_copy_t(void *, const teken_rect_t *, const teken_pos_t *);
typedef void tf_pre_input_t(void *);
typedef void tf_post_input_t(void *);
typedef void tf_param_t(void *, int, unsigned int);
#define TP_SHOWCURSOR 0
#define TP_KEYPADAPP 1
@@ -114,6 +116,8 @@ typedef struct {
tf_putchar_t *tf_putchar;
tf_fill_t *tf_fill;
tf_copy_t *tf_copy;
tf_pre_input_t *tf_pre_input;
tf_post_input_t *tf_post_input;
tf_param_t *tf_param;
tf_respond_t *tf_respond;
} teken_funcs_t;