1 /* Northwestern University */
2 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
4 #include <palacios/vm_dev.h>
5 #include <palacios/vmm.h>
9 struct vm_device * allocate_device() {
11 struct vm_device * dev = NULL;
12 dev = (struct vm_device*)V3_Malloc(sizeof(struct vm_device));
14 V3_ASSERT(dev != NULL);
17 memset(dev->name, 0, 32);
19 dev->private_data = NULL;
22 INIT_LIST_HEAD(&(dev->io_hooks));
23 dev->num_io_hooks = 0;
25 INIT_LIST_HEAD(&(dev->mem_hooks));
26 dev->num_mem_hooks = 0;
28 INIT_LIST_HEAD(&(dev->irq_hooks));
29 dev->num_irq_hooks = 0;
34 struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) {
35 struct vm_device * dev = allocate_device();
37 strncpy(dev->name, name, 32);
39 dev->private_data = private_data;
44 void free_device(struct vm_device * dev) {