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.


This patch computes the CMOS checksum after initializing the rest of the NVRAM regist...
[palacios.git] / palacios / src / devices / generic.c
index d01ce95..3142488 100644 (file)
@@ -148,9 +148,7 @@ static int generic_read_port_ignore(struct guest_info * core, uint16_t port, voi
 
 
 
-static int generic_free(struct vm_device * dev) {
-    struct generic_internal * state = (struct generic_internal *)(dev->private_data);
-
+static int generic_free(struct generic_internal * state) {
     PrintDebug("generic: deinit_device\n");
 
     V3_Free(state);
@@ -162,7 +160,7 @@ static int generic_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = { 
-    .free = generic_free, 
+    .free = (int (*)(void *))generic_free, 
 };
 
 
@@ -215,9 +213,9 @@ static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     
     memset(state, 0, sizeof(struct generic_internal));
     
-    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
+    struct vm_device * dev = v3_add_device(vm, dev_id, &dev_ops, state);
 
-    if (v3_attach_device(vm, dev) == -1) {
+    if (dev == NULL) {
        PrintError("Could not attach device %s\n", dev_id);
        V3_Free(state);
        return -1;
@@ -238,13 +236,13 @@ static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
            mode = GENERIC_PRINT_AND_PASSTHROUGH;
        } else {
            PrintError("Invalid Mode %s\n", mode_str);
-           v3_detach_device(dev);
+           v3_remove_device(dev);
            return -1;
        }
        
        if (add_port_range(dev, start, end, mode) == -1) {
            PrintError("Could not add port range %d-%d\n", start, end);
-           v3_detach_device(dev);
+           v3_remove_device(dev);
            return -1;
        }