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

[Xen-changelog] [xen-unstable] merge with xen-unstable.hg



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 2d73714911c2103958e3bc82957a78cacf4d8bfe
# Parent  199d53efd02974b9e78f4492a3baee426e4e03c3
# Parent  5848356af8da250becd856b244a33c9391b9ab1c
merge with xen-unstable.hg
---
 Config.mk                                            |    2 
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c   |   11 ++--
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |    2 
 tools/ioemu/hw/vga.c                                 |    2 
 tools/ioemu/patches/domain-reset                     |    8 +-
 tools/ioemu/patches/domain-timeoffset                |   18 +++---
 tools/ioemu/patches/hypervisor-pit                   |   10 +--
 tools/ioemu/patches/ioemu-ia64                       |    2 
 tools/ioemu/patches/qemu-bugfixes                    |   14 ++++-
 tools/ioemu/patches/qemu-init-vgabios                |    9 ++-
 tools/ioemu/patches/qemu-logging                     |   16 ++---
 tools/ioemu/patches/qemu-smp                         |   10 +--
 tools/ioemu/patches/shared-vram                      |   16 ++---
 tools/ioemu/patches/support-xm-console               |   12 ++--
 tools/ioemu/patches/vnc-cleanup                      |   22 ++++----
 tools/ioemu/patches/vnc-fixes                        |    8 +-
 tools/ioemu/patches/vnc-start-vncviewer              |   18 +++---
 tools/ioemu/patches/xen-domain-name                  |   14 ++---
 tools/ioemu/patches/xen-domid                        |   15 ++---
 tools/ioemu/patches/xen-mm                           |   12 ++--
 tools/ioemu/patches/xen-network                      |    6 +-
 tools/ioemu/vl.c                                     |    1 
 tools/libxc/xc_hvm_build.c                           |   32 +----------
 xen/arch/x86/hvm/vmx/vmx.c                           |   18 +++---
 xen/arch/x86/shadow32.c                              |   24 ++------
 xen/arch/x86/shadow_public.c                         |   19 +++---
 xen/common/memory.c                                  |    2 
 xen/include/asm-ia64/mm.h                            |    5 +
 xen/include/asm-x86/hvm/vmx/vmx.h                    |   52 +++++++++++++------
 xen/include/asm-x86/mm.h                             |    5 +
 30 files changed, 207 insertions(+), 178 deletions(-)

diff -r 199d53efd029 -r 2d73714911c2 Config.mk
--- a/Config.mk Thu Jul 27 10:00:00 2006 -0600
+++ b/Config.mk Thu Jul 27 10:43:34 2006 -0600
@@ -36,6 +36,8 @@ CFLAGS    ?= -O2 -fomit-frame-pointer
 CFLAGS    ?= -O2 -fomit-frame-pointer
 CFLAGS    += -DNDEBUG
 else
+# Less than -O1 produces bad code and large stack frames
+CFLAGS    ?= -O1 -fno-omit-frame-pointer
 CFLAGS    += -g
 endif
 
diff -r 199d53efd029 -r 2d73714911c2 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Jul 27 
10:00:00 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Jul 27 
10:43:34 2006 -0600
@@ -99,24 +99,21 @@ static spinlock_t net_schedule_list_lock
 #define MAX_MFN_ALLOC 64
 static unsigned long mfn_list[MAX_MFN_ALLOC];
 static unsigned int alloc_index = 0;
-static DEFINE_SPINLOCK(mfn_lock);
 
 static unsigned long alloc_mfn(void)
 {
-       unsigned long mfn = 0, flags;
+       unsigned long mfn = 0;
        struct xen_memory_reservation reservation = {
                .nr_extents   = MAX_MFN_ALLOC,
                .extent_order = 0,
                .domid        = DOMID_SELF
        };
        set_xen_guest_handle(reservation.extent_start, mfn_list);
-       spin_lock_irqsave(&mfn_lock, flags);
        if ( unlikely(alloc_index == 0) )
                alloc_index = HYPERVISOR_memory_op(
                        XENMEM_increase_reservation, &reservation);
        if ( alloc_index != 0 )
                mfn = mfn_list[--alloc_index];
-       spin_unlock_irqrestore(&mfn_lock, flags);
        return mfn;
 }
 
@@ -222,9 +219,13 @@ static void net_rx_action(unsigned long 
        unsigned long vdata, old_mfn, new_mfn;
        struct sk_buff_head rxq;
        struct sk_buff *skb;
-       u16 notify_list[NET_RX_RING_SIZE];
        int notify_nr = 0;
        int ret;
+       /*
+        * Putting hundreds of bytes on the stack is considered rude.
+        * Static works because a tasklet can only be on one CPU at any time.
+        */
+       static u16 notify_list[NET_RX_RING_SIZE];
 
        skb_queue_head_init(&rxq);
 
diff -r 199d53efd029 -r 2d73714911c2 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Jul 27 
10:00:00 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Jul 27 
10:43:34 2006 -0600
@@ -788,6 +788,8 @@ static int network_start_xmit(struct sk_
 
                gso->u.gso.size = skb_shinfo(skb)->gso_size;
                gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+               gso->u.gso.pad = 0;
+               gso->u.gso.features = 0;
 
                gso->type = XEN_NETIF_EXTRA_TYPE_GSO;
                gso->flags = 0;
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c      Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/hw/vga.c      Thu Jul 27 10:43:34 2006 -0600
@@ -1953,6 +1953,8 @@ void vga_common_init(VGAState *s, Displa
                          vga_screen_dump, s);
     /* XXX: currently needed for display */
     vga_state = s;
+
+    vga_bios_init(s);
 }
 
 
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/domain-reset
--- a/tools/ioemu/patches/domain-reset  Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/domain-reset  Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/target-i386-dm/helper2.c
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
---- ioemu.orig/target-i386-dm/helper2.c        2006-07-12 11:35:00.710827712 
+0100
-+++ ioemu/target-i386-dm/helper2.c     2006-07-12 11:35:02.419613627 +0100
+--- ioemu.orig/target-i386-dm/helper2.c        2006-07-27 11:16:57.527492229 
+0100
++++ ioemu/target-i386-dm/helper2.c     2006-07-27 11:16:59.381287013 +0100
 @@ -123,6 +123,25 @@
  /* called from main_cpu_reset */
  void cpu_reset(CPUX86State *env)
@@ -41,9 +41,9 @@ Index: ioemu/target-i386-dm/helper2.c
          /* Wait up to 10 msec. */
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:02.273631916 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:02.421613376 +0100
-@@ -4411,7 +4411,7 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.317294097 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.384286681 +0100
+@@ -4412,7 +4412,7 @@
  } QEMUResetEntry;
  
  static QEMUResetEntry *first_reset_entry;
@@ -54,8 +54,8 @@ Index: ioemu/vl.c
  
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-12 11:35:01.454734511 +0100
-+++ ioemu/vl.h 2006-07-12 11:35:02.422613251 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:16:58.127425816 +0100
++++ ioemu/vl.h 2006-07-27 11:16:59.384286681 +0100
 @@ -122,6 +122,7 @@
  
  void qemu_register_reset(QEMUResetHandler *func, void *opaque);
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/domain-timeoffset
--- a/tools/ioemu/patches/domain-timeoffset     Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/domain-timeoffset     Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/mc146818rtc.c
 Index: ioemu/hw/mc146818rtc.c
 ===================================================================
---- ioemu.orig/hw/mc146818rtc.c        2006-07-26 15:17:35.110819901 +0100
-+++ ioemu/hw/mc146818rtc.c     2006-07-26 15:17:40.292255496 +0100
+--- ioemu.orig/hw/mc146818rtc.c        2006-07-27 11:17:18.007225084 +0100
++++ ioemu/hw/mc146818rtc.c     2006-07-27 11:17:48.250876949 +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-07-26 15:17:39.820306906 +0100
-+++ ioemu/hw/pc.c      2006-07-26 15:17:40.293255388 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:17:47.993905398 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:17:48.251876839 +0100
 @@ -151,7 +151,7 @@
  }
  
