From: Alexander Kudryavtsev Date: Fri, 17 Feb 2012 20:25:41 +0000 (-0600) Subject: Handle 8254 PIT reload count of 0 correctly (means 65536) X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6731d8c63a50ae8083edb56a9a726957910ec64;p=palacios.git Handle 8254 PIT reload count of 0 correctly (means 65536) --- diff --git a/palacios/src/devices/8254.c b/palacios/src/devices/8254.c index 1a44399..5944cfa 100644 --- a/palacios/src/devices/8254.c +++ b/palacios/src/devices/8254.c @@ -177,10 +177,11 @@ static int handle_crystal_tics(struct pit * pit, struct channel * ch, uint_t osc reload_val -= reload_val % 2; } - // TODO: Check this.... - // Is this correct??? if (reload_val == 0) { - reload_val = 1; + // This means the value is being set to 0x10000 + // but due to the tick after the reload, it wraps + // down to 0xffff + reload_val = 0xffff; } channel_cycles += oscillations / reload_val;