From 182d7debb9f725cff2dbfe543ed82d4d9f988bb6 Mon Sep 17 00:00:00 2001 From: Tycho Nightingale Date: Fri, 21 Feb 2014 01:15:26 +0000 Subject: [PATCH] Avoid clobbering the counter mode when issuing a latch command. Approved by: grehan (co-mentor) --- usr.sbin/bhyve/pit_8254.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); }