@@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
  QEMUMachine pc_machine = {
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 15:17:40.169268893 +0100
-+++ ioemu/vl.c 2006-07-26 15:17:40.296255061 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:17:48.126890676 +0100
++++ ioemu/vl.c 2006-07-27 11:17:48.254876507 +0100
 @@ -164,6 +164,8 @@
  
  int xc_handle;
@@ -128,7 +128,7 @@ Index: ioemu/vl.c
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
  extern int domid;
  
-@@ -4799,6 +4801,7 @@
+@@ -4800,6 +4802,7 @@
  #endif
             "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
           "-vnc display    start a VNC server on display\n"
@@ -136,7 +136,7 @@ Index: ioemu/vl.c
             "\n"
             "During emulation, the following keys are useful:\n"
             "ctrl-alt-f      toggle full screen\n"
-@@ -4889,6 +4892,7 @@
+@@ -4890,6 +4893,7 @@
  
      QEMU_OPTION_d,
      QEMU_OPTION_vcpus,
@@ -144,7 +144,7 @@ Index: ioemu/vl.c
  };
  
  typedef struct QEMUOption {
-@@ -4967,6 +4971,7 @@
+@@ -4968,6 +4972,7 @@
      
      { "d", HAS_ARG, QEMU_OPTION_d },
      { "vcpus", 1, QEMU_OPTION_vcpus },
@@ -152,7 +152,7 @@ Index: ioemu/vl.c
      { NULL },
  };
  
-@@ -5669,6 +5674,9 @@
+@@ -5670,6 +5675,9 @@
                  vcpus = atoi(optarg);
                  fprintf(logfile, "qemu: the number of cpus is %d\n", vcpus);
                  break;
@@ -162,7 +162,7 @@ Index: ioemu/vl.c
              }
          }
      }
-@@ -5992,7 +6000,8 @@
+@@ -5993,7 +6001,8 @@
  
      machine->init(ram_size, vga_ram_size, boot_device,
                    ds, fd_filename, snapshot,
@@ -174,8 +174,8 @@ Index: ioemu/vl.c
      qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock));
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 15:17:39.825306361 +0100
-+++ ioemu/vl.h 2006-07-26 15:17:40.297254952 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:17:47.998904845 +0100
++++ ioemu/vl.h 2006-07-27 11:17:48.254876507 +0100
 @@ -556,7 +556,7 @@
                                   int boot_device,
               DisplayState *ds, const char **fd_filename, int snapshot,
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/hypervisor-pit
--- a/tools/ioemu/patches/hypervisor-pit        Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/hypervisor-pit        Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-07-12 11:35:01.899678766 +0100
-+++ ioemu/Makefile.target      2006-07-12 11:35:02.711577049 +0100
+--- ioemu.orig/Makefile.target 2006-07-27 11:16:58.970332506 +0100
++++ ioemu/Makefile.target      2006-07-27 11:16:59.758245283 +0100
 @@ -333,7 +333,7 @@
  ifeq ($(TARGET_BASE_ARCH), i386)
  # Hardware support
@@ -13,8 +13,8 @@ Index: ioemu/Makefile.target
  endif
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-12 11:35:02.059658723 +0100
-+++ ioemu/hw/pc.c      2006-07-12 11:35:02.712576924 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:16:59.036325200 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:16:59.759245173 +0100
 @@ -38,7 +38,9 @@
  
  static fdctrl_t *floppy_controller;
@@ -38,9 +38,9 @@ Index: ioemu/hw/pc.c
          pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:02.649584815 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:02.715576548 +0100
-@@ -5033,6 +5033,7 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.614261222 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.762244841 +0100
+@@ -5034,6 +5034,7 @@
  
  #ifdef HAS_AUDIO
  struct soundhw soundhw[] = {
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
  #ifdef TARGET_I386
      {
          "pcspk",
-@@ -5042,6 +5043,7 @@
+@@ -5043,6 +5044,7 @@
          { .init_isa = pcspk_audio_init }
      },
  #endif
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/ioemu-ia64
--- a/tools/ioemu/patches/ioemu-ia64    Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/ioemu-ia64    Thu Jul 27 10:43:34 2006 -0600
@@ -62,7 +62,7 @@ Index: ioemu/vl.c
      if (xc_get_pfn_list(xc_handle, domid, page_array, nr_pages) != nr_pages) {
          fprintf(logfile, "xc_get_pfn_list returned error %d\n", errno);
          exit(-1);
-@@ -5597,6 +5598,34 @@
+@@ -5598,6 +5599,34 @@
      fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", nr_pages - 1,
              (uint64_t)(page_array[nr_pages - 1]));
  
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/qemu-bugfixes
--- a/tools/ioemu/patches/qemu-bugfixes Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/qemu-bugfixes Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/console.c
 Index: ioemu/console.c
 ===================================================================
---- ioemu.orig/console.c       2006-07-26 13:39:11.999009495 +0100
-+++ ioemu/console.c    2006-07-26 14:15:19.413719225 +0100
+--- ioemu.orig/console.c       2006-07-27 11:16:53.732912290 +0100
++++ ioemu/console.c    2006-07-27 11:16:57.753467214 +0100
 @@ -449,7 +449,7 @@
              c++;
          }
@@ -50,8 +50,8 @@ Index: ioemu/console.c
      s->y_base = 0;
 Index: ioemu/usb-linux.c
 ===================================================================
---- ioemu.orig/usb-linux.c     2006-07-26 13:39:11.999009495 +0100
-+++ ioemu/usb-linux.c  2006-07-26 13:39:16.622514851 +0100
+--- ioemu.orig/usb-linux.c     2006-07-27 11:16:53.732912290 +0100
++++ ioemu/usb-linux.c  2006-07-27 11:16:57.754467103 +0100
 @@ -26,6 +26,7 @@
  #if defined(__linux__)
  #include <dirent.h>
@@ -60,3 +60,15 @@ Index: ioemu/usb-linux.c
  #include <linux/usbdevice_fs.h>
  #include <linux/version.h>
  
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:16:57.681475183 +0100
++++ ioemu/vl.c 2006-07-27 11:17:33.279534373 +0100
+@@ -3201,6 +3201,7 @@
+             if (net_tap_fd_init(vlan, fd))
+                 ret = 0;
+         } else {
++            ifname[0] = '\0';
+             get_param_value(ifname, sizeof(ifname), "ifname", p);
+             if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
+                 pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/qemu-init-vgabios
--- a/tools/ioemu/patches/qemu-init-vgabios     Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/qemu-init-vgabios     Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/vga.c
 Index: ioemu/hw/vga.c
 ===================================================================
---- ioemu.orig/hw/vga.c        2006-07-26 15:16:41.955609165 +0100
-+++ ioemu/hw/vga.c     2006-07-26 15:17:16.910802283 +0100
+--- ioemu.orig/hw/vga.c        2006-07-27 11:10:44.847738090 +0100
++++ ioemu/hw/vga.c     2006-07-27 11:11:02.008839258 +0100
 @@ -1669,6 +1669,136 @@
      }
  }
@@ -139,3 +139,12 @@ Index: ioemu/hw/vga.c
  void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
                       unsigned long vga_ram_offset, int vga_ram_size)
  {
+@@ -1710,6 +1840,8 @@
+                          vga_screen_dump, s);
+     /* XXX: currently needed for display */
+     vga_state = s;
++
++    vga_bios_init(s);
+ }
+ 
+ 
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/qemu-logging
--- a/tools/ioemu/patches/qemu-logging  Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/qemu-logging  Thu Jul 27 10:43:34 2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-14 15:55:59.491503372 +0100
-+++ ioemu/vl.c 2006-07-14 15:55:59.693480386 +0100
-@@ -4697,7 +4697,7 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:57.756466882 +0100
++++ ioemu/vl.c 2006-07-27 11:16:57.828458912 +0100
+@@ -4698,7 +4698,7 @@
             "-S              freeze CPU at startup (use 'c' to start 
