[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [qemu patches] Update patches upto changeset 11870:29b02d929b7e.



# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Node ID 55ff34dceb0bfba8bcc648dd30a2b97d85f24b3c
# Parent  2c29a2e42937e7e57c1fa465298c32c1d5d39bd4
[qemu patches] Update patches upto changeset 11870:29b02d929b7e.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/ioemu/patches/domain-timeoffset             |    8 -
 tools/ioemu/patches/hypervisor-rtc                |   26 ++++
 tools/ioemu/patches/ide-cd-dma                    |   18 ++
 tools/ioemu/patches/qemu-bootorder                |   22 +--
 tools/ioemu/patches/qemu-cleanup                  |   33 ++++-
 tools/ioemu/patches/qemu-daemonize                |    4 
 tools/ioemu/patches/qemu-logging                  |    3 
 tools/ioemu/patches/qemu-target-i386-dm           |   18 --
 tools/ioemu/patches/serial-port-rate-limit        |   47 +++++++
 tools/ioemu/patches/series                        |    6 
 tools/ioemu/patches/vnc-access-monitor-vt         |    8 -
 tools/ioemu/patches/vnc-backoff-screen-scan       |   42 ++----
 tools/ioemu/patches/vnc-display-find-unused       |   15 +-
 tools/ioemu/patches/vnc-fixes                     |   17 +-
 tools/ioemu/patches/vnc-listen-specific-interface |  142 ++++++++++++++++++++++
 tools/ioemu/patches/vnc-password                  |  119 ++++++++++++++++++
 tools/ioemu/patches/vnc-protocol-fixes            |   46 +++++++
 tools/ioemu/patches/vnc-start-vncviewer           |    8 -
 tools/ioemu/patches/vnc-title-domain-name         |    8 -
 tools/ioemu/patches/xen-build                     |   13 --
 tools/ioemu/patches/xen-platform-device           |   12 -
 tools/ioemu/patches/xen-support-buffered-ioreqs   |    8 -
 tools/ioemu/patches/xenstore-block-device-config  |   47 +++----
 tools/ioemu/patches/xenstore-write-vnc-port       |   12 -
 24 files changed, 550 insertions(+), 132 deletions(-)

diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/domain-timeoffset
--- a/tools/ioemu/patches/domain-timeoffset     Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/domain-timeoffset     Tue Oct 24 14:48:06 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/hw/mc146818rtc.c
 Index: ioemu/hw/mc146818rtc.c
 ===================================================================
---- ioemu.orig/hw/mc146818rtc.c        2006-09-21 19:33:25.000000000 +0100
-+++ ioemu/hw/mc146818rtc.c     2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/hw/mc146818rtc.c        2006-10-24 14:45:21.000000000 +0100
++++ ioemu/hw/mc146818rtc.c     2006-10-24 14:45:39.000000000 +0100
 @@ -178,10 +178,27 @@
      }
  }
@@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
  static void rtc_copy_date(RTCState *s)
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/hw/pc.c      2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/hw/pc.c 2006-10-24 14:45:38.000000000 +0100
++++ ioemu/hw/pc.c      2006-10-24 14:45:39.000000000 +0100
 @@ -159,7 +159,7 @@
  }
  
@@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
  QEMUMachine pc_machine = {
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/vl.c    2006-10-24 14:45:38.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:45:39.000000000 +0100
 @@ -163,6 +163,8 @@
  
  int xc_handle;
@@ -174,8 +174,8 @@ Index: ioemu/vl.c
      if (usb_enabled) {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/vl.h    2006-10-24 14:45:38.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:45:39.000000000 +0100
 @@ -576,7 +576,7 @@
                                   int boot_device,
               DisplayState *ds, const char **fd_filename, int snapshot,
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/qemu-bootorder
--- a/tools/ioemu/patches/qemu-bootorder        Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/qemu-bootorder        Tue Oct 24 14:48:06 2006 +0100
@@ -1,9 +1,9 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -124,7 +124,7 @@
- int vncunused;
+--- ioemu.orig/vl.c    2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -125,7 +125,7 @@
+ struct sockaddr_in vnclisten_addr;
  const char* keyboard_layout = NULL;
  int64_t ticks_per_sec;
 -int boot_device = 'c';
@@ -11,7 +11,7 @@ Index: ioemu/vl.c
  uint64_t ram_size;
  int pit_min_timer_count = 0;
  int nb_nics;
-@@ -6063,14 +6063,14 @@
+@@ -6075,14 +6075,14 @@
                  break;
  #endif /* !CONFIG_DM */
              case QEMU_OPTION_boot:
@@ -32,7 +32,7 @@ Index: ioemu/vl.c
                      exit(1);
                  }
                  break;
-@@ -6334,6 +6334,7 @@
+@@ -6349,6 +6349,7 @@
          fd_filename[0] == '\0')
          help();
      
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
      /* boot to cd by default if no hard disk */
      if (hd_filename[0] == '\0' && boot_device == 'c') {
          if (fd_filename[0] != '\0')
-@@ -6341,6 +6342,7 @@
+@@ -6356,6 +6357,7 @@
          else
              boot_device = 'd';
      }
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
  #endif /* !CONFIG_DM */
  
      setvbuf(stdout, NULL, _IOLBF, 0);
-@@ -6599,6 +6601,7 @@
+@@ -6614,6 +6616,7 @@
                    ds, fd_filename, snapshot,
                    kernel_filename, kernel_cmdline, initrd_filename,
                    timeoffset);
@@ -58,9 +58,9 @@ Index: ioemu/vl.c
      if (usb_enabled) {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:32.000000000 +0100
-@@ -576,7 +576,7 @@
+--- ioemu.orig/vl.h    2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:47.000000000 +0100
+@@ -578,7 +578,7 @@
  #ifndef QEMU_TOOL
  
  typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size, 
@@ -69,7 +69,7 @@ Index: ioemu/vl.h
               DisplayState *ds, const char **fd_filename, int snapshot,
               const char *kernel_filename, const char *kernel_cmdline,
               const char *initrd_filename, time_t timeoffset);
-@@ -1021,7 +1021,7 @@
+@@ -1023,7 +1023,7 @@
                      uint32_t start, uint32_t count);
  int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
                            const unsigned char *arch,
@@ -80,8 +80,8 @@ Index: ioemu/vl.h
                            uint32_t initrd_image, uint32_t initrd_size,
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/hw/pc.c      2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/hw/pc.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/hw/pc.c      2006-10-24 14:33:47.000000000 +0100
 @@ -158,8 +158,23 @@
      rtc_set_memory(s, info_ofs + 8, sectors);
  }
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/qemu-cleanup
--- a/tools/ioemu/patches/qemu-cleanup  Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/qemu-cleanup  Tue Oct 24 14:48:06 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/hw/vga.c
 Index: ioemu/hw/vga.c
 ===================================================================
---- ioemu.orig/hw/vga.c        2006-08-06 02:03:51.906765409 +0100
-+++ ioemu/hw/vga.c     2006-08-06 02:15:10.364150665 +0100
+--- ioemu.orig/hw/vga.c        2006-10-24 14:44:03.000000000 +0100
++++ ioemu/hw/vga.c     2006-10-24 14:45:22.000000000 +0100
 @@ -1622,7 +1622,9 @@
  static void vga_save(QEMUFile *f, void *opaque)
  {
@@ -26,8 +26,8 @@ Index: ioemu/hw/vga.c
          return -EINVAL;
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-08-06 02:15:01.774108287 +0100
-+++ ioemu/vl.c 2006-08-06 02:15:31.040845624 +0100
+--- ioemu.orig/vl.c    2006-10-24 14:44:08.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:45:29.000000000 +0100
 @@ -39,6 +39,7 @@
  #include <sys/ioctl.h>
  #include <sys/socket.h>
@@ -36,6 +36,24 @@ Index: ioemu/vl.c
  #include <dirent.h>
  #include <netdb.h>
  #ifdef _BSD
+@@ -2932,7 +2933,7 @@
+     }
+ 
+     /* XXX: better tmp dir construction */
+-    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
++    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
+     if (mkdir(smb_dir, 0700) < 0) {
+         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", 
smb_dir);
+         exit(1);
+@@ -3893,7 +3894,7 @@
+                 perror("Opening pidfile");
+                 exit(1);
+             }
+-            fprintf(f, "%d\n", getpid());
++            fprintf(f, "%ld\n", (long)getpid());
+             fclose(f);
+             pid_filename = qemu_strdup(filename);
+             if (!pid_filename) {
 @@ -5308,7 +5309,9 @@
      QEMU_OPTION_d,
      QEMU_OPTION_hdachs,
@@ -70,8 +88,8 @@ Index: ioemu/vl.c
                      fprintf(stderr, "qemu: too many network clients\n");
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-08-06 02:15:01.775108175 +0100
-+++ ioemu/vl.h 2006-08-06 02:15:10.368150219 +0100
+--- ioemu.orig/vl.h    2006-10-24 14:44:08.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:45:22.000000000 +0100
 @@ -957,7 +957,7 @@
               unsigned long vram_offset, int vram_size, int width, int height);
  
@@ -81,3 +99,18 @@ Index: ioemu/vl.h
  void slavio_intctl_set_cpu(void *opaque, unsigned int cpu, CPUState *env);
  void slavio_pic_info(void *opaque);
  void slavio_irq_info(void *opaque);
+Index: ioemu/usb-linux.c
+===================================================================
+--- ioemu.orig/usb-linux.c     2006-10-24 14:44:03.000000000 +0100
++++ ioemu/usb-linux.c  2006-10-24 14:44:08.000000000 +0100
+@@ -26,7 +26,9 @@
+ #if defined(__linux__)
+ #include <dirent.h>
+ #include <sys/ioctl.h>
+-#include <linux/compiler.h>
++/* Some versions of usbdevice_fs.h need __user to be defined for them.   */
++/* This may (harmlessly) conflict with a definition in linux/compiler.h. */
++#define __user
+ #include <linux/usbdevice_fs.h>
+ #include <linux/version.h>
+ 
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/qemu-daemonize
--- a/tools/ioemu/patches/qemu-daemonize        Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/qemu-daemonize        Tue Oct 24 14:48:06 2006 +0100
@@ -2,9 +2,9 @@ Changes required because qemu-dm runs da
 
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -6042,10 +6042,11 @@
+--- ioemu.orig/vl.c    2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -6054,10 +6054,11 @@
                  }
                  break;
              case QEMU_OPTION_nographic:
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/qemu-logging
--- a/tools/ioemu/patches/qemu-logging  Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/qemu-logging  Tue Oct 24 14:48:06 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-08-06 02:15:48.550893605 +0100
-+++ ioemu/vl.c 2006-08-06 02:16:31.246133963 +0100
+--- ioemu.orig/vl.c    2006-10-24 14:36:58.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:37:03.000000000 +0100
 @@ -5234,7 +5234,7 @@
             "-S              freeze CPU at startup (use 'c' to start 
execution)\n"
             "-s              wait gdb connection to port %d\n"
@@ -43,7 +43,7 @@ Index: ioemu/vl.c
      /* default mac address of the first network interface */
      
 +    /* init debug */
