1 #include <palacios/vm_dev.h>
2 #include <palacios/vmm.h>
6 struct vm_device * allocate_device() {
8 struct vm_device * dev = NULL;
9 dev = (struct vm_device*)V3_Malloc(sizeof(struct vm_device));
11 V3_ASSERT(dev != NULL);
14 memset(dev->name, 0, 32);
16 dev->private_data = NULL;
19 INIT_LIST_HEAD(&(dev->io_hooks));
20 dev->num_io_hooks = 0;
22 INIT_LIST_HEAD(&(dev->mem_hooks));
23 dev->num_mem_hooks = 0;
25 INIT_LIST_HEAD(&(dev->irq_hooks));
26 dev->num_irq_hooks = 0;
31 struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) {
32 struct vm_device * dev = allocate_device();
34 strncpy(dev->name, name, 32);
36 dev->private_data = private_data;
41 void free_device(struct vm_device * dev) {