execution)\n"
             "-s              wait gdb connection to port %d\n"
             "-p port         change gdb connection port\n"
@@ -11,7 +11,7 @@ Index: ioemu/vl.c
             "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the 
optional BIOS\n"
             "                translation (t=none or lba) (usually qemu can 
guess them)\n"
             "-L path         set the directory for the BIOS and VGA BIOS\n"
-@@ -4775,7 +4775,7 @@
+@@ -4776,7 +4776,7 @@
      QEMU_OPTION_S,
      QEMU_OPTION_s,
      QEMU_OPTION_p,
@@ -20,7 +20,7 @@ Index: ioemu/vl.c
      QEMU_OPTION_hdachs,
      QEMU_OPTION_L,
  #ifdef USE_CODE_COPY
-@@ -4844,7 +4844,7 @@
+@@ -4845,7 +4845,7 @@
      { "S", 0, QEMU_OPTION_S },
      { "s", 0, QEMU_OPTION_s },
      { "p", HAS_ARG, QEMU_OPTION_p },
@@ -29,7 +29,7 @@ Index: ioemu/vl.c
      { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
      { "L", HAS_ARG, QEMU_OPTION_L },
  #ifdef USE_CODE_COPY
-@@ -5095,6 +5095,8 @@
+@@ -5096,6 +5096,8 @@
      char usb_devices[MAX_VM_USB_PORTS][128];
      int usb_devices_index;
  
@@ -38,7 +38,7 @@ Index: ioemu/vl.c
      LIST_INIT (&vm_change_state_head);
  #if !defined(CONFIG_SOFTMMU)
      /* we never want that malloc() uses mmap() */
-@@ -5144,6 +5146,11 @@
+@@ -5145,6 +5147,11 @@
      nb_nics = 0;
      /* default mac address of the first network interface */
      
@@ -50,7 +50,7 @@ Index: ioemu/vl.c
      optind = 1;
      for(;;) {
          if (optind >= argc)
-@@ -5329,7 +5336,7 @@
+@@ -5330,7 +5337,7 @@
                      exit(1);
                  }
                  break;
@@ -59,7 +59,7 @@ Index: ioemu/vl.c
                  {
                      int mask;
                      CPULogItem *item;
-@@ -5700,7 +5707,7 @@
+@@ -5701,7 +5708,7 @@
          stk.ss_flags = 0;
  
          if (sigaltstack(&stk, NULL) < 0) {
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/qemu-smp
--- a/tools/ioemu/patches/qemu-smp      Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/qemu-smp      Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:01.687705323 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:01.753697055 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.619371357 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.823348777 +0100
 @@ -159,6 +159,8 @@
  #define MAX_CPUS 1
  #endif
@@ -11,7 +11,7 @@ Index: ioemu/vl.c
  int xc_handle;
  
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
-@@ -4635,6 +4637,7 @@
+@@ -4636,6 +4638,7 @@
             "-m megs         set virtual RAM size to megs MB [default=%d]\n"
             "-smp n          set the number of CPUs to 'n' [default=1]\n"
             "-nographic      disable graphical output and redirect serial I/Os 
to console\n"
@@ -19,7 +19,7 @@ Index: ioemu/vl.c
  #ifndef _WIN32
           "-k language     use keyboard layout (for example \"fr\" for 
French)\n"
  #endif
-@@ -4809,6 +4812,7 @@
+@@ -4810,6 +4813,7 @@
      QEMU_OPTION_vnc,
  
      QEMU_OPTION_d,
@@ -27,7 +27,7 @@ Index: ioemu/vl.c
  };
  
  typedef struct QEMUOption {
-@@ -4886,6 +4890,7 @@
+@@ -4887,6 +4891,7 @@
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
      
      { "d", HAS_ARG, QEMU_OPTION_d },
@@ -35,7 +35,7 @@ Index: ioemu/vl.c
      { NULL },
  };
  
-@@ -5508,6 +5513,10 @@
+@@ -5509,6 +5514,10 @@
                  domid = atoi(optarg);
                  fprintf(logfile, "domid: %d\n", domid);
                  break;
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/shared-vram
--- a/tools/ioemu/patches/shared-vram   Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/shared-vram   Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/cirrus_vga.c
 Index: ioemu/hw/cirrus_vga.c
 ===================================================================
---- ioemu.orig/hw/cirrus_vga.c 2006-07-26 15:17:35.230806831 +0100
-+++ ioemu/hw/cirrus_vga.c      2006-07-26 15:17:39.819307015 +0100
+--- ioemu.orig/hw/cirrus_vga.c 2006-07-27 11:16:53.059986783 +0100
++++ ioemu/hw/cirrus_vga.c      2006-07-27 11:16:59.923227020 +0100
 @@ -28,6 +28,9 @@
   */
  #include "vl.h"
@@ -176,8 +176,8 @@ Index: ioemu/hw/cirrus_vga.c
  }
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-26 15:17:39.752314312 +0100
-+++ ioemu/hw/pc.c      2006-07-26 15:17:39.820306906 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:16:59.759245173 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:16:59.924226909 +0100
 @@ -783,14 +783,14 @@
      if (cirrus_vga_enabled) {
          if (pci_enabled) {
@@ -198,8 +198,8 @@ Index: ioemu/hw/pc.c
  
 Index: ioemu/hw/vga.c
 ===================================================================
---- ioemu.orig/hw/vga.c        2006-07-26 15:17:39.352357879 +0100
-+++ ioemu/hw/vga.c     2006-07-26 15:17:39.821306797 +0100
+--- ioemu.orig/hw/vga.c        2006-07-27 11:16:59.103317784 +0100
++++ ioemu/hw/vga.c     2006-07-27 11:16:59.925226798 +0100
 @@ -1799,6 +1799,7 @@
      /* TODO: add vbe support if enabled */
  }
@@ -217,7 +217,7 @@ Index: ioemu/hw/vga.c
      s->vram_offset = vga_ram_offset;
      s->vram_size = vga_ram_size;
      s->ds = ds;
-@@ -1941,6 +1942,31 @@
+@@ -1943,6 +1944,31 @@
      return 0;
  }
  
@@ -251,8 +251,8 @@ Index: ioemu/hw/vga.c
  
 Index: ioemu/hw/vga_int.h
 ===================================================================
---- ioemu.orig/hw/vga_int.h    2006-07-26 15:17:38.201483242 +0100
-+++ ioemu/hw/vga_int.h 2006-07-26 15:17:39.822306688 +0100
+--- ioemu.orig/hw/vga_int.h    2006-07-27 11:16:57.447501084 +0100
++++ ioemu/hw/vga_int.h 2006-07-27 11:16:59.925226798 +0100
 @@ -166,5 +166,6 @@
                               unsigned int color0, unsigned int color1,
                               unsigned int color_xor);
@@ -262,9 +262,9 @@ Index: ioemu/hw/vga_int.h
  extern const uint8_t gr_mask[16];
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 15:17:39.755313985 +0100
-+++ ioemu/vl.c 2006-07-26 15:17:39.824306470 +0100
-@@ -5148,6 +5148,78 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.762244841 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.928226466 +0100
+@@ -5149,6 +5149,78 @@
  
  #define MAX_NET_CLIENTS 32
  
