diff --git a/usr.sbin/bhyve/pit_8254.c b/usr.sbin/bhyve/pit_8254.c index 3eb1aa753591..26fb03dbbac6 100644 --- a/usr.sbin/bhyve/pit_8254.c +++ b/usr.sbin/bhyve/pit_8254.c @@ -216,11 +216,12 @@ pit_8254_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, c = &counter[sel >> 6]; c->ctx = ctx; - c->mode = mode; if (rw == TIMER_LATCH) pit_update_counter(c, 1); - else + else { + c->mode = mode; c->olbyte = 0; /* reset latch after reprogramming */ + } return (0); }