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) 2010, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2010, Erik van der Kouwe <vdkouwe@cs.vu.nl>
12 * Copyright (c) 2010, The V3VEE Project <http://www.v3vee.org>
13 * All rights reserved.
15 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * Author: Erik van der Kouwe <vdkouwe@cs.vu.nl>
18 * This is free software. You are permitted to use,
19 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
23 #ifndef __VMM_CONSOLE_H__
24 #define __VMM_CONSOLE_H__
26 #include <palacios/vmm.h>
31 #define V3_TtyOpen(path, mode) \
33 extern struct v3_console_hooks *console_hooks; \
34 ((console_hooks) && (console_hooks)->tty_open) ? \
35 (console_hooks)->tty_open((path), (mode)) : NULL; \
38 #define V3_TtyCursorSet(tty, x, y) \
40 extern struct v3_console_hooks *console_hooks; \
41 ((console_hooks) && (console_hooks)->tty_cursor_set) ? \
42 (console_hooks)->tty_cursor_set((tty), (x), (y)) : -1; \
45 #define V3_TtyCharacterSet(tty, x, y, c, style) \
47 extern struct v3_console_hooks *console_hooks; \
48 ((console_hooks) && (console_hooks)->tty_character_set) ? \
49 (console_hooks)->tty_character_set((tty), (x), (y), (c), (style)) : -1; \
52 #define V3_TtyScroll(tty, lines) \
54 extern struct v3_console_hooks *console_hooks; \
55 ((console_hooks) && (console_hooks)->tty_scroll) ? \
56 (console_hooks)->tty_scroll((tty), (lines)) : -1; \
59 #define V3_TtyUpdate(tty) \
61 extern struct v3_console_hooks *console_hooks; \
62 ((console_hooks) && (console_hooks)->tty_update) ? \
63 (console_hooks)->tty_update((tty)) : -1; \
68 #define TTY_OPEN_MODE_READ (1 << 0)
69 #define TTY_OPEN_MODE_WRITE (1 << 1)
71 struct v3_console_hooks {
72 /* open console device, mode is a combination of TTY_OPEN_MODE_* flags */
73 void *(*tty_open)(const char *path, int mode);
75 /* set cursor position */
76 int (*tty_cursor_set)(void *tty, int x, int y);
78 /* output character c with specified style at (x, y) */
79 int (*tty_character_set)(void *tty, int x, int y, char c, unsigned char style);
81 /* scroll the console down the specified number of lines */
82 int (*tty_scroll)(void *tty, int lines);
84 /* force update of console display; all updates by above functions
85 * may be defferred until the next tty_update call
87 int (*tty_update)(void *tty);
91 extern void V3_Init_Console(struct v3_console_hooks * hooks);