@@ -345,8 +345,8 @@ Index: ioemu/vl.c
  #ifdef CONFIG_GDBSTUB
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 15:17:39.621328580 +0100
-+++ ioemu/vl.h 2006-07-26 15:17:39.825306361 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:16:59.549268417 +0100
++++ ioemu/vl.h 2006-07-27 11:16:59.929226356 +0100
 @@ -136,6 +136,13 @@
  
  void main_loop_wait(int timeout);
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/support-xm-console
--- a/tools/ioemu/patches/support-xm-console    Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/support-xm-console    Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,8 @@ diff -r d08c08f8fbf3 vl.c
-diff -r d08c08f8fbf3 vl.c
---- a/vl.c     Mon Jun 26 15:18:25 2006 +0100
-+++ b/vl.c     Mon Jun 26 15:18:37 2006 +0100
-@@ -1535,26 +1535,65 @@ CharDriverState *qemu_chr_open_stdio(voi
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.384286681 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.614261222 +0100
+@@ -1535,26 +1535,65 @@
      return chr;
  }
  
@@ -65,19 +66,18 @@ diff -r d08c08f8fbf3 vl.c
 -    tty.c_cc[VMIN] = 1;
 -    tty.c_cc[VTIME] = 0;
 -    tcsetattr (master_fd, TCSAFLUSH, &tty);
--
--    fprintf(stderr, "char device redirected to %s\n", slave_name);
 +    /* Set raw attributes on the pty. */
 +    cfmakeraw(&tty);
 +    tcsetattr(slave_fd, TCSAFLUSH, &tty);
 +    
 +    fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd));
 +    store_console_dev(domid, ptsname(master_fd));
-+
+ 
+-    fprintf(stderr, "char device redirected to %s\n", slave_name);
      return qemu_chr_open_fd(master_fd, master_fd);
  }
  
-@@ -5297,7 +5336,9 @@ int main(int argc, char **argv)
+@@ -5298,7 +5337,9 @@
                  break;
              case QEMU_OPTION_nographic:
                  pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/vnc-cleanup