-+    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
++    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%ld.log", 
(long)getpid());
 +    cpu_set_log_filename(qemu_dm_logfilename);
 +    cpu_set_log(0);
 +    
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/qemu-target-i386-dm
--- a/tools/ioemu/patches/qemu-target-i386-dm   Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/qemu-target-i386-dm   Tue Oct 24 14:48:06 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/Makefile.target      2006-09-21 18:54:22.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/Makefile.target      2006-10-24 14:30:56.000000000 +0100
 @@ -62,6 +62,8 @@
  QEMU_SYSTEM=qemu-fast
  endif
@@ -32,8 +32,8 @@ Index: ioemu/Makefile.target
  DEFINES += -DHAS_AUDIO
 Index: ioemu/configure
 ===================================================================
---- ioemu.orig/configure       2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/configure    2006-09-21 18:54:21.000000000 +0100
+--- ioemu.orig/configure       2006-10-24 13:47:23.000000000 +0100
++++ ioemu/configure    2006-10-24 14:29:34.000000000 +0100
 @@ -373,6 +373,8 @@
      if [ "$user" = "yes" ] ; then
          target_list="i386-user arm-user armeb-user sparc-user ppc-user 
mips-user mipsel-user $target_list"
@@ -45,8 +45,8 @@ Index: ioemu/configure
  fi
 Index: ioemu/monitor.c
 ===================================================================
---- ioemu.orig/monitor.c       2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/monitor.c    2006-09-21 18:54:23.000000000 +0100
+--- ioemu.orig/monitor.c       2006-10-24 13:47:23.000000000 +0100
++++ ioemu/monitor.c    2006-10-24 14:30:56.000000000 +0100
 @@ -1262,6 +1262,10 @@
        "", "show profiling information", },
      { "capture", "", do_info_capture,
@@ -60,8 +60,8 @@ Index: ioemu/monitor.c
  
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 18:54:23.000000000 +0100
+--- ioemu.orig/vl.c    2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:30:56.000000000 +0100
 @@ -87,7 +87,7 @@
  
  #include "exec-all.h"
@@ -98,8 +98,8 @@ Index: ioemu/vl.c
  {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 18:54:23.000000000 +0100
+--- ioemu.orig/vl.h    2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:30:56.000000000 +0100
 @@ -37,6 +37,8 @@
  #include <unistd.h>
  #include <fcntl.h>
@@ -132,7 +132,7 @@ Index: ioemu/target-i386-dm/cpu.h
 Index: ioemu/target-i386-dm/cpu.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/cpu.h 2006-09-21 18:54:22.000000000 +0100
++++ ioemu/target-i386-dm/cpu.h 2006-10-24 14:30:56.000000000 +0100
 @@ -0,0 +1,86 @@
 +/*
 + * i386 virtual CPU header
@@ -223,7 +223,7 @@ Index: ioemu/target-i386-dm/exec-dm.c
 Index: ioemu/target-i386-dm/exec-dm.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/exec-dm.c     2006-09-21 18:54:22.000000000 +0100
++++ ioemu/target-i386-dm/exec-dm.c     2006-10-24 14:30:56.000000000 +0100
 @@ -0,0 +1,516 @@
 +/*
 + *  virtual page mapping and translated block handling
@@ -744,7 +744,7 @@ Index: ioemu/target-i386-dm/helper2.c
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/helper2.c     2006-09-21 18:55:31.000000000 +0100
++++ ioemu/target-i386-dm/helper2.c     2006-10-24 14:31:01.000000000 +0100
 @@ -0,0 +1,469 @@
 +/*
 + *  i386 helpers (without register variable usage)
@@ -1205,8 +1205,8 @@ Index: ioemu/target-i386-dm/helper2.c
 +                break;
 +        }
 +
-+        /* Wait up to 100 msec. */
-+        main_loop_wait(100);
++        /* Wait up to 10 msec. */
++        main_loop_wait(10);
 +
 +        if (env->send_event) {
 +            env->send_event = 0;
@@ -1218,7 +1218,7 @@ Index: ioemu/target-i386-dm/i8259-dm.c
 Index: ioemu/target-i386-dm/i8259-dm.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/i8259-dm.c    2006-09-21 11:30:11.000000000 +0100
++++ ioemu/target-i386-dm/i8259-dm.c    2006-10-24 13:47:23.000000000 +0100
 @@ -0,0 +1,107 @@
 +/* Xen 8259 stub for interrupt controller emulation
 + * 
@@ -1330,7 +1330,7 @@ Index: ioemu/target-i386-dm/qemu-dm.debu
 Index: ioemu/target-i386-dm/qemu-dm.debug
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/qemu-dm.debug 2006-09-21 11:30:11.000000000 +0100
++++ ioemu/target-i386-dm/qemu-dm.debug 2006-10-24 13:47:23.000000000 +0100
 @@ -0,0 +1,5 @@
 +#!/bin/sh
 +
@@ -1340,7 +1340,7 @@ Index: ioemu/target-i386-dm/qemu-ifup
 Index: ioemu/target-i386-dm/qemu-ifup
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/qemu-ifup     2006-09-21 11:30:11.000000000 +0100
++++ ioemu/target-i386-dm/qemu-ifup     2006-10-24 13:47:23.000000000 +0100
 @@ -0,0 +1,10 @@
 +#!/bin/sh
 +
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/series
--- a/tools/ioemu/patches/series        Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/series        Tue Oct 24 14:48:06 2006 +0100
@@ -32,10 +32,12 @@ fix-vga-scanning-code-overflow
 fix-vga-scanning-code-overflow
 vnc-cleanup
 vnc-fixes
+vnc-protocol-fixes
 vnc-start-vncviewer
 vnc-title-domain-name
 vnc-access-monitor-vt
 vnc-display-find-unused
+vnc-listen-specific-interface
 vnc-backoff-screen-scan
 xenstore-block-device-config
 xenstore-write-vnc-port
@@ -47,3 +49,7 @@ qemu-bootorder
 qemu-bootorder
 qemu-tunable-ide-write-cache
 qemu-pci 
+serial-port-rate-limit
+hypervisor-rtc
+ide-cd-dma
+vnc-password
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-access-monitor-vt
--- a/tools/ioemu/patches/vnc-access-monitor-vt Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/vnc-access-monitor-vt Tue Oct 24 14:48:06 2006 +0100
@@ -1,8 +1,8 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vnc.c        2006-09-21 19:33:31.000000000 +0100
-@@ -32,6 +32,10 @@
+--- ioemu.orig/vnc.c   2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:33:46.000000000 +0100
+@@ -33,6 +33,10 @@
  #include "vnc_keysym.h"
  #include "keymaps.c"
  
@@ -13,7 +13,7 @@ Index: ioemu/vnc.c
  typedef struct Buffer
  {
      size_t capacity;
-@@ -95,6 +99,8 @@
+@@ -96,6 +100,8 @@
      int visible_h;
  
      int slow_client;
@@ -22,7 +22,7 @@ Index: ioemu/vnc.c
  };
  
  #define DIRTY_PIXEL_BITS 64
-@@ -791,16 +797,80 @@
+@@ -794,16 +800,80 @@
  
  static void do_key_event(VncState *vs, int down, uint32_t sym)
  {
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-backoff-screen-scan
--- a/tools/ioemu/patches/vnc-backoff-screen-scan       Tue Oct 24 14:47:41 
2006 +0100
+++ b/tools/ioemu/patches/vnc-backoff-screen-scan       Tue Oct 24 14:48:06 
2006 +0100
@@ -1,10 +1,10 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-09-21 19:31:03.000000000 +0100
-+++ ioemu/vnc.c        2006-09-21 19:32:23.000000000 +0100
-@@ -27,7 +27,19 @@
- #include "vl.h"
+--- ioemu.orig/vnc.c   2006-10-24 14:33:17.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:33:24.000000000 +0100
+@@ -28,7 +28,19 @@
  #include "qemu_socket.h"
+ #include <assert.h>
  
 -#define VNC_REFRESH_INTERVAL (1000 / 30)
 +/* The refresh interval starts at BASE.  If we scan the buffer and
@@ -23,7 +23,7 @@ Index: ioemu/vnc.c
  
  #include "vnc_keysym.h"
  #include "keymaps.c"
-@@ -64,10 +76,11 @@
+@@ -65,10 +77,11 @@
  struct VncState
  {
      QEMUTimer *timer;
@@ -36,7 +36,7 @@ Index: ioemu/vnc.c
      int width;
      int height;
      uint64_t *dirty_row;      /* screen regions which are possibly dirty */
-@@ -98,8 +111,6 @@
+@@ -99,8 +112,6 @@
      int visible_w;
      int visible_h;
  
@@ -45,7 +45,7 @@ Index: ioemu/vnc.c
      int ctl_keys;               /* Ctrl+Alt starts calibration */
  };
  
-@@ -380,7 +391,7 @@
+@@ -381,7 +392,7 @@
      int y = 0;
      int pitch = ds->linesize;
      VncState *vs = ds->opaque;
@@ -54,19 +54,19 @@ Index: ioemu/vnc.c
  
      if (src_x < vs->visible_x || src_y < vs->visible_y ||
        dst_x < vs->visible_x || dst_y < vs->visible_y ||
-@@ -390,11 +401,6 @@
+@@ -391,10 +402,8 @@
        (dst_y + h) > (vs->visible_y + vs->visible_h))
        updating_client = 0;
  
 -    if (updating_client) {
 -      vs->need_update = 1;
--      _vnc_update_client(vs);
++    if (updating_client)
+       _vnc_update_client(vs);
 -    }
--
+ 
      if (dst_y > src_y) {
        y = h - 1;
-       pitch = -pitch;
-@@ -445,110 +451,145 @@
+@@ -446,110 +455,149 @@
  static void _vnc_update_client(void *opaque)
  {
      VncState *vs = opaque;
@@ -279,12 +279,16 @@ Index: ioemu/vnc.c
 +             interested (e.g. minimised) it'll ignore this, and we
 +             can stop scanning the buffer until it sends another
 +             update request. */
-+          /* Note that there are bugs in xvncviewer which prevent
-+             this from actually working.  Leave the code in place
-+             for correct clients. */
++          /* It turns out that there's a bug in realvncviewer 4.1.2
++             which means that if you send a proper null update (with
++             no update rectangles), it gets a bit out of sync and
++             never sends any further requests, regardless of whether
++             it needs one or not.  Fix this by sending a single 1x1
++             update rectangle instead. */
 +          vnc_write_u8(vs, 0);
 +          vnc_write_u8(vs, 0);
-+          vnc_write_u16(vs, 0);
++          vnc_write_u16(vs, 1);
++          send_framebuffer_update(vs, 0, 0, 1, 1);
 +          vnc_flush(vs);
 +          vs->last_update_time = now;
 +          return;
@@ -295,7 +299,7 @@ Index: ioemu/vnc.c
  }
  
  static void vnc_update_client(void *opaque)
-@@ -561,8 +602,10 @@
+@@ -562,8 +610,10 @@
  
  static void vnc_timer_init(VncState *vs)
  {
@@ -307,7 +311,7 @@ Index: ioemu/vnc.c
  }
  
  static void vnc_dpy_refresh(DisplayState *ds)
-@@ -622,7 +665,6 @@
+@@ -623,7 +673,6 @@
        vs->csock = -1;
        buffer_reset(&vs->input);
        buffer_reset(&vs->output);
@@ -315,7 +319,7 @@ Index: ioemu/vnc.c
        return 0;
      }
      return ret;
-@@ -892,7 +934,6 @@
+@@ -895,7 +944,6 @@
                                       int x_position, int y_position,
                                       int w, int h)
  {
@@ -323,7 +327,7 @@ Index: ioemu/vnc.c
      if (!incremental)
        framebuffer_set_updated(vs, x_position, y_position, w, h);
      vs->visible_x = x_position;
-@@ -1015,6 +1056,7 @@
+@@ -1018,6 +1066,7 @@
  {
      int i;
      uint16_t limit;
@@ -331,7 +335,7 @@ Index: ioemu/vnc.c
  
      switch (data[0]) {
      case 0:
-@@ -1054,12 +1096,18 @@
+@@ -1061,12 +1110,18 @@
        if (len == 1)
            return 8;
  
@@ -352,15 +356,15 @@ Index: ioemu/vnc.c
      case 6:
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:31:03.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:32:23.000000000 +0100
-@@ -725,6 +725,12 @@
+--- ioemu.orig/vl.c    2006-10-24 14:33:17.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:24.000000000 +0100
+@@ -726,6 +726,12 @@
      }
  }
  
 +void qemu_advance_timer(QEMUTimer *ts, int64_t expire_time)
 +{
-+    if (ts->expire_time > expire_time)
++    if (ts->expire_time > expire_time || !qemu_timer_pending(ts))
 +      qemu_mod_timer(ts, expire_time);
 +}
 +
@@ -369,9 +373,9 @@ Index: ioemu/vl.c
  void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:31:03.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:32:23.000000000 +0100
-@@ -405,6 +405,7 @@
+--- ioemu.orig/vl.h    2006-10-24 14:33:17.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:24.000000000 +0100
+@@ -407,6 +407,7 @@
  void qemu_free_timer(QEMUTimer *ts);
  void qemu_del_timer(QEMUTimer *ts);
  void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-display-find-unused
--- a/tools/ioemu/patches/vnc-display-find-unused       Tue Oct 24 14:47:41 
2006 +0100
+++ b/tools/ioemu/patches/vnc-display-find-unused       Tue Oct 24 14:48:06 
2006 +0100
@@ -1,8 +1,8 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vnc.c        2006-09-21 19:33:31.000000000 +0100
-@@ -1182,7 +1182,7 @@
+--- ioemu.orig/vnc.c   2006-10-24 14:31:09.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:31:36.000000000 +0100
+@@ -1195,7 +1195,7 @@
      }
  }
  
