diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2011-09-16 00:48:07 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-09-16 08:25:57 -0500 |
commit | f81bdefb63243e82d16ce49332f7cf74d10b8f27 (patch) | |
tree | 41d10787574bb5a55805ee590ae7f7c52fbcd8e1 | |
parent | 2313e998d7bf55d02499ee162fb4558af4fbb3f5 (diff) |
console: Properly switch consoles for screen dumps
Do not mess with active_console, use console_select instead. This fixes
corrupt virtual monitor consoles after issuing the screendump command.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | console.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -115,6 +115,7 @@ typedef enum { /* ??? This is mis-named. It is used for both text and graphical consoles. */ struct TextConsole { + int index; console_type_t console_type; DisplayState *ds; /* Graphic console state. */ @@ -177,12 +178,15 @@ void vga_hw_screen_dump(const char *filename) TextConsole *previous_active_console; previous_active_console = active_console; - active_console = consoles[0]; + /* There is currently no way of specifying which screen we want to dump, so always dump the first one. */ - if (consoles[0] && consoles[0]->hw_screen_dump) + console_select(0); + if (consoles[0] && consoles[0]->hw_screen_dump) { consoles[0]->hw_screen_dump(consoles[0]->hw, filename); - active_console = previous_active_console; + } + + console_select(previous_active_console->index); } void vga_hw_text_update(console_ch_t *chardata) @@ -1247,6 +1251,7 @@ static TextConsole *new_console(DisplayState *ds, console_type_t console_type) s->ds = ds; s->console_type = console_type; if (console_type != GRAPHIC_CONSOLE) { + s->index = nb_consoles; consoles[nb_consoles++] = s; } else { /* HACK: Put graphical consoles before text consoles. */ @@ -1254,7 +1259,9 @@ static TextConsole *new_console(DisplayState *ds, console_type_t console_type) if (consoles[i - 1]->console_type == GRAPHIC_CONSOLE) break; consoles[i] = consoles[i - 1]; + consoles[i]->index = i; } + s->index = i; consoles[i] = s; nb_consoles++; } |