--- a/tools/ioemu/patches/vnc-cleanup   Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/vnc-cleanup   Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,8 @@ diff -r c84300f3abc2 vnc.c
-diff -r c84300f3abc2 vnc.c
---- a/vnc.c    Wed Jul 05 18:11:23 2006 +0100
-+++ b/vnc.c    Thu Jul 06 14:27:28 2006 +0100
-@@ -83,13 +83,16 @@ static void vnc_dpy_update(DisplayState 
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2006-07-27 11:16:52.783017443 +0100
++++ ioemu/vnc.c        2006-07-27 11:17:00.722138579 +0100
+@@ -83,13 +83,16 @@
  static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
  {
      VncState *vs = ds->opaque;
@@ -21,7 +22,7 @@ diff -r c84300f3abc2 vnc.c
  }
  
  static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
-@@ -262,6 +265,7 @@ static void vnc_update_client(void *opaq
+@@ -262,6 +265,7 @@
  static void vnc_update_client(void *opaque)
  {
      VncState *vs = opaque;
@@ -29,7 +30,7 @@ diff -r c84300f3abc2 vnc.c
  
      if (vs->need_update && vs->csock != -1) {
        int y;
-@@ -282,7 +286,7 @@ static void vnc_update_client(void *opaq
+@@ -282,7 +286,7 @@
        row = vs->ds->data;
        old_row = vs->old_data;
  
@@ -38,7 +39,7 @@ diff -r c84300f3abc2 vnc.c
            if (vs->dirty_row[y] & width_mask) {
                int x;
                char *ptr, *old_ptr;
-@@ -307,10 +311,8 @@ static void vnc_update_client(void *opaq
+@@ -307,10 +311,8 @@
            old_row += vs->ds->linesize;
        }
  
@@ -51,7 +52,7 @@ diff -r c84300f3abc2 vnc.c
  
        /* Count rectangles */
        n_rectangles = 0;
-@@ -348,7 +350,9 @@ static void vnc_update_client(void *opaq
+@@ -348,7 +350,9 @@
        vnc_flush(vs);
  
      }
@@ -62,10 +63,11 @@ diff -r c84300f3abc2 vnc.c
  }
  
  static void vnc_timer_init(VncState *vs)
-diff -r c84300f3abc2 vl.c
---- a/vl.c     Wed Jul 05 18:11:23 2006 +0100
-+++ b/vl.c     Thu Jul 06 14:27:28 2006 +0100
-@@ -4586,10 +4586,10 @@ void main_loop_wait(int timeout)
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:17:00.311184072 +0100
++++ ioemu/vl.c 2006-07-27 11:17:00.724138358 +0100
+@@ -4587,10 +4587,10 @@
          /* XXX: better handling of removal */
          for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
              ioh_next = ioh->next;
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/vnc-fixes
--- a/tools/ioemu/patches/vnc-fixes     Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/vnc-fixes     Thu Jul 27 10:43:34 2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 14:29:04.481598583 +0100
-+++ ioemu/vl.c 2006-07-26 14:31:22.668325993 +0100
-@@ -6003,8 +6003,10 @@
+--- ioemu.orig/vl.c    2006-07-27 11:17:00.724138358 +0100
++++ ioemu/vl.c 2006-07-27 11:17:00.874121755 +0100
+@@ -6004,8 +6004,10 @@
                    kernel_filename, kernel_cmdline, initrd_filename,
                    timeoffset);
  
@@ -17,8 +17,8 @@ Index: ioemu/vl.c
      if (use_gdbstub) {
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-07-26 14:29:04.479598804 +0100
-+++ ioemu/vnc.c        2006-07-26 14:31:22.669325883 +0100
+--- ioemu.orig/vnc.c   2006-07-27 11:17:00.722138579 +0100
++++ ioemu/vnc.c        2006-07-27 11:17:00.875121644 +0100
 @@ -3,6 +3,7 @@
   * 
   * Copyright (C) 2006 Anthony Liguori <anthony@xxxxxxxxxxxxx>
@@ -493,8 +493,8 @@ Index: ioemu/vnc.c
  }
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 14:31:22.669325883 +0100
-+++ ioemu/vl.h 2006-07-26 14:32:44.505279724 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:17:00.311184072 +0100
++++ ioemu/vl.h 2006-07-27 11:17:00.875121644 +0100
 @@ -301,6 +301,7 @@
  int is_graphic_console(void);
  CharDriverState *text_console_init(DisplayState *ds);
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/vnc-start-vncviewer
--- a/tools/ioemu/patches/vnc-start-vncviewer   Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/vnc-start-vncviewer   Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-07-26 14:33:08.166663983 +0100
-+++ ioemu/vnc.c        2006-07-26 14:33:08.225657462 +0100
+--- ioemu.orig/vnc.c   2006-07-27 11:17:00.875121644 +0100
++++ ioemu/vnc.c        2006-07-27 11:17:01.032104266 +0100
 @@ -1002,3 +1002,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-07-26 14:33:08.165664094 +0100
-+++ ioemu/vl.c 2006-07-26 14:33:08.227657240 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:17:00.874121755 +0100
++++ ioemu/vl.c 2006-07-27 11:17:01.035103934 +0100
 @@ -121,6 +121,7 @@
  int bios_size;
  static DisplayState display_state;
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
  const char* keyboard_layout = NULL;
  int64_t ticks_per_sec;
  int boot_device = 'c';
-@@ -4801,6 +4802,7 @@
+@@ -4802,6 +4803,7 @@
  #endif
             "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
           "-vnc display    start a VNC server on display\n"
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
             "-timeoffset     time offset (in seconds) from local time\n"
             "\n"
             "During emulation, the following keys are useful:\n"
-@@ -4889,6 +4891,7 @@
+@@ -4890,6 +4892,7 @@
      QEMU_OPTION_usbdevice,
      QEMU_OPTION_smp,
      QEMU_OPTION_vnc,
@@ -56,7 +56,7 @@ Index: ioemu/vl.c
  
      QEMU_OPTION_d,
      QEMU_OPTION_vcpus,
-@@ -4964,6 +4967,7 @@
+@@ -4965,6 +4968,7 @@
      { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
      { "smp", HAS_ARG, QEMU_OPTION_smp },
      { "vnc", HAS_ARG, QEMU_OPTION_vnc },
@@ -64,7 +64,7 @@ Index: ioemu/vl.c
      
      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
-@@ -5294,6 +5298,7 @@
+@@ -5295,6 +5299,7 @@
  #endif
      snapshot = 0;
      nographic = 0;
@@ -72,7 +72,7 @@ Index: ioemu/vl.c
      kernel_filename = NULL;
      kernel_cmdline = "";
  #ifdef TARGET_PPC
-@@ -5663,6 +5668,9 @@
+@@ -5664,6 +5669,9 @@
                    exit(1);
                }
                break;
@@ -82,7 +82,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_domainname:
                  strncat(domain_name, optarg, sizeof(domain_name) - 20);
                  break;
-@@ -5910,6 +5918,8 @@
+@@ -5911,6 +5919,8 @@
          dumb_display_init(ds);
      } else if (vnc_display != -1) {
        vnc_display_init(ds, vnc_display);
@@ -93,8 +93,8 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 14:33:08.167663873 +0100
-+++ ioemu/vl.h 2006-07-26 14:33:08.228657130 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:17:00.875121644 +0100
++++ ioemu/vl.h 2006-07-27 11:17:01.036103823 +0100
 @@ -733,6 +733,7 @@
  
  /* vnc.c */
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/xen-domain-name
--- a/tools/ioemu/patches/xen-domain-name       Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/xen-domain-name       Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/sdl.c
 Index: ioemu/sdl.c
 ===================================================================
---- ioemu.orig/sdl.c   2006-07-12 11:33:54.665109493 +0100
-+++ ioemu/sdl.c        2006-07-12 11:35:01.450735012 +0100
+--- ioemu.orig/sdl.c   2006-07-27 11:16:53.590928008 +0100
++++ ioemu/sdl.c        2006-07-27 11:16:58.124426148 +0100
 @@ -268,14 +268,14 @@
  static void sdl_update_caption(void)
  {
@@ -21,8 +21,8 @@ Index: ioemu/sdl.c
  static void sdl_hide_cursor(void)
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:01.094779608 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:01.453734636 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:57.828458912 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.126425927 +0100
 @@ -159,6 +159,8 @@
  #define MAX_CPUS 1
  #endif
@@ -32,7 +32,7 @@ Index: ioemu/vl.c
  /***********************************************************/
  /* x86 ISA bus support */
  
-@@ -4698,6 +4700,7 @@
+@@ -4699,6 +4701,7 @@
             "-s              wait gdb connection to port %d\n"
             "-p port         change gdb connection port\n"
             "-l item1,...    output log to %s (use -d ? for a list of log 
items)\n"
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
             "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the 
optional BIOS\n"
             "                translation (t=none or lba) (usually qemu can 
guess them)\n"
             "-L path         set the directory for the BIOS and VGA BIOS\n"
-@@ -4787,6 +4790,7 @@
+@@ -4788,6 +4791,7 @@
      QEMU_OPTION_g,
      QEMU_OPTION_std_vga,
      QEMU_OPTION_monitor,
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
      QEMU_OPTION_serial,
      QEMU_OPTION_parallel,
      QEMU_OPTION_loadvm,
-@@ -4860,6 +4864,7 @@
+@@ -4861,6 +4865,7 @@
      { "localtime", 0, QEMU_OPTION_localtime },
      { "std-vga", 0, QEMU_OPTION_std_vga },
      { "monitor", 1, QEMU_OPTION_monitor },
@@ -56,7 +56,7 @@ Index: ioemu/vl.c
      { "serial", 1, QEMU_OPTION_serial },
      { "parallel", 1, QEMU_OPTION_parallel },
      { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
-@@ -5483,6 +5488,9 @@
+@@ -5484,6 +5489,9 @@
                    exit(1);
                }
                break;
@@ -68,8 +68,8 @@ Index: ioemu/vl.c
      }
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-12 11:35:00.955797021 +0100
-+++ ioemu/vl.h 2006-07-12 11:35:01.454734511 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:16:57.682475072 +0100
++++ ioemu/vl.h 2006-07-27 11:16:58.127425816 +0100
 @@ -1094,4 +1094,5 @@
  
  void kqemu_record_dump(void);
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/xen-domid
--- a/tools/ioemu/patches/xen-domid     Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/xen-domid     Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,8 @@ diff -r 03705e837ce8 vl.c
-diff -r 03705e837ce8 vl.c
---- a/vl.c     Tue May 30 14:10:44 2006 +0100
-+++ b/vl.c     Tue May 30 14:11:16 2006 +0100
-@@ -160,6 +160,7 @@ int vnc_display = -1;
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.126425927 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.296407110 +0100
+@@ -160,6 +160,7 @@
  #endif
  
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
@@ -9,7 +10,7 @@ diff -r 03705e837ce8 vl.c
  
  /***********************************************************/
  /* x86 ISA bus support */
-@@ -4700,6 +4701,7 @@ void help(void)
+@@ -4701,6 +4702,7 @@
             "-s              wait gdb connection to port %d\n"
             "-p port         change gdb connection port\n"
             "-l item1,...    output log to %s (use -d ? for a list of log 
items)\n"
@@ -17,7 +18,7 @@ diff -r 03705e837ce8 vl.c
             "-domain-name    domain name that we're serving\n"
             "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the 
optional BIOS\n"
             "                translation (t=none or lba) (usually qemu can 
guess them)\n"
-@@ -4803,6 +4805,8 @@ enum {
+@@ -4804,6 +4806,8 @@
      QEMU_OPTION_usbdevice,
      QEMU_OPTION_smp,
      QEMU_OPTION_vnc,
@@ -26,7 +27,7 @@ diff -r 03705e837ce8 vl.c
  };
  
  typedef struct QEMUOption {
-@@ -4878,6 +4882,8 @@ const QEMUOption qemu_options[] = {
+@@ -4879,6 +4883,8 @@
      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
@@ -35,7 +36,7 @@ diff -r 03705e837ce8 vl.c
      { NULL },
  };
  
-@@ -5491,6 +5497,10 @@ int main(int argc, char **argv)
+@@ -5492,6 +5498,10 @@
              case QEMU_OPTION_domainname:
                  strncat(domain_name, optarg, sizeof(domain_name) - 20);
                  break;
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/xen-mm
--- a/tools/ioemu/patches/xen-mm        Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/xen-mm        Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/pc.c
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-14 15:55:59.489503600 +0100
-+++ ioemu/hw/pc.c      2006-07-14 15:56:00.354405169 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:16:57.678475515 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:16:58.447390396 +0100
 @@ -639,7 +639,9 @@
      }
  
@@ -25,8 +25,8 @@ Index: ioemu/hw/pc.c
      isa_bios_size = bios_size;
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-14 15:56:00.271414614 +0100
-+++ ioemu/vl.c 2006-07-14 15:56:00.358404714 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.296407110 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.450390064 +0100
 @@ -159,6 +159,8 @@
  #define MAX_CPUS 1
  #endif
@@ -36,7 +36,7 @@ Index: ioemu/vl.c
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
  extern int domid;
  
-@@ -5105,6 +5107,9 @@
+@@ -5106,6 +5108,9 @@
      QEMUMachine *machine;
      char usb_devices[MAX_VM_USB_PORTS][128];
      int usb_devices_index;
@@ -46,7 +46,7 @@ Index: ioemu/vl.c
  
      char qemu_dm_logfilename[64];
  
-@@ -5341,11 +5346,13 @@
+@@ -5342,11 +5347,13 @@
                  ram_size = atol(optarg) * 1024 * 1024;
                  if (ram_size <= 0)
                      help();