@@ -11,7 +11,7 @@ Index: ioemu/vnc.c
  {
      struct sockaddr_in addr;
      int reuse_addr, ret;
-@@ -1213,10 +1213,6 @@
+@@ -1226,10 +1226,6 @@
        exit(1);
      }
  
@@ -22,7 +22,7 @@ Index: ioemu/vnc.c
      reuse_addr = 1;
      ret = setsockopt(vs->lsock, SOL_SOCKET, SO_REUSEADDR,
                     (const char *)&reuse_addr, sizeof(reuse_addr));
-@@ -1225,7 +1221,16 @@
+@@ -1238,7 +1234,16 @@
        exit(1);
      }
  
@@ -39,7 +39,7 @@ Index: ioemu/vnc.c
        fprintf(stderr, "bind() failed\n");
        exit(1);
      }
-@@ -1246,6 +1251,8 @@
+@@ -1259,6 +1264,8 @@
      vs->ds->dpy_refresh = vnc_dpy_refresh;
  
      vnc_dpy_resize(vs->ds, 640, 400);
@@ -50,8 +50,8 @@ Index: ioemu/vnc.c
  int vnc_start_viewer(int port)
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/vl.c    2006-10-24 14:31:09.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:31:41.000000000 +0100
 @@ -121,6 +121,7 @@
  static DisplayState display_state;
  int nographic;
@@ -99,7 +99,7 @@ Index: ioemu/vl.c
 +            case QEMU_OPTION_vncunused:
 +                vncunused++;
 +                if (vnc_display == -1)
-+                    vnc_display = -2;
++                    vnc_display = 0;
 +                break;
              }
          }
@@ -115,8 +115,8 @@ Index: ioemu/vl.c
      } else {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/vl.h    2006-10-24 14:31:09.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:31:36.000000000 +0100
 @@ -785,7 +785,7 @@
  void cocoa_display_init(DisplayState *ds, int full_screen);
  
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-fixes
--- a/tools/ioemu/patches/vnc-fixes     Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/vnc-fixes     Tue Oct 24 14:48:06 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:08:18.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:26:24.000000000 +0100
+--- ioemu.orig/vl.c    2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:19:36.000000000 +0100
 @@ -6534,8 +6534,10 @@
          }
      }
@@ -17,8 +17,8 @@ Index: ioemu/vl.c
      if (use_gdbstub) {
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-09-21 19:08:18.000000000 +0100
-+++ ioemu/vnc.c        2006-09-21 19:26:38.000000000 +0100
+--- ioemu.orig/vnc.c   2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:20:00.000000000 +0100
 @@ -3,6 +3,7 @@
   * 
   * Copyright (C) 2006 Anthony Liguori <anthony@xxxxxxxxxxxxx>
@@ -483,7 +483,16 @@ Index: ioemu/vnc.c
  
      vga_hw_invalidate();
      vga_hw_update();
-@@ -1010,11 +1101,11 @@
+@@ -924,6 +1015,8 @@
+ {
+     char pad[3] = { 0, 0, 0 };
+ 
++    vga_hw_update();
++
+     vs->width = vs->ds->width;
+     vs->height = vs->ds->height;
+     vnc_write_u16(vs, vs->ds->width);
+@@ -1010,11 +1103,11 @@
        vnc_write(vs, "RFB 003.003\n", 12);
        vnc_flush(vs);
        vnc_read_when(vs, protocol_version, 12);
@@ -497,7 +506,7 @@ Index: ioemu/vnc.c
      }
  }
  
-@@ -1071,17 +1162,15 @@
+@@ -1071,17 +1164,15 @@
        exit(1);
      }
  
@@ -520,8 +529,8 @@ Index: ioemu/vnc.c
  }
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:00:48.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:26:24.000000000 +0100
+--- ioemu.orig/vl.h    2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:19:36.000000000 +0100
 @@ -319,6 +319,7 @@
  int is_graphic_console(void);
  CharDriverState *text_console_init(DisplayState *ds);
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-start-vncviewer
--- a/tools/ioemu/patches/vnc-start-vncviewer   Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/vnc-start-vncviewer   Tue Oct 24 14:48:06 2006 +0100
@@ -1,8 +1,8 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-09-21 19:26:38.000000000 +0100
-+++ ioemu/vnc.c        2006-09-21 19:29:58.000000000 +0100
-@@ -1174,3 +1174,25 @@
+--- ioemu.orig/vnc.c   2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:33:46.000000000 +0100
+@@ -1187,3 +1187,25 @@
  
      vnc_dpy_resize(vs->ds, 640, 400);
  }
@@ -30,8 +30,8 @@ Index: ioemu/vnc.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:26:24.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:29:50.000000000 +0100
+--- ioemu.orig/vl.c    2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:46.000000000 +0100
 @@ -120,6 +120,7 @@
  int bios_size;
  static DisplayState display_state;
@@ -93,8 +93,8 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:26:24.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:29:50.000000000 +0100
+--- ioemu.orig/vl.h    2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:46.000000000 +0100
 @@ -786,6 +786,7 @@
  
  /* vnc.c */
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-title-domain-name
--- a/tools/ioemu/patches/vnc-title-domain-name Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/vnc-title-domain-name Tue Oct 24 14:48:06 2006 +0100
@@ -1,16 +1,16 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vnc.c        2006-09-21 19:33:31.000000000 +0100
-@@ -1013,6 +1013,7 @@
+--- ioemu.orig/vnc.c   2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:33:46.000000000 +0100
+@@ -1024,6 +1024,7 @@
  
  static int protocol_client_init(VncState *vs, char *data, size_t len)
  {
 +    size_t l;
      char pad[3] = { 0, 0, 0 };
  
-     vs->width = vs->ds->width;
-@@ -1058,8 +1059,10 @@
+     vga_hw_update();
+@@ -1071,8 +1072,10 @@
        
      vnc_write(vs, pad, 3);           /* padding */
  
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/xen-build
--- a/tools/ioemu/patches/xen-build     Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/xen-build     Tue Oct 24 14:48:06 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/Makefile
 Index: ioemu/Makefile
 ===================================================================
---- ioemu.orig/Makefile        2006-08-28 20:19:23.000000000 +0100
-+++ ioemu/Makefile     2006-08-28 20:20:08.000000000 +0100
+--- ioemu.orig/Makefile        2006-10-24 14:37:25.000000000 +0100
++++ ioemu/Makefile     2006-10-24 14:37:28.000000000 +0100
 @@ -1,11 +1,14 @@
  # Makefile for QEMU.
  
@@ -85,8 +85,8 @@ Index: ioemu/Makefile
  info: qemu-doc.info qemu-tech.info
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-08-28 20:19:23.000000000 +0100
-+++ ioemu/Makefile.target      2006-08-28 20:19:47.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 14:37:25.000000000 +0100
++++ ioemu/Makefile.target      2006-10-24 14:40:25.000000000 +0100
 @@ -1,5 +1,8 @@
  include config.mak
  
@@ -112,7 +112,7 @@ Index: ioemu/Makefile.target
  endif
 -CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 +CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
-+SSE2 := $(call test-gcc-flag,$(CC),-msse2)
++SSE2 := $(call cc-option,$(CC),-msse2,)
 +ifeq ($(SSE2),-msse2)
 +CFLAGS += -DUSE_SSE2=1 -msse2
 +endif
@@ -149,17 +149,18 @@ Index: ioemu/Makefile.target
  install: all 
 +      mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
  ifneq ($(PROGS),)
-       $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
- endif
-+      install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
-+      install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
+-      $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
++      $(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)"
+ endif
++      $(INSTALL_PROG) $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
++      $(INSTALL_PROG) $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
  
  ifneq ($(wildcard .depend),)
  include .depend
 Index: ioemu/configure
 ===================================================================
---- ioemu.orig/configure       2006-08-28 20:19:23.000000000 +0100
-+++ ioemu/configure    2006-08-28 20:19:47.000000000 +0100
+--- ioemu.orig/configure       2006-10-24 14:37:25.000000000 +0100
++++ ioemu/configure    2006-10-24 14:40:20.000000000 +0100
 @@ -18,8 +18,8 @@
  
  # default parameters
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/xen-platform-device
--- a/tools/ioemu/patches/xen-platform-device   Tue Oct 24 14:47:41 2006 +0100
+++ b/tools/ioemu/patches/xen-platform-device   Tue Oct 24 14:48:06 2006 +0100
@@ -3,8 +3,8 @@ will come later.
 
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/Makefile.target      2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 14:41:01.000000000 +0100
++++ ioemu/Makefile.target      2006-10-24 14:41:01.000000000 +0100
 @@ -359,6 +359,7 @@
  VL_OBJS+= usb-uhci.o
  VL_OBJS+= piix4acpi.o
@@ -15,8 +15,8 @@ Index: ioemu/Makefile.target
  ifeq ($(TARGET_BASE_ARCH), ppc)
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/hw/pc.c      2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/hw/pc.c 2006-10-24 14:41:00.000000000 +0100
++++ ioemu/hw/pc.c      2006-10-24 14:41:01.000000000 +0100
 @@ -823,6 +823,9 @@
      }
  #endif /* !CONFIG_DM */
