Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


filedisk XML configuration language tweak
[palacios.git] / palacios / src / devices / 8254.c
index 1a44399..d7659f8 100644 (file)
@@ -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;