Index | Thread | Search

From:
Dave Voutila <dv@sisu.io>
Subject:
Re: [PATCH 4/6] vmd: reset i8253 input latch on new counter writes
To:
ssnf <ssnf@ssnf.xyz>
Cc:
tech@openbsd.org
Date:
Fri, 28 Aug 2026 13:49:27 -0400

Download raw body.

Thread
ssnf <ssnf@ssnf.xyz> writes:

> A new LSB/MSB counter write must replace the previous programmed
> value.
>
> The first byte is currently OR'ed into ilatch, leaving bits from
> the previous divisor set and potentially programming the wrong
> count.

Based on my research, this looks correct. I'll commit this as-is.


> ---
>  usr.sbin/vmd/i8253.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/usr.sbin/vmd/i8253.c b/usr.sbin/vmd/i8253.c
> index 917def18b75..3723bcde639 100644
> --- a/usr.sbin/vmd/i8253.c
> +++ b/usr.sbin/vmd/i8253.c
> @@ -287,7 +287,7 @@ vcpu_exit_i8253(struct vm_run_params *vrp)
>
>  		if (vei->vei.vei_dir == VEI_DIR_OUT) { /* OUT instruction */
>  			if (i8253_channel[sel].last_w == 0) {
> -				i8253_channel[sel].ilatch |= (out_data & 0xff);
> +				i8253_channel[sel].ilatch = out_data & 0xff;
>  				i8253_channel[sel].last_w = 1;
>  			} else {
>  				i8253_channel[sel].ilatch |=
> --
> 2.51.0