@@ -30,8 +30,8 @@ Index: ioemu/hw/xen_platform.c
 Index: ioemu/hw/xen_platform.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/hw/xen_platform.c    2006-09-21 19:33:32.000000000 +0100
-@@ -0,0 +1,138 @@
++++ ioemu/hw/xen_platform.c    2006-10-24 14:41:04.000000000 +0100
+@@ -0,0 +1,144 @@
 +/*
 + * XEN platform fake pci device, formerly known as the event channel device
 + * 
@@ -131,7 +131,8 @@ Index: ioemu/hw/xen_platform.c
 +    uint8_t  bist; /* Built in self test */
 +    uint32_t base_address_regs[6];
 +    uint32_t reserved1;
-+    uint32_t reserved2;
++    uint16_t subsystem_vendor_id;
++    uint16_t subsystem_id;
 +    uint32_t rom_addr;
 +    uint32_t reserved3;
 +    uint32_t reserved4;
@@ -160,6 +161,11 @@ Index: ioemu/hw/xen_platform.c
 +    pch->header_type = 0;
 +    pch->interrupt_pin = 1;
 +
++    /* Microsoft WHQL requires non-zero subsystem IDs. */
++    /* http://www.pcisig.com/reflector/msg02205.html.  */
++    pch->subsystem_vendor_id = pch->vendor_id; /* Duplicate vendor id.  */
++    pch->subsystem_id        = 0x0001;         /* Hardcode sub-id as 1. */
++
 +    pci_register_io_region(d, 0, 0x100, PCI_ADDRESS_SPACE_IO,
 +                           platform_ioport_map);
 +
@@ -172,9 +178,9 @@ Index: ioemu/hw/xen_platform.c
 +}
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:32.000000000 +0100
-@@ -1210,6 +1210,9 @@
+--- ioemu.orig/vl.h    2006-10-24 14:41:01.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:41:01.000000000 +0100
+@@ -1212,6 +1212,9 @@
  void xenstore_check_new_media_present(int timeout);
  void xenstore_write_vncport(int vnc_display);
  
diff -r 2c29a2e42937 -r 55ff34dceb0b 
tools/ioemu/patches/xen-support-buffered-ioreqs
--- a/tools/ioemu/patches/xen-support-buffered-ioreqs   Tue Oct 24 14:47:41 
2006 +0100
+++ b/tools/ioemu/patches/xen-support-buffered-ioreqs   Tue Oct 24 14:48:06 
2006 +0100
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -5844,6 +5844,7 @@
+--- ioemu.orig/vl.c    2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -5854,6 +5854,7 @@
      unsigned long nr_pages, tmp_nr_pages, shared_page_nr;
      xen_pfn_t *page_array;
      extern void *shared_page;
@@ -10,7 +10,7 @@ Index: ioemu/vl.c
  
      char qemu_dm_logfilename[64];
  
-@@ -6425,6 +6426,18 @@
+@@ -6440,6 +6441,18 @@
      fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n",
              shared_page_nr, (uint64_t)(page_array[shared_page_nr]));
  
@@ -31,8 +31,8 @@ Index: ioemu/vl.c
  #elif defined(__ia64__)
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
---- ioemu.orig/target-i386-dm/helper2.c        2006-09-21 19:33:30.000000000 
+0100
-+++ ioemu/target-i386-dm/helper2.c     2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/target-i386-dm/helper2.c        2006-10-24 14:33:45.000000000 
+0100
++++ ioemu/target-i386-dm/helper2.c     2006-10-24 14:33:47.000000000 +0100
 @@ -76,6 +76,10 @@
  
  shared_iopage_t *shared_page = NULL;
diff -r 2c29a2e42937 -r 55ff34dceb0b 
tools/ioemu/patches/xenstore-block-device-config
--- a/tools/ioemu/patches/xenstore-block-device-config  Tue Oct 24 14:47:41 
2006 +0100
+++ b/tools/ioemu/patches/xenstore-block-device-config  Tue Oct 24 14:48:06 
2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/Makefile.target      2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 14:31:36.000000000 +0100
++++ ioemu/Makefile.target      2006-10-24 14:33:28.000000000 +0100
 @@ -358,6 +358,7 @@
  VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
  VL_OBJS+= usb-uhci.o
@@ -13,7 +13,7 @@ Index: ioemu/xenstore.c
 Index: ioemu/xenstore.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/xenstore.c   2006-09-21 19:33:31.000000000 +0100
++++ ioemu/xenstore.c   2006-10-24 14:33:28.000000000 +0100
 @@ -0,0 +1,187 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General
@@ -204,9 +204,9 @@ Index: ioemu/xenstore.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:31.000000000 +0100
-@@ -5249,9 +5249,11 @@
+--- ioemu.orig/vl.c    2006-10-24 14:33:24.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:28.000000000 +0100
+@@ -5256,9 +5256,11 @@
             "Standard options:\n"
             "-M machine      select emulated machine (-M ? for list)\n"
             "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n"
@@ -218,7 +218,7 @@ Index: ioemu/vl.c
             "-boot [a|c|d]   boot on floppy (a), hard disk (c) or CD-ROM (d)\n"
           "-snapshot       write to temporary files instead of disk image 
files\n"
  #ifdef TARGET_I386
-@@ -5378,11 +5380,13 @@
+@@ -5386,11 +5388,13 @@
      QEMU_OPTION_M,
      QEMU_OPTION_fda,
      QEMU_OPTION_fdb,
@@ -232,7 +232,7 @@ Index: ioemu/vl.c
      QEMU_OPTION_boot,
      QEMU_OPTION_snapshot,
  #ifdef TARGET_I386
-@@ -5454,11 +5458,13 @@
+@@ -5463,11 +5467,13 @@
      { "M", HAS_ARG, QEMU_OPTION_M },
      { "fda", HAS_ARG, QEMU_OPTION_fda },
      { "fdb", HAS_ARG, QEMU_OPTION_fdb },
@@ -246,7 +246,7 @@ Index: ioemu/vl.c
      { "boot", HAS_ARG, QEMU_OPTION_boot },
      { "snapshot", 0, QEMU_OPTION_snapshot },
  #ifdef TARGET_I386
-@@ -5807,10 +5813,16 @@
+@@ -5817,10 +5823,16 @@
  #ifdef CONFIG_GDBSTUB
      int use_gdbstub, gdbstub_port;
  #endif
@@ -265,7 +265,7 @@ Index: ioemu/vl.c
      const char *kernel_filename, *kernel_cmdline;
      DisplayState *ds = &display_state;
      int cyls, heads, secs, translation;
-@@ -5871,8 +5883,10 @@
+@@ -5881,8 +5893,10 @@
      initrd_filename = NULL;
      for(i = 0; i < MAX_FD; i++)
          fd_filename[i] = NULL;
@@ -276,7 +276,7 @@ Index: ioemu/vl.c
      ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
      vga_ram_size = VGA_RAM_SIZE;
      bios_size = BIOS_SIZE;
-@@ -5886,11 +5900,13 @@
+@@ -5896,11 +5910,13 @@
      vncunused = 0;
      kernel_filename = NULL;
      kernel_cmdline = "";
@@ -290,7 +290,7 @@ Index: ioemu/vl.c
      cyls = heads = secs = 0;
      translation = BIOS_ATA_TRANSLATION_AUTO;
      pstrcpy(monitor_device, sizeof(monitor_device), "vc");
-@@ -5923,7 +5939,11 @@
+@@ -5935,7 +5951,11 @@
              break;
          r = argv[optind];
          if (r[0] != '-') {
@@ -302,7 +302,7 @@ Index: ioemu/vl.c
          } else {
              const QEMUOption *popt;
  
-@@ -5967,6 +5987,7 @@
+@@ -5979,6 +5999,7 @@
              case QEMU_OPTION_initrd:
                  initrd_filename = optarg;
                  break;
@@ -310,7 +310,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_hda:
              case QEMU_OPTION_hdb:
              case QEMU_OPTION_hdc:
-@@ -5979,6 +6000,7 @@
+@@ -5991,6 +6012,7 @@
                          cdrom_index = -1;
                  }
                  break;
@@ -318,7 +318,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_snapshot:
                  snapshot = 1;
                  break;
-@@ -6031,11 +6053,13 @@
+@@ -6043,11 +6065,13 @@
              case QEMU_OPTION_append:
                  kernel_cmdline = optarg;
                  break;
@@ -332,7 +332,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_boot:
                  boot_device = optarg[0];
                  if (boot_device != 'a' && 
-@@ -6290,12 +6314,18 @@
+@@ -6305,12 +6329,18 @@
          }
      }
  
@@ -351,7 +351,7 @@ Index: ioemu/vl.c
      if (!linux_boot && 
          hd_filename[0] == '\0' && 
          (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
-@@ -6309,6 +6339,7 @@
+@@ -6324,6 +6354,7 @@
          else
              boot_device = 'd';
      }
@@ -359,7 +359,7 @@ Index: ioemu/vl.c
  
      setvbuf(stdout, NULL, _IOLBF, 0);
      
-@@ -6441,6 +6472,7 @@
+@@ -6456,6 +6487,7 @@
  
  #endif /* !CONFIG_DM */
  
@@ -367,7 +367,7 @@ Index: ioemu/vl.c
      /* we always create the cdrom drive, even if no disk is there */
      bdrv_init();
      if (cdrom_index >= 0) {
-@@ -6467,6 +6499,7 @@
+@@ -6482,6 +6514,7 @@
              }
          }
      }
@@ -375,7 +375,7 @@ Index: ioemu/vl.c
  
      /* we always create at least one floppy disk */
      fd_table[0] = bdrv_new("fda");
-@@ -6545,6 +6578,8 @@
+@@ -6560,6 +6593,8 @@
          }
      }
  
@@ -386,8 +386,8 @@ Index: ioemu/vl.c
                    kernel_filename, kernel_cmdline, initrd_filename,
 Index: ioemu/monitor.c
 ===================================================================
---- ioemu.orig/monitor.c       2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/monitor.c    2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/monitor.c       2006-10-24 14:31:36.000000000 +0100
++++ ioemu/monitor.c    2006-10-24 14:33:28.000000000 +0100
 @@ -24,6 +24,7 @@
  #include "vl.h"
  #include "disas.h"
@@ -416,8 +416,8 @@ Index: ioemu/monitor.c
      int i;
 Index: ioemu/block.c
 ===================================================================
