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 #include <palacios/vmm_console.h>
24 #include <palacios/vmm.h>
25 #include <palacios/vmm_debug.h>
26 #include <palacios/vmm_types.h>
27 #include <palacios/vm_guest.h>
29 struct v3_console_hooks * console_hooks = 0;
31 v3_console_t v3_console_open(struct v3_vm_info * vm, uint32_t width, uint32_t height) {
32 V3_ASSERT(console_hooks != NULL);
33 V3_ASSERT(console_hooks->open != NULL);
35 return console_hooks->open(vm->host_priv_data, width, height);
38 void v3_console_close(v3_console_t cons) {
39 V3_ASSERT(console_hooks);
40 V3_ASSERT(console_hooks->close);
42 console_hooks->close(cons);
45 int v3_console_set_cursor(v3_console_t cons, int x, int y) {
46 V3_ASSERT(console_hooks != NULL);
47 V3_ASSERT(console_hooks->set_cursor != NULL);
49 return console_hooks->set_cursor(cons, x, y);
52 int v3_console_set_char(v3_console_t cons, int x, int y, char c, uint8_t style) {
53 V3_ASSERT(console_hooks != NULL);
54 V3_ASSERT(console_hooks->set_character != NULL);
56 return console_hooks->set_character(cons, x, y, c, style);
60 int v3_console_scroll(v3_console_t cons, int lines) {
61 V3_ASSERT(console_hooks != NULL);
62 V3_ASSERT(console_hooks->scroll != NULL);
64 return console_hooks->scroll(cons, lines);
68 int v3_console_update(v3_console_t cons) {
69 V3_ASSERT(console_hooks != NULL);
70 V3_ASSERT(console_hooks->update != NULL);
72 return console_hooks->update(cons);
75 void V3_Init_Console(struct v3_console_hooks * hooks) {
76 console_hooks = hooks;
77 PrintDebug("V3 console inited\n");