Skip to contentSkip to conversation

Patch for SDL framebuffer console problem

Qemu-devel Kitambi Leo 2 participants 4 messages Apr 24, 2007 – May 3, 2007

lore
Share & tools
lore
#0 lore raw

I've been using qemu using the Linux framebuffer console, on a machine that's a bit too slow to support X. There have been more than a few snags, but perhaps the most irritating one was that if qemu crashed (and received a SIGSEGV), it would leave the console in an unusable state. This would require me to log into the machine via ssh and reboot it remotely. I'm submitting a patch that installs a signal handler to call sdl_cleanup(), then exit. This has alleviated my problem with the system being left in an unusable state, however I suspect that the segfault problem lies somewhere in SDL itself, and not in qemu.

? sdl.c.diff
Index: sdl.c
===================================================================
RCS file: /sources/qemu/qemu/sdl.c,v
retrieving revision 1.37

sdl.c +12 -0
diff -u -r1.37 sdl.c
@@ -563,10 +563,17 @@
     SDL_Quit();
 }
 
+static void segv_exit(void)
+{
+	sdl_cleanup();
+	exit(255);
+}
+
 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
 {
     int flags;
     uint8_t data = 0;
+    struct sigaction act;
 
 #if defined(__APPLE__)
     /* always use generic keymaps */
@@ -582,6 +589,11 @@
     if (no_frame)
         gui_noframe = 1;
 
+    act.sa_flags = 0;
+    act.sa_handler = segv_exit;
+
+    sigaction(SIGSEGV, &act, NULL);
+
     flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
     if (SDL_Init (flags)) {
         fprintf(stderr, "Could not initialize SDL - exiting\n");
#1 lore raw
Quoted 5 lines · Kitambi Leo

I've been using qemu using the Linux framebuffer console, on a machine that's a bit too slow to support X. There have been more than a few snags, but perhaps the most irritating one was that if qemu crashed (and received a SIGSEGV), it would leave the console in an unusable state. This would require me to log into the machine via ssh and reboot it remotely.

Type "reset" and hit enter when this happens.

Rob

#2 lore raw

I did, of course, try this first. The keyboard doesn't work after qemu crashes. The ways I tried to fix this were:
1. "reset" (didn't work)
2. log in remotely and reboot (always works)
3. log in remotely and try "vga_reset", and "fbset 800x600-56" (the normal mode

Quoted 13 lines · Rob Landley
Quoted 2 lines · Kitambi Leo

I've been using qemu using the Linux framebuffer console, on a machine that's a bit too slow to support X. There have been more than a few

snags,

Quoted 1 line

but perhaps the most irritating one was that if qemu crashed (and received

a

Quoted 2 lines

SIGSEGV), it would leave the console in an unusable state. This would require me to log into the machine via ssh and reboot it remotely.

Type "reset" and hit enter when this happens.

Rob

#3 lore raw

I tried various combinations of fixing this problem before I wrote a patch. The keyboard is somehow trashed and/or disabled when qemu crashes in this manner. The methods I tried to fix it were:
1. "reset" - never works
2. log in remotely and reboot - always works
3. log in remotely and try various combinations of "vga_reset" and "fbset 800x600-56" - always works after I figured out the right order to run the commands in.

In the end, I couldn't find any acceptable solutions without a patch, since this is a laptop and I don't always have it connected to a network so I can bail myself out. I apologize for the duplicate message too, I accidently sent the last email without finishing it.

Quoted 23 lines · On 5/3/07, [email protected] <[email protected]> wrote:

I did, of course, try this first. The keyboard doesn't work after qemu crashes. The ways I tried to fix this were:
1. "reset" (didn't work)
2. log in remotely and reboot (always works)
3. log in remotely and try "vga_reset", and "fbset 800x600-56" (the normal mode

Quoted 5 lines · Rob Landley
Quoted 2 lines · Kitambi Leo

I've been using qemu using the Linux framebuffer console, on a machine that's a bit too slow to support X. There have been more than a few

snags,

Quoted 1 line

but perhaps the most irritating one was that if qemu crashed (and

received

Quoted 8 lines

a

Quoted 2 lines

SIGSEGV), it would leave the console in an unusable state. This would require me to log into the machine via ssh and reboot it remotely.

Type "reset" and hit enter when this happens.

Rob