Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


add console hook support
[palacios.git] / palacios / include / palacios / vmm_console.h
1 /*
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
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.
14  *
15  * Author: Jack Lange <jarusl@cs.northwestern.edu>
16  * Author: Erik van der Kouwe <vdkouwe@cs.vu.nl>
17  *
18  * This is free software.  You are permitted to use,
19  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20  */
21
22
23 #ifndef __VMM_CONSOLE_H__
24 #define __VMM_CONSOLE_H__
25
26 #include <palacios/vmm.h>
27
28
29 #ifdef __V3VEE__
30
31 #define V3_TtyOpen(path, mode)                                          \
32     ({                                                                  \
33         extern struct v3_console_hooks *console_hooks;                          \
34         ((console_hooks) && (console_hooks)->tty_open) ?                                \
35             (console_hooks)->tty_open((path), (mode)) : NULL;           \
36     })
37
38 #define V3_TtyCursorSet(tty, x, y)                                      \
39     ({                                                                  \
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;              \
43     })
44
45 #define V3_TtyCharacterSet(tty, x, y, c, style)                         \
46     ({                                                                  \
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; \
50     })
51
52 #define V3_TtyScroll(tty, lines)                                        \
53     ({                                                                  \
54         extern struct v3_console_hooks *console_hooks;                          \
55         ((console_hooks) && (console_hooks)->tty_scroll) ?                      \
56             (console_hooks)->tty_scroll((tty), (lines)) : -1;           \
57     })
58
59 #define V3_TtyUpdate(tty)                                               \
60     ({                                                                  \
61         extern struct v3_console_hooks *console_hooks;                          \
62         ((console_hooks) && (console_hooks)->tty_update) ?                      \
63             (console_hooks)->tty_update((tty)) : -1;                            \
64     })
65
66 #endif
67
68 #define TTY_OPEN_MODE_READ      (1 << 0)
69 #define TTY_OPEN_MODE_WRITE     (1 << 1)
70
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);
74
75     /* set cursor position */
76     int (*tty_cursor_set)(void *tty, int x, int y);
77
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);
80
81     /* scroll the console down the specified number of lines */
82     int (*tty_scroll)(void *tty, int lines);
83
84     /* force update of console display; all updates by above functions
85      * may be defferred until the next tty_update call 
86      */
87     int (*tty_update)(void *tty);
88 };
89
90
91 extern void V3_Init_Console(struct v3_console_hooks * hooks);
92
93 #endif