@@ -60,7 +60,7 @@ Index: ioemu/vl.c
                  break;
              case QEMU_OPTION_l:
                  {
-@@ -5559,6 +5566,39 @@
+@@ -5560,6 +5567,39 @@
      /* init the memory */
      phys_ram_size = ram_size + vga_ram_size + bios_size;
  
@@ -100,7 +100,7 @@ Index: ioemu/vl.c
  #ifdef CONFIG_SOFTMMU
      phys_ram_base = qemu_vmalloc(phys_ram_size);
      if (!phys_ram_base) {
-@@ -5599,6 +5639,8 @@
+@@ -5600,6 +5640,8 @@
      }
  #endif
  
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/patches/xen-network
--- a/tools/ioemu/patches/xen-network   Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/patches/xen-network   Thu Jul 27 10:43:34 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:01.753697055 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:02.126650330 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.823348777 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.169310479 +0100
 @@ -89,6 +89,7 @@
  #include "exec-all.h"
  
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
          int fd;
          if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
              fd = strtol(buf, NULL, 0);
-@@ -3212,7 +3215,10 @@
+@@ -3213,7 +3216,10 @@
              if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
                  pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
              }
@@ -52,7 +52,7 @@ Index: ioemu/vl.c
          }
      } else
  #endif
-@@ -4671,7 +4677,7 @@
+@@ -4672,7 +4678,7 @@
             "-net tap[,vlan=n],ifname=name\n"
             "                connect the host TAP network interface to VLAN 
'n'\n"
  #else
