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.


e5f699aadfab401dadae56e4a5ce487b1da66188
[palacios.git] / palacios / include / palacios / vm_dev.h
1 /* Northwestern University */
2 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
3
4 #ifndef __VM_DEV_H
5 #define __VM_DEV_H
6
7 #include <palacios/vmm_types.h>
8 #include <palacios/vmm_list.h>
9 #include <palacios/vmm_dev_mgr.h>
10
11 struct guest_info;
12
13
14 struct vm_device;
15
16
17 struct vm_device_ops {
18   int (*init)(struct vm_device *dev);
19   int (*deinit)(struct vm_device *dev);
20
21
22   int (*reset)(struct vm_device *dev);
23
24   int (*start)(struct vm_device *dev);
25   int (*stop)(struct vm_device *dev);
26
27
28   //int (*save)(struct vm_device *dev, struct *iostream);
29   //int (*restore)(struct vm_device *dev, struct *iostream);
30 };
31
32
33
34 struct vm_device {
35   char name[32];
36   
37   void *private_data;
38
39   struct vm_device_ops * ops;
40
41   struct guest_info * vm;
42
43   struct list_head dev_link;
44
45
46   uint_t num_io_hooks;
47   struct list_head io_hooks;
48   uint_t num_mem_hooks;
49   struct list_head mem_hooks;
50   uint_t num_irq_hooks;
51   struct list_head irq_hooks;
52
53 };
54
55
56
57 struct vm_device * allocate_device();
58 struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data);
59 void free_device(struct vm_device * dev);
60
61
62
63 int dev_hook_io(struct vm_device   *dev,
64                 ushort_t            port,
65                 int (*read)(ushort_t port, void * dst, uint_t length, struct vm_device * dev),
66                 int (*write)(ushort_t port, void * src, uint_t length, struct vm_device * dev));
67
68 int dev_unhook_io(struct vm_device   *dev,
69                   ushort_t            port);
70
71 int dev_hook_mem(struct vm_device   *dev,
72                  void               *start,
73                  void               *end);
74
75 int dev_unhook_mem(struct vm_device   * dev,
76                    void               * start,
77                    void               * end);
78
79
80 int dev_hook_irq(struct vm_device * dev,
81                  uint_t irq, 
82                  int (*handler)(uint_t irq, struct vm_device * dev));
83 int dev_unhook_irq(struct vm_device * dev, uint_t irq);
84
85
86 #endif