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.


deallocation of devices
Jack Lange [Tue, 23 Nov 2010 22:56:54 +0000 (16:56 -0600)]
35 files changed:
palacios/include/palacios/vmm.h
palacios/include/palacios/vmm_dev_mgr.h
palacios/src/devices/8254.c
palacios/src/devices/8259a.c
palacios/src/devices/apic.c
palacios/src/devices/bochs_debug.c
palacios/src/devices/cga.c
palacios/src/devices/char_stream.c
palacios/src/devices/curses_cons.c
palacios/src/devices/disk_model.c
palacios/src/devices/filedisk.c
palacios/src/devices/generic.c
palacios/src/devices/i440fx.c
palacios/src/devices/ide.c
palacios/src/devices/io_apic.c
palacios/src/devices/keyboard.c
palacios/src/devices/lnx_virtio_balloon.c
palacios/src/devices/lnx_virtio_blk.c
palacios/src/devices/lnx_virtio_nic.c
palacios/src/devices/lnx_virtio_sym.c
palacios/src/devices/lnx_virtio_symmod.c
palacios/src/devices/lnx_virtio_vnet.c
palacios/src/devices/netdisk.c
palacios/src/devices/nic_bridge.c
palacios/src/devices/nvram.c
palacios/src/devices/os_debug.c
palacios/src/devices/pci.c
palacios/src/devices/piix3.c
palacios/src/devices/ramdisk.c
palacios/src/devices/serial.c
palacios/src/devices/telnet_cons.c
palacios/src/devices/tmpdisk.c
palacios/src/devices/vnet_nic.c
palacios/src/palacios/vmm.c
palacios/src/palacios/vmm_dev_mgr.c

index a0827fd..d2873c8 100644 (file)
@@ -325,6 +325,7 @@ void Init_V3(struct v3_os_hooks * hooks,  int num_cpus);
 struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name);
 int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask);
 int v3_stop_vm(struct v3_vm_info * vm);
+int v3_free_vm(struct v3_vm_info * vm);
 
 int v3_deliver_irq(struct v3_vm_info * vm, struct v3_interrupt * intr);
 
