2 Interface to Nautilus screen and keyboard
5 #include <nautilus/nautilus.h>
6 #include <nautilus/printk.h>
7 #include <nautilus/cga.h>
11 #include <palacios/vmm.h>
13 #include <interfaces/vmm_console.h>
14 #include <palacios/vmm_host_events.h>
19 This is a gruesome hack to allow the VM designated by the
20 host as "the_vm" to do I/O to the standard VGA text mode console
25 static void * palacios_tty_open(void * private_data, unsigned int width, unsigned int height)
27 if (width!=80 || height!=25) {
28 ERROR("Console is wrong size\n");
31 INFO("Console connected\n");
36 static int palacios_tty_cursor_set(void * console, int x, int y)
46 static int palacios_tty_character_set(void * console, int x, int y, char c, unsigned char style)
49 term_putc(c,style,x,y);
56 static int palacios_tty_scroll(void * console, int lines)
60 for (i=0;i<lines;i++) {
70 static int palacios_set_text_resolution(void * console, int cols, int rows)
73 if (cols!=80 || rows!=25) {
74 ERROR("Cannot change resolution\n");
83 static int palacios_tty_update(void * console)
88 static void palacios_tty_close(void * console)
92 term_print("Palacios Console Finished\n");
96 static void kbd_callback(uint8_t scancode, uint8_t status)
98 struct v3_keyboard_event event = {status,scancode};
100 //INFO("kbd callback scancode=%x\n",scancode);
102 //INFO("Deliver scancode 0x%x\n",scancode);
103 v3_deliver_keyboard_event(the_vm, &event);
108 static struct v3_console_hooks palacios_console_hooks = {
109 .open = palacios_tty_open,
110 .set_cursor = palacios_tty_cursor_set,
111 .set_character = palacios_tty_character_set,
112 .scroll = palacios_tty_scroll,
113 .set_text_resolution = palacios_set_text_resolution,
114 .update = palacios_tty_update,
115 .close = palacios_tty_close,
120 int nautilus_console_init(void)
123 term_print("Palacios Console\n");
125 V3_Init_Console(&palacios_console_hooks);
127 kbd_register_callback(kbd_callback);
132 int nautilus_console_deinit(void)