Skip to contentSkip to conversation

Add shared memory interface to QEMU

PATCH New Anthony Liguori 1 participant 1 message Jul 16, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add shared memory interface to QEMU

This is actually adds the shared memory interface to QEMU.

Regards,

Anthony Liguori

# HG changeset patch
# User [email protected]
# Node ID 0b4c6f94ee520884063f11f4631185368998cf9c
# Parent b9f2ce1d04dc160035f2a8c44fa400912b8a01fd
Add shared memory interface for external GUIs. The protocol is documented in README.shmem.

Makefile.target +1 -0
diff -r b9f2ce1d04dc -r 0b4c6f94ee52 Makefile.target
@@ -375,6 +375,7 @@
 VL_OBJS+=sdl.o
 endif
 VL_OBJS+=vnc.o
+VL_OBJS+=shmem.o
 ifdef CONFIG_COCOA
 VL_OBJS+=cocoa.o
 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
vl.c +20 -0
diff -r b9f2ce1d04dc -r 0b4c6f94ee52 vl.c
@@ -5221,6 +5221,7 @@
 #endif
            "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
 	   "-vnc display    start a VNC server on display\n"
+	   "-shmem dev      start the shared memory interface on char device 'dev'\n"
            "\n"
            "During emulation, the following keys are useful:\n"
            "ctrl-alt-f      toggle full screen\n"
@@ -5299,6 +5300,7 @@
     QEMU_OPTION_smp,
     QEMU_OPTION_vnc,
     QEMU_OPTION_no_acpi,
+    QEMU_OPTION_shmem,
 };
 
 typedef struct QEMUOption {
@@ -5370,6 +5372,7 @@
     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
     { "smp", HAS_ARG, QEMU_OPTION_smp },
     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
+    { "shmem", HAS_ARG, QEMU_OPTION_shmem },
     
     /* temporary options */
     { "usb", 0, QEMU_OPTION_usb },
@@ -5604,6 +5607,7 @@
     QEMUMachine *machine;
     char usb_devices[MAX_USB_CMDLINE][128];
     int usb_devices_index;
+    const char *shmem_path = 0;
 
     LIST_INIT (&vm_change_state_head);
 #ifndef _WIN32
@@ -6020,6 +6024,9 @@
             case QEMU_OPTION_no_acpi:
                 acpi_enabled = 0;
                 break;
+	    case QEMU_OPTION_shmem:
+		shmem_path = optarg;
+                break;
             }
         }
     }
@@ -6133,6 +6140,19 @@
         dumb_display_init(ds);
     } else if (vnc_display != -1) {
 	vnc_display_init(ds, vnc_display);
+    } else if (shmem_path) {
+	CharDriverState *s;
+
+	s = qemu_chr_open(shmem_path);
+	if (!s) {
+	    fprintf(stderr, "qemu: could not open shmem device '%s'\n", 
+		    shmem_path);
+	    exit(1);
+	}
+	if (!strcmp(shmem_path, "vc"))
+	    qemu_chr_printf(s, "shmem console\n");
+
+	shmem_display_init(ds, s);
     } else {
 #if defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
vl.h +3 -0
diff -r b9f2ce1d04dc -r 0b4c6f94ee52 vl.h
@@ -767,6 +767,9 @@
 /* vnc.c */
 void vnc_display_init(DisplayState *ds, int display);
 
+/* shmem.c */
+void shmem_display_init(DisplayState *ds, CharDriverState *s);
+
 /* ide.c */
 #define MAX_DISKS 4
 
README.shmem new file +96 -0

96 lines not on this page · raw message

shmem.c new file +249 -0

249 lines not on this page · raw message

shmem_keysym.h new file +277 -0

277 lines not on this page · raw message