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.


added copyright tags
[palacios.git] / palacios / src / palacios / vm_dev.c
1 /* Northwestern University */
2 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
3
4 #include <palacios/vm_dev.h>
5 #include <palacios/vmm.h>
6
7
8
9 struct vm_device * allocate_device() {
10
11   struct vm_device * dev = NULL;
12   dev = (struct vm_device*)V3_Malloc(sizeof(struct vm_device));
13
14   V3_ASSERT(dev != NULL);
15
16   dev->ops = NULL;
17   memset(dev->name, 0, 32);
18   dev->vm = NULL;
19   dev->private_data = NULL;
20
21
22   INIT_LIST_HEAD(&(dev->io_hooks));
23   dev->num_io_hooks = 0;
24
25   INIT_LIST_HEAD(&(dev->mem_hooks));
26   dev->num_mem_hooks = 0;
27   
28   INIT_LIST_HEAD(&(dev->irq_hooks));
29   dev->num_irq_hooks = 0;
30
31   return dev;
32 }
33
34 struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) {
35   struct vm_device * dev = allocate_device();
36
37   strncpy(dev->name, name, 32);
38   dev->ops = ops;
39   dev->private_data = private_data;
40
41   return dev;
42 }
43
44 void free_device(struct vm_device * dev) {
45   V3_Free(dev);
46 }
47