---- ioemu.orig/block.c 2006-09-21 19:33:25.000000000 +0100
-+++ ioemu/block.c      2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/block.c 2006-10-24 14:31:36.000000000 +0100
++++ ioemu/block.c      2006-10-24 14:33:28.000000000 +0100
 @@ -758,6 +758,7 @@
  static void raw_close(BlockDriverState *bs)
  {
@@ -428,9 +428,9 @@ Index: ioemu/block.c
  
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:31.000000000 +0100
-@@ -1189,6 +1189,8 @@
+--- ioemu.orig/vl.h    2006-10-24 14:33:24.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:28.000000000 +0100
+@@ -1191,6 +1191,8 @@
  void term_print_help(void);
  void monitor_readline(const char *prompt, int is_password,
                        char *buf, int buf_size);
@@ -439,7 +439,7 @@ Index: ioemu/vl.h
  
  /* readline.c */
  typedef void ReadLineFunc(void *opaque, const char *str);
-@@ -1201,6 +1203,13 @@
+@@ -1203,6 +1205,13 @@
  void readline_start(const char *prompt, int is_password,
                      ReadLineFunc *readline_func, void *opaque);
  
@@ -455,8 +455,8 @@ Index: ioemu/vl.h
  extern char domain_name[];
 Index: ioemu/hw/ide.c
 ===================================================================
---- ioemu.orig/hw/ide.c        2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/hw/ide.c     2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/hw/ide.c        2006-10-24 14:31:36.000000000 +0100
++++ ioemu/hw/ide.c     2006-10-24 14:33:28.000000000 +0100
 @@ -1158,6 +1158,7 @@
          } else {
              ide_atapi_cmd_error(s, SENSE_NOT_READY, 
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/xenstore-write-vnc-port
--- a/tools/ioemu/patches/xenstore-write-vnc-port       Tue Oct 24 14:47:41 
2006 +0100
+++ b/tools/ioemu/patches/xenstore-write-vnc-port       Tue Oct 24 14:48:06 
2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/xenstore.c
 Index: ioemu/xenstore.c
 ===================================================================
---- ioemu.orig/xenstore.c      2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/xenstore.c   2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/xenstore.c      2006-10-24 14:33:47.000000000 +0100
++++ ioemu/xenstore.c   2006-10-24 14:33:47.000000000 +0100
 @@ -185,3 +185,31 @@
      free(image);
      free(vec);
@@ -36,10 +36,10 @@ Index: ioemu/xenstore.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -6535,6 +6535,7 @@
-       vnc_display = vnc_display_init(ds, vnc_display, vncunused);
+--- ioemu.orig/vl.c    2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -6550,6 +6550,7 @@
+       vnc_display = vnc_display_init(ds, vnc_display, vncunused, 
&vnclisten_addr);
        if (vncviewer)
            vnc_start_viewer(vnc_display);
 +      xenstore_write_vncport(vnc_display);
@@ -48,9 +48,9 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:32.000000000 +0100
-@@ -1208,6 +1208,7 @@
+--- ioemu.orig/vl.h    2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:47.000000000 +0100
+@@ -1210,6 +1210,7 @@
  int xenstore_fd(void);
  void xenstore_process_event(void *opaque);
  void xenstore_check_new_media_present(int timeout);
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/hypervisor-rtc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/hypervisor-rtc        Tue Oct 24 14:48:06 2006 +0100
@@ -0,0 +1,143 @@
+# HG changeset patch
+# User kfraser@xxxxxxxxxxxxxxxxxxxxx
+# Node ID 71e2a165aa7f81602c569430b18ba1ea705f0b70
+# Parent  da66691687dfd90c55420cfdf27f55d18cca7810
+[HVM] Move RTC emulation into the hypervisor.
+Signed-off-by: Xiaowei Yang <xiaowei.yang@xxxxxxxxx>
+
+--- ioemu/Makefile.target      Wed Oct 18 18:13:57 2006 +0100
++++ ioemu/Makefile.target      Wed Oct 18 18:35:21 2006 +0100
+@@ -294,7 +294,11 @@ endif
+ endif
+ 
+ # qemu-dm objects
++ifeq ($(ARCH),ia64)
+ LIBOBJS=helper2.o exec-dm.o i8259-dm.o
++else
++LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o
++endif
+ 
+ all: $(PROGS)
+ 
+@@ -354,7 +358,11 @@ ifeq ($(TARGET_BASE_ARCH), i386)
+ ifeq ($(TARGET_BASE_ARCH), i386)
+ # Hardware support
+ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
++ifeq ($(ARCH),ia64)
+ VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
++else
++VL_OBJS+= fdc.o serial.o pc.o
++endif
+ VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
+ VL_OBJS+= usb-uhci.o
+ VL_OBJS+= piix4acpi.o
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ ioemu/target-i386-dm/rtc-dm.c      Wed Oct 18 18:35:21 2006 +0100
+@@ -0,0 +1,107 @@
++/*
++ * QEMU MC146818 RTC emulation
++ * 
++ * Copyright (c) 2003-2004 Fabrice Bellard
++ * 
++ * Permission is hereby granted, free of charge, to any person obtaining a 
copy
++ * of this software and associated documentation files (the "Software"), to 
deal
++ * in the Software without restriction, including without limitation the 
rights
++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++ * copies of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
++ * THE SOFTWARE.
++ */
++
++#include "vl.h"
++
++//#define DEBUG_CMOS
++
++struct RTCState {
++    uint8_t cmos_data[128];
++    uint8_t cmos_index;
++};
++
++void rtc_set_memory(RTCState *s, int addr, int val)
++{
++    if (addr >= 0 && addr <= 127)
++        s->cmos_data[addr] = val;
++}
++
++static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
++{
++    RTCState *s = opaque;
++
++    if ((addr & 1) == 0) {
++        s->cmos_index = data & 0x7f;
++    } else {
++#ifdef DEBUG_CMOS
++        printf("cmos: write index=0x%02x val=0x%02x\n",
++               s->cmos_index, data);
++#endif        
++        s->cmos_data[s->cmos_index] = data;
++    }
++}
++
++static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
++{
++    RTCState *s = opaque;
++    int ret;
++    if ((addr & 1) == 0) {
++        return 0xff;
++    } else {
++        ret = s->cmos_data[s->cmos_index];
++#ifdef DEBUG_CMOS
++        printf("cmos: read index=0x%02x val=0x%02x\n",
++               s->cmos_index, ret);
++#endif
++        return ret;
++    }
++}
++
++static void rtc_save(QEMUFile *f, void *opaque)
++{
++    RTCState *s = opaque;
++
++    qemu_put_buffer(f, s->cmos_data, 128);
++    qemu_put_8s(f, &s->cmos_index);
++}
++
++static int rtc_load(QEMUFile *f, void *opaque, int version_id)
++{
++    RTCState *s = opaque;
++
++    if (version_id != 1)
++        return -EINVAL;
++
++    qemu_get_buffer(f, s->cmos_data, 128);
++    qemu_get_8s(f, &s->cmos_index);
++
++    return 0;
++}
++
++RTCState *rtc_init(int base, int irq)
++{
++    RTCState *s;
++
++    s = qemu_mallocz(sizeof(RTCState));
++    if (!s)
++        return NULL;
++
++    register_ioport_write(base, 2, 1, cmos_ioport_write, s);
++    register_ioport_read(base, 2, 1, cmos_ioport_read, s);
++
++    register_savevm("mc146818rtc", base, 1, rtc_save, rtc_load, s);
++    return s;
++}
++
++void rtc_set_date(RTCState *s, const struct tm *tm) {}
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/ide-cd-dma
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/ide-cd-dma    Tue Oct 24 14:48:06 2006 +0100
@@ -0,0 +1,21 @@
+# HG changeset patch
+# User kfraser@xxxxxxxxxxxxxxxxxxxxx
+# Node ID 1e8ba8d2117548d4f13b7b438d1e992b1815f580
+# Parent  f247e0b52dda257c0000c9da5a0cdff507b3ced8
+[HVM] Enable DMA mode for CD-ROM IDE ATAPI interface.
+Signed-off-by: Winston Wang <winston.l.wang@xxxxxxxxx
+
+--- ioemu/hw/ide.c     Wed Oct 18 18:37:18 2006 +0100
++++ ioemu/hw/ide.c     Wed Oct 18 18:41:47 2006 +0100
+@@ -557,9 +557,9 @@ static void ide_atapi_identify(IDEState 
+     padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
+     padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */
+     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
+-    put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */
++    put_le16(p + 49, (1 << 11) | (1 << 9) | (1 << 8)); /* DMA and LBA 
supported */
+     put_le16(p + 53, 3); /* words 64-70, 54-58 valid */
+-    put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */
++    put_le16(p + 63, 0x07); /* mdma0-2 supported */
+     put_le16(p + 64, 1); /* PIO modes */
+     put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */
+     put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/serial-port-rate-limit
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/serial-port-rate-limit        Tue Oct 24 14:48:06 
2006 +0100
@@ -0,0 +1,116 @@
+# HG changeset patch
+# User Steven Smith <ssmith@xxxxxxxxxxxxx>
+# Node ID 1d3f52eb256e3522edc12daca91039b319dbbbe5
+# Parent  b7b653e36d20811831f26bb951ea66dca5854b17
+[HVM] Rate limit guest accesses to the qemu virtual serial port.  This stops
+grub's boot menu from hammering dom0.
+
+Signed-off-by: Steven Smith <sos22@xxxxxxxxx>
+
+--- ioemu/hw/serial.c  Mon Sep 25 16:31:02 2006 +0100
++++ ioemu/hw/serial.c  Mon Sep 25 17:27:18 2006 +0100
+@@ -22,6 +22,9 @@
+  * THE SOFTWARE.
+  */
+ #include "vl.h"
++#include <sys/time.h>
++#include <time.h>
++#include <assert.h>
+ 
+ //#define DEBUG_SERIAL
+ 
+@@ -138,6 +141,67 @@ static void serial_update_parameters(Ser
+     printf("speed=%d parity=%c data=%d stop=%d\n", 
+            speed, parity, data_bits, stop_bits);
+ #endif
++}
++
++/* Rate limit serial requests so that e.g. grub on a serial console
++   doesn't kill dom0.  Simple token bucket.  If we get some actual
++   data from the user, instantly refil the bucket. */
++
++/* How long it takes to generate a token, in microseconds. */
++#define TOKEN_PERIOD 1000
++/* Maximum and initial size of token bucket */
++#define TOKENS_MAX 100000
++
++static int tokens_avail;
++
++static void serial_get_token(void)
++{
++    static struct timeval last_refil_time;
++    static int started;
++
++    assert(tokens_avail >= 0);
++    if (!tokens_avail) {
++      struct timeval delta, now;
++      int generated;
++
++      if (!started) {
++          gettimeofday(&last_refil_time, NULL);
++          tokens_avail = TOKENS_MAX;
++          started = 1;
++          return;
++      }
++    retry:
++      gettimeofday(&now, NULL);
++      delta.tv_sec = now.tv_sec - last_refil_time.tv_sec;
++      delta.tv_usec = now.tv_usec - last_refil_time.tv_usec;
++      if (delta.tv_usec < 0) {
++          delta.tv_usec += 1000000;
++          delta.tv_sec--;
++      }
++      assert(delta.tv_usec >= 0 && delta.tv_sec >= 0);
++      if (delta.tv_usec < TOKEN_PERIOD) {
++          struct timespec ts;
++          /* Wait until at least one token is available. */
++          ts.tv_sec = TOKEN_PERIOD / 1000000;
++          ts.tv_nsec = (TOKEN_PERIOD % 1000000) * 1000;
++          while (nanosleep(&ts, &ts) < 0 && errno == EINTR)
++              ;
++          goto retry;
++      }
++      generated = (delta.tv_sec * 1000000) / TOKEN_PERIOD;
++      generated +=
++          ((delta.tv_sec * 1000000) % TOKEN_PERIOD + delta.tv_usec) / 
TOKEN_PERIOD;
++      assert(generated > 0);
++
++      last_refil_time.tv_usec += (generated * TOKEN_PERIOD) % 1000000;
++      last_refil_time.tv_sec  += last_refil_time.tv_usec / 1000000;
++      last_refil_time.tv_usec %= 1000000;
++      last_refil_time.tv_sec  += (generated * TOKEN_PERIOD) / 1000000;
++      if (generated > TOKENS_MAX)
++          generated = TOKENS_MAX;
++      tokens_avail = generated;
++    }
++    tokens_avail--;
+ }
+ 
+ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+@@ -245,9 +309,11 @@ static uint32_t serial_ioport_read(void 
+         ret = s->mcr;
+         break;
+     case 5:
++      serial_get_token();
+         ret = s->lsr;
+         break;
+     case 6:
++      serial_get_token();
+         if (s->mcr & UART_MCR_LOOP) {
+             /* in loopback, the modem output pins are connected to the
+                inputs */
+@@ -296,12 +362,14 @@ static void serial_receive1(void *opaque
+ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
+ {
+     SerialState *s = opaque;
++    tokens_avail = TOKENS_MAX;
+     serial_receive_byte(s, buf[0]);
+ }
+ 
+ static void serial_event(void *opaque, int event)
+ {
+     SerialState *s = opaque;
++    tokens_avail = TOKENS_MAX;
+     if (event == CHR_EVENT_BREAK)
+         serial_receive_break(s);
+ }
diff -r 2c29a2e42937 -r 55ff34dceb0b 
tools/ioemu/patches/vnc-listen-specific-interface
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/vnc-listen-specific-interface Tue Oct 24 14:48:06 
2006 +0100
@@ -0,0 +1,177 @@
+# HG changeset patch
+# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
+# Node ID a95dfbc8dca8ecddcb9be51d78f446b0fa461892
+# Parent  8959876abbe319963974fab21dda7185e0ad84e6
+[HVM/vncserver] Implement a 'vnclisten' option to limit the interface
+that the VNC server from qemu listens on. 
+
+Defaults to only listen on 127.0.0.1
+
+The old behaviour (listen on all interfaces) can be restored, by
+- changing the system-wide default in /etc/xen/xend-config.sxp by adding:
+(vnc-listen '0.0.0.0')
+- changing individual domain config files by adding:
+vnclisten="0.0.0.0"
+
+Also allows specifying the hostname associated with an interface to limit
+to that interface.
+
+Signed-off-by:  Daniel P. Berrange <berrange@xxxxxxxxxx>
+
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:34:28.000000000 +0100
+@@ -122,6 +122,7 @@
+ int nographic;
+ int vncviewer;
+ int vncunused;
++struct sockaddr_in vnclisten_addr;
+ const char* keyboard_layout = NULL;
+ int64_t ticks_per_sec;
+ int boot_device = 'c';
+@@ -2777,10 +2778,22 @@
+     return -1;
+ }
+ 
++int parse_host(struct sockaddr_in *saddr, const char *buf)
++{
++    struct hostent *he;
++
++    if ((he = gethostbyname(buf)) != NULL) {
++        saddr->sin_addr = *(struct in_addr *)he->h_addr;
++    } else {
++        if (!inet_aton(buf, &saddr->sin_addr))
++            return -1;
++    }
++    return 0;
++}
++
+ int parse_host_port(struct sockaddr_in *saddr, const char *str)
+ {
+     char buf[512];
+-    struct hostent *he;
+     const char *p, *r;
+     int port;
+ 
+@@ -2791,14 +2804,8 @@
+     if (buf[0] == '\0') {
+         saddr->sin_addr.s_addr = 0;
+     } else {
+-        if (isdigit(buf[0])) {
+-            if (!inet_aton(buf, &saddr->sin_addr))
+-                return -1;
+-        } else {
+-            if ((he = gethostbyname(buf)) == NULL)
+-                return - 1;
+-            saddr->sin_addr = *(struct in_addr *)he->h_addr;
+-        }
++        if (parse_host(saddr, buf) == -1)
++            return -1;
+     }
+     port = strtol(p, (char **)&r, 0);
+     if (r == p)
+@@ -5344,6 +5351,7 @@
+          "-vnc display    start a VNC server on display\n"
+            "-vncviewer      start a vncviewer process for this domain\n"
+            "-vncunused      bind the VNC server to an unused port\n"
++           "-vnclisten      bind the VNC server to this address\n"
+            "-timeoffset     time offset (in seconds) from local time\n"
+            "-acpi           disable or enable ACPI of HVM domain \n"
+            "\n"
+@@ -5434,6 +5442,7 @@
+     QEMU_OPTION_acpi,
+     QEMU_OPTION_vncviewer,
+     QEMU_OPTION_vncunused,
++    QEMU_OPTION_vnclisten,
+ };
+ 
+ typedef struct QEMUOption {
+@@ -5510,6 +5519,7 @@
+     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
+     { "vncviewer", 0, QEMU_OPTION_vncviewer },
+     { "vncunused", 0, QEMU_OPTION_vncunused },
++    { "vnclisten", HAS_ARG, QEMU_OPTION_vnclisten },
+     
+     /* temporary options */
+     { "usb", 0, QEMU_OPTION_usb },
+@@ -5905,6 +5915,8 @@
+ 
+     nb_nics = 0;
+     /* default mac address of the first network interface */
++
++    memset(&vnclisten_addr.sin_addr, 0, sizeof(vnclisten_addr.sin_addr));
+     
+     /* init debug */
+     sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
+@@ -6280,6 +6292,9 @@
+                 if (vnc_display == -1)
+                     vnc_display = 0;
+                 break;
++            case QEMU_OPTION_vnclisten:
++                parse_host(&vnclisten_addr, optarg);
++                break;
+             }
+         }
+     }
+@@ -6493,7 +6508,7 @@
+     if (nographic) {
+         dumb_display_init(ds);
+     } else if (vnc_display != -1) {
+-      vnc_display = vnc_display_init(ds, vnc_display, vncunused);
++      vnc_display = vnc_display_init(ds, vnc_display, vncunused, 
&vnclisten_addr);
+       if (vncviewer)
+           vnc_start_viewer(vnc_display);
+     } else {
+Index: ioemu/vl.h
+===================================================================
+--- ioemu.orig/vl.h    2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:34:22.000000000 +0100
+@@ -37,6 +37,8 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sys/stat.h>
++#include <sys/socket.h>
++#include <sys/types.h>
+ #include "xenctrl.h"
+ #include "xs.h"
+ #include <xen/hvm/e820.h>
+@@ -785,7 +787,7 @@
+ void cocoa_display_init(DisplayState *ds, int full_screen);
+ 
+ /* vnc.c */
+-int vnc_display_init(DisplayState *ds, int display, int find_unused);
++int vnc_display_init(DisplayState *ds, int display, int find_unused, struct 
sockaddr_in *addr);
+ int vnc_start_viewer(int port);
+ 
+ /* ide.c */
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:34:22.000000000 +0100
+@@ -1195,9 +1195,8 @@
+     }
+ }
+ 
+-int vnc_display_init(DisplayState *ds, int display, int find_unused)
++int vnc_display_init(DisplayState *ds, int display, int find_unused, struct 
sockaddr_in *addr)
+ {
+-    struct sockaddr_in addr;
+     int reuse_addr, ret;
+     VncState *vs;
+ 
+@@ -1235,11 +1234,10 @@
+     }
+ 
+  retry:
+-    addr.sin_family = AF_INET;
+-    addr.sin_port = htons(5900 + display);
+-    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
++    addr->sin_family = AF_INET;
++    addr->sin_port = htons(5900 + display);
+ 
+-    if (bind(vs->lsock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
++    if (bind(vs->lsock, (struct sockaddr *)addr, sizeof(struct sockaddr_in)) 
== -1) {
+       if (find_unused && errno == EADDRINUSE) {
+           display++;
+           goto retry;
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-password
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/vnc-password  Tue Oct 24 14:48:06 2006 +0100
@@ -0,0 +1,785 @@
+# HG changeset patch
+# User kfraser@xxxxxxxxxxxxxxxxxxxxx
+# Node ID 02506a7443155611d6bbf03e49fbf193e96d24db
+# Parent  328606e0705f0341bebda14cdd17962e463868e8
+[HVM] Implement password authentication of VNC connections.
+
+The specification is as mentioned at
+http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html
+(However, password came to describe plain text)
+
+The difference is follows.
+- protocol_authtype() without the necessity was deleted.
+- The check on the protocol version was added.
+- And, some small modification.
+
+Signed-off-by: Masami Watanabe <masami.watanabe@xxxxxxxxxxxxxx>
+
+--- ioemu/Makefile.target      Fri Oct 20 09:32:16 2006 +0100
++++ ioemu/Makefile.target      Fri Oct 20 09:50:09 2006 +0100
+@@ -406,6 +406,7 @@ VL_OBJS+=sdl.o
+ VL_OBJS+=sdl.o
+ endif
+ VL_OBJS+=vnc.o
++VL_OBJS+=d3des.o
+ ifdef CONFIG_COCOA
+ VL_OBJS+=cocoa.o
+ COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
+@@ -464,6 +465,9 @@ sdl.o: sdl.c keymaps.c sdl_keysym.h
+       $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+ 
+ vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
++      $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
++
++d3des.o: d3des.c d3des.h
+       $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+ 
+ sdlaudio.o: sdlaudio.c
+--- ioemu/vl.c Fri Oct 20 09:32:16 2006 +0100
++++ ioemu/vl.c Fri Oct 20 09:50:09 2006 +0100
+@@ -170,6 +170,9 @@ time_t timeoffset = 0;
+ 
+ char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
+ extern int domid;
++
++char vncpasswd[64];
++unsigned char challenge[AUTHCHALLENGESIZE];
+ 
+ /***********************************************************/
+ /* x86 ISA bus support */
+@@ -5911,6 +5914,7 @@ int main(int argc, char **argv)
+     vncunused = 0;
+     kernel_filename = NULL;
+     kernel_cmdline = "";
++    *vncpasswd = '\0';
+ #ifndef CONFIG_DM
+ #ifdef TARGET_PPC
+     cdrom_index = 1;
+@@ -6559,6 +6563,10 @@ int main(int argc, char **argv)
+ 
+     init_ioports();
+ 
++    /* read vncpasswd from xenstore */
++    if (0 > xenstore_read_vncpasswd(domid))
++        exit(1);
++
+     /* terminal init */
+     if (nographic) {
+         dumb_display_init(ds);
+--- ioemu/vl.h Fri Oct 20 09:32:16 2006 +0100
++++ ioemu/vl.h Fri Oct 20 09:50:09 2006 +0100
+@@ -1211,6 +1211,7 @@ void xenstore_process_event(void *opaque
+ void xenstore_process_event(void *opaque);
+ void xenstore_check_new_media_present(int timeout);
+ void xenstore_write_vncport(int vnc_display);
++int xenstore_read_vncpasswd(int domid);
+ 
+ /* xen_platform.c */
+ void pci_xen_platform_init(PCIBus *bus);
+@@ -1222,4 +1223,7 @@ extern char domain_name[];
+ 
+ void destroy_hvm_domain(void);
+ 
++/* VNC Authentication */
++#define AUTHCHALLENGESIZE 16
++
+ #endif /* VL_H */
+--- ioemu/vnc.c        Fri Oct 20 09:32:16 2006 +0100
++++ ioemu/vnc.c        Fri Oct 20 09:50:09 2006 +0100
+@@ -44,6 +44,7 @@
+ 
+ #include "vnc_keysym.h"
+ #include "keymaps.c"
++#include "d3des.h"
+ 
+ #define XK_MISCELLANY
+ #define XK_LATIN1
+@@ -137,6 +138,9 @@ static void vnc_update_client(void *opaq
+ static void vnc_update_client(void *opaque);
+ static void vnc_client_read(void *opaque);
+ static void framebuffer_set_updated(VncState *vs, int x, int y, int w, int h);
++static int make_challenge(char *random, int size);
++static void set_seed(unsigned int *seedp);
++static void get_random(int len, unsigned char *buf);
+ 
+ #if 0
+ static inline void vnc_set_bit(uint32_t *d, int k)
+@@ -1208,23 +1212,92 @@ static int protocol_client_init(VncState
+     return 0;
+ }
+ 
++static int protocol_response(VncState *vs, char *client_response, size_t len)
++{
++    extern char vncpasswd[64];
++    extern unsigned char challenge[AUTHCHALLENGESIZE];
++    unsigned char cryptchallenge[AUTHCHALLENGESIZE];
++    unsigned char key[8];
++    int passwdlen, i, j;
++
++    memcpy(cryptchallenge, challenge, AUTHCHALLENGESIZE);
++
++    /* Calculate the sent challenge */
++    passwdlen = strlen(vncpasswd);
++    for (i=0; i<8; i++)
++      key[i] = i<passwdlen ? vncpasswd[i] : 0;
++    deskey(key, EN0);
++    for (j = 0; j < AUTHCHALLENGESIZE; j += 8)
++      des(cryptchallenge+j, cryptchallenge+j);
++
++    /* Check the actual response */
++    if (memcmp(cryptchallenge, client_response, AUTHCHALLENGESIZE) != 0) {
++      /* password error */
++      vnc_write_u32(vs, 1);
++      vnc_write_u32(vs, 22);
++      vnc_write(vs, "Authentication failure", 22);
++      vnc_flush(vs);
++      fprintf(stderr, "VNC Password error.\n");
++      vnc_client_error(vs);
++      return 0;
++    }
++
++    vnc_write_u32(vs, 0);
++    vnc_flush(vs);
++
++    vnc_read_when(vs, protocol_client_init, 1);
++
++    return 0;
++}
++
+ static int protocol_version(VncState *vs, char *version, size_t len)
+ {
++    extern char vncpasswd[64];
++    extern unsigned char challenge[AUTHCHALLENGESIZE];
+     char local[13];
+-    int maj, min;
++    int  support, maj, min;
+ 
+     memcpy(local, version, 12);
+     local[12] = 0;
+ 
++    /* protocol version check */
+     if (sscanf(local, "RFB %03d.%03d\n", &maj, &min) != 2) {
++      fprintf(stderr, "Protocol version error.\n");
+       vnc_client_error(vs);
+       return 0;
+     }
+ 
+-    vnc_write_u32(vs, 1); /* None */
+-    vnc_flush(vs);
+-
+-    vnc_read_when(vs, protocol_client_init, 1);
++
++    support = 0;
++    if (maj = 3) {
++      if (min == 3 || min ==4) {
++          support = 1;
++      }
++    }
++
++    if (! support) {
++      fprintf(stderr, "Client uses unsupported protocol version %d.%d.\n",
++              maj, min);
++      vnc_client_error(vs);
++      return 0;
++    }
++
++    if (*vncpasswd == '\0') {
++      /* AuthType is None */
++      vnc_write_u32(vs, 1);
++      vnc_flush(vs);
++      vnc_read_when(vs, protocol_client_init, 1);
++    } else {
++      /* AuthType is VncAuth */
++      vnc_write_u32(vs, 2);
++
++      /* Challenge-Responce authentication */
++      /* Send Challenge */
++      make_challenge(challenge, AUTHCHALLENGESIZE);
++      vnc_write(vs, challenge, AUTHCHALLENGESIZE);
++      vnc_flush(vs);
++      vnc_read_when(vs, protocol_response, AUTHCHALLENGESIZE);
++    }
+ 
+     return 0;
+ }
+@@ -1342,3 +1415,32 @@ int vnc_start_viewer(int port)
+       return pid;
+     }
+ }
++
++unsigned int seed;
++
++static int make_challenge(char *random, int size)
++{
++ 
++    set_seed(&seed);
++    get_random(size, random);
++
++    return 0;
++}
++
++static void set_seed(unsigned int *seedp)
++{
++    *seedp += (unsigned int)(time(NULL)+getpid()+getpid()*987654+rand());
++    srand(*seedp);
++
++    return;
++}
++
++static void get_random(int len, unsigned char *buf)
++{
++    int i;
++
++    for (i=0; i<len; i++)
++      buf[i] = (int) (256.0*rand()/(RAND_MAX+1.0));
++
++    return;
++}
+--- ioemu/xenstore.c   Fri Oct 20 09:32:16 2006 +0100
++++ ioemu/xenstore.c   Fri Oct 20 09:50:09 2006 +0100
+@@ -213,3 +213,54 @@ void xenstore_write_vncport(int display)
+     free(portstr);
+     free(buf);
+ }
++
++int xenstore_read_vncpasswd(int domid)
++{
++    extern char vncpasswd[64];
++    char *buf = NULL, *path, *uuid = NULL, *passwd = NULL;
++    unsigned int i, len, rc = 0;
++
++    if (xsh == NULL) {
++      return -1;
++    }
++
++    path = xs_get_domain_path(xsh, domid);
++    if (path == NULL) {
++      fprintf(logfile, "xs_get_domain_path() error. domid %d.\n", domid);
++      return -1;
++    }
++
++    pasprintf(&buf, "%s/vm", path);
++    uuid = xs_read(xsh, XBT_NULL, buf, &len);
++    if (uuid == NULL) {
++      fprintf(logfile, "xs_read(): uuid get error. %s.\n", buf);
++      free(path);
++      return -1;
++    }
++
++    pasprintf(&buf, "%s/vncpasswd", uuid);
++    passwd = xs_read(xsh, XBT_NULL, buf, &len);
++    if (passwd == NULL) {
++      fprintf(logfile, "xs_read(): vncpasswd get error. %s.\n", buf);
++      free(uuid);
++      free(path);
++      return rc;
++    }
++
++    for (i=0; i<len && i<63; i++) {
++      vncpasswd[i] = passwd[i];
++      passwd[i] = '\0';
++    }
++    vncpasswd[len] = '\0';
++    pasprintf(&buf, "%s/vncpasswd", uuid);
++    if (xs_write(xsh, XBT_NULL, buf, passwd, len) == 0) {
++      fprintf(logfile, "xs_write() vncpasswd failed.\n");
++      rc = -1;
++    }
++
++    free(passwd);
++    free(uuid);
++    free(path);
++
++    return rc;
++}
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ ioemu/d3des.c      Fri Oct 20 09:50:09 2006 +0100
+@@ -0,0 +1,434 @@
++/*
++ * This is D3DES (V5.09) by Richard Outerbridge with the double and
++ * triple-length support removed for use in VNC.  Also the bytebit[] array
++ * has been reversed so that the most significant bit in each byte of the
++ * key is ignored, not the least significant.
++ *
++ * These changes are:
++ *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
++ *
++ * This software is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++ */
++
++/* D3DES (V5.09) -
++ *
++ * A portable, public domain, version of the Data Encryption Standard.
++ *
++ * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
++ * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
++ * code;  Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
++ * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
++ * for humouring me on.
++ *
++ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
++ * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
++ */
++
++#include "d3des.h"
++
++static void scrunch(unsigned char *, unsigned long *);
++static void unscrun(unsigned long *, unsigned char *);
++static void desfunc(unsigned long *, unsigned long *);
++static void cookey(unsigned long *);
++
++static unsigned long KnL[32] = { 0L };
++
++static unsigned short bytebit[8]      = {
++      01, 02, 04, 010, 020, 040, 0100, 0200 };
++
++static unsigned long bigbyte[24] = {
++      0x800000L,      0x400000L,      0x200000L,      0x100000L,
++      0x80000L,       0x40000L,       0x20000L,       0x10000L,
++      0x8000L,        0x4000L,        0x2000L,        0x1000L,
++      0x800L,         0x400L,         0x200L,         0x100L,
++      0x80L,          0x40L,          0x20L,          0x10L,
++      0x8L,           0x4L,           0x2L,           0x1L    };
++
++/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
++
++static unsigned char pc1[56] = {
++      56, 48, 40, 32, 24, 16,  8,      0, 57, 49, 41, 33, 25, 17,
++       9,  1, 58, 50, 42, 34, 26,     18, 10,  2, 59, 51, 43, 35,
++      62, 54, 46, 38, 30, 22, 14,      6, 61, 53, 45, 37, 29, 21,
++      13,  5, 60, 52, 44, 36, 28,     20, 12,  4, 27, 19, 11,  3 };
++
++static unsigned char totrot[16] = {
++      1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
++
++static unsigned char pc2[48] = {
++      13, 16, 10, 23,  0,  4,  2, 27, 14,  5, 20,  9,
++      22, 18, 11,  3, 25,  7, 15,  6, 26, 19, 12,  1,
++      40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
++      43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
++
++void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
++unsigned char *key;
++int edf;
++{
++      register int i, j, l, m, n;
++      unsigned char pc1m[56], pcr[56];
++      unsigned long kn[32];
++
++      for ( j = 0; j < 56; j++ ) {
++              l = pc1[j];
++              m = l & 07;
++              pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
++              }
++      for( i = 0; i < 16; i++ ) {
++              if( edf == DE1 ) m = (15 - i) << 1;
++              else m = i << 1;
++              n = m + 1;
++              kn[m] = kn[n] = 0L;
++              for( j = 0; j < 28; j++ ) {
++                      l = j + totrot[i];
++                      if( l < 28 ) pcr[j] = pc1m[l];
++                      else pcr[j] = pc1m[l - 28];
++                      }
++              for( j = 28; j < 56; j++ ) {
++                  l = j + totrot[i];
++                  if( l < 56 ) pcr[j] = pc1m[l];
++                  else pcr[j] = pc1m[l - 28];
++                  }
++              for( j = 0; j < 24; j++ ) {
++                      if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
++                      if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
++                      }
++              }
++      cookey(kn);
++      return;
++      }
++
++static void cookey(raw1)
++register unsigned long *raw1;
++{
++      register unsigned long *cook, *raw0;
++      unsigned long dough[32];
++      register int i;
++
++      cook = dough;
++      for( i = 0; i < 16; i++, raw1++ ) {
++              raw0 = raw1++;
++              *cook    = (*raw0 & 0x00fc0000L) << 6;
++              *cook   |= (*raw0 & 0x00000fc0L) << 10;
++              *cook   |= (*raw1 & 0x00fc0000L) >> 10;
++              *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
++              *cook    = (*raw0 & 0x0003f000L) << 12;
++              *cook   |= (*raw0 & 0x0000003fL) << 16;
++              *cook   |= (*raw1 & 0x0003f000L) >> 4;
++              *cook++ |= (*raw1 & 0x0000003fL);
++              }
++      usekey(dough);
++      return;
++      }
++
++void cpkey(into)
++register unsigned long *into;
++{
++      register unsigned long *from, *endp;
++
++      from = KnL, endp = &KnL[32];
++      while( from < endp ) *into++ = *from++;
++      return;
++      }
++
++void usekey(from)
++register unsigned long *from;
++{
++      register unsigned long *to, *endp;
++
++      to = KnL, endp = &KnL[32];
++      while( to < endp ) *to++ = *from++;
++      return;
++      }
++
++void des(inblock, outblock)
++unsigned char *inblock, *outblock;
++{
++      unsigned long work[2];
++
++      scrunch(inblock, work);
++      desfunc(work, KnL);
++      unscrun(work, outblock);
++      return;
++      }
++
++static void scrunch(outof, into)
++register unsigned char *outof;
++register unsigned long *into;
++{
++      *into    = (*outof++ & 0xffL) << 24;
++      *into   |= (*outof++ & 0xffL) << 16;
++      *into   |= (*outof++ & 0xffL) << 8;
++      *into++ |= (*outof++ & 0xffL);
++      *into    = (*outof++ & 0xffL) << 24;
++      *into   |= (*outof++ & 0xffL) << 16;
++      *into   |= (*outof++ & 0xffL) << 8;
++      *into   |= (*outof   & 0xffL);
++      return;
++      }
++
++static void unscrun(outof, into)
++register unsigned long *outof;
++register unsigned char *into;
++{
++      *into++ = (unsigned char)((*outof >> 24) & 0xffL);
++      *into++ = (unsigned char)((*outof >> 16) & 0xffL);
++      *into++ = (unsigned char)((*outof >>  8) & 0xffL);
++      *into++ = (unsigned char)(*outof++       & 0xffL);
++      *into++ = (unsigned char)((*outof >> 24) & 0xffL);
++      *into++ = (unsigned char)((*outof >> 16) & 0xffL);
++      *into++ = (unsigned char)((*outof >>  8) & 0xffL);
++      *into   =  (unsigned char)(*outof        & 0xffL);
++      return;
++      }
++
++static unsigned long SP1[64] = {
++      0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
++      0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
++      0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
++      0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
++      0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
++      0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
++      0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
++      0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
++      0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
++      0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
++      0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
++      0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
++      0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
++      0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
++      0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
++      0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
++
++static unsigned long SP2[64] = {
++      0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
++      0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
++      0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
++      0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
++      0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
++      0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
++      0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
++      0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
++      0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
++      0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
++      0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
++      0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
++      0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
++      0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
++      0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
++      0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
++
++static unsigned long SP3[64] = {
++      0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
++      0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
++      0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
++      0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
++      0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
++      0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
++      0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
++      0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
++      0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
++      0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
++      0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
++      0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
++      0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
++      0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
++      0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
++      0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
++
++static unsigned long SP4[64] = {
++      0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
++      0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
++      0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
++      0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
++      0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
++      0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
++      0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
++      0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
++      0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
++      0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
++      0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
++      0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
++      0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
++      0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
++      0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
++      0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
++
++static unsigned long SP5[64] = {
++      0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
++      0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
++      0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
++      0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
++      0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
++      0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
++      0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
++      0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
++      0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
++      0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
++      0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
++      0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
++      0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
++      0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
++      0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
++      0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
++
++static unsigned long SP6[64] = {
++      0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
++      0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
++      0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
++      0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
++      0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
++      0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
++      0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
++      0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
++      0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
++      0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
++      0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
++      0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
++      0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
++      0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
++      0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
++      0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
++
++static unsigned long SP7[64] = {
++      0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
++      0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
++      0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
++      0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
++      0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
++      0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
++      0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
++      0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
++      0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
++      0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
++      0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
++      0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
++      0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
++      0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
++      0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
++      0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
++
++static unsigned long SP8[64] = {
++      0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
++      0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
++      0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
++      0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
++      0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
++      0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
++      0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
++      0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
++      0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
++      0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
++      0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
++      0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
++      0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
++      0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
++      0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
++      0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
++
++static void desfunc(block, keys)
++register unsigned long *block, *keys;
++{
++      register unsigned long fval, work, right, leftt;
++      register int round;
++
++      leftt = block[0];
++      right = block[1];
++      work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
++      right ^= work;
++      leftt ^= (work << 4);
++      work = ((leftt >> 16) ^ right) & 0x0000ffffL;
++      right ^= work;
++      leftt ^= (work << 16);
++      work = ((right >> 2) ^ leftt) & 0x33333333L;
++      leftt ^= work;
++      right ^= (work << 2);
++      work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
++      leftt ^= work;
++      right ^= (work << 8);
++      right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
++      work = (leftt ^ right) & 0xaaaaaaaaL;
++      leftt ^= work;
++      right ^= work;
++      leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
++
++      for( round = 0; round < 8; round++ ) {
++              work  = (right << 28) | (right >> 4);
++              work ^= *keys++;
++              fval  = SP7[ work                & 0x3fL];
++              fval |= SP5[(work >>  8) & 0x3fL];
++              fval |= SP3[(work >> 16) & 0x3fL];
++              fval |= SP1[(work >> 24) & 0x3fL];
++              work  = right ^ *keys++;
++              fval |= SP8[ work                & 0x3fL];
++              fval |= SP6[(work >>  8) & 0x3fL];
++              fval |= SP4[(work >> 16) & 0x3fL];
++              fval |= SP2[(work >> 24) & 0x3fL];
++              leftt ^= fval;
++              work  = (leftt << 28) | (leftt >> 4);
++              work ^= *keys++;
++              fval  = SP7[ work                & 0x3fL];
++              fval |= SP5[(work >>  8) & 0x3fL];
++              fval |= SP3[(work >> 16) & 0x3fL];
++              fval |= SP1[(work >> 24) & 0x3fL];
++              work  = leftt ^ *keys++;
++              fval |= SP8[ work                & 0x3fL];
++              fval |= SP6[(work >>  8) & 0x3fL];
++              fval |= SP4[(work >> 16) & 0x3fL];
++              fval |= SP2[(work >> 24) & 0x3fL];
++              right ^= fval;
++              }
++
++      right = (right << 31) | (right >> 1);
++      work = (leftt ^ right) & 0xaaaaaaaaL;
++      leftt ^= work;
++      right ^= work;
++      leftt = (leftt << 31) | (leftt >> 1);
++      work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
++      right ^= work;
++      leftt ^= (work << 8);
++      work = ((leftt >> 2) ^ right) & 0x33333333L;
++      right ^= work;
++      leftt ^= (work << 2);
++      work = ((right >> 16) ^ leftt) & 0x0000ffffL;
++      leftt ^= work;
++      right ^= (work << 16);
++      work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
++      leftt ^= work;
++      right ^= (work << 4);
++      *block++ = right;
++      *block = leftt;
++      return;
++      }
++
++/* Validation sets:
++ *
++ * Single-length key, single-length plaintext -
++ * Key          : 0123 4567 89ab cdef
++ * Plain  : 0123 4567 89ab cde7
++ * Cipher : c957 4425 6a5e d31d
++ *
++ * Double-length key, single-length plaintext -
++ * Key          : 0123 4567 89ab cdef fedc ba98 7654 3210
++ * Plain  : 0123 4567 89ab cde7
++ * Cipher : 7f1d 0a77 826b 8aff
++ *
++ * Double-length key, double-length plaintext -
++ * Key          : 0123 4567 89ab cdef fedc ba98 7654 3210
++ * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
++ * Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
++ *
++ * Triple-length key, single-length plaintext -
++ * Key          : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
++ * Plain  : 0123 4567 89ab cde7
++ * Cipher : de0b 7c06 ae5e 0ed5
++ *
++ * Triple-length key, double-length plaintext -
++ * Key          : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
++ * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
++ * Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
++ *
++ * d3des V5.0a rwo 9208.07 18:44 Graven Imagery
++ **********************************************************************/
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ ioemu/d3des.h      Fri Oct 20 09:50:09 2006 +0100
+@@ -0,0 +1,51 @@
++/*
++ * This is D3DES (V5.09) by Richard Outerbridge with the double and
++ * triple-length support removed for use in VNC.
++ *
++ * These changes are:
++ *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
++ *
++ * This software is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++ */
++
++/* d3des.h -
++ *
++ *    Headers and defines for d3des.c
++ *    Graven Imagery, 1992.
++ *
++ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
++ *    (GEnie : OUTER; CIS : [71755,204])
++ */
++
++#define EN0   0       /* MODE == encrypt */
++#define DE1   1       /* MODE == decrypt */
++
++extern void deskey(unsigned char *, int);
++/*                  hexkey[8]     MODE
++ * Sets the internal key register according to the hexadecimal
++ * key contained in the 8 bytes of hexkey, according to the DES,
++ * for encryption or decryption according to MODE.
++ */
++
++extern void usekey(unsigned long *);
++/*                cookedkey[32]
++ * Loads the internal key register with the data in cookedkey.
++ */
++
++extern void cpkey(unsigned long *);
++/*               cookedkey[32]
++ * Copies the contents of the internal key register into the storage
++ * located at &cookedkey[0].
++ */
++
++extern void des(unsigned char *, unsigned char *);
++/*                from[8]           to[8]
++ * Encrypts/Decrypts (according to the key currently loaded in the
++ * internal key register) one block of eight bytes at address 'from'
++ * into the block at address 'to'.  They can be the same.
++ */
++
++/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
++ ********************************************************************/
diff -r 2c29a2e42937 -r 55ff34dceb0b tools/ioemu/patches/vnc-protocol-fixes
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/vnc-protocol-fixes    Tue Oct 24 14:48:06 2006 +0100
@@ -0,0 +1,63 @@
+# HG changeset patch
+# User Steven Smith <ssmith@xxxxxxxxxxxxx>
+# Node ID ca3abb3804f4400b24037a4366cb2ca5e51ed742
+# Parent  7fca81d456b2cb40d4effe2492f7ed1aafd32f52
+[HVM][VNC] Make sure that qemu doesn't go into an infinite loop when
+it receives certain invalid requests from the viewer.
+
+Signed-off-by: Steven Smith <sos22@xxxxxxxxx>
+
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2006-10-24 14:28:05.000000000 +0100
++++ ioemu/vnc.c        2006-10-24 14:30:11.000000000 +0100
+@@ -26,6 +26,7 @@
+ 
+ #include "vl.h"
+ #include "qemu_socket.h"
++#include <assert.h>
+ 
+ #define VNC_REFRESH_INTERVAL (1000 / 30)
+ 
+@@ -677,8 +678,10 @@
+           memmove(vs->input.buffer, vs->input.buffer + len,
+                   vs->input.offset - len);
+           vs->input.offset -= len;
+-      } else
++      } else {
++          assert(ret > vs->read_handler_expect);
+           vs->read_handler_expect = ret;
++      }
+     }
+ }
+ 
+@@ -961,8 +964,12 @@
+       if (len == 1)
+           return 4;
+ 
+-      if (len == 4)
+-          return 4 + (read_u16(data, 2) * 4);
++      if (len == 4) {
++          uint16_t v;
++          v = read_u16(data, 2);
++          if (v)
++              return 4 + v * 4;
++      }
+ 
+       limit = read_u16(data, 2);
+       for (i = 0; i < limit; i++) {
+@@ -996,8 +1003,12 @@
+       if (len == 1)
+           return 8;
+ 
+-      if (len == 8)
+-          return 8 + read_u32(data, 4);
++      if (len == 8) {
++          uint32_t v;
++          v = read_u32(data, 4);
++          if (v)
++              return 8 + v;
++      }
+ 
+       client_cut_text(vs, read_u32(data, 4), data + 8);
+       break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.