From: mlarkin Date: Fri, 8 Jul 2016 06:35:12 +0000 (+0000) Subject: Return 0 on read from PIT control port. Intel explicitly says this is not X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=97f2e5c7919e80fb5bebe3a510837d79bce0add4;p=openbsd Return 0 on read from PIT control port. Intel explicitly says this is not supported, and it looks like other emulators/hypervisors do a variety of different things here. Most return 0, but at least one might return random garbage. Returning 0 seems safest here, but leave a warning in place for the logs in case a guest VM does this. --- diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c index f8f37a25c9a..b863a876ddb 100644 --- a/usr.sbin/vmd/vmm.c +++ b/usr.sbin/vmd/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.30 2016/07/07 00:58:31 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.31 2016/07/08 06:35:12 mlarkin Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -1088,9 +1088,9 @@ vcpu_exit_i8253(struct vm_run_params *vrp) goto ret; } else { - /* XXX should this return 0xff as the data read? */ log_warnx("%s: i8253 PIT: read from control " - "port unsupported", __progname); + "port unsupported - returning 0", __progname); + vei->vei.vei_data = 0; } } else { sel = vei->vei.vei_port - (TIMER_CNTR0 + TIMER_BASE);