index f18664b..3e52d9a 100644 (file)
@@ -99,7 +99,7 @@ int v3_init_devices();
 
 
 struct v3_device_ops {
-    int (*free)(struct vm_device * dev);
+    int (*free)(void * private_data);
 
     //int (*save)(struct vm_device *dev, struct *iostream);
     //int (*restore)(struct vm_device *dev, struct *iostream);
index 5a78e93..e5498b9 100644 (file)
@@ -89,6 +89,8 @@ struct pit {
 
     struct v3_timer * timer;
 
+    struct v3_vm_info * vm;
+
     struct channel ch_0;
     struct channel ch_1;
     struct channel ch_2;
@@ -642,9 +644,9 @@ static void init_channel(struct channel * ch) {
 
 
 
-static int pit_free(struct vm_device * dev) {
-    struct pit * state = (struct pit *)dev->private_data;
-    struct guest_info * info = &(dev->vm->cores[0]);
+static int pit_free(void * private_data) {
+    struct pit * state = (struct pit *)private_data;
+    struct guest_info * info = &(state->vm->cores[0]);
 
 
     if (state->timer) {
@@ -657,7 +659,7 @@ static int pit_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = pit_free,
+    .free = (int (*)(void *))pit_free,
 
 
 };
index bbe6e39..69707b9 100644 (file)
@@ -721,8 +721,13 @@ static int write_elcr_port(struct guest_info * core, ushort_t port, void * src,
 
 
 
-static int pic_free(struct vm_device * dev) {
+static int pic_free(struct pic_internal * state) {
 
+
+    // unregister intr_controller
+    // unregister intr router
+
+    V3_Free(state);
     return 0;
 }
 
@@ -733,7 +738,7 @@ static int pic_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = pic_free,
+    .free = (int (*)(void *))pic_free,
 
 };
 
index 8e07132..3d7f792 100644 (file)
@@ -1462,14 +1462,15 @@ static struct v3_timer_ops timer_ops = {
 
 
 
-static int apic_free(struct vm_device * dev) {
-    struct apic_dev_state * apic_dev = (struct apic_dev_state *)dev->private_data;
+static int apic_free(struct apic_dev_state * apic_dev) {
     int i = 0;
+    struct v3_vm_info * vm = NULL;
 
-    for (i = 0; i < dev->vm->num_cores; i++) {
+    for (i = 0; i < apic_dev->num_apics; i++) {
        struct apic_state * apic = &(apic_dev->apics[i]);
-       struct guest_info * core = &(dev->vm->cores[i]);
+       struct guest_info * core = apic->core;
        
+       vm = core->vm_info;
 
        // unregister intr controller
 
@@ -1481,7 +1482,7 @@ static int apic_free(struct vm_device * dev) {
 
     }
 
-    v3_unhook_msr(dev->vm, BASE_ADDR_MSR);
+    v3_unhook_msr(vm, BASE_ADDR_MSR);
 
     V3_Free(apic_dev);
     return 0;
@@ -1489,7 +1490,7 @@ static int apic_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = apic_free,
+    .free = (int (*)(void *))apic_free,
 };
 
 
index c12c1f8..339999d 100644 (file)
@@ -113,11 +113,9 @@ static int handle_gen_write(struct guest_info * core, ushort_t port, void * src,
 
 
 
-static int debug_free(struct vm_device * dev) {
-    struct debug_state * state = dev->private_data;
+static int debug_free(struct debug_state * state) {
 
     V3_Free(state);
-
     return 0;
 };
 
@@ -125,7 +123,7 @@ static int debug_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = debug_free,
+    .free = (int (*)(void *))debug_free,
 
 };
 
index 10722dd..febc36e 100644 (file)
@@ -70,6 +70,8 @@ struct video_internal {
     // so we need a temp variable to hold the partial update
     uint16_t tmp_screen_offset; 
     
+    struct vm_device * dev;
+
 
     uint8_t passthrough;
 
@@ -307,14 +309,13 @@ int v3_cons_get_fb(struct vm_device * frontend_dev, uint8_t * dst, uint_t offset
 
 
 
-static int free_device(struct vm_device * dev) {
-    struct video_internal * video_state = (struct video_internal *)dev->private_data;
+static int free_device(struct video_internal * video_state) {
 
     if (video_state->framebuf_pa) {
        V3_FreePages((void *)(video_state->framebuf_pa), (FRAMEBUF_SIZE / 4096));
     }
 
-    v3_unhook_mem(dev->vm, V3_MEM_CORE_ANY, START_ADDR);
+    v3_unhook_mem(video_state->dev->vm, V3_MEM_CORE_ANY, START_ADDR);
 
 
     V3_Free(video_state);
@@ -324,7 +325,7 @@ static int free_device(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = free_device,
+    .free = (int (*)(void *))free_device,
 };
 
 static int cga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
@@ -345,6 +346,8 @@ static int cga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
        V3_Free(video_state);
        return -1;
     }
+  
+    video_state->dev = dev;
 
     video_state->framebuf_pa = (addr_t)V3_AllocPages(FRAMEBUF_SIZE / 4096);
     video_state->framebuf = V3_VAddr((void *)(video_state->framebuf_pa));
index be72399..2bf4841 100644 (file)
@@ -53,9 +53,7 @@ static int stream_write(uint8_t * buf, uint64_t length, void * private_data) {
     return v3_stream_write(state->stream, buf, length);
 }
 
-static int stream_free(struct vm_device * dev) {
-    struct stream_state * state = (struct stream_state *)(dev->private_data);
-
+static int stream_free(struct stream_state * state) {
     v3_stream_close(state->stream);
 
     // detach host event
@@ -67,7 +65,7 @@ static int stream_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = stream_free,
+    .free = (int (*)(void *))stream_free,
 };
 
 static int stream_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
index c4aba1d..2a96eb5 100644 (file)
@@ -161,9 +161,7 @@ static int scroll(int rows, void * private_data) {
 }
 
 
-static int cons_free(struct vm_device * dev) {
-    struct cons_state * state = (struct cons_state *)dev->private_data;
-
+static int cons_free(struct cons_state * state) {
     v3_console_close(state->cons);
 
     // remove host event
@@ -188,7 +186,7 @@ static struct v3_console_ops cons_ops = {
 };
 
 static struct v3_device_ops dev_ops = {
-    .free = cons_free,
+    .free = (int (*)(void *))cons_free,
 };
 
 static int cons_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) 
index c1d8836..b142547 100644 (file)
@@ -58,8 +58,12 @@ static uint64_t model_get_capacity(void * private_data) {
     return model->ops->get_capacity(model->private_data);
 }
 
-static int model_free(struct vm_device * dev) {
-    return -1;
+static int model_free(struct disk_state * model) {
+
+    // unhook from frontend
+
+    V3_Free(model);
+    return 0;
 }
 
 
@@ -73,7 +77,7 @@ static struct v3_dev_blk_ops blk_ops = {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = model_free,
+    .free = (int (*)(void *))model_free,
 };
 
 
index 001f1da..b007ace 100644 (file)
@@ -111,9 +111,7 @@ static struct v3_dev_blk_ops blk_ops = {
 
 
 
-static int disk_free(struct vm_device * dev) {
-    struct disk_state * disk = dev->private_data;
-
+static int disk_free(struct disk_state * disk) {
     v3_file_close(disk->fd);
     
     V3_Free(disk);
@@ -121,7 +119,7 @@ static int disk_free(struct vm_device * dev) {
 }
 
 static struct v3_device_ops dev_ops = {
-    .free = disk_free,
+    .free = (int (*)(void *))disk_free,
 };
 
 
index f10048d..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, 
 };
 
 
index f1fc628..6c587d3 100644 (file)
@@ -45,8 +45,7 @@ static int io_write(struct guest_info * core, ushort_t port, void * src, uint_t
 
 
 
-static int i440_free(struct vm_device * dev) {
-    struct i440_state * state = dev->private_data;
+static int i440_free(struct i440_state * state) {
 
     // unregister from PCI
 
@@ -56,7 +55,7 @@ static int i440_free(struct vm_device * dev) {
 }
 
 static struct v3_device_ops dev_ops = {
-    .free = i440_free,
+    .free = (int (*)(void *))i440_free,
 
 };
 
index 0af2198..6bc37fb 100644 (file)
@@ -1430,20 +1430,18 @@ static int init_ide_state(struct ide_internal * ide) {
 
 
 
-static int ide_free(struct vm_device * dev) {
-    // unhook io ports....
-
+static int ide_free(struct ide_internal * ide) {
 
     // deregister from PCI?
 
-
+    V3_Free(ide);
 
     return 0;
 }
 
 
 static struct v3_device_ops dev_ops = {
-    .free = ide_free,
+    .free = (int (*)(void *))ide_free,
 
 };
 
index 31169f4..b0e9584 100644 (file)
@@ -307,15 +307,20 @@ static struct intr_router_ops router_ops = {
 
 
 
-static int io_apic_free(struct vm_device * dev) {
-    //  struct guest_info * info = dev->vm;
+static int io_apic_free(struct io_apic_state * ioapic) {
+
+    // unregister intr router
+
+    // unhook memory
+
+    V3_Free(ioapic);
 
     return 0;
 }
 
 
 static struct v3_device_ops dev_ops = {
-    .free = io_apic_free,
+    .free = (int (*)(void *))io_apic_free,
 
 };
 
index 71bed11..2aa4bec 100644 (file)
@@ -957,8 +957,12 @@ static int keyboard_read_input(struct guest_info * core, ushort_t port, void * d
 
 
 
-static int keyboard_free(struct vm_device * dev) {
+static int keyboard_free(struct keyboard_internal * kbd) {
     
+
+    // unhook host events
+
+    V3_Free(kbd);
     return 0;
 }
 
@@ -1010,7 +1014,7 @@ static int keyboard_reset_device(struct keyboard_internal * kbd) {
 }
 
 static struct v3_device_ops dev_ops = { 
-    .free = keyboard_free,
+    .free = (int (*)(void *))keyboard_free,
 
 };
 
index 0bd5727..e936f9e 100644 (file)
@@ -77,9 +77,7 @@ struct virtio_balloon_state {
 };
 
 
-static int virtio_free(struct vm_device * dev) {
-    return -1;
-}
+
 
 static int virtio_reset(struct virtio_balloon_state * virtio) {
 
@@ -361,10 +359,17 @@ static int virtio_io_read(struct guest_info * core, uint16_t port, void * dst, u
 }
 
 
+static int virtio_free(struct virtio_balloon_state * virtio) {
+
+    // unregister from PCI
+
+    V3_Free(virtio);
+    return 0;
+}
 
 
 static struct v3_device_ops dev_ops = {
-    .free = virtio_free,
+    .free = (int (*)(void *))virtio_free,
 
 };
 
index bb29d9a..2c871d9 100644 (file)
@@ -104,9 +104,7 @@ struct virtio_blk_state {
 };
 
 
-static int virtio_free(struct vm_device * dev) {
-    return -1;
-}
+
 
 static int blk_reset(struct virtio_blk_state * virtio) {
 
@@ -473,10 +471,17 @@ static int virtio_io_read(struct guest_info * core, uint16_t port, void * dst, u
 }
 
 
+static int virtio_free(struct virtio_dev_state * virtio) {
+    
+    V3_Free(virtio);
+
+    return 0;
+}
+
 
 
 static struct v3_device_ops dev_ops = {
-    .free = virtio_free,
+    .free = (int (*)(void *))virtio_free,
 
 };
 
index fb5c18b..d0ac9a5 100644 (file)
@@ -115,11 +115,7 @@ struct virtio_net_state {
 #define ERR_VIRTIO_TXQ_DISABLED 6
 
 
-static int virtio_free(struct vm_device * dev) 
-{
-       
-    return 0;
-}
+
 
 static int virtio_init_state(struct virtio_net_state * virtio) 
 {
@@ -651,9 +647,17 @@ exit:
     return ret_val;
 }
 
+static int virtio_free(struct virtio_net_state * virtio) {
+       
+    // unregister from PCI
+
+    V3_Free(virtio);
+    return 0;
+}
+
 
 static struct v3_device_ops dev_ops = {
-    .free = virtio_free,
+    .free = (int (*)(void *))virtio_free,
 };
 
 
index b5ca9e8..f5b6501 100644 (file)
@@ -337,11 +337,18 @@ static int virtio_io_read(struct guest_info * core, uint16_t port, void * dst, u
 }
 
 
+int virtio_free(struct virtio_sym_state * virtio_state) {
+
+    // unregister from PCI
+
+    V3_Free(virtio_state);
+    return 0;
+}
 
    
 
 static struct v3_device_ops dev_ops = {
-    .free = NULL,
+    .free = (int (*)(void *))virtio_free,
 };
 
 
@@ -365,9 +372,11 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     memset(virtio_state, 0, sizeof(struct virtio_sym_state));
 
 
-    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
-    if (v3_attach_device(vm, dev) == -1) {
+    struct vm_device * dev = v3_add_device(vm, dev_id, &dev_ops, virtio_state);
+
+    if (dev == NULL) {
        PrintError("Could not attach device %s\n", dev_id);
+       V3_Free(virtio_state);
        return -1;
     }
 
@@ -415,6 +424,7 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
        if (!pci_dev) {
            PrintError("Could not register PCI Device\n");
+           v3_remove_device(dev);
            return -1;
        }
        
index d3d5d7e..993dcb6 100644 (file)
@@ -588,15 +588,16 @@ static int virtio_load_capsule(struct v3_vm_info * vm, struct v3_sym_capsule * m
 }
 
 
-static int virtio_free(struct vm_device * dev) 
-{
-       
+static int virtio_free(struct virtio_sym_state * virtio_state) {
+    // unregister from PCI
+
+    V3_Free(virtio_state);
     return 0;
 }
 
 
 static struct v3_device_ops dev_ops = {
-    .free = virtio_free,
+    .free = (int (*)(void *))virtio_free,
 };
 
 
index 7746bcc..9e10784 100644 (file)
@@ -562,12 +562,17 @@ static int vnet_virtio_io_read(struct guest_info * core,
 }
 
 
+static int virtio_free(struct virtio_vnet_state * vnet_state) {
+
+    // unregister from PCI
+
+    V3_Free(vnet_state);
+    return 0;
+}
+
 
 static struct v3_device_ops dev_ops = {
-    .free = NULL,
-    .reset = NULL,
-    .start = NULL,
-    .stop = NULL,
+    .free = (int (*)(void *))virtio_free,
 };
 
 static int dev_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
index 60f71ff..7121d4f 100644 (file)
@@ -210,12 +210,16 @@ static struct v3_dev_blk_ops blk_ops = {
 
 
 
-static int disk_free(struct vm_device * dev) {
+static int disk_free(struct disk_state * disk) {
+
+    v3_socket_close(disk->socket);
+
+    V3_Free(disk);
     return 0;
 }
 
 static struct v3_device_ops dev_ops = {
-    .free = disk_free,
+    .free = (int (*)(void *))disk_free,
 };
 
 
index 7cdf392..60f606f 100644 (file)
@@ -62,8 +62,7 @@ static int packet_input(struct v3_vm_info * vm,
 }
 
 
-static int vnet_nic_free(struct vm_device * dev) {
-    struct nic_bridge_state * bridge = dev->private_data;
+static int vnet_nic_free(struct nic_bridge_state * bridge) {
 
     /*detach from front device */
 
@@ -73,7 +72,7 @@ static int vnet_nic_free(struct vm_device * dev) {
 }
 
 static struct v3_device_ops dev_ops = {
-    .free = vnet_nic_free,
+    .free = (int (*)(void *))vnet_nic_free,
 
 };
 
index 38e9794..6fc974f 100644 (file)
@@ -743,7 +743,11 @@ static int nvram_write_data_port(struct guest_info * core, ushort_t port,
 
 
 
-static int nvram_free(struct vm_device * dev) {
+static int nvram_free(struct nvram_internal * nvram_state) {
+
+    // unregister host events
+
+    V3_Free(nvram_state);
     return 0;
 }
 
@@ -752,7 +756,7 @@ static int nvram_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {  
-    .free = nvram_free,
+    .free = (int (*)(void *))nvram_free,
 };
 
 
index b97da12..97cdabc 100644 (file)
@@ -81,8 +81,11 @@ static int handle_hcall(struct guest_info * info, uint_t hcall_id, void * priv_d
 
 
 
-static int debug_free(struct vm_device * dev) {
+static int debug_free(struct debug_state * state) {
 
+    // unregister hypercall
+
+    V3_Free(state);
     return 0;
 };
 
@@ -90,7 +93,7 @@ static int debug_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = debug_free,
+    .free = (int (*)(void *))debug_free,
 };
 
 
index 5a12909..04d56f3 100644 (file)
@@ -597,11 +597,6 @@ static int data_port_write(struct guest_info * core, ushort_t port, void * src,
 
 
 
-static int pci_free(struct vm_device * dev) {
-    
-    return 0;
-}
-
 
 
 static void init_pci_busses(struct pci_internal * pci_state) {
@@ -615,10 +610,17 @@ static void init_pci_busses(struct pci_internal * pci_state) {
 }
 
 
+static int pci_free(struct pci_internal * pci_state) {
+
+    // cleanup devices (?)
+    
+    V3_Free(pci_state);
+    return 0;
+}
 
 
 static struct v3_device_ops dev_ops = {
-    .free = pci_free,
+    .free = (int (*)(void *))pci_free,
 
 };
 
index 669d147..ab82bdb 100644 (file)
@@ -395,13 +395,17 @@ static int lower_pci_irq(struct pci_device * pci_dev, void * dev_data) {
 
 
 
-static int piix_free(struct vm_device * dev) {
+static int piix_free(struct v3_southbridge * piix3) {
+
+    // unregister pci
+
+    V3_Free(piix3);
     return 0;
 }
 
 
 static struct v3_device_ops dev_ops = {
-    .free = piix_free,
+    .free = (int (*)(void *))piix_free,
 };
 
 
index 5695bc4..4598707 100644 (file)
@@ -72,12 +72,14 @@ static struct v3_dev_blk_ops blk_ops = {
 
 
 
-static int disk_free(struct vm_device * dev) {
+static int disk_free(struct disk_state * state) {
+
+    V3_Free(state);
     return 0;
 }
 
 static struct v3_device_ops dev_ops = {
-    .free = disk_free,
+    .free = (int (*)(void *))disk_free,
 };
 
 
index e6adf3c..0035a7f 100644 (file)
@@ -834,7 +834,9 @@ static int read_status_port(struct guest_info * core, uint16_t port, void * dst,
     return length;
 }
 
-static int serial_free(struct vm_device * dev) {
+static int serial_free(struct serial_state * state) {
+
+    V3_Free(state);
     return 0;
 }
 
@@ -842,7 +844,7 @@ static int serial_free(struct vm_device * dev) {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = serial_free,
+    .free = (int (*)(void *))serial_free,
 };
 
 
index fc03c88..bd379cc 100644 (file)
@@ -392,13 +392,17 @@ static struct v3_console_ops cons_ops = {
     .scroll = scroll,
 };
 
-static int cons_free(struct vm_device * dev) {
-    return -1;
+static int cons_free(struct cons_state * state) {
+
+    // kill thread... ?
+
+    V3_Free(state);
+    return 0;
 }
 
 
 static struct v3_device_ops dev_ops = {
-    .free = cons_free,
+    .free = (int (*)(void *))cons_free,
 };
 
 
index 96bffef..0be279f 100644 (file)
@@ -73,8 +73,11 @@ static int blk_write(uint8_t * buf,  uint64_t lba, uint64_t num_bytes, void * pr
 }
 
 
-static int blk_free(struct vm_device * dev) {
-    return -1;
+static int blk_free(struct blk_state * blk) {
+    V3_FreePages((void *)blk->blk_base_addr, blk->capacity / 4096);
+
+    V3_Free(blk);
+    return 0;
 }
 
 
@@ -87,7 +90,7 @@ static struct v3_dev_blk_ops blk_ops = {
 
 
 static struct v3_device_ops dev_ops = {
-    .free = blk_free,
+    .free = (int (*)(void *))blk_free,
 
 };
 
index 4850d93..526da07 100644 (file)
@@ -117,12 +117,15 @@ static void stop_tx(void * private_data){
 }
 
 
-static int vnet_nic_free(struct vm_device * dev) {
+static int vnet_nic_free(struct vnet_nic_state * vnetnic) {
+    
+
+    V3_Free(vnetnic);
     return 0;
 }
 
 static struct v3_device_ops dev_ops = {
-    .free = vnet_nic_free,
+    .free = (int (*)(void *))vnet_nic_free,
 
 };
 
index 14d1963..65b4b49 100644 (file)
@@ -274,8 +274,17 @@ int v3_stop_vm(struct v3_vm_info * vm) {
 
     // Wait for all cores to enter CORE_STOPPED state
 
+
+
+    return 0;
+}
+
+
+int v3_free_vm(struct v3_vm_info * vm) {
     // deinitialize guest (free memory, etc...)
 
+    v3_dev_mgr_deinit(vm);
+
     return 0;
 }
 
index 70d0d5e..6f80ba9 100644 (file)
@@ -234,7 +234,7 @@ int v3_remove_device(struct vm_device * dev) {
     }
 
     if (dev->ops->free) {
-       dev->ops->free(dev);
+       dev->ops->free(dev->private_data);
     } else {
        PrintError("Error: %s free() not implemented\n",  dev->name);
     }