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 #ifndef __VMM_HOST_EVENTS_H__
21 #define __VMM_HOST_EVENTS_H__
24 struct v3_keyboard_event {
26 unsigned char scan_code;
29 struct v3_mouse_event {
30 unsigned char data[3];
33 struct v3_timer_event {
34 unsigned int period_us;
37 struct v3_serial_event {
38 unsigned char data[128];
42 struct v3_console_event {
46 struct v3_packet_event {
53 #include <palacios/vmm_list.h>
57 typedef enum { HOST_KEYBOARD_EVT,
61 HOST_SERIAL_EVT} v3_host_evt_type_t;
64 union v3_host_event_handler {
65 int (*keyboard_handler)(struct v3_vm_info * vm, struct v3_keyboard_event * evt, void * priv_data);
66 int (*mouse_handler)(struct v3_vm_info * vm, struct v3_mouse_event * evt, void * priv_data);
67 int (*timer_handler)(struct v3_vm_info * vm, struct v3_timer_event * evt, void * priv_data);
68 int (*serial_handler)(struct v3_vm_info * vm, struct v3_serial_event * evt, void * priv_data);
69 int (*console_handler)(struct v3_vm_info * vm, struct v3_console_event * evt, void * priv_data);
73 struct v3_host_event_hook {
74 union v3_host_event_handler cb;
76 struct list_head link;
81 struct v3_host_events {
82 struct list_head keyboard_events;
83 struct list_head mouse_events;
84 struct list_head timer_events;
85 struct list_head serial_events;
86 struct list_head console_events;
91 int v3_init_host_events(struct v3_vm_info * vm);
92 int v3_deinit_host_events(struct v3_vm_info * vm);
94 #define V3_HOST_EVENT_HANDLER(cb) ((union v3_host_event_handler)cb)
96 int v3_hook_host_event(struct v3_vm_info * vm,
97 v3_host_evt_type_t event_type,
98 union v3_host_event_handler cb,
101 #endif /* ! __V3VEE__ */
105 int v3_deliver_keyboard_event(struct v3_vm_info * vm, struct v3_keyboard_event * evt);
106 int v3_deliver_mouse_event(struct v3_vm_info * vm, struct v3_mouse_event * evt);
107 int v3_deliver_timer_event(struct v3_vm_info * vm, struct v3_timer_event * evt);
108 int v3_deliver_serial_event(struct v3_vm_info * vm, struct v3_serial_event * evt);
109 int v3_deliver_console_event(struct v3_vm_info * vm, struct v3_console_event * evt);