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) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, 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 #include <palacios/vmm.h>
21 #include <palacios/vmm_muxer.h>
22 #include <palacios/vmm_list.h>
26 static struct v3_vm_info * foreground_vm = NULL;
28 // list of notification callbacks
29 static LIST_HEAD(cb_list);
33 struct list_head cb_node;
35 int (*focus_change)(struct v3_vm_info * old_vm, struct v3_vm_info * new_vm);
39 struct v3_vm_info * v3_get_foreground_vm() {
44 void v3_set_foreground_vm(struct v3_vm_info * vm) {
45 struct mux_callback * tmp_cb;
47 list_for_each_entry(tmp_cb, &(cb_list), cb_node) {
48 tmp_cb->focus_change(foreground_vm, vm);
55 int v3_add_mux_notification(int (*focus_change)(struct v3_vm_info * old_vm,
56 struct v3_vm_info * new_vm)) {
58 struct mux_callback * cb = (struct mux_callback *)V3_Malloc(sizeof(struct mux_callback));
60 cb->focus_change = focus_change;
62 list_add(&(cb->cb_node), &cb_list);