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.


296fe81981c24ed3d35376dce484242b4b84d9c5
[palacios.git] / palacios / include / palacios / vmm_events.h
1 /* 
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2012, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2012, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __VMM_EVENTS_H__
21 #define __VMM_EVENTS_H__
22
23 #ifdef __V3VEE__
24
25 #include <palacios/vmm_types.h>
26 #include <palacios/vmm_list.h>
27
28 struct guest_info;
29 struct v3_vm_info;
30
31 typedef enum { 
32                V3_EVENT_INVALID /* This entry must always be last */
33 } v3_event_type_t;
34
35
36 struct v3_event_map {
37     struct list_head * events; // array of events
38
39 };
40
41
42 int v3_init_events(struct v3_vm_info * vm);
43 int v3_deinit_events(struct v3_vm_info * vm);
44
45
46 struct v3_notifier {
47
48     v3_event_type_t event_type;
49
50     void (*notify)(struct guest_info * core, 
51                    v3_event_type_t event_type,
52                    void * priv_data, 
53                    void * event_data);
54     void * priv_data;
55     
56     struct list_head node;
57
58 };
59
60
61 struct v3_notifier * v3_subscribe_event(struct v3_vm_info * vm, 
62                                        v3_event_type_t event_type, 
63                                        void (*notify)(struct guest_info * core, 
64                                                       v3_event_type_t event_type,
65                                                       void * priv_data, 
66                                                       void * event_data),
67                                        void * priv_data, 
68                                        struct guest_info * current_core);
69
70 int v3_unsubscribe_event(struct v3_vm_info * vm, struct v3_notifier * notifier, 
71                          struct guest_info * current_core);
72
73
74
75 #include <palacios/vm_guest.h>
76
77 #ifdef __VM_EVENTS_H2___ /* Just ignore the man behind the curtain.... */
78
79 static void inline v3_dispatch_event(struct guest_info * core, 
80                                      v3_event_type_t event_type, 
81                                      void * event_data) {
82     struct v3_notifier * tmp_notifier = NULL;
83
84     if (event_type >= V3_EVENT_INVALID) {
85         PrintError("Tried to dispatch illegal event (%d)\n", event_type);
86         return;
87     }
88
89     list_for_each_entry(tmp_notifier, &(core->vm_info->event_map.events[event_type]), node) {
90         tmp_notifier->notify(core, event_type, tmp_notifier->priv_data, event_data);
91     }
92
93 }
94
95 #endif
96 #define __VM_EVENTS_H2___
97
98
99
100
101
102 #endif
103
104 #endif