#include <palacios/vmm.h>
#include <palacios/vmm_host_events.h>
#include <palacios/vm_guest.h>
+#include <palacios/vmm_muxer.h>
int v3_init_host_events(struct v3_vm_info * vm) {
struct v3_host_events * host_evts = &(vm->host_event_hooks);
int v3_deliver_keyboard_event(struct v3_vm_info * vm,
struct v3_keyboard_event * evt) {
- struct v3_host_events * host_evts = &(vm->host_event_hooks);
+ struct v3_host_events * host_evts = NULL;
struct v3_host_event_hook * hook = NULL;
+ if (vm == NULL) {
+ vm = v3_get_foreground_vm();
+ }
+
+ host_evts = &(vm->host_event_hooks);
+
if (vm->run_state != VM_RUNNING) {
return -1;
}
int v3_deliver_mouse_event(struct v3_vm_info * vm,
struct v3_mouse_event * evt) {
- struct v3_host_events * host_evts = &(vm->host_event_hooks);
+ struct v3_host_events * host_evts = NULL;
struct v3_host_event_hook * hook = NULL;
+ if (vm == NULL) {
+ vm = v3_get_foreground_vm();
+ }
+
+ host_evts = &(vm->host_event_hooks);
+
if (vm->run_state != VM_RUNNING) {
return -1;
}
int v3_deliver_timer_event(struct v3_vm_info * vm,
struct v3_timer_event * evt) {
- struct v3_host_events * host_evts = &(vm->host_event_hooks);
+ struct v3_host_events * host_evts = NULL;
struct v3_host_event_hook * hook = NULL;
+ if (vm == NULL) {
+ vm = v3_get_foreground_vm();
+ }
+
+ host_evts = &(vm->host_event_hooks);
+
if (vm->run_state != VM_RUNNING) {
return -1;
}