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.


HVM updates to support apic partitioning
[palacios.releases.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   /* First event must be zero */
33   V3_EVENT_INVALID /* This entry must always be last */
34 } v3_event_type_t;
35
36
37 struct v3_event_map {
38     struct list_head * events; // array of events
39
40 };
41
42
43 int v3_init_events(struct v3_vm_info * vm);
44 int v3_deinit_events(struct v3_vm_info * vm);
45
46
47 struct v3_notifier {
48
49     v3_event_type_t event_type;
50
51     void (*notify)(struct guest_info * core, 
52                    v3_event_type_t event_type,
53                    void * priv_data, 
54                    void * event_data);
55     void * priv_data;
56     
57     struct list_head node;
58
59 };
60
61
62 struct v3_notifier * v3_subscribe_event(struct v3_vm_info * vm, 
63                                        v3_event_type_t event_type, 
64                                        void (*notify)(struct guest_info * core, 
65                                                       v3_event_type_t event_type,
66                                                       void * priv_data, 
67                                                       void * event_data),
68                                        void * priv_data, 
69                                        struct guest_info * current_core);
70
71 int v3_unsubscribe_event(struct v3_vm_info * vm, struct v3_notifier * notifier, 
72                          struct guest_info * current_core);
73
74
75
76 #include <palacios/vm_guest.h>
77
78 #ifdef __VM_EVENTS_H2___ /* Just ignore the man behind the curtain.... */
79
80 static void inline v3_dispatch_event(struct guest_info * core, 
81                                      v3_event_type_t event_type, 
82                                      void * event_data) {
83     struct v3_notifier * tmp_notifier = NULL;
84
85     if (event_type >= V3_EVENT_INVALID) {
86         PrintError(info->vm_info, info, "Tried to dispatch illegal event (%d)\n", event_type);
87         return;
88     }
89
90     list_for_each_entry(tmp_notifier, &(core->vm_info->event_map.events[event_type]), node) {
91         tmp_notifier->notify(core, event_type, tmp_notifier->priv_data, event_data);
92     }
93
94 }
95
96 #endif
97 #define __VM_EVENTS_H2___
98
99
100
101
102
103 #endif
104
105 #endif