From: Erik van der Kouwe Date: Tue, 13 Apr 2010 21:49:02 +0000 (-0500) Subject: This patch fixes several issues with the console/cga code: X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=c09d92dc256363c742ca2a4bef685ed79575bf22;hp=3b67b03716ad6bfdda5c95c8a0ef9004da1b3913 This patch fixes several issues with the console/cga code: - Fixes some #includes - Adds a missing prototype - Adds a missing return - Checks the length of screen updates to avoid sending updates for non- visible memory regions --- diff --git a/palacios/include/devices/console.h b/palacios/include/devices/console.h index 8484452..1040b95 100644 --- a/palacios/include/devices/console.h +++ b/palacios/include/devices/console.h @@ -34,6 +34,7 @@ struct v3_console_ops { int v3_cons_get_fb(struct vm_device * frontend_dev, uint8_t * dst, uint_t offset, uint_t length); +int v3_console_register_cga(struct vm_device * cga_dev, struct v3_console_ops * ops, void * private_data); #endif // ! __V3VEE__ diff --git a/palacios/src/devices/cga.c b/palacios/src/devices/cga.c index ee94f84..6c82c58 100644 --- a/palacios/src/devices/cga.c +++ b/palacios/src/devices/cga.c @@ -24,7 +24,7 @@ #include #include -#include +#include @@ -120,6 +120,7 @@ static int video_write_mem(addr_t guest_addr, void * dest, uint_t length, void * struct video_internal * state = (struct video_internal *)dev->private_data; uint_t fb_offset = guest_addr - START_ADDR; uint_t screen_byte_offset = state->screen_offset * BYTES_PER_COL; + uint_t screen_length; PrintDebug("Guest address: %p length = %d, fb_offset=%d, screen_offset=%d\n", (void *)guest_addr, length, fb_offset, screen_byte_offset); @@ -136,7 +137,11 @@ static int video_write_mem(addr_t guest_addr, void * dest, uint_t length, void * if (state->ops) { PrintDebug("\tcalling update_screen()\n"); - state->ops->update_screen(x, y, length, state->private_data); + + /* avoid updates past end of screen */ + screen_length = SCREEN_SIZE - screen_byte_offset; + if (screen_length > length) screen_length = length; + state->ops->update_screen(x, y, screen_length, state->private_data); } } diff --git a/palacios/src/devices/telnet_cons.c b/palacios/src/devices/telnet_cons.c index 8f71adf..d0c2b1f 100644 --- a/palacios/src/devices/telnet_cons.c +++ b/palacios/src/devices/telnet_cons.c @@ -29,8 +29,10 @@ #include #include -#include +#include +#if 0 #include +#endif #define NUM_ROWS 25 #define NUM_COLS 80 @@ -516,6 +518,8 @@ static int cons_server(void * arg) { state->connected = 0; V3_Close_Socket(state->client_fd); } + + return -1; }