X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2F8254.c;h=d7659f83a9960de7c7e0f2211c5debed535dbe1b;hb=d0652a946b5d7dcee13c9d445b103f37284059aa;hp=1a44399569fdd8c7dbcc84939a5661b83ecc1663;hpb=5d1bbcc86de011e3f0d115b6f10fd8645cdf855e;p=palacios.git diff --git a/palacios/src/devices/8254.c b/palacios/src/devices/8254.c index 1a44399..d7659f8 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; @@ -735,7 +736,11 @@ static int pit_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { pit_state = (struct pit *)V3_Malloc(sizeof(struct pit)); - V3_ASSERT(pit_state != NULL); + if (!pit_state) { + PrintError("Cannot allocate in init\n"); + return -1; + } + pit_state->speaker = 0; pit_state->vm = vm;