2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <palacios/vm_dev.h>
22 #include <palacios/vmm.h>
26 struct vm_device * allocate_device() {
28 struct vm_device * dev = NULL;
29 dev = (struct vm_device*)V3_Malloc(sizeof(struct vm_device));
31 V3_ASSERT(dev != NULL);
34 memset(dev->name, 0, 32);
36 dev->private_data = NULL;
39 INIT_LIST_HEAD(&(dev->io_hooks));
40 dev->num_io_hooks = 0;
42 INIT_LIST_HEAD(&(dev->mem_hooks));
43 dev->num_mem_hooks = 0;
45 INIT_LIST_HEAD(&(dev->irq_hooks));
46 dev->num_irq_hooks = 0;
51 struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) {
52 struct vm_device * dev = allocate_device();
54 strncpy(dev->name, name, 32);
56 dev->private_data = private_data;
61 void free_device(struct vm_device * dev) {