diff -r 199d53efd029 -r 2d73714911c2 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/ioemu/vl.c  Thu Jul 27 10:43:34 2006 -0600
@@ -3284,6 +3284,7 @@ int net_client_init(const char *str)
             if (net_tap_fd_init(vlan, fd))
                 ret = 0;
         } else {
+            ifname[0] = '\0';
             get_param_value(ifname, sizeof(ifname), "ifname", p);
             if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
                 pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
diff -r 199d53efd029 -r 2d73714911c2 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Thu Jul 27 10:00:00 2006 -0600
+++ b/tools/libxc/xc_hvm_build.c        Thu Jul 27 10:43:34 2006 -0600
@@ -15,12 +15,6 @@
 
 #define HVM_LOADER_ENTR_ADDR  0x00100000
 
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#ifdef __x86_64__
-#define L3_PROT (_PAGE_PRESENT)
-#endif
-
 #define E820MAX     128
 
 #define E820_RAM          1
@@ -41,9 +35,6 @@ struct e820entry {
     uint32_t type;
 } __attribute__((packed));
 
-#define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
-#define round_pgdown(_p)  ((_p)&PAGE_MASK)
-
 static int
 parseelfimage(
     char *elfbase, unsigned long elfsize, struct domain_setup_info *dsi);
@@ -52,7 +43,7 @@ loadelfimage(
     char *elfbase, int xch, uint32_t dom, unsigned long *parray,
     struct domain_setup_info *dsi);
 
-static unsigned char build_e820map(void *e820_page, unsigned long long 
mem_size)
+static void build_e820map(void *e820_page, unsigned long long mem_size)
 {
     struct e820entry *e820entry =
         (struct e820entry *)(((unsigned char *)e820_page) + E820_MAP_OFFSET);
@@ -115,7 +106,7 @@ static unsigned char build_e820map(void 
     e820entry[nr_map].type = E820_IO;
     nr_map++;
 
-    return (*(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map);
+    *(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
 }
 
 static void set_hvm_info_checksum(struct hvm_info_table *t)
@@ -186,7 +177,6 @@ static int setup_guest(int xc_handle,
 
     shared_info_t *shared_info;
     void *e820_page;
-    unsigned char e820_map_nr;
 
     struct domain_setup_info dsi;
     uint64_t v_end;
@@ -261,7 +251,7 @@ static int setup_guest(int xc_handle,
               page_array[E820_MAP_PAGE >> PAGE_SHIFT])) == 0 )
         goto error_out;
     memset(e820_page, 0, PAGE_SIZE);
-    e820_map_nr = build_e820map(e820_page, v_end);
+    build_e820map(e820_page, v_end);
     munmap(e820_page, PAGE_SIZE);
 
     /* shared_info page starts its life empty. */
@@ -311,23 +301,7 @@ static int setup_guest(int xc_handle,
     /*
      * Initial register values:
      */
-    ctxt->user_regs.ds = 0;
-    ctxt->user_regs.es = 0;
-    ctxt->user_regs.fs = 0;
-    ctxt->user_regs.gs = 0;
-    ctxt->user_regs.ss = 0;
-    ctxt->user_regs.cs = 0;
     ctxt->user_regs.eip = dsi.v_kernentry;
-    ctxt->user_regs.edx = 0;
-    ctxt->user_regs.eax = 0;
-    ctxt->user_regs.esp = 0;
-    ctxt->user_regs.ebx = 0; /* startup_32 expects this to be 0 to signal boot 
cpu */
-    ctxt->user_regs.ecx = 0;
-    ctxt->user_regs.esi = 0;
-    ctxt->user_regs.edi = 0;
-    ctxt->user_regs.ebp = 0;
-
-    ctxt->user_regs.eflags = 0;
 
     return 0;
 
diff -r 199d53efd029 -r 2d73714911c2 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Jul 27 10:43:34 2006 -0600
@@ -286,7 +286,7 @@ static inline int long_mode_do_msr_write
         if ( msr_content & ~(EFER_LME | EFER_LMA | EFER_NX | EFER_SCE) )
         {
             printk("trying to set reserved bit in EFER\n");
-            vmx_inject_exception(v, TRAP_gp_fault, 0);
+            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
             return 0;
         }
 
@@ -300,7 +300,7 @@ static inline int long_mode_do_msr_write
             {
                 printk("trying to set LME bit when "
                        "in paging mode or PAE bit is not set\n");
-                vmx_inject_exception(v, TRAP_gp_fault, 0);
+                vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
                 return 0;
             }
 
@@ -318,7 +318,7 @@ static inline int long_mode_do_msr_write
         if ( !IS_CANO_ADDRESS(msr_content) )
         {
             HVM_DBG_LOG(DBG_LEVEL_1, "Not cano address of msr write\n");
-            vmx_inject_exception(v, TRAP_gp_fault, 0);
+            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
             return 0;
         }
 
@@ -1438,7 +1438,7 @@ static int vmx_set_cr0(unsigned long val
                        &v->arch.hvm_vmx.cpu_state) )
         {
             HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enabled\n");
-            vmx_inject_exception(v, TRAP_gp_fault, 0);
+            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
         }
 
         if ( test_bit(VMX_CPU_STATE_LME_ENABLED,
@@ -1520,7 +1520,7 @@ static int vmx_set_cr0(unsigned long val
     {
         if ( value & X86_CR0_PG ) {
             /* inject GP here */
-            vmx_inject_exception(v, TRAP_gp_fault, 0);
+            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
             return 0;
         } else {
             /*
@@ -1764,7 +1764,7 @@ static int mov_to_cr(int gp, int cr, str
         else
         {
             if ( test_bit(VMX_CPU_STATE_LMA_ENABLED, 
&v->arch.hvm_vmx.cpu_state) )
-                vmx_inject_exception(v, TRAP_gp_fault, 0);
+                vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
 
             clear_bit(VMX_CPU_STATE_PAE_ENABLED, &v->arch.hvm_vmx.cpu_state);
         }
@@ -2192,7 +2192,7 @@ asmlinkage void vmx_vmexit_handler(struc
             if ( test_bit(_DOMF_debugging, &v->domain->domain_flags) )
                 domain_pause_for_debugger();
             else 
-                vmx_inject_exception(v, TRAP_int3, VMX_DELIVER_NO_ERROR_CODE);
+                vmx_reflect_exception(v);
             break;
         }
 #endif
@@ -2219,7 +2219,7 @@ asmlinkage void vmx_vmexit_handler(struc
                 /*
                  * Inject #PG using Interruption-Information Fields
                  */
-                vmx_inject_exception(v, TRAP_page_fault, regs.error_code);
+                vmx_inject_hw_exception(v, TRAP_page_fault, regs.error_code);
                 v->arch.hvm_vmx.cpu_cr2 = va;
                 TRACE_3D(TRC_VMX_INT, v->domain->domain_id, TRAP_page_fault, 
va);
             }
@@ -2335,7 +2335,7 @@ asmlinkage void vmx_vmexit_handler(struc
     case EXIT_REASON_VMON:
         /* Report invalid opcode exception when a VMX guest tries to execute 
             any of the VMX instructions */
-        vmx_inject_exception(v, TRAP_invalid_op, VMX_DELIVER_NO_ERROR_CODE);
+        vmx_inject_hw_exception(v, TRAP_invalid_op, VMX_DELIVER_NO_ERROR_CODE);
         break;
 
     default:
diff -r 199d53efd029 -r 2d73714911c2 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c   Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/arch/x86/shadow32.c   Thu Jul 27 10:43:34 2006 -0600
@@ -835,12 +835,12 @@ void free_monitor_pagetable(struct vcpu 
 }
 
 static int
-map_p2m_entry(l1_pgentry_t *l1tab, unsigned long va,
-              unsigned long gpa, unsigned long mfn)
+map_p2m_entry(l1_pgentry_t *l1tab, unsigned long gpfn, unsigned long mfn)
 {
     unsigned long *l0tab = NULL;
     l1_pgentry_t l1e = { 0 };
     struct page_info *page;
+    unsigned long va = RO_MPT_VIRT_START + (gpfn * sizeof(mfn));
 
     l1e = l1tab[l1_table_offset(va)];
     if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
@@ -858,7 +858,7 @@ map_p2m_entry(l1_pgentry_t *l1tab, unsig
     else
         l0tab = map_domain_page(l1e_get_pfn(l1e));
 
-    l0tab[gpa & ((PAGE_SIZE / sizeof(mfn)) - 1)] = mfn;
+    l0tab[gpfn & ((PAGE_SIZE / sizeof(mfn)) - 1)] = mfn;
 
     unmap_domain_page(l0tab);
 
@@ -877,15 +877,9 @@ set_p2m_entry(struct domain *d, unsigned
     unsigned long va = pfn << PAGE_SHIFT;
 
     if ( shadow_mode_external(d) )
-    {
         tabpfn = pagetable_get_pfn(d->vcpu[0]->arch.monitor_table);
-        va = RO_MPT_VIRT_START + (pfn * sizeof (unsigned long));
-    }
     else
-    {
         tabpfn = pagetable_get_pfn(d->arch.phys_table);
-        va = pfn << PAGE_SHIFT;
-    }
 
     ASSERT(tabpfn != 0);
     ASSERT(shadow_lock_is_acquired(d));
@@ -902,12 +896,12 @@ set_p2m_entry(struct domain *d, unsigned
         l1_pgentry_t *l1tab = NULL;
         l2_pgentry_t l2e;
 
-        l2e = l2[l2_table_offset(va)];
+        l2e = l2[l2_table_offset(RO_MPT_VIRT_START)];
 
         ASSERT( l2e_get_flags(l2e) & _PAGE_PRESENT );
 
         l1tab = map_domain_page(l2e_get_pfn(l2e));
-        if ( !(error = map_p2m_entry(l1tab, va, pfn, mfn)) )
+        if ( !(error = map_p2m_entry(l1tab, pfn, mfn)) )
             domain_crash(d);
 
         unmap_domain_page(l1tab);
@@ -952,7 +946,6 @@ alloc_p2m_table(struct domain *d)
 alloc_p2m_table(struct domain *d)
 {
     struct list_head *list_ent;
-    unsigned long va = RO_MPT_VIRT_START;   /* phys_to_machine_mapping */
 
     l2_pgentry_t *l2tab = NULL;
     l1_pgentry_t *l1tab = NULL;
@@ -965,14 +958,14 @@ alloc_p2m_table(struct domain *d)
     {
         l2tab = map_domain_page(
             pagetable_get_pfn(d->vcpu[0]->arch.monitor_table));
-        l2e = l2tab[l2_table_offset(va)];
+        l2e = l2tab[l2_table_offset(RO_MPT_VIRT_START)];
         if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
         {
             page = alloc_domheap_page(NULL);
 
             l1tab = map_domain_page(page_to_mfn(page));
             memset(l1tab, 0, PAGE_SIZE);
-            l2e = l2tab[l2_table_offset(va)] =
+            l2e = l2tab[l2_table_offset(RO_MPT_VIRT_START)] =
                 l2e_from_page(page, __PAGE_HYPERVISOR);
         }
         else
@@ -1002,14 +995,13 @@ alloc_p2m_table(struct domain *d)
         page = list_entry(list_ent, struct page_info, list);
         mfn = page_to_mfn(page);
 
-        if ( !(error = map_p2m_entry(l1tab, va, gpfn, mfn)) )
+        if ( !(error = map_p2m_entry(l1tab, gpfn, mfn)) )
         {
             domain_crash(d);
             break;
         }
 
         list_ent = frame_table[mfn].list.next;
-        va += sizeof(mfn);
     }
 
     unmap_domain_page(l1tab);
diff -r 199d53efd029 -r 2d73714911c2 xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c      Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/arch/x86/shadow_public.c      Thu Jul 27 10:43:34 2006 -0600
@@ -438,6 +438,8 @@ static void alloc_monitor_pagetable(stru
             (l3e_get_flags(mpl3e[i]) & _PAGE_PRESENT) ?
             l2e_from_pfn(l3e_get_pfn(mpl3e[i]), __PAGE_HYPERVISOR) :
             l2e_empty();
+    for ( i = 0; i < (MACHPHYS_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
+        mpl2e[l2_table_offset(RO_MPT_VIRT_START) + i] = l2e_empty();
 
     if ( v->vcpu_id == 0 )
     {
@@ -1471,8 +1473,7 @@ int _shadow_mode_refcounts(struct domain
 }
 
 static int
-map_p2m_entry(pgentry_64_t *top_tab, unsigned long va,
-              unsigned long gpfn, unsigned long mfn)
+map_p2m_entry(pgentry_64_t *top_tab, unsigned long gpfn, unsigned long mfn)
 {
 #if CONFIG_PAGING_LEVELS >= 4
     pgentry_64_t l4e = { 0 };
@@ -1487,6 +1488,7 @@ map_p2m_entry(pgentry_64_t *top_tab, uns
     l2_pgentry_t l2e = { 0 };
     l1_pgentry_t l1e = { 0 };
     struct page_info *page;
+    unsigned long va = RO_MPT_VIRT_START + (gpfn * sizeof(mfn));
 
 #if CONFIG_PAGING_LEVELS >= 4
     l4e = top_tab[l4_table_offset(va)];
@@ -1568,7 +1570,7 @@ map_p2m_entry(pgentry_64_t *top_tab, uns
 
     unmap_domain_page(l1tab);
 
-    l0tab[gpfn & ((PAGE_SIZE / sizeof (mfn)) - 1) ] = mfn;
+    l0tab[gpfn & ((PAGE_SIZE / sizeof(mfn)) - 1)] = mfn;
 
     unmap_domain_page(l0tab);
 
@@ -1584,7 +1586,6 @@ set_p2m_entry(struct domain *d, unsigned
               struct domain_mmap_cache *l1cache)
 {
     unsigned long tabmfn = pagetable_get_pfn(d->vcpu[0]->arch.monitor_table);
-    unsigned long va = RO_MPT_VIRT_START + (gpfn * sizeof(unsigned long));
     pgentry_64_t *top_tab;
     int error;
 
@@ -1593,7 +1594,7 @@ set_p2m_entry(struct domain *d, unsigned
 
     top_tab = map_domain_page_with_cache(tabmfn, l2cache);
 
-    if ( !(error = map_p2m_entry(top_tab, va, gpfn, mfn)) )
+    if ( !(error = map_p2m_entry(top_tab, gpfn, mfn)) )
         domain_crash(d);
 
     unmap_domain_page_with_cache(top_tab, l2cache);
@@ -1605,10 +1606,9 @@ alloc_p2m_table(struct domain *d)
 alloc_p2m_table(struct domain *d)
 {
     struct list_head *list_ent;
-    unsigned long va = RO_MPT_VIRT_START; /*  phys_to_machine_mapping */
     pgentry_64_t *top_tab = NULL;
-    unsigned long mfn;
-    int gpfn, error = 0;
+    unsigned long gpfn, mfn;
+    int error = 0;
 
     ASSERT( pagetable_get_pfn(d->vcpu[0]->arch.monitor_table) );
 
@@ -1624,14 +1624,13 @@ alloc_p2m_table(struct domain *d)
         page = list_entry(list_ent, struct page_info, list);
         mfn = page_to_mfn(page);
 
-        if ( !(error = map_p2m_entry(top_tab, va, gpfn, mfn)) )
+        if ( !(error = map_p2m_entry(top_tab, gpfn, mfn)) )
         {
             domain_crash(d);
             break;
         }
 
         list_ent = frame_table[mfn].list.next;
-        va += sizeof(mfn);
     }
 
     unmap_domain_page(top_tab);
diff -r 199d53efd029 -r 2d73714911c2 xen/common/memory.c
--- a/xen/common/memory.c       Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/common/memory.c       Thu Jul 27 10:43:34 2006 -0600
@@ -170,7 +170,7 @@ guest_remove_page(
     if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
         put_page(page);
 
-    if ( unlikely((page->count_info & PGC_count_mask) != 1) )
+    if ( unlikely(!page_is_removable(page)) )
     {
         /* We'll make this a guest-visible error in future, so take heed! */
         DPRINTK("Dom%d freeing in-use page %lx (pseudophys %lx):"
diff -r 199d53efd029 -r 2d73714911c2 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/include/asm-ia64/mm.h Thu Jul 27 10:43:34 2006 -0600
@@ -211,6 +211,11 @@ static inline int get_page_and_type(stru
     }
 
     return rc;
+}
+
+static inline int page_is_removable(struct page_info *page)
+{
+    return ((page->count_info & PGC_count_mask) == 2);
 }
 
 #define        set_machinetophys(_mfn, _pfn) do { } while(0);
diff -r 199d53efd029 -r 2d73714911c2 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Thu Jul 27 10:43:34 2006 -0600
@@ -143,11 +143,12 @@ extern unsigned int cpu_rev;
  */
 #define INTR_INFO_VECTOR_MASK           0xff            /* 7:0 */
 #define INTR_INFO_INTR_TYPE_MASK        0x700           /* 10:8 */
-#define INTR_INFO_DELIEVER_CODE_MASK    0x800           /* 11 */
+#define INTR_INFO_DELIVER_CODE_MASK     0x800           /* 11 */
 #define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
 
 #define INTR_TYPE_EXT_INTR              (0 << 8) /* external interrupt */
-#define INTR_TYPE_EXCEPTION             (3 << 8) /* processor exception */
+#define INTR_TYPE_HW_EXCEPTION             (3 << 8) /* hardware exception */
+#define INTR_TYPE_SW_EXCEPTION             (6 << 8) /* software exception */
 
 /*
  * Exit Qualifications for MOV for Control Register Access
@@ -421,7 +422,7 @@ static inline int vmx_pgbit_test(struct 
 }
 
 static inline int __vmx_inject_exception(struct vcpu *v, int trap, int type, 
-                                         int error_code)
+                                         int error_code, int ilen)
 {
     unsigned long intr_fields;
 
@@ -429,22 +430,33 @@ static inline int __vmx_inject_exception
     intr_fields = (INTR_INFO_VALID_MASK | type | trap);
     if (error_code != VMX_DELIVER_NO_ERROR_CODE) {
         __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
-        intr_fields |= INTR_INFO_DELIEVER_CODE_MASK;
+        intr_fields |= INTR_INFO_DELIVER_CODE_MASK;
      }
-    
+
+    if(ilen)
+      __vmwrite(VM_ENTRY_INSTRUCTION_LEN, ilen);
+
     __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
     return 0;
 }
 
-static inline int vmx_inject_exception(struct vcpu *v, int trap, int 
error_code)
+static inline int vmx_inject_hw_exception(struct vcpu *v, int trap, int 
error_code)
 {
     v->arch.hvm_vmx.vector_injected = 1;
-    return __vmx_inject_exception(v, trap, INTR_TYPE_EXCEPTION, error_code);
+    return __vmx_inject_exception(v, trap, INTR_TYPE_HW_EXCEPTION,
+                                 error_code, 0);
+}
+
+static inline int vmx_inject_sw_exception(struct vcpu *v, int trap, int 
instruction_len) {
+     v->arch.hvm_vmx.vector_injected=1;
+     return __vmx_inject_exception(v, trap, INTR_TYPE_SW_EXCEPTION,
+                                  VMX_DELIVER_NO_ERROR_CODE,
+                                  instruction_len);
 }
 
 static inline int vmx_inject_extint(struct vcpu *v, int trap, int error_code)
 {
-    __vmx_inject_exception(v, trap, INTR_TYPE_EXT_INTR, error_code);
+    __vmx_inject_exception(v, trap, INTR_TYPE_EXT_INTR, error_code, 0);
     __vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0);
 
     return 0;
@@ -452,14 +464,14 @@ static inline int vmx_inject_extint(stru
 
 static inline int vmx_reflect_exception(struct vcpu *v)
 {
-    int error_code, vector;
-
-    __vmread(VM_EXIT_INTR_INFO, &vector);
-    if (vector & INTR_INFO_DELIEVER_CODE_MASK)
+    int error_code, intr_info, vector;
+
+    __vmread(VM_EXIT_INTR_INFO, &intr_info);
+    vector = intr_info & 0xff;
+    if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
         __vmread(VM_EXIT_INTR_ERROR_CODE, &error_code);
     else
         error_code = VMX_DELIVER_NO_ERROR_CODE;
-    vector &= 0xff;
 
 #ifndef NDEBUG
     {
@@ -472,7 +484,19 @@ static inline int vmx_reflect_exception(
     }
 #endif /* NDEBUG */
 
-    vmx_inject_exception(v, vector, error_code);
+    /* According to Intel Virtualization Technology Specification for
+       the IA-32 Intel Architecture (C97063-002 April 2005), section
+       2.8.3, SW_EXCEPTION should be used for #BP and #OV, and
+       HW_EXCPEPTION used for everything else.  The main difference
+       appears to be that for SW_EXCEPTION, the EIP/RIP is incremented
+       by VM_ENTER_INSTRUCTION_LEN bytes, whereas for HW_EXCEPTION, 
+       it is not.  */
+    if((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_SW_EXCEPTION) {
+      int ilen;
+      __vmread(VM_EXIT_INSTRUCTION_LEN, &ilen);
+      vmx_inject_sw_exception(v, vector, ilen);
+    } else
+      vmx_inject_hw_exception(v, vector, error_code);
     return 0;
 }
 
diff -r 199d53efd029 -r 2d73714911c2 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Thu Jul 27 10:00:00 2006 -0600
+++ b/xen/include/asm-x86/mm.h  Thu Jul 27 10:43:34 2006 -0600
@@ -241,6 +241,11 @@ static inline int get_page_and_type(stru
     return rc;
 }
 
+static inline int page_is_removable(struct page_info *page)
+{
+    return ((page->count_info & PGC_count_mask) == 1);
+}
+
 #define ASSERT_PAGE_IS_TYPE(_p, _t)                            \
     ASSERT(((_p)->u.inuse.type_info & PGT_type_mask) == (_t)); \
     ASSERT(((_p)->u.inuse.type_info & PGT_count_mask) != 0)

_______________________________________________
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®.