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) 2012, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2012, 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".
20 #ifndef __VMM_EVENTS_H__
21 #define __VMM_EVENTS_H__
25 #include <palacios/vmm_types.h>
26 #include <palacios/vmm_list.h>
32 /* First event must be zero */
33 V3_EVENT_INVALID /* This entry must always be last */
38 struct list_head * events; // array of events
43 int v3_init_events(struct v3_vm_info * vm);
44 int v3_deinit_events(struct v3_vm_info * vm);
49 v3_event_type_t event_type;
51 void (*notify)(struct guest_info * core,
52 v3_event_type_t event_type,
57 struct list_head node;
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,
69 struct guest_info * current_core);
71 int v3_unsubscribe_event(struct v3_vm_info * vm, struct v3_notifier * notifier,
72 struct guest_info * current_core);
76 #include <palacios/vm_guest.h>
78 #ifdef __VM_EVENTS_H2___ /* Just ignore the man behind the curtain.... */
80 static void inline v3_dispatch_event(struct guest_info * core,
81 v3_event_type_t event_type,
83 struct v3_notifier * tmp_notifier = NULL;
85 if (event_type >= V3_EVENT_INVALID) {
86 PrintError(info->vm_info, info, "Tried to dispatch illegal event (%d)\n", event_type);
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);
97 #define __VM_EVENTS_H2___