1 #include <palacios/vm_dev.h>
2 #include <palacios/vmm.h>
6 struct vm_device * allocate_device() {
8 struct vm_device * dev = NULL;
9 VMMMalloc(struct vm_device *, dev, sizeof(struct vm_device));
12 memset(dev->name, 0, 32);
14 dev->private_data = NULL;
17 INIT_LIST_HEAD(&(dev->io_hooks));
18 dev->num_io_hooks = 0;
20 INIT_LIST_HEAD(&(dev->mem_hooks));
21 dev->num_mem_hooks = 0;
23 INIT_LIST_HEAD(&(dev->irq_hooks));
24 dev->num_irq_hooks = 0;
29 struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) {
30 struct vm_device * dev = allocate_device();
32 strncpy(dev->name, name, 32);
34 dev->private_data = private_data;
39 void free_device(struct vm_device * dev) {