mailestone-2
[linux-based-stubdoms.git] / ioemu.patch
blob2d63d10bed4857334fe27bc32d74331b47c3e8fc
1 diff --git a/Makefile b/Makefile
2 index f3a03ad..1dd5f6b 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -47,7 +47,11 @@ config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
6 -include $(SUBDIR_DEVICES_MAK_DEP)
8 %/config-devices.mak: default-configs/%.mak
9 +ifneq ($(CONFIG_STUBDOM),y)
10 $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, " GEN $@")
11 +else
12 + $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ default-configs/stubdom.mak, " GEN $@")
13 +endif
14 @if test -f $@; then \
15 if cmp -s $@.old $@; then \
16 mv $@.tmp $@; \
17 diff --git a/Makefile.dis b/Makefile.dis
18 old mode 100644
19 new mode 100755
20 diff --git a/Makefile.hw b/Makefile.hw
21 old mode 100644
22 new mode 100755
23 diff --git a/Makefile.objs b/Makefile.objs
24 index 6991a9f..ecdced2 100644
25 --- a/Makefile.objs
26 +++ b/Makefile.objs
27 @@ -18,11 +18,11 @@ block-obj-y += nbd.o block.o aio.o aes.o qemu-config.o qemu-progress.o qemu-sock
28 block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
29 block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
31 -block-nested-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
32 -block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o
33 -block-nested-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
34 -block-nested-y += qed-check.o
35 -block-nested-y += parallels.o nbd.o blkdebug.o sheepdog.o blkverify.o
36 +block-nested-$(CONFIG_BLOCK_NESTED) += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
37 +block-nested-$(CONFIG_BLOCK_NESTED) += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o
38 +block-nested-$(CONFIG_BLOCK_NESTED) += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
39 +block-nested-$(CONFIG_BLOCK_NESTED) += qed-check.o
40 +block-nested-$(CONFIG_BLOCK_NESTED) += parallels.o nbd.o blkdebug.o sheepdog.o blkverify.o
41 block-nested-$(CONFIG_WIN32) += raw-win32.o
42 block-nested-$(CONFIG_POSIX) += raw-posix.o
43 block-nested-$(CONFIG_CURL) += curl.o
44 @@ -70,7 +70,7 @@ common-obj-y += $(oslib-obj-y)
45 common-obj-$(CONFIG_WIN32) += os-win32.o
46 common-obj-$(CONFIG_POSIX) += os-posix.o
48 -common-obj-y += tcg-runtime.o host-utils.o
49 +common-obj-$(CONFIG_TRANSLATE) += tcg-runtime.o host-utils.o
50 common-obj-y += irq.o ioport.o input.o
51 common-obj-$(CONFIG_PTIMER) += ptimer.o
52 common-obj-$(CONFIG_MAX7310) += max7310.o
53 @@ -94,22 +94,28 @@ common-obj-y += usb-serial.o usb-net.o usb-bus.o usb-desc.o
54 common-obj-$(CONFIG_SSI) += ssi.o
55 common-obj-$(CONFIG_SSI_SD) += ssi-sd.o
56 common-obj-$(CONFIG_SD) += sd.o
57 -common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
58 -common-obj-y += bt-hci-csr.o
59 -common-obj-y += buffered_file.o migration.o migration-tcp.o
60 +common-obj-$(CONFIG_BLUETOOTH) += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
61 +common-obj-$(CONFIG_BLUETOOTH) += bt-hci-csr.o
62 +common-obj-y += buffered_file.o
63 +common-obj-$(CONFIG_MIGRATION) += migration.o migration-tcp.o
64 common-obj-y += qemu-char.o savevm.o #aio.o
65 common-obj-y += msmouse.o ps2.o
66 common-obj-y += qdev.o qdev-properties.o
67 -common-obj-y += block-migration.o iohandler.o
68 +common-obj-y += iohandler.o
69 +common-obj-$(CONFIG_MIGRATION) += block-migration.o
70 common-obj-y += pflib.o
71 common-obj-y += bitmap.o bitops.o
73 common-obj-$(CONFIG_BRLAPI) += baum.o
74 +ifeq ($(CONFIG_MIGRATION),y)
75 common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
76 +endif
77 common-obj-$(CONFIG_WIN32) += version.o
79 common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o ui/spice-display.o spice-qemu-char.o
81 +common-obj-$(CONFIG_STUBDOM) += fbdev.o
83 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
84 audio-obj-$(CONFIG_SDL) += sdlaudio.o
85 audio-obj-$(CONFIG_OSS) += ossaudio.o
86 @@ -124,7 +130,7 @@ audio-obj-$(CONFIG_WINWAVE) += winwaveaudio.o
87 audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
88 audio-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
89 audio-obj-y += wavcapture.o
90 -common-obj-y += $(addprefix audio/, $(audio-obj-y))
91 +common-obj-$(CONFIG_AUDIO) += $(addprefix audio/, $(audio-obj-y))
93 ui-obj-y += keymaps.o
94 ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
95 @@ -163,7 +169,7 @@ common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o
97 user-obj-y =
98 user-obj-y += envlist.o path.o
99 -user-obj-y += tcg-runtime.o host-utils.o
100 +user-obj-$(CONFIG_TRANSLATE) += tcg-runtime.o host-utils.o
101 user-obj-y += cutils.o cache-utils.o
103 ######################################################################
104 @@ -178,7 +184,7 @@ hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o
105 hw-obj-$(CONFIG_PCI) += msix.o msi.o
106 hw-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o
107 hw-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o
108 -hw-obj-y += watchdog.o
109 +hw-obj-$(CONFIG_WATCHDOG) += watchdog.o
110 hw-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o
111 hw-obj-$(CONFIG_ECC) += ecc.o
112 hw-obj-$(CONFIG_NAND) += nand.o
113 @@ -229,7 +235,9 @@ hw-obj-$(CONFIG_PPCE500_PCI) += ppce500_pci.o
114 hw-obj-$(CONFIG_PIIX4) += piix4.o
116 # PCI watchdog devices
117 +ifeq ($(CONFIG_WATCHDOG),y)
118 hw-obj-$(CONFIG_PCI) += wdt_i6300esb.o
119 +endif
121 hw-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o
123 diff --git a/Makefile.target b/Makefile.target
124 old mode 100644
125 new mode 100755
126 index cde509b..301ce2e
127 --- a/Makefile.target
128 +++ b/Makefile.target
129 @@ -71,12 +71,16 @@ all: $(PROGS) stap
131 #########################################################
132 # cpu emulator library
133 +ifeq ($(CONFIG_TRANSLATE),y)
134 libobj-y = exec.o translate-all.o cpu-exec.o translate.o
135 libobj-y += tcg/tcg.o
136 +else
137 +libobj-y = exec.o translate-all-stub.o cpu-exec.o
138 +endif
139 libobj-y += fpu/softfloat.o
140 libobj-y += op_helper.o helper.o
141 ifeq ($(TARGET_BASE_ARCH), i386)
142 -libobj-y += cpuid.o
143 +libobj-$(CONFIG_TRANSLATE) += cpuid.o
144 endif
145 libobj-$(CONFIG_NEED_MMU) += mmu.o
146 libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
147 @@ -226,7 +230,8 @@ obj-i386-y += vga.o
148 obj-i386-y += mc146818rtc.o i8259.o pc.o
149 obj-i386-y += cirrus_vga.o sga.o apic.o ioapic.o piix_pci.o
150 obj-i386-y += vmport.o
151 -obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
152 +obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o
153 +obj-i386-$(CONFIG_WATCHDOG) += wdt_ib700.o
154 obj-i386-y += debugcon.o multiboot.o
155 obj-i386-y += pc_piix.o
156 obj-i386-$(CONFIG_KVM) += kvmclock.o
157 diff --git a/Makefile.user b/Makefile.user
158 old mode 100644
159 new mode 100755
160 diff --git a/arch_init.c b/arch_init.c
161 index 484b39d..96037c6 100644
162 --- a/arch_init.c
163 +++ b/arch_init.c
164 @@ -32,12 +32,18 @@
165 #include "monitor.h"
166 #include "sysemu.h"
167 #include "arch_init.h"
168 +#ifdef CONFIG_AUDIO
169 #include "audio/audio.h"
170 +#endif
171 #include "hw/pc.h"
172 #include "hw/pci.h"
173 +#ifdef CONFIG_AUDIO
174 #include "hw/audiodev.h"
175 +#endif
176 #include "kvm.h"
177 +#ifdef CONFIG_MIGRATION
178 #include "migration.h"
179 +#endif
180 #include "net.h"
181 #include "gdbstub.h"
182 #include "hw/smbios.h"
183 @@ -92,6 +98,7 @@ const uint32_t arch_type = QEMU_ARCH;
184 #define RAM_SAVE_FLAG_EOS 0x10
185 #define RAM_SAVE_FLAG_CONTINUE 0x20
187 +#ifdef CONFIG_MIGRATION
188 static int is_dup_page(uint8_t *page, uint8_t ch)
190 uint32_t val = ch << 24 | ch << 16 | ch << 8 | ch;
191 @@ -334,6 +341,7 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
193 return (stage == 2) && (expected_time <= migrate_max_downtime());
195 +#endif
197 static inline void *host_from_stream_offset(QEMUFile *f,
198 ram_addr_t offset,
199 @@ -365,6 +373,7 @@ static inline void *host_from_stream_offset(QEMUFile *f,
200 return NULL;
203 +#ifdef CONFIG_MIGRATION
204 int ram_load(QEMUFile *f, void *opaque, int version_id)
206 ram_addr_t addr;
207 @@ -456,6 +465,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
209 return 0;
211 +#endif
213 void qemu_service_io(void)
215 @@ -695,7 +705,7 @@ void do_smbios_option(const char *optarg)
217 void cpudef_init(void)
219 -#if defined(cpudef_setup)
220 +#if defined(cpudef_setup) && defined(CONFIG_TRANSLATE)
221 cpudef_setup(); /* parse cpu definitions in target config file */
222 #endif
224 diff --git a/configure b/configure
225 index e5ecec9..920a76d 100755
226 --- a/configure
227 +++ b/configure
228 @@ -179,6 +179,13 @@ smartcard=""
229 smartcard_nss=""
230 usb_redir=""
231 opengl=""
232 +stubdom="no"
233 +block_nested="yes"
234 +translate="yes"
235 +migration="yes"
236 +audio="yes"
237 +watchdog="yes"
238 +bluetooth="yes"
240 # parse CC options first
241 for opt do
242 @@ -748,6 +755,32 @@ for opt do
244 --enable-usb-redir) usb_redir="yes"
246 + --enable-stubdom) stubdom="yes"
247 + ;;
248 + --enable-block-nested) block_nested="yes"
249 + ;;
250 + --disable-block-nested) block_nested="no"
251 + ;;
252 + --enable-translate) translate="yes"
253 + ;;
254 + --disable-translate) translate="no"
255 + ;;
256 + --enable-migration) migration="yes"
257 + ;;
258 + --disable-migration) migration="no"
259 + ;;
260 + --enable-audio) audio="yes"
261 + ;;
262 + --disable-audio) audio="no"
263 + ;;
264 + --enable-watchdog) watchdog="yes"
265 + ;;
266 + --disable-watchdog) watchdog="no"
267 + ;;
268 + --enable-bluetooth) bluetooth="yes"
269 + ;;
270 + --disable-bluetooth) bluetooth="no"
271 + ;;
272 *) echo "ERROR: unknown option $opt"; show_help="yes"
274 esac
275 @@ -1025,6 +1058,19 @@ echo " --disable-smartcard-nss disable smartcard nss support"
276 echo " --enable-smartcard-nss enable smartcard nss support"
277 echo " --disable-usb-redir disable usb network redirection support"
278 echo " --enable-usb-redir enable usb network redirection support"
279 +echo " --enable-stubdom enable building the ioemu-stubdom"
280 +echo " --disable-block-nested disable block-nested support"
281 +echo " --enable-block-nested enable block-nested support"
282 +echo " --disable-translate disable translate support"
283 +echo " --enable-translate enable translate support"
284 +echo " --disable-migration disable migration support"
285 +echo " --enable-migration enable migration support"
286 +echo " --disable-audio disable audio support"
287 +echo " --enable-audio enable audio support"
288 +echo " --disable-watchdog disable watchdog support"
289 +echo " --enable-watchdog enable watchdog support"
290 +echo " --disable-bluetooth disable bluetooth support"
291 +echo " --enable-bluetooth enable bluetooth support"
292 echo ""
293 echo "NOTE: The object files are built at the place where configure is launched"
294 exit 1
295 @@ -1150,6 +1196,51 @@ else
296 hostlongbits=32
299 +if test "$stubdom" != "no"; then
300 + sdl="no"
301 + vnc="no"
302 + vnc_tls="no"
303 + vnc_sasl="no"
304 + vnc_jpeg="no"
305 + vnc_png="no"
306 + vnc_thread="no"
307 + slirp="yes"
308 + debug_tcg="no"
309 + debug_mon="no"
310 + sparse="no"
311 + strip_opt="no"
312 + uuid="no"
313 + vde="no"
314 + brlapi="no"
315 + bluez="no"
316 + kvm="no"
317 + spice="no"
318 + bsd_user="no"
319 + darwin_user="no"
320 + guest_base="no"
321 + user_pie="no"
322 + curses="no"
323 + curl="no"
324 + check_utests="no"
325 + nptl="no"
326 + linux_aio="no"
327 + attr="no"
328 + blobs="no"
329 + docs="no"
330 + vhost_net="no"
331 + opengl="no"
332 + rbd="no"
333 + smartcard="no"
334 + smartcard_nss="no"
335 + audio_drv_list=""
336 + audio_card_list=""
337 + block_nested="no"
338 + translate="no"
339 + migration="no"
340 + audio="no"
341 + watchdog="no"
342 + bluetooth="no"
345 ##########################################
346 # NPTL probe
347 @@ -2555,7 +2646,7 @@ if test "$softmmu" = yes ; then
348 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
349 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
350 tools="qemu-nbd\$(EXESUF) $tools"
351 - tools="qemu-ga\$(EXESUF) $tools"
352 +# tools="qemu-ga\$(EXESUF) $tools"
353 if [ "$check_utests" = "yes" ]; then
354 tools="check-qint check-qstring check-qdict check-qlist $tools"
355 tools="check-qfloat check-qjson $tools"
356 @@ -2564,6 +2655,7 @@ if test "$softmmu" = yes ; then
359 # Mac OS X ships with a broken assembler
360 +if test "$stubdom" = "no"; then
361 roms=
362 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
363 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
364 @@ -2573,6 +2665,7 @@ fi
365 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
366 roms="$roms spapr-rtas"
370 echo "Install prefix $prefix"
371 echo "BIOS directory `eval echo $datadir`"
372 @@ -2655,6 +2748,13 @@ echo "xfsctl support $xfs"
373 echo "nss used $smartcard_nss"
374 echo "usb net redir $usb_redir"
375 echo "OpenGL support $opengl"
376 +echo "Stubdom support" $stubdom
377 +echo "Block_nested support" $block_nested
378 +echo "Translate support" $translate
379 +echo "Migration support" $migration
380 +echo "Audio support" $audio
381 +echo "Watchdog support" $watchdog
382 +echo "Bluetooth support" $bluetooth
384 if test $sdl_too_old = "yes"; then
385 echo "-> Your SDL version is too old - please upgrade to have SDL support"
386 @@ -2970,6 +3070,41 @@ if test "$rbd" = "yes" ; then
387 echo "CONFIG_RBD=y" >> $config_host_mak
390 +# stubdom support
391 +if test "$stubdom" = "yes"; then
392 + echo "CONFIG_STUBDOM=y" >> $config_host_mak
395 +# Block_nested support
396 +if test "$block_nested" = "yes"; then
397 + echo "CONFIG_BLOCK_NESTED=y" >> $config_host_mak
400 +# Translate support
401 +if test "$translate" = "yes"; then
402 + echo "CONFIG_TRANSLATE=y" >> $config_host_mak
405 +# Migration support
406 +if test "$migration" = "yes"; then
407 + echo "CONFIG_MIGRATION=y" >> $config_host_mak
410 +# Audio support
411 +if test "$audio" = "yes"; then
412 + echo "CONFIG_AUDIO=y" >> $config_host_mak
415 +# Watchdog support
416 +if test "$watchdog" = "yes"; then
417 + echo "CONFIG_WATCHDOG=y" >> $config_host_mak
420 +# Bluetooth support
421 +if test "$bluetooth" = "yes"; then
422 + echo "CONFIG_BLUETOOTH=y" >> $config_host_mak
425 # USB host support
426 case "$usb" in
427 linux)
428 @@ -2996,7 +3131,9 @@ if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
430 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
432 -echo "TOOLS=$tools" >> $config_host_mak
433 +if test "$stubdom" = "no"; then
434 + echo "TOOLS=$tools" >> $config_host_mak
436 echo "ROMS=$roms" >> $config_host_mak
437 echo "MAKE=$make" >> $config_host_mak
438 echo "INSTALL=$install" >> $config_host_mak
439 @@ -3436,6 +3573,7 @@ alpha)
440 esac
442 if test "$target_softmmu" = "yes" ; then
443 + if test "$stubdom" = "no"; then
444 case "$TARGET_BASE_ARCH" in
445 arm)
446 cflags="-DHAS_AUDIO $cflags"
447 @@ -3447,6 +3585,7 @@ if test "$target_softmmu" = "yes" ; then
448 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
450 esac
451 + fi
454 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
455 diff --git a/console.h b/console.h
456 index 67d1373..5ef2111 100644
457 --- a/console.h
458 +++ b/console.h
459 @@ -164,7 +164,7 @@ struct DisplayChangeListener {
460 int w, int h, uint32_t c);
461 void (*dpy_text_cursor)(struct DisplayState *s, int x, int y);
463 - struct DisplayChangeListener *next;
464 + QLIST_ENTRY(DisplayChangeListener) next;
467 struct DisplayAllocator {
468 @@ -176,10 +176,9 @@ struct DisplayAllocator {
469 struct DisplayState {
470 struct DisplaySurface *surface;
471 void *opaque;
472 - struct QEMUTimer *gui_timer;
474 struct DisplayAllocator* allocator;
475 - struct DisplayChangeListener* listeners;
476 + QLIST_HEAD(, DisplayChangeListener) listeners;
478 void (*mouse_set)(int x, int y, int on);
479 void (*cursor_define)(QEMUCursor *cursor);
480 @@ -229,72 +228,81 @@ static inline int is_buffer_shared(DisplaySurface *surface)
482 static inline void register_displaychangelistener(DisplayState *ds, DisplayChangeListener *dcl)
484 - dcl->next = ds->listeners;
485 - ds->listeners = dcl;
486 + QLIST_INSERT_HEAD(&ds->listeners, dcl, next);
489 +static inline void unregister_displaychangelistener(DisplayChangeListener *dcl)
491 + QLIST_REMOVE(dcl, next);
494 static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
496 - struct DisplayChangeListener *dcl = s->listeners;
497 - while (dcl != NULL) {
498 + struct DisplayChangeListener *dcl;
499 + QLIST_FOREACH(dcl, &s->listeners, next) {
500 dcl->dpy_update(s, x, y, w, h);
501 - dcl = dcl->next;
505 static inline void dpy_resize(DisplayState *s)
507 - struct DisplayChangeListener *dcl = s->listeners;
508 - while (dcl != NULL) {
509 + struct DisplayChangeListener *dcl;
510 + QLIST_FOREACH(dcl, &s->listeners, next) {
511 dcl->dpy_resize(s);
512 - dcl = dcl->next;
516 static inline void dpy_setdata(DisplayState *s)
518 - struct DisplayChangeListener *dcl = s->listeners;
519 - while (dcl != NULL) {
520 - if (dcl->dpy_setdata) dcl->dpy_setdata(s);
521 - dcl = dcl->next;
522 + struct DisplayChangeListener *dcl;
523 + QLIST_FOREACH(dcl, &s->listeners, next) {
524 + if (dcl->dpy_setdata) {
525 + dcl->dpy_setdata(s);
530 static inline void dpy_refresh(DisplayState *s)
532 - struct DisplayChangeListener *dcl = s->listeners;
533 - while (dcl != NULL) {
534 - if (dcl->dpy_refresh) dcl->dpy_refresh(s);
535 - dcl = dcl->next;
536 + struct DisplayChangeListener *dcl;
537 + QLIST_FOREACH(dcl, &s->listeners, next) {
538 + if (dcl->dpy_refresh) {
539 + dcl->dpy_refresh(s);
544 static inline void dpy_copy(struct DisplayState *s, int src_x, int src_y,
545 - int dst_x, int dst_y, int w, int h) {
546 - struct DisplayChangeListener *dcl = s->listeners;
547 - while (dcl != NULL) {
548 - if (dcl->dpy_copy)
549 + int dst_x, int dst_y, int w, int h)
551 + struct DisplayChangeListener *dcl;
552 + QLIST_FOREACH(dcl, &s->listeners, next) {
553 + if (dcl->dpy_copy) {
554 dcl->dpy_copy(s, src_x, src_y, dst_x, dst_y, w, h);
555 - else /* TODO */
556 + }else{ /* TODO */
557 dcl->dpy_update(s, dst_x, dst_y, w, h);
558 - dcl = dcl->next;
563 static inline void dpy_fill(struct DisplayState *s, int x, int y,
564 - int w, int h, uint32_t c) {
565 - struct DisplayChangeListener *dcl = s->listeners;
566 - while (dcl != NULL) {
567 - if (dcl->dpy_fill) dcl->dpy_fill(s, x, y, w, h, c);
568 - dcl = dcl->next;
569 + int w, int h, uint32_t c)
571 + struct DisplayChangeListener *dcl;
572 + QLIST_FOREACH(dcl, &s->listeners, next) {
573 + if (dcl->dpy_fill) {
574 + dcl->dpy_fill(s, x, y, w, h, c);
579 -static inline void dpy_cursor(struct DisplayState *s, int x, int y) {
580 - struct DisplayChangeListener *dcl = s->listeners;
581 - while (dcl != NULL) {
582 - if (dcl->dpy_text_cursor) dcl->dpy_text_cursor(s, x, y);
583 - dcl = dcl->next;
584 +static inline void dpy_cursor(struct DisplayState *s, int x, int y)
586 + struct DisplayChangeListener *dcl;
587 + QLIST_FOREACH(dcl, &s->listeners, next) {
588 + if (dcl->dpy_text_cursor) {
589 + dcl->dpy_text_cursor(s, x, y);
594 @@ -365,6 +373,10 @@ void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
595 /* sdl.c */
596 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
598 +/* fbdev.c */
599 +void fbdev_display_init(DisplayState *ds, const char *device);
600 +void fbdev_display_uninit(void);
602 /* cocoa.m */
603 void cocoa_display_init(DisplayState *ds, int full_screen);
605 diff --git a/cpus.c b/cpus.c
606 index 6bf4e3f..6b8d7f5 100644
607 --- a/cpus.c
608 +++ b/cpus.c
609 @@ -1170,7 +1170,7 @@ int64_t cpu_get_icount(void)
610 void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
612 /* XXX: implement xxx_cpu_list for targets that still miss it */
613 -#if defined(cpu_list_id)
614 +#if defined(cpu_list_id) && defined(CONFIG_TRANSLATE)
615 cpu_list_id(f, cpu_fprintf, optarg);
616 #elif defined(cpu_list)
617 cpu_list(f, cpu_fprintf); /* deprecated */
618 diff --git a/default-configs/stubdom.mak b/default-configs/stubdom.mak
619 new file mode 100644
620 index 0000000..745118a
621 --- /dev/null
622 +++ b/default-configs/stubdom.mak
623 @@ -0,0 +1,37 @@
624 +CONFIG_PCI=y
625 +CONFIG_VIRTIO_PCI=n
626 +CONFIG_VIRTIO=n
627 +CONFIG_USB_UHCI=y
628 +CONFIG_USB_OHCI=n
629 +CONFIG_NE2000_PCI=n
630 +CONFIG_EEPRO100_PCI=n
631 +CONFIG_PCNET_PCI=y
632 +CONFIG_PCNET_COMMON=y
633 +CONFIG_LSI_SCSI_PCI=n
634 +CONFIG_RTL8139_PCI=y
635 +CONFIG_E1000_PCI=y
636 +CONFIG_IDE_CORE=y
637 +CONFIG_IDE_QDEV=y
638 +CONFIG_IDE_PCI=y
639 +CONFIG_AHCI=n
640 +CONFIG_VGA_PCI=y
641 +CONFIG_VGA_ISA=n
642 +CONFIG_VMWARE_VGA=n
643 +CONFIG_VMMOUSE=n
644 +CONFIG_SERIAL=n
645 +CONFIG_PARALLEL=n
646 +CONFIG_I8254=y
647 +CONFIG_PCSPK=n
648 +CONFIG_PCKBD=y
649 +CONFIG_FDC=y
650 +CONFIG_ACPI=y
651 +CONFIG_APM=y
652 +CONFIG_DMA=y
653 +CONFIG_IDE_ISA=y
654 +CONFIG_IDE_PIIX=y
655 +CONFIG_NE2000_ISA=n
656 +CONFIG_PIIX_PCI=y
657 +CONFIG_SOUND=n
658 +CONFIG_HPET=y
659 +CONFIG_APPLESMC=n
661 diff --git a/exec.c b/exec.c
662 index bfc9a43..9f1d0e9 100644
663 --- a/exec.c
664 +++ b/exec.c
665 @@ -576,8 +576,10 @@ void cpu_exec_init_all(unsigned long tb_size)
666 #if !defined(CONFIG_USER_ONLY) || !defined(CONFIG_USE_GUEST_BASE)
667 /* There's no guest base to take into account, so go ahead and
668 initialize the prologue now. */
669 +#ifdef CONFIG_TRANSLATE
670 tcg_prologue_init(&tcg_ctx);
671 #endif
672 +#endif
675 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
676 @@ -4724,7 +4726,9 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
677 cpu_fprintf(f, "TB flush count %d\n", tb_flush_count);
678 cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count);
679 cpu_fprintf(f, "TLB flush count %d\n", tlb_flush_count);
680 +#ifdef CONFIG_TRANSLATE
681 tcg_dump_info(f, cpu_fprintf);
682 +#endif
685 #define MMUSUFFIX _cmmu
686 diff --git a/fbdev.c b/fbdev.c
687 new file mode 100644
688 index 0000000..c876b11
689 --- /dev/null
690 +++ b/fbdev.c
691 @@ -0,0 +1,958 @@
693 + * linux fbdev output driver.
695 + * Author: Gerd Hoffmann <kra...@redhat.com>
697 + * This work is licensed under the terms of the GNU GPL, version 2. See
698 + * the COPYING file in the top-level directory.
700 + */
701 +#include <stdio.h>
702 +#include <stdlib.h>
703 +#include <stdbool.h>
704 +#include <string.h>
705 +#include <unistd.h>
706 +#include <fcntl.h>
707 +#include <signal.h>
708 +#include <termios.h>
710 +#include <sys/ioctl.h>
711 +#include <sys/mman.h>
713 +#include <linux/kd.h>
714 +#include <linux/vt.h>
715 +#include <linux/fb.h>
716 +#include <linux/input.h>
718 +#include "qemu-common.h"
719 +#include "console.h"
720 +#include "ui/keymaps.h"
721 +#include "sysemu.h"
722 +#include "pflib.h"
723 +#include "hw/xen_common.h"
725 +/* -------------------------------------------------------------------- */
727 +/* file handles */
728 +static int tty = -1, fb = -1, mice = -1;
730 +/* saved state, for restore on exit */
731 +static int orig_vtno = 0;
732 +static int kd_omode;
733 +static struct vt_mode vt_omode;
734 +static struct fb_var_screeninfo fb_ovar;
736 +/* framebuffer */
737 +static struct fb_fix_screeninfo fb_fix;
738 +static struct fb_var_screeninfo fb_var;
739 +static uint8_t *fb_mem;
740 +static int fb_mem_offset = 0;
741 +#define FB_ACTIVATE_ALL 64
743 +#define KEY_CNT (KEY_MAX+1)
744 +/* linux console */
745 +static int vtno;
746 +static struct vt_mode vt_mode;
747 +static struct termios tty_attributes;
748 +static unsigned long tty_mode;
749 +static unsigned int tty_flags;
750 +static bool tty_mediumraw;
751 +static bool key_down[KEY_CNT];
753 +/* console switching */
754 +#define SIG_ACQ (SIGRTMIN+6)
755 +#define SIG_REL (SIGRTMIN+7)
756 +#define FB_ACTIVE 0
757 +#define FB_REL_REQ 1
758 +#define FB_INACTIVE 2
759 +#define FB_ACQ_REQ 3
760 +static int fb_switch_state = FB_ACTIVE;
762 +/* qdev windup */
763 +static DisplayChangeListener *dcl;
764 +static QemuPfConv *conv;
765 +static PixelFormat fbpf;
766 +static int resize_screen;
767 +static int redraw_screen;
768 +static int cx, cy, cw, ch;
769 +static int debug = 0;
770 +static Notifier exit_notifier;
772 +/* fwd decls */
773 +static int fbdev_activate_vt(int tty, int vtno, bool wait);
775 +/* -------------------------------------------------------------------- */
776 +/* mouse */
778 +static void read_mouse(void *opaque)
780 + char buf[3];
781 + int rc, x, y, b;
783 + rc = read(mice, buf, sizeof(buf));
784 + if (rc != sizeof(buf))
785 + return;
787 + if (fb_switch_state != FB_ACTIVE)
788 + return;
790 + x = buf[1];
791 + y = -buf[2];
792 + b = buf[0] & 0x7;
794 + if (kbd_mouse_is_absolute()) {
795 + static int ax, ay;
796 + ax += x; ay += y;
797 + if (ax < 0)
798 + ax = 0;
799 + if (ay < 0)
800 + ay = 0;
801 + if (ax >= cw)
802 + ax = cw-1;
803 + if (ay >= ch)
804 + ay = ch-1;
805 + kbd_mouse_event(ax * 0x7FFF / cw, ay * 0x7FFF / ch, 0, b);
806 + } else {
807 + kbd_mouse_event(x, y, 0, b);
811 +static int init_mouse(void)
813 + mice = open("/dev/input/mice", O_RDONLY);
814 + if (-1 == mice)
815 + return -1;
816 + qemu_set_fd_handler(mice, read_mouse, NULL, NULL);
817 + return 0;
820 +static void uninit_mouse(void)
822 + if (-1 == mice)
823 + return;
824 + qemu_set_fd_handler(mice, NULL, NULL, NULL);
825 + close(mice);
826 + mice = -1;
829 +/* -------------------------------------------------------------------- */
830 +/* keyboard */
832 +static const char *keynames[] = {
833 +#include "linux-keynames.h"
836 +static int scancode_map[KEY_CNT] = {
837 + [ KEY_ESC ] = 0x01,
838 + [ KEY_1 ] = 0x02,
839 + [ KEY_2 ] = 0x03,
840 + [ KEY_3 ] = 0x04,
841 + [ KEY_4 ] = 0x05,
842 + [ KEY_5 ] = 0x06,
843 + [ KEY_6 ] = 0x07,
844 + [ KEY_7 ] = 0x08,
845 + [ KEY_8 ] = 0x09,
846 + [ KEY_9 ] = 0x0a,
847 + [ KEY_0 ] = 0x0b,
848 + [ KEY_MINUS ] = 0x0c,
849 + [ KEY_EQUAL ] = 0x0d,
850 + [ KEY_BACKSPACE ] = 0x0e,
852 + [ KEY_TAB ] = 0x0f,
853 + [ KEY_Q ] = 0x10,
854 + [ KEY_W ] = 0x11,
855 + [ KEY_E ] = 0x12,
856 + [ KEY_R ] = 0x13,
857 + [ KEY_T ] = 0x14,
858 + [ KEY_Y ] = 0x15,
859 + [ KEY_U ] = 0x16,
860 + [ KEY_I ] = 0x17,
861 + [ KEY_O ] = 0x18,
862 + [ KEY_P ] = 0x19,
863 + [ KEY_LEFTBRACE ] = 0x1a,
864 + [ KEY_RIGHTBRACE ] = 0x1b,
865 + [ KEY_ENTER ] = 0x1c,
867 + [ KEY_A ] = 0x1e,
868 + [ KEY_S ] = 0x1f,
869 + [ KEY_D ] = 0x20,
870 + [ KEY_F ] = 0x21,
871 + [ KEY_G ] = 0x22,
872 + [ KEY_H ] = 0x23,
873 + [ KEY_J ] = 0x24,
874 + [ KEY_K ] = 0x25,
875 + [ KEY_L ] = 0x26,
876 + [ KEY_SEMICOLON ] = 0x27,
877 + [ KEY_APOSTROPHE ] = 0x28,
878 + [ KEY_GRAVE ] = 0x29,
879 + [ KEY_LEFTSHIFT ] = 0x2a,
880 + [ KEY_BACKSLASH ] = 0x2b,
882 + [ KEY_Z ] = 0x2c,
883 + [ KEY_X ] = 0x2d,
884 + [ KEY_C ] = 0x2e,
885 + [ KEY_V ] = 0x2f,
886 + [ KEY_B ] = 0x30,
887 + [ KEY_N ] = 0x31,
888 + [ KEY_M ] = 0x32,
889 + [ KEY_COMMA ] = 0x33,
890 + [ KEY_DOT ] = 0x34,
891 + [ KEY_SLASH ] = 0x35,
892 + [ KEY_RIGHTSHIFT ] = 0x36,
893 + [ KEY_SPACE ] = 0x39,
895 + [ KEY_F1 ] = 0x3b,
896 + [ KEY_F2 ] = 0x3c,
897 + [ KEY_F3 ] = 0x3d,
898 + [ KEY_F4 ] = 0x3e,
899 + [ KEY_F5 ] = 0x3f,
900 + [ KEY_F6 ] = 0x40,
901 + [ KEY_F7 ] = 0x41,
902 + [ KEY_F8 ] = 0x42,
903 + [ KEY_F9 ] = 0x43,
904 + [ KEY_F10 ] = 0x44,
905 + [ KEY_F11 ] = 0x57,
906 + [ KEY_F12 ] = 0x58,
908 + [ KEY_SYSRQ ] = 0xb7,
909 + [ KEY_SCROLLLOCK ] = 0x46,
910 +// [ KEY_PAUSE ] = FIXME,
911 + [ KEY_CAPSLOCK ] = 0x3a,
912 + [ KEY_102ND ] = 0x56,
914 + [ KEY_LEFTCTRL ] = 0x1d,
915 + [ KEY_LEFTMETA ] = 0xdb,
916 + [ KEY_LEFTALT ] = 0x38,
917 + [ KEY_RIGHTALT ] = 0xb8,
918 + [ KEY_RIGHTMETA ] = 0xdc,
919 + [ KEY_RIGHTCTRL ] = 0x9d,
920 + [ KEY_COMPOSE ] = 0xdd,
922 + [ KEY_INSERT ] = 0xd2,
923 + [ KEY_DELETE ] = 0xd3,
924 + [ KEY_HOME ] = 0xc7,
925 + [ KEY_END ] = 0xcf,
926 + [ KEY_PAGEUP ] = 0xc9,
927 + [ KEY_PAGEDOWN ] = 0xd1,
929 + [ KEY_UP ] = 0xc8,
930 + [ KEY_LEFT ] = 0xcb,
931 + [ KEY_RIGHT ] = 0xcd,
932 + [ KEY_DOWN ] = 0xd0,
934 + [ KEY_NUMLOCK ] = 0x45,
935 + [ KEY_KPSLASH ] = 0xb5,
936 + [ KEY_KPASTERISK ] = 0x37,
937 + [ KEY_KP7 ] = 0x47,
938 + [ KEY_KP8 ] = 0x48,
939 + [ KEY_KP9 ] = 0x49,
940 + [ KEY_KPMINUS ] = 0x4a,
941 + [ KEY_KP4 ] = 0x4b,
942 + [ KEY_KP5 ] = 0x4c,
943 + [ KEY_KP6 ] = 0x4d,
944 + [ KEY_KPPLUS ] = 0x4e,
945 + [ KEY_KP1 ] = 0x4f,
946 + [ KEY_KP2 ] = 0x50,
947 + [ KEY_KP3 ] = 0x51,
948 + [ KEY_KP0 ] = 0x52,
949 + [ KEY_KPDOT ] = 0x53,
950 + [ KEY_KPENTER ] = 0x9c,
953 +static struct keysym_map {
954 + int normal, shifted;
955 +} keysym_map_en_us[KEY_CNT] = {
956 + [ KEY_A ] = { .normal = 'a', .shifted = 'A' },
957 + [ KEY_B ] = { .normal = 'b', .shifted = 'B' },
958 + [ KEY_C ] = { .normal = 'c', .shifted = 'C' },
959 + [ KEY_D ] = { .normal = 'd', .shifted = 'D' },
960 + [ KEY_E ] = { .normal = 'e', .shifted = 'E' },
961 + [ KEY_F ] = { .normal = 'f', .shifted = 'F' },
962 + [ KEY_G ] = { .normal = 'g', .shifted = 'G' },
963 + [ KEY_H ] = { .normal = 'h', .shifted = 'H' },
964 + [ KEY_I ] = { .normal = 'i', .shifted = 'I' },
965 + [ KEY_J ] = { .normal = 'j', .shifted = 'J' },
966 + [ KEY_K ] = { .normal = 'k', .shifted = 'K' },
967 + [ KEY_L ] = { .normal = 'l', .shifted = 'L' },
968 + [ KEY_M ] = { .normal = 'm', .shifted = 'M' },
969 + [ KEY_N ] = { .normal = 'n', .shifted = 'N' },
970 + [ KEY_O ] = { .normal = 'o', .shifted = 'O' },
971 + [ KEY_P ] = { .normal = 'p', .shifted = 'P' },
972 + [ KEY_Q ] = { .normal = 'q', .shifted = 'Q' },
973 + [ KEY_R ] = { .normal = 'r', .shifted = 'R' },
974 + [ KEY_S ] = { .normal = 's', .shifted = 'S' },
975 + [ KEY_T ] = { .normal = 't', .shifted = 'T' },
976 + [ KEY_U ] = { .normal = 'u', .shifted = 'U' },
977 + [ KEY_V ] = { .normal = 'v', .shifted = 'V' },
978 + [ KEY_W ] = { .normal = 'w', .shifted = 'W' },
979 + [ KEY_X ] = { .normal = 'x', .shifted = 'X' },
980 + [ KEY_Y ] = { .normal = 'y', .shifted = 'Y' },
981 + [ KEY_Z ] = { .normal = 'z', .shifted = 'Z' },
983 + [ KEY_1 ] = { .normal = '1', .shifted = '!' },
984 + [ KEY_2 ] = { .normal = '2', .shifted = '@' },
985 + [ KEY_3 ] = { .normal = '3', .shifted = '#' },
986 + [ KEY_4 ] = { .normal = '4', .shifted = '$' },
987 + [ KEY_5 ] = { .normal = '5', .shifted = '%' },
988 + [ KEY_6 ] = { .normal = '6', .shifted = '^' },
989 + [ KEY_7 ] = { .normal = '7', .shifted = '&' },
990 + [ KEY_8 ] = { .normal = '8', .shifted = '*' },
991 + [ KEY_9 ] = { .normal = '9', .shifted = '(' },
992 + [ KEY_0 ] = { .normal = '0', .shifted = ')' },
994 + [ KEY_MINUS ] = { .normal = '-', .shifted = '_' },
995 + [ KEY_EQUAL ] = { .normal = '=', .shifted = '+' },
996 + [ KEY_TAB ] = { .normal = '\t' },
997 + [ KEY_LEFTBRACE ] = { .normal = '[', .shifted = '{' },
998 + [ KEY_RIGHTBRACE ] = { .normal = ']', .shifted = '}' },
999 + [ KEY_ENTER ] = { .normal = '\n', },
1000 + [ KEY_SEMICOLON ] = { .normal = ';', .shifted = ':' },
1001 + [ KEY_APOSTROPHE ] = { .normal = '"', .shifted = '\'' },
1002 + [ KEY_BACKSLASH ] = { .normal = '\\', .shifted = '|' },
1003 + [ KEY_COMMA ] = { .normal = ',', .shifted = '<' },
1004 + [ KEY_DOT ] = { .normal = '.', .shifted = '>' },
1005 + [ KEY_SLASH ] = { .normal = '/', .shifted = '?' },
1006 + [ KEY_SPACE ] = { .normal = ' ' },
1008 + [ KEY_BACKSPACE ] = { .normal = QEMU_KEY_BACKSPACE },
1009 + [ KEY_UP ] = { .normal = QEMU_KEY_UP },
1010 + [ KEY_DOWN ] = { .normal = QEMU_KEY_DOWN },
1011 + [ KEY_LEFT ] = { .normal = QEMU_KEY_LEFT },
1012 + [ KEY_RIGHT ] = { .normal = QEMU_KEY_RIGHT },
1015 +static void start_mediumraw(int tty)
1017 + struct termios tattr;
1019 + if (tty_mediumraw)
1020 + return;
1021 + if (debug)
1022 + fprintf(stderr, "%s\n", __FUNCTION__);
1024 + /* save state */
1025 + tcgetattr(tty, &tty_attributes);
1026 + ioctl(tty, KDGKBMODE, &tty_mode);
1027 + tty_flags = fcntl(tty, F_GETFL, NULL);
1029 + /* setup */
1030 + tattr = tty_attributes;
1031 + tattr.c_cflag &= ~(IXON|IXOFF);
1032 + tattr.c_lflag &= ~(ICANON|ECHO|ISIG);
1033 + tattr.c_iflag = 0;
1034 + tattr.c_cc[VMIN] = 1;
1035 + tattr.c_cc[VTIME] = 0;
1036 + tcsetattr(tty, TCSAFLUSH, &tattr);
1037 + ioctl(tty, KDSKBMODE, K_MEDIUMRAW);
1038 + fcntl(tty, F_SETFL, tty_flags | O_NONBLOCK);
1040 + tty_mediumraw = true;
1043 +static void stop_mediumraw(int tty)
1045 + if (!tty_mediumraw)
1046 + return;
1047 + if (debug)
1048 + fprintf(stderr, "%s\n", __FUNCTION__);
1050 + /* restore state */
1051 + tcsetattr(tty, TCSANOW, &tty_attributes);
1052 + ioctl(tty, KDSKBMODE, tty_mode);
1053 + fcntl(tty, F_SETFL, tty_flags);
1055 + tty_mediumraw = false;
1058 +static void send_scancode(int keycode, int up)
1060 + int scancode = scancode_map[keycode];
1062 + if (!scancode) {
1063 + fprintf(stderr, "%s: unmapped key: 0x%x %s\n",
1064 + __FUNCTION__, keycode, keynames[keycode]);
1065 + return;
1067 + if (scancode & SCANCODE_GREY)
1068 + kbd_put_keycode(SCANCODE_EMUL0);
1069 + if (up) {
1070 + kbd_put_keycode(scancode | SCANCODE_UP);
1071 + } else {
1072 + kbd_put_keycode(scancode & SCANCODE_KEYCODEMASK);
1076 +static void send_keysym(int keycode, int shift)
1078 + struct keysym_map *keysym_map = keysym_map_en_us;
1079 + int keysym;
1081 + if (shift && keysym_map[keycode].shifted) {
1082 + keysym = keysym_map[keycode].shifted;
1083 + } else if (keysym_map[keycode].normal) {
1084 + keysym = keysym_map[keycode].normal;
1085 + } else {
1086 + fprintf(stderr, "%s: unmapped key: 0x%x %s\n",
1087 + __FUNCTION__, keycode, keynames[keycode]);
1088 + return;
1090 + kbd_put_keysym(keysym);
1093 +static void reset_keys(void)
1095 + int keycode;
1097 + for (keycode = 0; keycode < KEY_MAX; keycode++) {
1098 + if (key_down[keycode]) {
1099 + if (is_graphic_console())
1100 + send_scancode(keycode, 1);
1101 + key_down[keycode] = false;
1106 +static void read_mediumraw(void *opaque)
1108 + uint8_t buf[32];
1109 + int i, rc, up, keycode;
1110 + bool ctrl, alt, shift;
1112 + rc = read(tty, buf, sizeof(buf));
1113 + switch (rc) {
1114 + case -1:
1115 + perror("read tty");
1116 + goto err;
1117 + case 0:
1118 + fprintf(stderr, "%s: eof\n", __FUNCTION__);
1119 + goto err;
1120 + default:
1121 + for (i = 0; i < rc; i++) {
1122 + up = buf[i] & 0x80;
1123 + keycode = buf[i] & 0x7f;
1124 + if (keycode == 0) {
1125 + keycode = (buf[i+1] & 0x7f) << 7;
1126 + keycode |= buf[i+2] & 0x7f;
1127 + i += 2;
1129 + if (keycode > KEY_MAX) {
1130 + continue;
1133 + if (up) {
1134 + if (!key_down[keycode]) {
1135 + continue;
1137 + key_down[keycode] = false;
1138 + } else {
1139 + key_down[keycode] = true;
1142 + if (debug)
1143 + fprintf(stderr, "%s: 0x%x %s %s\n", __FUNCTION__,
1144 + keycode, keynames[keycode], up ? "up" : "down");
1146 + alt = key_down[KEY_LEFTALT] || key_down[KEY_RIGHTALT];
1147 + ctrl = key_down[KEY_LEFTCTRL] || key_down[KEY_RIGHTCTRL];
1148 + shift = key_down[KEY_LEFTSHIFT] || key_down[KEY_RIGHTSHIFT];
1150 + if (ctrl && alt && !up) {
1151 + if (keycode == KEY_ESC) {
1152 + fprintf(stderr, "=== fbdev emergency escape (ctrl-alt-esc) ===\n");
1153 + exit(1);
1155 + if (keycode >= KEY_F1 && keycode <= KEY_F10) {
1156 + fbdev_activate_vt(tty, keycode+1-KEY_F1, false);
1157 + key_down[keycode] = false;
1158 + continue;
1160 + if (keycode >= KEY_1 && keycode <= KEY_9) {
1161 + console_select(keycode-KEY_1);
1162 + reset_keys();
1163 + continue;
1167 + if (is_graphic_console()) {
1168 + send_scancode(keycode, up);
1169 + } else if (!up) {
1170 + send_keysym(keycode, shift);
1174 + return;
1176 +err:
1177 + exit(1);
1180 +/* -------------------------------------------------------------------- */
1182 +static void fbdev_cls(void)
1184 + memset(fb_mem+fb_mem_offset, 0, fb_fix.line_length * fb_var.yres);
1187 +static int fbdev_activate_vt(int tty, int vtno, bool wait)
1189 + if (debug) {
1190 + fprintf(stderr, "%s: %d (%s)\n", __FUNCTION__,
1191 + vtno, wait ? "wait" : "nowait");
1194 + if (ioctl(tty,VT_ACTIVATE, vtno) < 0) {
1195 + perror("ioctl VT_ACTIVATE");
1196 + return -1;
1198 + if (wait) {
1199 + if (ioctl(tty,VT_WAITACTIVE, vtno) < 0) {
1200 + perror("ioctl VT_WAITACTIVE");
1201 + return -1;
1203 + if (debug) {
1204 + fprintf(stderr, "%s: finished\n", __FUNCTION__);
1207 + return 0;
1210 +static void fbdev_cleanup(void)
1212 + if (debug)
1213 + fprintf(stderr, "%s\n", __FUNCTION__);
1215 + /* restore console */
1216 + if (fb != -1) {
1217 + if (ioctl(fb,FBIOPUT_VSCREENINFO, &fb_ovar) < 0)
1218 + perror("ioctl FBIOPUT_VSCREENINFO");
1219 + close(fb);
1220 + fb = -1;
1223 + if (tty != -1) {
1224 + stop_mediumraw(tty);
1225 + if (ioctl(tty,KDSETMODE, kd_omode) < 0)
1226 + perror("ioctl KDSETMODE");
1227 + if (ioctl(tty,VT_SETMODE, &vt_omode) < 0)
1228 + perror("ioctl VT_SETMODE");
1229 + if (orig_vtno)
1230 + fbdev_activate_vt(tty, orig_vtno, true);
1231 + qemu_set_fd_handler(tty, NULL, NULL, NULL);
1232 + close(tty);
1233 + tty = -1;
1237 +static int fbdev_init(const char *device)
1239 + struct vt_stat vts;
1240 + unsigned long page_mask;
1241 + char ttyname[32];
1243 + /* open framebuffer */
1244 + if (device == NULL) {
1245 + device = getenv("FRAMEBUFFER");
1247 + if (device == NULL) {
1248 + device = "/dev/fb0";
1250 + fb = open(device, O_RDWR);
1251 + if (fb == -1) {
1252 + fprintf(stderr, "open %s: %s\n", device, strerror(errno));
1253 + return -1;
1256 + /* open virtual console */
1257 + tty = 0;
1258 + if (ioctl(tty, VT_GETSTATE, &vts) < 0) {
1259 + fprintf(stderr, "Not started from virtual terminal, trying to open one.\n");
1261 + snprintf(ttyname, sizeof(ttyname), "/dev/tty0");
1262 + tty = open(ttyname, O_RDWR);
1263 + if (tty == -1) {
1264 + fprintf(stderr, "open %s: %s\n", ttyname, strerror(errno));
1265 + exit(1);
1267 + if (ioctl(tty,VT_OPENQRY, &vtno) < 0) {
1268 + perror("ioctl VT_OPENQRY");
1269 + exit(1);
1271 + if (ioctl(tty,VT_GETSTATE, &vts) < 0) {
1272 + perror("ioctl VT_GETSTATE\n");
1273 + exit(1);
1275 + close(tty);
1277 + snprintf(ttyname, sizeof(ttyname), "/dev/tty%d", vtno);
1278 + tty = open(ttyname, O_RDWR);
1279 + if (tty == -1) {
1280 + fprintf(stderr, "open %s: %s\n", ttyname, strerror(errno));
1281 + exit(1);
1283 + orig_vtno = vts.v_active;
1284 + } else {
1285 + orig_vtno = 0;
1286 + vtno = vts.v_active;
1288 + fbdev_activate_vt(tty, vtno, true);
1290 + /* get current settings (which we have to restore) */
1291 + if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_ovar) < 0) {
1292 + perror("ioctl FBIOGET_VSCREENINFO");
1293 + return -1;
1295 + if (ioctl(tty, KDGETMODE, &kd_omode) < 0) {
1296 + perror("ioctl KDGETMODE");
1297 + return -1;
1299 + if (ioctl(tty, VT_GETMODE, &vt_omode) < 0) {
1300 + perror("ioctl VT_GETMODE");
1301 + return -1;
1304 + /* checks & initialisation */
1305 + if (ioctl(fb,FBIOGET_FSCREENINFO,&fb_fix) < 0) {
1306 + perror("ioctl FBIOGET_FSCREENINFO");
1307 + goto err;
1309 + if (ioctl(fb,FBIOGET_VSCREENINFO,&fb_var) < 0) {
1310 + perror("ioctl FBIOGET_VSCREENINFO");
1311 + goto err;
1313 + if (fb_fix.type != FB_TYPE_PACKED_PIXELS) {
1314 + fprintf(stderr, "can handle only packed pixel frame buffers\n");
1315 + goto err;
1317 + switch (fb_var.bits_per_pixel) {
1318 + case 32:
1319 + break;
1320 + default:
1321 + fprintf(stderr, "can't handle %d bpp frame buffers\n",
1322 + fb_var.bits_per_pixel);
1323 + goto err;
1326 + page_mask = getpagesize()-1;
1327 + fb_mem_offset = (unsigned long)(fb_fix.smem_start) & page_mask;
1328 + fb_mem = mmap(NULL,fb_fix.smem_len+fb_mem_offset,
1329 + PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);
1330 + if (fb_mem == MAP_FAILED) {
1331 + perror("mmap");
1332 + goto err;
1335 + /* move viewport to upper left corner */
1336 + if (fb_var.xoffset != 0 || fb_var.yoffset != 0) {
1337 + fb_var.xoffset = 0;
1338 + fb_var.yoffset = 0;
1339 + if (ioctl(fb,FBIOPAN_DISPLAY,&fb_var) < 0) {
1340 + perror("ioctl FBIOPAN_DISPLAY");
1341 + goto err;
1344 + if (ioctl(tty,KDSETMODE, KD_GRAPHICS) < 0) {
1345 + perror("ioctl KDSETMODE");
1346 + goto err;
1348 + /* some fb drivers need this again after switching to graphics ... */
1349 + fbdev_activate_vt(tty, vtno, true);
1351 + fbdev_cls();
1353 + start_mediumraw(tty);
1354 + qemu_set_fd_handler(tty, read_mediumraw, NULL, NULL);
1356 + /* create PixelFormat from fbdev structs */
1357 + fbpf.bits_per_pixel = fb_var.bits_per_pixel;
1358 + fbpf.bytes_per_pixel = (fb_var.bits_per_pixel+7)/8;
1359 + fbpf.depth = fb_var.bits_per_pixel == 32 ? 24 : fb_var.bits_per_pixel;
1360 + fbpf.rshift = fb_var.red.offset;
1361 + fbpf.rbits = fb_var.red.length;
1362 + fbpf.gshift = fb_var.green.offset;
1363 + fbpf.gbits = fb_var.green.length;
1364 + fbpf.bshift = fb_var.blue.offset;
1365 + fbpf.bbits = fb_var.blue.length;
1366 + fbpf.ashift = fb_var.transp.offset;
1367 + fbpf.abits = fb_var.transp.length;
1369 + if (fbpf.rbits) {
1370 + fbpf.rmax = (1 << fbpf.rbits) - 1;
1371 + fbpf.rmask = fbpf.rmax << fbpf.rshift;
1373 + if (fbpf.gbits) {
1374 + fbpf.gmax = (1 << fbpf.gbits) - 1;
1375 + fbpf.gmask = fbpf.gmax << fbpf.gshift;
1377 + if (fbpf.bbits) {
1378 + fbpf.bmax = (1 << fbpf.bbits) - 1;
1379 + fbpf.bmask = fbpf.bmax << fbpf.bshift;
1381 + if (fbpf.abits) {
1382 + fbpf.amax = (1 << fbpf.abits) - 1;
1383 + fbpf.amask = fbpf.amax << fbpf.ashift;
1386 + return 0;
1388 + err:
1389 + fbdev_cleanup();
1390 + return -1;
1393 +static void
1394 +fbdev_catch_fatal_signal(int signal)
1396 + fbdev_cleanup();
1397 + abort();
1400 +static void fbdev_catch_exit_signals(void)
1402 + struct sigaction act,old;
1404 + memset(&act,0,sizeof(act));
1405 + act.sa_handler = fbdev_catch_fatal_signal;
1406 + sigemptyset(&act.sa_mask);
1407 + sigaction(SIGSEGV,&act,&old);
1410 +/* -------------------------------------------------------------------- */
1411 +/* console switching */
1413 +static void fbdev_switch_signal(int signal)
1415 + if (signal == SIG_REL) {
1416 + /* release */
1417 + if (debug)
1418 + fprintf(stderr, "%s: release request\n", __FUNCTION__);
1419 + fb_switch_state = FB_REL_REQ;
1421 + if (signal == SIG_ACQ) {
1422 + /* acquisition */
1423 + if (debug)
1424 + fprintf(stderr, "%s: aquire request\n", __FUNCTION__);
1425 + fb_switch_state = FB_ACQ_REQ;
1429 +static void fbdev_switch_release(void)
1431 + if (debug)
1432 + fprintf(stderr, "%s\n", __FUNCTION__);
1433 + stop_mediumraw(tty);
1434 + ioctl(tty, VT_RELDISP, 1);
1435 + fb_switch_state = FB_INACTIVE;
1438 +static void fbdev_switch_acquire(void)
1440 + if (debug)
1441 + fprintf(stderr, "%s\n", __FUNCTION__);
1442 + ioctl(tty, VT_RELDISP, VT_ACKACQ);
1443 + start_mediumraw(tty);
1444 + reset_keys();
1445 + fb_switch_state = FB_ACTIVE;
1448 +static int fbdev_switch_init(void)
1450 + struct sigaction act,old;
1452 + memset(&act,0,sizeof(act));
1453 + act.sa_handler = fbdev_switch_signal;
1454 + sigemptyset(&act.sa_mask);
1455 + sigaction(SIG_REL,&act,&old);
1456 + sigaction(SIG_ACQ,&act,&old);
1458 + if (ioctl(tty, VT_GETMODE, &vt_mode) < 0) {
1459 + perror("ioctl VT_GETMODE");
1460 + exit(1);
1462 + vt_mode.mode = VT_PROCESS;
1463 + vt_mode.waitv = 0;
1464 + vt_mode.relsig = SIG_REL;
1465 + vt_mode.acqsig = SIG_ACQ;
1467 + if (ioctl(tty, VT_SETMODE, &vt_mode) < 0) {
1468 + perror("ioctl VT_SETMODE");
1469 + exit(1);
1471 + return 0;
1474 +/* -------------------------------------------------------------------- */
1475 +/* rendering */
1477 +static void fbdev_render(DisplayState *ds, int x, int y, int w, int h)
1479 + uint8_t *dst;
1480 + uint8_t *src;
1481 + int line;
1483 + if (!conv)
1484 + return;
1486 + src = ds_get_data(ds) + y * ds_get_linesize(ds)
1487 + + x * ds_get_bytes_per_pixel(ds);
1488 + dst = fb_mem + y * fb_fix.line_length
1489 + + x * fbpf.bytes_per_pixel;
1491 + dst += cy * fb_fix.line_length;
1492 + dst += cx * fbpf.bytes_per_pixel;
1494 + if (h > fb_var.yres - y) {
1495 + h = fb_var.yres - y;
1497 + if (w > fb_var.xres - x) {
1498 + w = fb_var.xres - x;
1501 + for (line = y; line < y+h; line++) {
1502 + qemu_pf_conv_run(conv, dst, src, w);
1503 + dst += fb_fix.line_length;
1504 + src += ds_get_linesize(ds);
1508 +/* -------------------------------------------------------------------- */
1509 +/* qemu interfaces */
1511 +static void fbdev_update(DisplayState *ds, int x, int y, int w, int h)
1513 + unsigned long page_mask;
1515 + if (fb_switch_state != FB_ACTIVE)
1516 + return;
1518 + if (resize_screen) {
1519 + if (debug)
1520 + fprintf(stderr, "%s: handle resize\n", __FUNCTION__);
1521 + resize_screen = 0;
1522 + cx = 0; cy = 0;
1523 +#if 0
1524 + cx = cw = ds_get_width(ds);
1525 + cy = ch = ds_get_height(ds);
1526 +#endif
1527 + cw = ds_get_width(ds);
1528 + ch = ds_get_height(ds);
1529 + if (ds_get_width(ds) < fb_var.xres) {
1530 + cx = (fb_var.xres - ds_get_width(ds)) / 2;
1532 + if (ds_get_height(ds) < fb_var.yres) {
1533 + cy = (fb_var.yres - ds_get_height(ds)) / 2;
1536 +#if 0
1537 + fb_var.xres = cw;
1538 + fb_var.yres = ch;
1539 + fb_var.xres_virtual = cw;
1540 + fb_var.yres_virtual = ch;
1541 + fb_var.bits_per_pixel = ds_get_bits_per_pixel(ds);
1542 + fb_var.activate = FB_ACTIVATE_NOW;
1543 + if (ioctl(fb, FBIOPUT_VSCREENINFO, &fb_var))
1544 + fprintf(stderr,"ioctl-2");
1545 +#endif
1547 + if (conv) {
1548 + qemu_pf_conv_put(conv);
1550 + conv = qemu_pf_conv_get(&fbpf, &ds->surface->pf);
1551 + if (conv == NULL) {
1552 + fprintf(stderr, "fbdev: unsupported PixelFormat conversion\n");
1557 + if (redraw_screen) {
1558 + if (debug)
1559 + fprintf(stderr, "%s: handle redraw\n", __FUNCTION__);
1560 + redraw_screen = 0;
1561 + fbdev_cls();
1562 + x = 0; y = 0; w = ds_get_width(ds); h = ds_get_height(ds);
1565 + fbdev_render(ds, x, y, w, h);
1568 +static void fbdev_resize(DisplayState *ds)
1570 + if (debug)
1571 + fprintf(stderr, "%s: request resize+redraw\n", __FUNCTION__);
1572 + resize_screen++;
1573 + redraw_screen++;
1576 +static void fbdev_refresh(DisplayState *ds)
1578 + switch (fb_switch_state) {
1579 + case FB_REL_REQ:
1580 + fbdev_switch_release();
1581 + case FB_INACTIVE:
1582 + return;
1583 + case FB_ACQ_REQ:
1584 + fbdev_switch_acquire();
1585 + redraw_screen++;
1586 + if (debug)
1587 + fprintf(stderr, "%s: request redraw\n", __FUNCTION__);
1588 + case FB_ACTIVE:
1589 + break;
1592 + vga_hw_update();
1593 + if (redraw_screen) {
1594 + fbdev_update(ds, 0, 0, 0, 0);
1598 +static void fbdev_exit_notifier(Notifier *notifier)
1600 + fbdev_cleanup();
1603 +void fbdev_display_init(DisplayState *ds, const char *device)
1605 + if (dcl != NULL) {
1606 + if (debug)
1607 + fprintf(stderr, "%s: already active\n", __FUNCTION__);
1608 + return;
1611 + exit_notifier.notify = fbdev_exit_notifier;
1612 + qemu_add_exit_notifier(&exit_notifier);
1613 + fbdev_switch_init();
1614 + fbdev_catch_exit_signals();
1615 + init_mouse();
1617 + fbdev_resize(ds);
1618 + dcl = qemu_mallocz(sizeof(DisplayChangeListener));
1619 + dcl->dpy_update = fbdev_update;
1620 + dcl->dpy_resize = fbdev_resize;
1621 + dcl->dpy_refresh = fbdev_refresh;
1622 + register_displaychangelistener(ds, dcl);
1625 +void fbdev_display_uninit(void)
1627 + if (dcl == NULL) {
1628 + if (debug)
1629 + fprintf(stderr, "%s: not active\n", __FUNCTION__);
1630 + return;
1633 + unregister_displaychangelistener(dcl);
1634 + qemu_free(dcl);
1635 + dcl = NULL;
1637 + fbdev_cleanup();
1638 + qemu_remove_exit_notifier(&exit_notifier);
1639 + uninit_mouse();
1642 +uint8_t *fbdev_map_vram_to_qemu(void)
1644 + if (fbdev_init(NULL) != 0) {
1645 + return 0;
1648 + return fb_mem;
1650 diff --git a/hmp-commands.hx b/hmp-commands.hx
1651 index c857827..773439d 100644
1652 --- a/hmp-commands.hx
1653 +++ b/hmp-commands.hx
1654 @@ -753,6 +753,7 @@ STEXI
1655 Inject an NMI on the given CPU (x86 only).
1656 ETEXI
1658 +#ifdef CONFIG_MIGRATION
1660 .name = "migrate",
1661 .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
1662 @@ -765,7 +766,7 @@ ETEXI
1663 .user_print = monitor_user_noop,
1664 .mhandler.cmd_new = do_migrate,
1667 +#endif
1669 STEXI
1670 @item migrate [-d] [-b] [-i] @var{uri}
1671 @@ -775,6 +776,7 @@ Migrate to @var{uri} (using -d to not wait for completion).
1672 -i for migration with incremental copy of disk (base image is shared)
1673 ETEXI
1675 +#ifdef CONFIG_MIGRATION
1677 .name = "migrate_cancel",
1678 .args_type = "",
1679 @@ -783,6 +785,7 @@ ETEXI
1680 .user_print = monitor_user_noop,
1681 .mhandler.cmd_new = do_migrate_cancel,
1683 +#endif
1685 STEXI
1686 @item migrate_cancel
1687 @@ -790,6 +793,7 @@ STEXI
1688 Cancel the current VM migration.
1689 ETEXI
1691 +#ifdef CONFIG_MIGRATION
1693 .name = "migrate_set_speed",
1694 .args_type = "value:o",
1695 @@ -799,6 +803,7 @@ ETEXI
1696 .user_print = monitor_user_noop,
1697 .mhandler.cmd_new = do_migrate_set_speed,
1699 +#endif
1701 STEXI
1702 @item migrate_set_speed @var{value}
1703 @@ -806,6 +811,7 @@ STEXI
1704 Set maximum speed to @var{value} (in bytes) for migrations.
1705 ETEXI
1707 +#ifdef CONFIG_MIGRATION
1709 .name = "migrate_set_downtime",
1710 .args_type = "value:T",
1711 @@ -814,6 +820,7 @@ ETEXI
1712 .user_print = monitor_user_noop,
1713 .mhandler.cmd_new = do_migrate_set_downtime,
1715 +#endif
1717 STEXI
1718 @item migrate_set_downtime @var{second}
1719 @@ -821,6 +828,7 @@ STEXI
1720 Set maximum tolerated downtime (in seconds) for migration.
1721 ETEXI
1723 +#ifdef CONFIG_MIGRATION
1725 .name = "client_migrate_info",
1726 .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
1727 @@ -829,6 +837,7 @@ ETEXI
1728 .user_print = monitor_user_noop,
1729 .mhandler.cmd_new = client_migrate_info,
1731 +#endif
1733 STEXI
1734 @item client_migrate_info @var{protocol} @var{hostname} @var{port} @var{tls-port} @var{cert-subject}
1735 @@ -1054,6 +1063,7 @@ STEXI
1736 Switch link @var{name} on (i.e. up) or off (i.e. down).
1737 ETEXI
1739 +#ifdef CONFIG_WATCHDOG
1741 .name = "watchdog_action",
1742 .args_type = "action:s",
1743 @@ -1061,6 +1071,7 @@ ETEXI
1744 .help = "change watchdog action",
1745 .mhandler.cmd = do_watchdog_action,
1747 +#endif
1749 STEXI
1750 @item watchdog_action
1751 diff --git a/hw/apic.c b/hw/apic.c
1752 index 9febf40..6c19687 100644
1753 --- a/hw/apic.c
1754 +++ b/hw/apic.c
1755 @@ -307,8 +307,10 @@ void cpu_set_apic_base(DeviceState *d, uint64_t val)
1756 /* if disabled, cannot be enabled again */
1757 if (!(val & MSR_IA32_APICBASE_ENABLE)) {
1758 s->apicbase &= ~MSR_IA32_APICBASE_ENABLE;
1759 +#ifdef CONFIG_TRANSLATE
1760 cpu_clear_apic_feature(s->cpu_env);
1761 s->spurious_vec &= ~APIC_SV_ENABLE;
1762 +#endif
1766 diff --git a/hw/pc.c b/hw/pc.c
1767 index a3e8539..a8e8d0d 100644
1768 --- a/hw/pc.c
1769 +++ b/hw/pc.c
1770 @@ -1120,7 +1120,9 @@ void pc_basic_device_init(qemu_irq *isa_irq,
1771 qemu_register_boot_set(pc_boot_set, *rtc_state);
1773 pit = pit_init(0x40, 0);
1774 +#ifdef CONFIG_PCSPK
1775 pcspk_init(pit);
1776 +#endif
1778 for(i = 0; i < MAX_SERIAL_PORTS; i++) {
1779 if (serial_hds[i]) {
1780 diff --git a/hw/pc_piix.c b/hw/pc_piix.c
1781 index 40b73ea..b0e02c5 100644
1782 --- a/hw/pc_piix.c
1783 +++ b/hw/pc_piix.c
1784 @@ -171,7 +171,9 @@ static void pc_init1(ram_addr_t ram_size,
1788 +#ifdef CONFIG_AUDIO
1789 audio_init(isa_irq, pci_enabled ? pci_bus : NULL);
1790 +#endif
1792 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
1793 idebus[0], idebus[1], rtc_state);
1794 diff --git a/hw/vga.c b/hw/vga.c
1795 index 0f54734..19f2a94 100644
1796 --- a/hw/vga.c
1797 +++ b/hw/vga.c
1798 @@ -29,6 +29,9 @@
1799 #include "pixel_ops.h"
1800 #include "qemu-timer.h"
1802 +#include "hw/xen_common.h"
1803 +#include "xen-mapcache.h"
1805 //#define DEBUG_VGA
1806 //#define DEBUG_VGA_MEM
1807 //#define DEBUG_VGA_REG
1808 @@ -2237,6 +2240,24 @@ void vga_common_init(VGACommonState *s, int vga_ram_size)
1809 s->is_vbe_vmstate = 0;
1810 #endif
1811 s->vram_offset = qemu_ram_alloc(NULL, "vga.vram", vga_ram_size);
1812 +#ifdef CONFIG_STUBDOM
1813 + pid_t pid;
1814 + char module_param[64];
1816 + if((pid = fork()) < 0)
1817 + exit(1);
1818 + else if (pid == 0){
1819 + snprintf(module_param,64,"foreign_domid=%d foreign_gpfn=0x%lx",xen_domid,s->vram_offset);
1820 + execl("/bin/insmod", "insmod",
1821 + "/lib/modules/2.6.32.41/kernel/drivers/video/xen-fbfront.ko",
1822 + module_param, (char *)0);
1825 + if(waitpid(pid, NULL, 0) < 0)
1826 + exit(1);
1828 + xen_vga_ram_map(s->vram_offset, vga_ram_size);
1829 +#endif
1830 s->vram_ptr = qemu_get_ram_ptr(s->vram_offset);
1831 s->vram_size = vga_ram_size;
1832 s->get_bpp = vga_get_bpp;
1833 diff --git a/hw/xenfb.c b/hw/xenfb.c
1834 index d964318..274936f 100644
1835 --- a/hw/xenfb.c
1836 +++ b/hw/xenfb.c
1837 @@ -718,7 +718,7 @@ static void xenfb_update(void *opaque)
1838 if (xenfb_queue_full(xenfb))
1839 return;
1841 - for (l = xenfb->c.ds->listeners; l != NULL; l = l->next) {
1842 + QLIST_FOREACH(l, &xenfb->c.ds->listeners, next) {
1843 if (l->idle)
1844 continue;
1845 idle = 0;
1846 diff --git a/linux-keynames.h b/linux-keynames.h
1847 new file mode 100644
1848 index 0000000..9d0bc0a
1849 --- /dev/null
1850 +++ b/linux-keynames.h
1851 @@ -0,0 +1,388 @@
1853 + * awk '/#define KEY_/ { printf(" [ %-16s ] = \"%s\",\n",$2,$2); }' \
1854 + * /usr/include/linux/input.h
1855 + */
1856 + [ KEY_RESERVED ] = "KEY_RESERVED",
1857 + [ KEY_ESC ] = "KEY_ESC",
1858 + [ KEY_1 ] = "KEY_1",
1859 + [ KEY_2 ] = "KEY_2",
1860 + [ KEY_3 ] = "KEY_3",
1861 + [ KEY_4 ] = "KEY_4",
1862 + [ KEY_5 ] = "KEY_5",
1863 + [ KEY_6 ] = "KEY_6",
1864 + [ KEY_7 ] = "KEY_7",
1865 + [ KEY_8 ] = "KEY_8",
1866 + [ KEY_9 ] = "KEY_9",
1867 + [ KEY_0 ] = "KEY_0",
1868 + [ KEY_MINUS ] = "KEY_MINUS",
1869 + [ KEY_EQUAL ] = "KEY_EQUAL",
1870 + [ KEY_BACKSPACE ] = "KEY_BACKSPACE",
1871 + [ KEY_TAB ] = "KEY_TAB",
1872 + [ KEY_Q ] = "KEY_Q",
1873 + [ KEY_W ] = "KEY_W",
1874 + [ KEY_E ] = "KEY_E",
1875 + [ KEY_R ] = "KEY_R",
1876 + [ KEY_T ] = "KEY_T",
1877 + [ KEY_Y ] = "KEY_Y",
1878 + [ KEY_U ] = "KEY_U",
1879 + [ KEY_I ] = "KEY_I",
1880 + [ KEY_O ] = "KEY_O",
1881 + [ KEY_P ] = "KEY_P",
1882 + [ KEY_LEFTBRACE ] = "KEY_LEFTBRACE",
1883 + [ KEY_RIGHTBRACE ] = "KEY_RIGHTBRACE",
1884 + [ KEY_ENTER ] = "KEY_ENTER",
1885 + [ KEY_LEFTCTRL ] = "KEY_LEFTCTRL",
1886 + [ KEY_A ] = "KEY_A",
1887 + [ KEY_S ] = "KEY_S",
1888 + [ KEY_D ] = "KEY_D",
1889 + [ KEY_F ] = "KEY_F",
1890 + [ KEY_G ] = "KEY_G",
1891 + [ KEY_H ] = "KEY_H",
1892 + [ KEY_J ] = "KEY_J",
1893 + [ KEY_K ] = "KEY_K",
1894 + [ KEY_L ] = "KEY_L",
1895 + [ KEY_SEMICOLON ] = "KEY_SEMICOLON",
1896 + [ KEY_APOSTROPHE ] = "KEY_APOSTROPHE",
1897 + [ KEY_GRAVE ] = "KEY_GRAVE",
1898 + [ KEY_LEFTSHIFT ] = "KEY_LEFTSHIFT",
1899 + [ KEY_BACKSLASH ] = "KEY_BACKSLASH",
1900 + [ KEY_Z ] = "KEY_Z",
1901 + [ KEY_X ] = "KEY_X",
1902 + [ KEY_C ] = "KEY_C",
1903 + [ KEY_V ] = "KEY_V",
1904 + [ KEY_B ] = "KEY_B",
1905 + [ KEY_N ] = "KEY_N",
1906 + [ KEY_M ] = "KEY_M",
1907 + [ KEY_COMMA ] = "KEY_COMMA",
1908 + [ KEY_DOT ] = "KEY_DOT",
1909 + [ KEY_SLASH ] = "KEY_SLASH",
1910 + [ KEY_RIGHTSHIFT ] = "KEY_RIGHTSHIFT",
1911 + [ KEY_KPASTERISK ] = "KEY_KPASTERISK",
1912 + [ KEY_LEFTALT ] = "KEY_LEFTALT",
1913 + [ KEY_SPACE ] = "KEY_SPACE",
1914 + [ KEY_CAPSLOCK ] = "KEY_CAPSLOCK",
1915 + [ KEY_F1 ] = "KEY_F1",
1916 + [ KEY_F2 ] = "KEY_F2",
1917 + [ KEY_F3 ] = "KEY_F3",
1918 + [ KEY_F4 ] = "KEY_F4",
1919 + [ KEY_F5 ] = "KEY_F5",
1920 + [ KEY_F6 ] = "KEY_F6",
1921 + [ KEY_F7 ] = "KEY_F7",
1922 + [ KEY_F8 ] = "KEY_F8",
1923 + [ KEY_F9 ] = "KEY_F9",
1924 + [ KEY_F10 ] = "KEY_F10",
1925 + [ KEY_NUMLOCK ] = "KEY_NUMLOCK",
1926 + [ KEY_SCROLLLOCK ] = "KEY_SCROLLLOCK",
1927 + [ KEY_KP7 ] = "KEY_KP7",
1928 + [ KEY_KP8 ] = "KEY_KP8",
1929 + [ KEY_KP9 ] = "KEY_KP9",
1930 + [ KEY_KPMINUS ] = "KEY_KPMINUS",
1931 + [ KEY_KP4 ] = "KEY_KP4",
1932 + [ KEY_KP5 ] = "KEY_KP5",
1933 + [ KEY_KP6 ] = "KEY_KP6",
1934 + [ KEY_KPPLUS ] = "KEY_KPPLUS",
1935 + [ KEY_KP1 ] = "KEY_KP1",
1936 + [ KEY_KP2 ] = "KEY_KP2",
1937 + [ KEY_KP3 ] = "KEY_KP3",
1938 + [ KEY_KP0 ] = "KEY_KP0",
1939 + [ KEY_KPDOT ] = "KEY_KPDOT",
1940 + [ KEY_ZENKAKUHANKAKU ] = "KEY_ZENKAKUHANKAKU",
1941 + [ KEY_102ND ] = "KEY_102ND",
1942 + [ KEY_F11 ] = "KEY_F11",
1943 + [ KEY_F12 ] = "KEY_F12",
1944 + [ KEY_RO ] = "KEY_RO",
1945 + [ KEY_KATAKANA ] = "KEY_KATAKANA",
1946 + [ KEY_HIRAGANA ] = "KEY_HIRAGANA",
1947 + [ KEY_HENKAN ] = "KEY_HENKAN",
1948 + [ KEY_KATAKANAHIRAGANA ] = "KEY_KATAKANAHIRAGANA",
1949 + [ KEY_MUHENKAN ] = "KEY_MUHENKAN",
1950 + [ KEY_KPJPCOMMA ] = "KEY_KPJPCOMMA",
1951 + [ KEY_KPENTER ] = "KEY_KPENTER",
1952 + [ KEY_RIGHTCTRL ] = "KEY_RIGHTCTRL",
1953 + [ KEY_KPSLASH ] = "KEY_KPSLASH",
1954 + [ KEY_SYSRQ ] = "KEY_SYSRQ",
1955 + [ KEY_RIGHTALT ] = "KEY_RIGHTALT",
1956 + [ KEY_LINEFEED ] = "KEY_LINEFEED",
1957 + [ KEY_HOME ] = "KEY_HOME",
1958 + [ KEY_UP ] = "KEY_UP",
1959 + [ KEY_PAGEUP ] = "KEY_PAGEUP",
1960 + [ KEY_LEFT ] = "KEY_LEFT",
1961 + [ KEY_RIGHT ] = "KEY_RIGHT",
1962 + [ KEY_END ] = "KEY_END",
1963 + [ KEY_DOWN ] = "KEY_DOWN",
1964 + [ KEY_PAGEDOWN ] = "KEY_PAGEDOWN",
1965 + [ KEY_INSERT ] = "KEY_INSERT",
1966 + [ KEY_DELETE ] = "KEY_DELETE",
1967 + [ KEY_MACRO ] = "KEY_MACRO",
1968 + [ KEY_MUTE ] = "KEY_MUTE",
1969 + [ KEY_VOLUMEDOWN ] = "KEY_VOLUMEDOWN",
1970 + [ KEY_VOLUMEUP ] = "KEY_VOLUMEUP",
1971 + [ KEY_POWER ] = "KEY_POWER",
1972 + [ KEY_KPEQUAL ] = "KEY_KPEQUAL",
1973 + [ KEY_KPPLUSMINUS ] = "KEY_KPPLUSMINUS",
1974 + [ KEY_PAUSE ] = "KEY_PAUSE",
1975 +#if 0
1976 + [ KEY_SCALE ] = "KEY_SCALE",
1977 + [ KEY_KPCOMMA ] = "KEY_KPCOMMA",
1978 + [ KEY_HANGEUL ] = "KEY_HANGEUL",
1979 + [ KEY_HANGUEL ] = "KEY_HANGUEL",
1980 + [ KEY_HANJA ] = "KEY_HANJA",
1981 + [ KEY_YEN ] = "KEY_YEN",
1982 + [ KEY_LEFTMETA ] = "KEY_LEFTMETA",
1983 + [ KEY_RIGHTMETA ] = "KEY_RIGHTMETA",
1984 + [ KEY_COMPOSE ] = "KEY_COMPOSE",
1985 + [ KEY_STOP ] = "KEY_STOP",
1986 + [ KEY_AGAIN ] = "KEY_AGAIN",
1987 + [ KEY_PROPS ] = "KEY_PROPS",
1988 + [ KEY_UNDO ] = "KEY_UNDO",
1989 + [ KEY_FRONT ] = "KEY_FRONT",
1990 + [ KEY_COPY ] = "KEY_COPY",
1991 + [ KEY_OPEN ] = "KEY_OPEN",
1992 + [ KEY_PASTE ] = "KEY_PASTE",
1993 + [ KEY_FIND ] = "KEY_FIND",
1994 + [ KEY_CUT ] = "KEY_CUT",
1995 + [ KEY_HELP ] = "KEY_HELP",
1996 + [ KEY_MENU ] = "KEY_MENU",
1997 + [ KEY_CALC ] = "KEY_CALC",
1998 + [ KEY_SETUP ] = "KEY_SETUP",
1999 + [ KEY_SLEEP ] = "KEY_SLEEP",
2000 + [ KEY_WAKEUP ] = "KEY_WAKEUP",
2001 + [ KEY_FILE ] = "KEY_FILE",
2002 + [ KEY_SENDFILE ] = "KEY_SENDFILE",
2003 + [ KEY_DELETEFILE ] = "KEY_DELETEFILE",
2004 + [ KEY_XFER ] = "KEY_XFER",
2005 + [ KEY_PROG1 ] = "KEY_PROG1",
2006 + [ KEY_PROG2 ] = "KEY_PROG2",
2007 + [ KEY_WWW ] = "KEY_WWW",
2008 + [ KEY_MSDOS ] = "KEY_MSDOS",
2009 + [ KEY_COFFEE ] = "KEY_COFFEE",
2010 + [ KEY_SCREENLOCK ] = "KEY_SCREENLOCK",
2011 + [ KEY_DIRECTION ] = "KEY_DIRECTION",
2012 + [ KEY_CYCLEWINDOWS ] = "KEY_CYCLEWINDOWS",
2013 + [ KEY_MAIL ] = "KEY_MAIL",
2014 + [ KEY_BOOKMARKS ] = "KEY_BOOKMARKS",
2015 + [ KEY_COMPUTER ] = "KEY_COMPUTER",
2016 + [ KEY_BACK ] = "KEY_BACK",
2017 + [ KEY_FORWARD ] = "KEY_FORWARD",
2018 + [ KEY_CLOSECD ] = "KEY_CLOSECD",
2019 + [ KEY_EJECTCD ] = "KEY_EJECTCD",
2020 + [ KEY_EJECTCLOSECD ] = "KEY_EJECTCLOSECD",
2021 + [ KEY_NEXTSONG ] = "KEY_NEXTSONG",
2022 + [ KEY_PLAYPAUSE ] = "KEY_PLAYPAUSE",
2023 + [ KEY_PREVIOUSSONG ] = "KEY_PREVIOUSSONG",
2024 + [ KEY_STOPCD ] = "KEY_STOPCD",
2025 + [ KEY_RECORD ] = "KEY_RECORD",
2026 + [ KEY_REWIND ] = "KEY_REWIND",
2027 + [ KEY_PHONE ] = "KEY_PHONE",
2028 + [ KEY_ISO ] = "KEY_ISO",
2029 + [ KEY_CONFIG ] = "KEY_CONFIG",
2030 + [ KEY_HOMEPAGE ] = "KEY_HOMEPAGE",
2031 + [ KEY_REFRESH ] = "KEY_REFRESH",
2032 + [ KEY_EXIT ] = "KEY_EXIT",
2033 + [ KEY_MOVE ] = "KEY_MOVE",
2034 + [ KEY_EDIT ] = "KEY_EDIT",
2035 + [ KEY_SCROLLUP ] = "KEY_SCROLLUP",
2036 + [ KEY_SCROLLDOWN ] = "KEY_SCROLLDOWN",
2037 + [ KEY_KPLEFTPAREN ] = "KEY_KPLEFTPAREN",
2038 + [ KEY_KPRIGHTPAREN ] = "KEY_KPRIGHTPAREN",
2039 + [ KEY_NEW ] = "KEY_NEW",
2040 + [ KEY_REDO ] = "KEY_REDO",
2041 + [ KEY_F13 ] = "KEY_F13",
2042 + [ KEY_F14 ] = "KEY_F14",
2043 + [ KEY_F15 ] = "KEY_F15",
2044 + [ KEY_F16 ] = "KEY_F16",
2045 + [ KEY_F17 ] = "KEY_F17",
2046 + [ KEY_F18 ] = "KEY_F18",
2047 + [ KEY_F19 ] = "KEY_F19",
2048 + [ KEY_F20 ] = "KEY_F20",
2049 + [ KEY_F21 ] = "KEY_F21",
2050 + [ KEY_F22 ] = "KEY_F22",
2051 + [ KEY_F23 ] = "KEY_F23",
2052 + [ KEY_F24 ] = "KEY_F24",
2053 + [ KEY_PLAYCD ] = "KEY_PLAYCD",
2054 + [ KEY_PAUSECD ] = "KEY_PAUSECD",
2055 + [ KEY_PROG3 ] = "KEY_PROG3",
2056 + [ KEY_PROG4 ] = "KEY_PROG4",
2057 + [ KEY_DASHBOARD ] = "KEY_DASHBOARD",
2058 + [ KEY_SUSPEND ] = "KEY_SUSPEND",
2059 + [ KEY_CLOSE ] = "KEY_CLOSE",
2060 + [ KEY_PLAY ] = "KEY_PLAY",
2061 + [ KEY_FASTFORWARD ] = "KEY_FASTFORWARD",
2062 + [ KEY_BASSBOOST ] = "KEY_BASSBOOST",
2063 + [ KEY_PRINT ] = "KEY_PRINT",
2064 + [ KEY_HP ] = "KEY_HP",
2065 + [ KEY_CAMERA ] = "KEY_CAMERA",
2066 + [ KEY_SOUND ] = "KEY_SOUND",
2067 + [ KEY_QUESTION ] = "KEY_QUESTION",
2068 + [ KEY_EMAIL ] = "KEY_EMAIL",
2069 + [ KEY_CHAT ] = "KEY_CHAT",
2070 + [ KEY_SEARCH ] = "KEY_SEARCH",
2071 + [ KEY_CONNECT ] = "KEY_CONNECT",
2072 + [ KEY_FINANCE ] = "KEY_FINANCE",
2073 + [ KEY_SPORT ] = "KEY_SPORT",
2074 + [ KEY_SHOP ] = "KEY_SHOP",
2075 + [ KEY_ALTERASE ] = "KEY_ALTERASE",
2076 + [ KEY_CANCEL ] = "KEY_CANCEL",
2077 + [ KEY_BRIGHTNESSDOWN ] = "KEY_BRIGHTNESSDOWN",
2078 + [ KEY_BRIGHTNESSUP ] = "KEY_BRIGHTNESSUP",
2079 + [ KEY_MEDIA ] = "KEY_MEDIA",
2080 + [ KEY_SWITCHVIDEOMODE ] = "KEY_SWITCHVIDEOMODE",
2081 + [ KEY_KBDILLUMTOGGLE ] = "KEY_KBDILLUMTOGGLE",
2082 + [ KEY_KBDILLUMDOWN ] = "KEY_KBDILLUMDOWN",
2083 + [ KEY_KBDILLUMUP ] = "KEY_KBDILLUMUP",
2084 + [ KEY_SEND ] = "KEY_SEND",
2085 + [ KEY_REPLY ] = "KEY_REPLY",
2086 + [ KEY_FORWARDMAIL ] = "KEY_FORWARDMAIL",
2087 + [ KEY_SAVE ] = "KEY_SAVE",
2088 + [ KEY_DOCUMENTS ] = "KEY_DOCUMENTS",
2089 + [ KEY_BATTERY ] = "KEY_BATTERY",
2090 + [ KEY_BLUETOOTH ] = "KEY_BLUETOOTH",
2091 + [ KEY_WLAN ] = "KEY_WLAN",
2092 + [ KEY_UWB ] = "KEY_UWB",
2093 + [ KEY_UNKNOWN ] = "KEY_UNKNOWN",
2094 + [ KEY_VIDEO_NEXT ] = "KEY_VIDEO_NEXT",
2095 + [ KEY_VIDEO_PREV ] = "KEY_VIDEO_PREV",
2096 + [ KEY_BRIGHTNESS_CYCLE ] = "KEY_BRIGHTNESS_CYCLE",
2097 + [ KEY_BRIGHTNESS_ZERO ] = "KEY_BRIGHTNESS_ZERO",
2098 + [ KEY_DISPLAY_OFF ] = "KEY_DISPLAY_OFF",
2099 + [ KEY_WIMAX ] = "KEY_WIMAX",
2100 + [ KEY_OK ] = "KEY_OK",
2101 + [ KEY_SELECT ] = "KEY_SELECT",
2102 + [ KEY_GOTO ] = "KEY_GOTO",
2103 + [ KEY_CLEAR ] = "KEY_CLEAR",
2104 + [ KEY_POWER2 ] = "KEY_POWER2",
2105 + [ KEY_OPTION ] = "KEY_OPTION",
2106 + [ KEY_INFO ] = "KEY_INFO",
2107 + [ KEY_TIME ] = "KEY_TIME",
2108 + [ KEY_VENDOR ] = "KEY_VENDOR",
2109 + [ KEY_ARCHIVE ] = "KEY_ARCHIVE",
2110 + [ KEY_PROGRAM ] = "KEY_PROGRAM",
2111 + [ KEY_CHANNEL ] = "KEY_CHANNEL",
2112 + [ KEY_FAVORITES ] = "KEY_FAVORITES",
2113 + [ KEY_EPG ] = "KEY_EPG",
2114 + [ KEY_PVR ] = "KEY_PVR",
2115 + [ KEY_MHP ] = "KEY_MHP",
2116 + [ KEY_LANGUAGE ] = "KEY_LANGUAGE",
2117 + [ KEY_TITLE ] = "KEY_TITLE",
2118 + [ KEY_SUBTITLE ] = "KEY_SUBTITLE",
2119 + [ KEY_ANGLE ] = "KEY_ANGLE",
2120 + [ KEY_ZOOM ] = "KEY_ZOOM",
2121 + [ KEY_MODE ] = "KEY_MODE",
2122 + [ KEY_KEYBOARD ] = "KEY_KEYBOARD",
2123 + [ KEY_SCREEN ] = "KEY_SCREEN",
2124 + [ KEY_PC ] = "KEY_PC",
2125 + [ KEY_TV ] = "KEY_TV",
2126 + [ KEY_TV2 ] = "KEY_TV2",
2127 + [ KEY_VCR ] = "KEY_VCR",
2128 + [ KEY_VCR2 ] = "KEY_VCR2",
2129 + [ KEY_SAT ] = "KEY_SAT",
2130 + [ KEY_SAT2 ] = "KEY_SAT2",
2131 + [ KEY_CD ] = "KEY_CD",
2132 + [ KEY_TAPE ] = "KEY_TAPE",
2133 + [ KEY_RADIO ] = "KEY_RADIO",
2134 + [ KEY_TUNER ] = "KEY_TUNER",
2135 + [ KEY_PLAYER ] = "KEY_PLAYER",
2136 + [ KEY_TEXT ] = "KEY_TEXT",
2137 + [ KEY_DVD ] = "KEY_DVD",
2138 + [ KEY_AUX ] = "KEY_AUX",
2139 + [ KEY_MP3 ] = "KEY_MP3",
2140 + [ KEY_AUDIO ] = "KEY_AUDIO",
2141 + [ KEY_VIDEO ] = "KEY_VIDEO",
2142 + [ KEY_DIRECTORY ] = "KEY_DIRECTORY",
2143 + [ KEY_LIST ] = "KEY_LIST",
2144 + [ KEY_MEMO ] = "KEY_MEMO",
2145 + [ KEY_CALENDAR ] = "KEY_CALENDAR",
2146 + [ KEY_RED ] = "KEY_RED",
2147 + [ KEY_GREEN ] = "KEY_GREEN",
2148 + [ KEY_YELLOW ] = "KEY_YELLOW",
2149 + [ KEY_BLUE ] = "KEY_BLUE",
2150 + [ KEY_CHANNELUP ] = "KEY_CHANNELUP",
2151 + [ KEY_CHANNELDOWN ] = "KEY_CHANNELDOWN",
2152 + [ KEY_FIRST ] = "KEY_FIRST",
2153 + [ KEY_LAST ] = "KEY_LAST",
2154 + [ KEY_AB ] = "KEY_AB",
2155 + [ KEY_NEXT ] = "KEY_NEXT",
2156 + [ KEY_RESTART ] = "KEY_RESTART",
2157 + [ KEY_SLOW ] = "KEY_SLOW",
2158 + [ KEY_SHUFFLE ] = "KEY_SHUFFLE",
2159 + [ KEY_BREAK ] = "KEY_BREAK",
2160 + [ KEY_PREVIOUS ] = "KEY_PREVIOUS",
2161 + [ KEY_DIGITS ] = "KEY_DIGITS",
2162 + [ KEY_TEEN ] = "KEY_TEEN",
2163 + [ KEY_TWEN ] = "KEY_TWEN",
2164 + [ KEY_VIDEOPHONE ] = "KEY_VIDEOPHONE",
2165 + [ KEY_GAMES ] = "KEY_GAMES",
2166 + [ KEY_ZOOMIN ] = "KEY_ZOOMIN",
2167 + [ KEY_ZOOMOUT ] = "KEY_ZOOMOUT",
2168 + [ KEY_ZOOMRESET ] = "KEY_ZOOMRESET",
2169 + [ KEY_WORDPROCESSOR ] = "KEY_WORDPROCESSOR",
2170 + [ KEY_EDITOR ] = "KEY_EDITOR",
2171 + [ KEY_SPREADSHEET ] = "KEY_SPREADSHEET",
2172 + [ KEY_GRAPHICSEDITOR ] = "KEY_GRAPHICSEDITOR",
2173 + [ KEY_PRESENTATION ] = "KEY_PRESENTATION",
2174 + [ KEY_DATABASE ] = "KEY_DATABASE",
2175 + [ KEY_NEWS ] = "KEY_NEWS",
2176 + [ KEY_VOICEMAIL ] = "KEY_VOICEMAIL",
2177 + [ KEY_ADDRESSBOOK ] = "KEY_ADDRESSBOOK",
2178 + [ KEY_MESSENGER ] = "KEY_MESSENGER",
2179 + [ KEY_DISPLAYTOGGLE ] = "KEY_DISPLAYTOGGLE",
2180 + [ KEY_SPELLCHECK ] = "KEY_SPELLCHECK",
2181 + [ KEY_LOGOFF ] = "KEY_LOGOFF",
2182 + [ KEY_DOLLAR ] = "KEY_DOLLAR",
2183 + [ KEY_EURO ] = "KEY_EURO",
2184 + [ KEY_FRAMEBACK ] = "KEY_FRAMEBACK",
2185 + [ KEY_FRAMEFORWARD ] = "KEY_FRAMEFORWARD",
2186 + [ KEY_CONTEXT_MENU ] = "KEY_CONTEXT_MENU",
2187 + [ KEY_MEDIA_REPEAT ] = "KEY_MEDIA_REPEAT",
2188 + [ KEY_DEL_EOL ] = "KEY_DEL_EOL",
2189 + [ KEY_DEL_EOS ] = "KEY_DEL_EOS",
2190 + [ KEY_INS_LINE ] = "KEY_INS_LINE",
2191 + [ KEY_DEL_LINE ] = "KEY_DEL_LINE",
2192 + [ KEY_FN ] = "KEY_FN",
2193 + [ KEY_FN_ESC ] = "KEY_FN_ESC",
2194 + [ KEY_FN_F1 ] = "KEY_FN_F1",
2195 + [ KEY_FN_F2 ] = "KEY_FN_F2",
2196 + [ KEY_FN_F3 ] = "KEY_FN_F3",
2197 + [ KEY_FN_F4 ] = "KEY_FN_F4",
2198 + [ KEY_FN_F5 ] = "KEY_FN_F5",
2199 + [ KEY_FN_F6 ] = "KEY_FN_F6",
2200 + [ KEY_FN_F7 ] = "KEY_FN_F7",
2201 + [ KEY_FN_F8 ] = "KEY_FN_F8",
2202 + [ KEY_FN_F9 ] = "KEY_FN_F9",
2203 + [ KEY_FN_F10 ] = "KEY_FN_F10",
2204 + [ KEY_FN_F11 ] = "KEY_FN_F11",
2205 + [ KEY_FN_F12 ] = "KEY_FN_F12",
2206 + [ KEY_FN_1 ] = "KEY_FN_1",
2207 + [ KEY_FN_2 ] = "KEY_FN_2",
2208 + [ KEY_FN_D ] = "KEY_FN_D",
2209 + [ KEY_FN_E ] = "KEY_FN_E",
2210 + [ KEY_FN_F ] = "KEY_FN_F",
2211 + [ KEY_FN_S ] = "KEY_FN_S",
2212 + [ KEY_FN_B ] = "KEY_FN_B",
2213 + [ KEY_BRL_DOT1 ] = "KEY_BRL_DOT1",
2214 + [ KEY_BRL_DOT2 ] = "KEY_BRL_DOT2",
2215 + [ KEY_BRL_DOT3 ] = "KEY_BRL_DOT3",
2216 + [ KEY_BRL_DOT4 ] = "KEY_BRL_DOT4",
2217 + [ KEY_BRL_DOT5 ] = "KEY_BRL_DOT5",
2218 + [ KEY_BRL_DOT6 ] = "KEY_BRL_DOT6",
2219 + [ KEY_BRL_DOT7 ] = "KEY_BRL_DOT7",
2220 + [ KEY_BRL_DOT8 ] = "KEY_BRL_DOT8",
2221 + [ KEY_BRL_DOT9 ] = "KEY_BRL_DOT9",
2222 + [ KEY_BRL_DOT10 ] = "KEY_BRL_DOT10",
2223 + [ KEY_NUMERIC_0 ] = "KEY_NUMERIC_0",
2224 + [ KEY_NUMERIC_1 ] = "KEY_NUMERIC_1",
2225 + [ KEY_NUMERIC_2 ] = "KEY_NUMERIC_2",
2226 + [ KEY_NUMERIC_3 ] = "KEY_NUMERIC_3",
2227 + [ KEY_NUMERIC_4 ] = "KEY_NUMERIC_4",
2228 + [ KEY_NUMERIC_5 ] = "KEY_NUMERIC_5",
2229 + [ KEY_NUMERIC_6 ] = "KEY_NUMERIC_6",
2230 + [ KEY_NUMERIC_7 ] = "KEY_NUMERIC_7",
2231 + [ KEY_NUMERIC_8 ] = "KEY_NUMERIC_8",
2232 + [ KEY_NUMERIC_9 ] = "KEY_NUMERIC_9",
2233 + [ KEY_NUMERIC_STAR ] = "KEY_NUMERIC_STAR",
2234 + [ KEY_NUMERIC_POUND ] = "KEY_NUMERIC_POUND",
2235 +// [ KEY_RFKILL ] = "KEY_RFKILL",
2236 +#endif
2237 + [ KEY_MIN_INTERESTING ] = "KEY_MIN_INTERESTING",
2238 + [ KEY_MAX ] = "KEY_MAX",
2239 + [ KEY_CNT ] = "KEY_CNT",
2240 diff --git a/monitor.c b/monitor.c
2241 index 718935b..3c1d01c 100644
2242 --- a/monitor.c
2243 +++ b/monitor.c
2244 @@ -7,7 +7,8 @@
2245 * of this software and associated documentation files (the "Software"), to deal
2246 * in the Software without restriction, including without limitation the rights
2247 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2248 - * copies of the Software, and to permit persons to whom the Software is
2249 + * co
2250 + * #endifpies of the Software, and to permit persons to whom the Software is
2251 * furnished to do so, subject to the following conditions:
2253 * The above copyright notice and this permission notice shall be included in
2254 @@ -28,7 +29,9 @@
2255 #include "hw/pcmcia.h"
2256 #include "hw/pc.h"
2257 #include "hw/pci.h"
2258 +#ifdef CONFIG_WATCHDOG
2259 #include "hw/watchdog.h"
2260 +#endif
2261 #include "hw/loader.h"
2262 #include "gdbstub.h"
2263 #include "net.h"
2264 @@ -40,11 +43,15 @@
2265 #include "readline.h"
2266 #include "console.h"
2267 #include "blockdev.h"
2268 +#ifdef CONFIG_AUDIO
2269 #include "audio/audio.h"
2270 +#endif
2271 #include "disas.h"
2272 #include "balloon.h"
2273 #include "qemu-timer.h"
2274 +#ifdef CONFIG_MIGRATION
2275 #include "migration.h"
2276 +#endif
2277 #include "kvm.h"
2278 #include "acl.h"
2279 #include "qint.h"
2280 @@ -1075,6 +1082,18 @@ static int do_change_vnc(Monitor *mon, const char *target, const char *arg)
2282 #endif
2284 +static int do_change_fbdev(Monitor *mon, const char *target)
2286 +#ifdef CONFIG_STUBDOM
2287 + if (strcmp(target, "on") == 0) {
2288 + fbdev_display_init(get_displaystate(), NULL);
2289 + } else {
2290 + fbdev_display_uninit();
2292 +#endif
2293 + return 0;
2297 * do_change(): Change a removable medium, or VNC configuration
2299 @@ -1087,6 +1106,8 @@ static int do_change(Monitor *mon, const QDict *qdict, QObject **ret_data)
2301 if (strcmp(device, "vnc") == 0) {
2302 ret = do_change_vnc(mon, target, arg);
2303 + } else if (strcmp(device, "fbdev") == 0) {
2304 + ret = do_change_fbdev(mon, target);
2305 } else {
2306 ret = do_change_block(mon, device, target, arg);
2308 @@ -1189,7 +1210,6 @@ static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_d
2310 const char *protocol = qdict_get_str(qdict, "protocol");
2311 const char *fdname = qdict_get_str(qdict, "fdname");
2312 - int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);
2313 CharDriverState *s;
2315 if (strcmp(protocol, "spice") == 0) {
2316 @@ -1200,11 +1220,16 @@ static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_d
2318 qerror_report(QERR_ADD_CLIENT_FAILED);
2319 return -1;
2320 - } else if (strcmp(protocol, "vnc") == 0) {
2322 +#ifdef CONFIG_VNC
2323 + else if (strcmp(protocol, "vnc") == 0) {
2324 + int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);
2325 int fd = monitor_get_fd(mon, fdname);
2326 vnc_display_add_client(NULL, fd, skipauth);
2327 return 0;
2328 - } else if ((s = qemu_chr_find(protocol)) != NULL) {
2330 +#endif
2331 + else if ((s = qemu_chr_find(protocol)) != NULL) {
2332 int fd = monitor_get_fd(mon, fdname);
2333 if (qemu_chr_add_client(s, fd) < 0) {
2334 qerror_report(QERR_ADD_CLIENT_FAILED);
2335 @@ -1217,6 +1242,7 @@ static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_d
2336 return -1;
2339 +#ifdef CONFIG_MIGRATION
2340 static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
2342 const char *protocol = qdict_get_str(qdict, "protocol");
2343 @@ -1243,6 +1269,7 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject **ret_d
2344 qerror_report(QERR_INVALID_PARAMETER, "protocol");
2345 return -1;
2347 +#endif
2349 static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data)
2351 @@ -1307,10 +1334,12 @@ static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data)
2353 struct bdrv_iterate_context context = { mon, 0 };
2355 +#ifdef CONFIG_MIGRATION
2356 if (incoming_expected) {
2357 qerror_report(QERR_MIGRATION_EXPECTED);
2358 return -1;
2360 +#endif
2361 bdrv_iterate(encrypted_bdrv_it, &context);
2362 /* only resume the vm if all keys are set and valid */
2363 if (!context.err) {
2364 @@ -1357,6 +1386,7 @@ static void do_gdbserver(Monitor *mon, const QDict *qdict)
2368 +#ifdef CONFIG_WATCHDOG
2369 static void do_watchdog_action(Monitor *mon, const QDict *qdict)
2371 const char *action = qdict_get_str(qdict, "action");
2372 @@ -1364,6 +1394,7 @@ static void do_watchdog_action(Monitor *mon, const QDict *qdict)
2373 monitor_printf(mon, "Unknown watchdog action '%s'\n", action);
2376 +#endif
2378 static void monitor_printc(Monitor *mon, int c)
2380 @@ -2518,6 +2549,7 @@ static void do_info_profile(Monitor *mon)
2382 #endif
2384 +#ifdef CONFIG_AUDIO
2385 /* Capture support */
2386 static QLIST_HEAD (capture_list_head, CaptureState) capture_head;
2388 @@ -2575,6 +2607,8 @@ static void do_wav_capture(Monitor *mon, const QDict *qdict)
2390 #endif
2392 +#endif
2394 #if defined(TARGET_I386)
2395 static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
2397 @@ -2994,6 +3028,7 @@ static const mon_cmd_t info_cmds[] = {
2398 .help = "show profiling information",
2399 .mhandler.info = do_info_profile,
2401 +#ifdef CONFIG_AUDIO
2403 .name = "capture",
2404 .args_type = "",
2405 @@ -3001,6 +3036,7 @@ static const mon_cmd_t info_cmds[] = {
2406 .help = "show capture information",
2407 .mhandler.info = do_info_capture,
2409 +#endif
2411 .name = "snapshots",
2412 .args_type = "",
2413 @@ -3083,6 +3119,7 @@ static const mon_cmd_t info_cmds[] = {
2414 .mhandler.info = do_info_usernet,
2416 #endif
2417 +#ifdef CONFIG_MIGRATION
2419 .name = "migrate",
2420 .args_type = "",
2421 @@ -3091,6 +3128,7 @@ static const mon_cmd_t info_cmds[] = {
2422 .user_print = do_info_migrate_print,
2423 .mhandler.info_new = do_info_migrate,
2425 +#endif
2427 .name = "balloon",
2428 .args_type = "",
2429 @@ -3262,6 +3300,7 @@ static const mon_cmd_t qmp_query_cmds[] = {
2430 .user_print = do_info_uuid_print,
2431 .mhandler.info_new = do_info_uuid,
2433 +#ifdef CONFIG_MIGRATION
2435 .name = "migrate",
2436 .args_type = "",
2437 @@ -3270,6 +3309,7 @@ static const mon_cmd_t qmp_query_cmds[] = {
2438 .user_print = do_info_migrate_print,
2439 .mhandler.info_new = do_info_migrate,
2441 +#endif
2443 .name = "balloon",
2444 .args_type = "",
2445 diff --git a/net/tap-linux.c b/net/tap-linux.c
2446 index ff8cad0..3ab3970 100644
2447 --- a/net/tap-linux.c
2448 +++ b/net/tap-linux.c
2449 @@ -33,7 +33,11 @@
2450 #include "qemu-common.h"
2451 #include "qemu-error.h"
2453 +#ifdef CONFIG_STUBDOM
2454 +#define PATH_NET_TUN "/dev/tun"
2455 +#else
2456 #define PATH_NET_TUN "/dev/net/tun"
2457 +#endif
2459 int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
2461 diff --git a/net/tap.c b/net/tap.c
2462 index 1f26dc9..4bb72f0 100644
2463 --- a/net/tap.c
2464 +++ b/net/tap.c
2465 @@ -383,6 +383,8 @@ static int launch_script(const char *setup_script, const char *ifname, int fd)
2466 if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
2467 return 0;
2469 + fprintf(stderr,"WIFEXITED(status)=0x%lx WEXITSTATUS(status)=0x%lx\n",
2470 + WIFEXITED(status),WEXITSTATUS(status));
2472 fprintf(stderr, "%s: could not launch network script\n", setup_script);
2473 return -1;
2474 @@ -410,6 +412,8 @@ static int net_tap_init(QemuOpts *opts, int *vnet_hdr)
2475 return -1;
2478 + fprintf(stderr,"net_tap_init: ifname=%s\n",ifname);
2480 setup_script = qemu_opt_get(opts, "script");
2481 if (setup_script &&
2482 setup_script[0] != '\0' &&
2483 diff --git a/qemu-options.hx b/qemu-options.hx
2484 index 1d57f64..0465aa9 100644
2485 --- a/qemu-options.hx
2486 +++ b/qemu-options.hx
2487 @@ -715,6 +715,16 @@ STEXI
2488 Enable SDL.
2489 ETEXI
2491 +#ifdef CONFIG_STUBDOM
2492 +DEF("fbdev", 0, QEMU_OPTION_fbdev,
2493 + "-fbdev enable fbdev\n", QEMU_ARCH_ALL)
2494 +#endif
2495 +STEXI
2496 +@item -fbdev
2497 +@findex -fbdev
2498 +Enable fbdev (linux framebuffer).
2499 +ETEXI
2501 DEF("spice", HAS_ARG, QEMU_OPTION_spice,
2502 "-spice <args> enable spice\n", QEMU_ARCH_ALL)
2503 STEXI
2504 diff --git a/qmp-commands.hx b/qmp-commands.hx
2505 index 54e313c..fe81384 100644
2506 --- a/qmp-commands.hx
2507 +++ b/qmp-commands.hx
2508 @@ -456,6 +456,7 @@ Note: inject-nmi is only supported for x86 guest currently, it will
2510 EQMP
2512 +#ifdef CONFIG_MIGRATION
2514 .name = "migrate",
2515 .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
2516 @@ -468,6 +469,7 @@ EQMP
2517 .user_print = monitor_user_noop,
2518 .mhandler.cmd_new = do_migrate,
2520 +#endif
2522 SQMP
2523 migrate
2524 @@ -496,6 +498,7 @@ Notes:
2526 EQMP
2528 +#ifdef CONFIG_MIGRATION
2530 .name = "migrate_cancel",
2531 .args_type = "",
2532 @@ -504,6 +507,7 @@ EQMP
2533 .user_print = monitor_user_noop,
2534 .mhandler.cmd_new = do_migrate_cancel,
2536 +#endif
2538 SQMP
2539 migrate_cancel
2540 @@ -520,6 +524,7 @@ Example:
2542 EQMP
2544 +#ifdef CONFIG_MIGRATION
2546 .name = "migrate_set_speed",
2547 .args_type = "value:o",
2548 @@ -528,6 +533,7 @@ EQMP
2549 .user_print = monitor_user_noop,
2550 .mhandler.cmd_new = do_migrate_set_speed,
2552 +#endif
2554 SQMP
2555 migrate_set_speed
2556 @@ -546,6 +552,7 @@ Example:
2558 EQMP
2560 +#ifdef CONFIG_MIGRATION
2562 .name = "migrate_set_downtime",
2563 .args_type = "value:T",
2564 @@ -554,6 +561,7 @@ EQMP
2565 .user_print = monitor_user_noop,
2566 .mhandler.cmd_new = do_migrate_set_downtime,
2568 +#endif
2570 SQMP
2571 migrate_set_downtime
2572 @@ -572,6 +580,7 @@ Example:
2574 EQMP
2576 +#ifdef CONFIG_MIGRATION
2578 .name = "client_migrate_info",
2579 .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
2580 @@ -580,6 +589,7 @@ EQMP
2581 .user_print = monitor_user_noop,
2582 .mhandler.cmd_new = client_migrate_info,
2584 +#endif
2586 SQMP
2587 client_migrate_info
2588 diff --git a/sysemu.h b/sysemu.h
2589 index d3013f5..e469fd1 100644
2590 --- a/sysemu.h
2591 +++ b/sysemu.h
2592 @@ -85,6 +85,7 @@ typedef enum DisplayType
2593 DT_DEFAULT,
2594 DT_CURSES,
2595 DT_SDL,
2596 + DT_FBDEV,
2597 DT_NOGRAPHIC,
2598 DT_NONE,
2599 } DisplayType;
2600 diff --git a/target-i386/helper.c b/target-i386/helper.c
2601 index e9be104..00eb1a1 100644
2602 --- a/target-i386/helper.c
2603 +++ b/target-i386/helper.c
2604 @@ -1248,16 +1248,20 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
2605 /* init various static tables */
2606 if (!inited) {
2607 inited = 1;
2608 +#ifdef CONFIG_TRANSLATE
2609 optimize_flags_init();
2610 +#endif
2611 #ifndef CONFIG_USER_ONLY
2612 prev_debug_excp_handler =
2613 cpu_set_debug_excp_handler(breakpoint_handler);
2614 #endif
2616 +#ifdef CONFIG_TRANSLATE
2617 if (cpu_x86_register(env, cpu_model) < 0) {
2618 cpu_x86_close(env);
2619 return NULL;
2621 +#endif
2622 mce_init(env);
2624 qemu_init_vcpu(env);
2625 diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
2626 index 315e18b..032edd2 100644
2627 --- a/target-i386/op_helper.c
2628 +++ b/target-i386/op_helper.c
2629 @@ -1976,6 +1976,7 @@ void helper_single_step(void)
2630 raise_exception(EXCP01_DB);
2633 +#ifdef CONFIG_TRANSLATE
2634 void helper_cpuid(void)
2636 uint32_t eax, ebx, ecx, edx;
2637 @@ -1988,6 +1989,7 @@ void helper_cpuid(void)
2638 ECX = ecx;
2639 EDX = edx;
2641 +#endif
2643 void helper_enter_level(int level, int data32, target_ulong t1)
2645 diff --git a/translate-all-stub.c b/translate-all-stub.c
2646 new file mode 100644
2647 index 0000000..dfefcf7
2648 --- /dev/null
2649 +++ b/translate-all-stub.c
2650 @@ -0,0 +1,66 @@
2652 + * Host code generation stub
2654 + * Copyright (c) 2003 Fabrice Bellard
2656 + * This library is free software; you can redistribute it and/or
2657 + * modify it under the terms of the GNU Lesser General Public
2658 + * License as published by the Free Software Foundation; either
2659 + * version 2 of the License, or (at your option) any later version.
2661 + * This library is distributed in the hope that it will be useful,
2662 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2663 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2664 + * Lesser General Public License for more details.
2666 + * You should have received a copy of the GNU Lesser General Public
2667 + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
2668 + */
2669 +#include <stdarg.h>
2670 +#include <stdlib.h>
2671 +#include <stdio.h>
2672 +#include <string.h>
2673 +#include <inttypes.h>
2675 +#include "config.h"
2677 +#define NO_CPU_IO_DEFS
2678 +#include "cpu.h"
2679 +#include "exec-all.h"
2680 +#include "disas.h"
2681 +#include "tcg.h"
2682 +#include "qemu-timer.h"
2684 +/* code generation context */
2685 +TCGContext tcg_ctx;
2687 +uint16_t gen_opc_buf[OPC_BUF_SIZE];
2688 +TCGArg gen_opparam_buf[OPPARAM_BUF_SIZE];
2690 +target_ulong gen_opc_pc[OPC_BUF_SIZE];
2691 +uint16_t gen_opc_icount[OPC_BUF_SIZE];
2692 +uint8_t gen_opc_instr_start[OPC_BUF_SIZE];
2694 +void cpu_gen_init(void)
2696 + return ;
2699 +/* return non zero if the very first instruction is invalid so that
2700 + the virtual CPU can trigger an exception.
2702 + '*gen_code_size_ptr' contains the size of the generated code (host
2703 + code).
2705 +int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
2707 + return 0;
2709 +/* The cpu state corresponding to 'searched_pc' is restored.
2710 + */
2711 +int cpu_restore_state(TranslationBlock *tb,
2712 + CPUState *env, unsigned long searched_pc)
2714 + return 0;
2717 diff --git a/vl.c b/vl.c
2718 index d8c7c01..b77f783 100644
2719 --- a/vl.c
2720 +++ b/vl.c
2721 @@ -118,13 +118,17 @@ int main(int argc, char **argv)
2722 #include "hw/pc.h"
2723 #include "hw/isa.h"
2724 #include "hw/baum.h"
2725 +#ifdef CONFIG_BLUETOOTH
2726 #include "hw/bt.h"
2727 +#include "bt-host.h"
2728 +#endif
2729 +#ifdef CONFIG_WATCHDOG
2730 #include "hw/watchdog.h"
2731 +#endif
2732 #include "hw/smbios.h"
2733 #include "hw/xen.h"
2734 #include "hw/qdev.h"
2735 #include "hw/loader.h"
2736 -#include "bt-host.h"
2737 #include "net.h"
2738 #include "net/slirp.h"
2739 #include "monitor.h"
2740 @@ -244,7 +248,7 @@ int nb_numa_nodes;
2741 uint64_t node_mem[MAX_NODES];
2742 uint64_t node_cpumask[MAX_NODES];
2744 -static QEMUTimer *nographic_timer;
2745 +static QEMUTimer *periodic_timer;
2747 uint8_t qemu_uuid[16];
2749 @@ -434,6 +438,7 @@ static void configure_rtc(QemuOpts *opts)
2753 +#ifdef CONFIG_BLUETOOTH
2754 /***********************************************************/
2755 /* Bluetooth support */
2756 static int nb_hcis;
2757 @@ -624,6 +629,7 @@ static int bt_parse(const char *opt)
2758 fprintf(stderr, "qemu: bad bluetooth parameter '%s'\n", opt);
2759 return 1;
2761 +#endif
2763 /***********************************************************/
2764 /* QEMU Block devices */
2765 @@ -929,12 +935,15 @@ static int usb_device_add(const char *devname)
2766 /* only the linux version is qdev-ified, usb-bsd still needs this */
2767 if (strstart(devname, "host:", &p)) {
2768 dev = usb_host_device_open(p);
2769 - } else
2771 #endif
2772 - if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
2773 +#ifdef CONFIG_BLUETOOTH
2774 + else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
2775 dev = usb_bt_init(devname[2] ? hci_init(p) :
2776 bt_new_hci(qemu_find_bt_vlan(0)));
2777 - } else {
2778 + }
2779 +#endif
2780 + else {
2781 return -1;
2783 if (!dev)
2784 @@ -1078,30 +1087,22 @@ static QEMUMachine *find_default_machine(void)
2785 /***********************************************************/
2786 /* main execution loop */
2788 -static void gui_update(void *opaque)
2789 +static void periodic_update(void *opaque)
2791 uint64_t interval = GUI_REFRESH_INTERVAL;
2792 DisplayState *ds = opaque;
2793 - DisplayChangeListener *dcl = ds->listeners;
2794 + DisplayChangeListener *dcl;
2796 qemu_flush_coalesced_mmio_buffer();
2797 + if (ds != NULL && !QLIST_EMPTY(&ds->listeners)) {
2798 dpy_refresh(ds);
2800 - while (dcl != NULL) {
2801 + QLIST_FOREACH(dcl, &ds->listeners, next) {
2802 if (dcl->gui_timer_interval &&
2803 dcl->gui_timer_interval < interval)
2804 interval = dcl->gui_timer_interval;
2805 - dcl = dcl->next;
2807 - qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock));
2810 -static void nographic_update(void *opaque)
2812 - uint64_t interval = GUI_REFRESH_INTERVAL;
2814 - qemu_flush_coalesced_mmio_buffer();
2815 - qemu_mod_timer(nographic_timer, interval + qemu_get_clock_ms(rt_clock));
2817 + qemu_mod_timer(periodic_timer, interval + qemu_get_clock_ms(rt_clock));
2820 struct vm_change_state_entry {
2821 @@ -2072,7 +2073,6 @@ int main(int argc, char **argv, char **envp)
2822 const char *kernel_filename, *kernel_cmdline;
2823 char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
2824 DisplayState *ds;
2825 - DisplayChangeListener *dcl;
2826 int cyls, heads, secs, translation;
2827 QemuOpts *hda_opts = NULL, *opts;
2828 QemuOptsList *olist;
2829 @@ -2124,6 +2124,8 @@ int main(int argc, char **argv, char **envp)
2830 tb_size = 0;
2831 autostart= 1;
2833 + freopen("/dev/hvc0","w",stderr);
2834 + fprintf(stderr,"reoprn /dev/hvc0\n");
2835 /* first pass of option parsing */
2836 optind = 1;
2837 while (optind < argc) {
2838 @@ -2406,9 +2408,12 @@ int main(int argc, char **argv, char **envp)
2839 exit(1);
2840 break;
2841 #endif
2842 +#ifdef CONFIG_BLURTOOTH
2843 case QEMU_OPTION_bt:
2844 add_device_config(DEV_BT, optarg);
2845 break;
2846 +#endif
2847 +#ifdef CONFIG_AUDIO
2848 case QEMU_OPTION_audio_help:
2849 if (!(audio_available())) {
2850 printf("Option %s not supported for this target\n", popt->name);
2851 @@ -2424,6 +2429,7 @@ int main(int argc, char **argv, char **envp)
2853 select_soundhw (optarg);
2854 break;
2855 +#endif
2856 case QEMU_OPTION_h:
2857 help(0);
2858 break;
2859 @@ -2615,6 +2621,7 @@ int main(int argc, char **argv, char **envp)
2860 default_monitor = 0;
2862 break;
2863 +#ifdef CONFIG_WATCHDOG
2864 case QEMU_OPTION_watchdog:
2865 if (watchdog) {
2866 fprintf(stderr,
2867 @@ -2629,6 +2636,7 @@ int main(int argc, char **argv, char **envp)
2868 exit(1);
2870 break;
2871 +#endif
2872 case QEMU_OPTION_virtiocon:
2873 add_device_config(DEV_VIRTCON, optarg);
2874 default_virtcon = 0;
2875 @@ -2677,6 +2685,11 @@ int main(int argc, char **argv, char **envp)
2876 fprintf(stderr, "SDL support is disabled\n");
2877 exit(1);
2878 #endif
2879 +#ifdef CONFIG_STUBDOM
2880 + case QEMU_OPTION_fbdev:
2881 + display_type = DT_FBDEV;
2882 + break;
2883 +#endif
2884 case QEMU_OPTION_pidfile:
2885 pid_file = optarg;
2886 break;
2887 @@ -2705,7 +2718,7 @@ int main(int argc, char **argv, char **envp)
2888 fprintf(stderr, "parse error: %s\n", optarg);
2889 exit(1);
2891 - machine = machine_parse(qemu_opt_get(opts, "type"));
2892 + //machine = machine_parse(qemu_opt_get(opts, "type"));
2893 break;
2894 case QEMU_OPTION_usb:
2895 usb_enabled = 1;
2896 @@ -3089,9 +3102,11 @@ int main(int argc, char **argv, char **envp)
2897 exit(1);
2900 +#ifdef CONFIG_BLUETOOTH
2901 /* init the bluetooth world */
2902 if (foreach_device_config(DEV_BT, bt_parse))
2903 exit(1);
2904 +#endif
2906 /* init the memory */
2907 if (ram_size == 0) {
2908 @@ -3106,12 +3121,16 @@ int main(int argc, char **argv, char **envp)
2912 +#ifdef CONFIG_TRANSLATE
2913 /* init the dynamic translator */
2914 cpu_exec_init_all(tb_size * 1024 * 1024);
2915 +#endif
2917 bdrv_init_with_whitelist();
2919 +#ifdef CONFIG_MIGRATION
2920 blk_mig_init();
2921 +#endif
2923 /* open the virtual block devices */
2924 if (snapshot)
2925 @@ -3126,8 +3145,10 @@ int main(int argc, char **argv, char **envp)
2926 default_drive(default_sdcard, snapshot, machine->use_scsi,
2927 IF_SD, 0, SD_OPTS);
2929 +#ifdef CONFIG_MIGRATION
2930 register_savevm_live(NULL, "ram", 0, 4, NULL, ram_save_live, NULL,
2931 ram_load, NULL);
2932 +#endif
2934 if (nb_numa_nodes > 0) {
2935 int i;
2936 @@ -3189,11 +3210,13 @@ int main(int argc, char **argv, char **envp)
2937 if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0)
2938 exit(0);
2940 +#ifdef CONFIG_WATCHDOG
2941 if (watchdog) {
2942 i = select_watchdog(watchdog);
2943 if (i > 0)
2944 exit (i == 1 ? 1 : 0);
2946 +#endif
2948 if (machine->compat_props) {
2949 qdev_prop_register_global_list(machine->compat_props);
2950 @@ -3247,6 +3270,12 @@ int main(int argc, char **argv, char **envp)
2951 curses_display_init(ds, full_screen);
2952 break;
2953 #endif
2954 +#ifdef CONFIG_STUBDOM
2955 + case DT_FBDEV:
2956 + printf("initial fbdev for stubdom");
2957 + fbdev_display_init(ds, NULL);
2958 + break;
2959 +#endif
2960 #if defined(CONFIG_SDL)
2961 case DT_SDL:
2962 sdl_display_init(ds, full_screen, no_frame);
2963 @@ -3283,19 +3312,10 @@ int main(int argc, char **argv, char **envp)
2965 /* display setup */
2966 dpy_resize(ds);
2967 - dcl = ds->listeners;
2968 - while (dcl != NULL) {
2969 - if (dcl->dpy_refresh != NULL) {
2970 - ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds);
2971 - qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock));
2972 - break;
2974 - dcl = dcl->next;
2976 - if (ds->gui_timer == NULL) {
2977 - nographic_timer = qemu_new_timer_ms(rt_clock, nographic_update, NULL);
2978 - qemu_mod_timer(nographic_timer, qemu_get_clock_ms(rt_clock));
2981 + periodic_timer = qemu_new_timer_ms(rt_clock, periodic_update, ds);
2982 + qemu_mod_timer(periodic_timer, qemu_get_clock_ms(rt_clock));
2984 text_consoles_set_display(ds);
2986 if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) {
2987 @@ -3324,12 +3344,14 @@ int main(int argc, char **argv, char **envp)
2990 if (incoming) {
2991 +#ifdef CONFIG_MIGRATION
2992 int ret = qemu_start_incoming_migration(incoming);
2993 if (ret < 0) {
2994 fprintf(stderr, "Migration failed. Exit code %s(%d), exiting.\n",
2995 incoming, ret);
2996 exit(ret);
2998 +#endif
2999 } else if (autostart) {
3000 vm_start();
3002 diff --git a/xen-all.c b/xen-all.c
3003 index 3611e19..9d06e06 100644
3004 --- a/xen-all.c
3005 +++ b/xen-all.c
3006 @@ -848,9 +848,10 @@ static void xen_main_loop_prepare(XenIOState *state)
3008 static void xen_change_state_handler(void *opaque, int running, int reason)
3010 + XenIOState *state = opaque;
3011 if (running) {
3012 /* record state running */
3013 - xenstore_record_dm_state(xenstore, "running");
3014 + xenstore_record_dm_state(state->xenstore, "running");
3018 @@ -877,7 +878,6 @@ int xen_init(void)
3019 xen_be_printf(NULL, 0, "can't open xen interface\n");
3020 return -1;
3022 - qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
3024 return 0;
3026 @@ -905,6 +905,9 @@ int xen_hvm_init(void)
3027 state->exit.notify = xen_exit_notifier;
3028 qemu_add_exit_notifier(&state->exit);
3030 +#ifdef CONFIG_STUBDOM
3031 + xc_set_hvm_param(xen_xc,xen_domid,HVM_PARAM_DM_DOMAIN,DOMID_SELF);
3032 +#endif
3033 xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
3034 DPRINTF("shared page at pfn %lx\n", ioreq_pfn);
3035 state->shared_page = xc_map_foreign_range(xen_xc, xen_domid, XC_PAGE_SIZE,
3036 @@ -940,12 +943,14 @@ int xen_hvm_init(void)
3037 xen_ram_init(ram_size);
3039 qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
3040 + qemu_add_vm_change_state_handler(xen_change_state_handler, state);
3042 state->client = xen_cpu_phys_memory_client;
3043 QLIST_INIT(&state->physmap);
3044 cpu_register_phys_memory_client(&state->client);
3045 state->log_for_dirtybit = NULL;
3047 +#ifndef CONFIG_STUBDOM
3048 /* Initialize backend core & drivers */
3049 if (xen_be_init() != 0) {
3050 fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__);
3051 @@ -954,6 +959,7 @@ int xen_hvm_init(void)
3052 xen_be_register("console", &xen_console_ops);
3053 xen_be_register("vkbd", &xen_kbdmouse_ops);
3054 xen_be_register("qdisk", &xen_blkdev_ops);
3055 +#endif
3057 return 0;
3059 diff --git a/xen-mapcache.c b/xen-mapcache.c
3060 index 007136a..f65cfd1 100644
3061 --- a/xen-mapcache.c
3062 +++ b/xen-mapcache.c
3063 @@ -144,6 +144,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
3064 pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i;
3068 vaddr_base = xc_map_foreign_bulk(xen_xc, xen_domid, PROT_READ|PROT_WRITE,
3069 pfns, err, nb_pfn);
3070 if (vaddr_base == NULL) {
3071 @@ -235,6 +236,53 @@ uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
3072 return mapcache->last_address_vaddr + address_offset;
3075 +void xen_vga_ram_map(target_phys_addr_t phys_addr, target_phys_addr_t size)
3077 + MapCacheEntry *entry, *pentry = NULL;
3078 + target_phys_addr_t address_index = phys_addr >> MCACHE_BUCKET_SHIFT;
3079 + target_phys_addr_t address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
3080 + target_phys_addr_t __size = size;
3081 + target_phys_addr_t nb_pfn;
3082 + int i;
3084 + /* size is always a multiple of MCACHE_BUCKET_SIZE */
3085 + if ((address_offset + (__size % MCACHE_BUCKET_SIZE)) > MCACHE_BUCKET_SIZE)
3086 + __size += MCACHE_BUCKET_SIZE;
3087 + if (__size % MCACHE_BUCKET_SIZE)
3088 + __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
3089 + if (!__size)
3090 + __size = MCACHE_BUCKET_SIZE;
3092 + nb_pfn = __size >> XC_PAGE_SHIFT;
3093 + entry = &mapcache->entry[address_index % mapcache->nr_buckets];
3095 + while (entry) {
3096 + pentry = entry;
3097 + entry = entry->next;
3100 + entry = qemu_mallocz(sizeof (MapCacheEntry));
3101 + pentry->next = entry;
3103 + entry->vaddr_base = fbdev_map_vram_to_qemu();
3104 + if(!entry->vaddr_base){
3105 + fprintf(stderr,"Cannot map vram to qemu\n");
3106 + exit(1);
3108 + entry->paddr_index = address_index;
3109 + entry->size = __size;
3110 + entry->lock = 1;
3111 + entry->valid_mapping = (unsigned long *) qemu_mallocz(sizeof(unsigned long) *
3112 + BITS_TO_LONGS(__size >> XC_PAGE_SHIFT));
3114 + bitmap_zero(entry->valid_mapping, nb_pfn);
3115 + for (i = 0; i < nb_pfn; i++)
3116 + bitmap_set(entry->valid_mapping, i, 1);
3118 + mapcache->last_address_index = address_index;
3119 + mapcache->last_address_vaddr = entry->vaddr_base;
3122 ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
3124 MapCacheEntry *entry = NULL, *pentry = NULL;
3125 diff --git a/xen-mapcache.h b/xen-mapcache.h
3126 index da874ca..6e6020c 100644
3127 --- a/xen-mapcache.h
3128 +++ b/xen-mapcache.h
3129 @@ -19,6 +19,7 @@ uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
3130 ram_addr_t xen_ram_addr_from_mapcache(void *ptr);
3131 void xen_invalidate_map_cache_entry(uint8_t *buffer);
3132 void xen_invalidate_map_cache(void);
3133 +void xen_vga_ram_map(target_phys_addr_t phys_addr, target_phys_addr_t size);
3135 #else