WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [pushed] [ppc] merge with xen-unstable.hg

changeset:   9744:47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a
parent:      9715:1bdd8ec03da55dd5d7a802a147d9e77d06d3a244
parent:      9743:8a836199490422b44f02761f86eb1f4a59ad5342
user:        jimix@xxxxxxxxxxxxxxxxxxxxx
date:        Thu Mar 30 21:48:08 2006 -0500
files:       linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c 
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h 
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h 
linux-2.6-xen-sparse/include/xen/xenbus.h tools/python/xen/util/xmlrpclib2.py 
tools/python/xen/xend/XendClient.py tools/python/xen/xm/create.py 
tools/python/xen/xm/main.py xen/Rules.mk xen/arch/x86/Makefile 
xen/arch/x86/domain.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c 
xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/hvm.h 
xen/include/asm-x86/hvm/svm/svm.h xen/include/asm-x86/hvm/vmx/vmcs.h 
xen/include/public/xen.h
description:
[ppc] merge with xen-unstable.hg


diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a linux-2.6-xen-sparse/arch/i386/Makefile
--- a/linux-2.6-xen-sparse/arch/i386/Makefile   Thu Mar 30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/i386/Makefile   Thu Mar 30 21:48:08 2006 -0500
@@ -44,6 +44,11 @@ CFLAGS                               += $(shell if [ $(call 
cc-vers
 CFLAGS                         += $(shell if [ $(call cc-version) -lt 0400 ] ; 
then echo $(call cc-option,-fno-unit-at-a-time); fi ;)
 
 CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+       -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+
+CPPFLAGS += $(cppflags-y)
 
 # Default subarch .c files
 mcore-y  := mach-default
@@ -107,7 +112,7 @@ boot := arch/i386/boot
        zdisk bzdisk fdimage fdimage144 fdimage288 install
 
 ifdef CONFIG_XEN
-CPPFLAGS        := -D__KERNEL__ -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen 
$(LINUXINCLUDE)
+CPPFLAGS := -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS)
 head-y := arch/i386/kernel/head-xen.o arch/i386/kernel/init_task-xen.o
 boot := arch/i386/boot-xen
 .PHONY: vmlinuz
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c       Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c       Thu Mar 30 
21:48:08 2006 -0500
@@ -114,7 +114,7 @@ void xen_idle(void)
                smp_mb__after_clear_bit();
                stop_hz_timer();
                /* Blocking includes an implicit local_irq_enable(). */
-               HYPERVISOR_sched_op(SCHEDOP_block, 0);
+               HYPERVISOR_block();
                start_hz_timer();
                set_thread_flag(TIF_POLLING_NRFLAG);
        }
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/arch/i386/kernel/quirks-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/quirks-xen.c        Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/quirks-xen.c        Thu Mar 30 
21:48:08 2006 -0500
@@ -5,7 +5,7 @@
 #include <linux/pci.h>
 #include <linux/irq.h>
 
-#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
+#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_SMP) || 
defined(CONFIG_XEN)) && defined(CONFIG_PCI)
 
 static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
 {
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Mar 30 21:48:08 
2006 -0500
@@ -1633,9 +1633,9 @@ void __init setup_arch(char **cmdline_p)
        physdev_op_t op;
        unsigned long max_low_pfn;
 
-       /* Force a quick death if the kernel panics. */
+       /* Force a quick death if the kernel panics (not domain 0). */
        extern int panic_timeout;
-       if (panic_timeout == 0)
+       if (!panic_timeout && !(xen_start_info->flags & SIF_INITDOMAIN))
                panic_timeout = 1;
 
        /* Register a call for panic conditions. */
@@ -1877,7 +1877,7 @@ static int
 static int
 xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
-       HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+       HYPERVISOR_shutdown(SHUTDOWN_crash);
        /* we're never actually going to get here... */
        return NOTIFY_DONE;
 }
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a linux-2.6-xen-sparse/arch/ia64/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/Makefile   Thu Mar 30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/Makefile   Thu Mar 30 21:48:08 2006 -0500
@@ -42,6 +42,12 @@ endif
 endif
 
 CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+       -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+
+CPPFLAGS += $(cppflags-y)
+
 head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
 
 libs-y                         += arch/ia64/lib/
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/arch/x86_64/Makefile
--- a/linux-2.6-xen-sparse/arch/x86_64/Makefile Thu Mar 30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/x86_64/Makefile Thu Mar 30 21:48:08 2006 -0500
@@ -30,6 +30,10 @@ cflags-$(CONFIG_MK8) += $(call cc-option
 cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
 cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
 CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+       -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+CPPFLAGS += $(cppflags-y)
 
 CFLAGS += -m64
 CFLAGS += -mno-red-zone
@@ -71,7 +75,7 @@ boot := arch/x86_64/boot
        fdimage fdimage144 fdimage288 archclean
 
 ifdef CONFIG_XEN
-CPPFLAGS := -D__KERNEL__ -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen 
$(LINUXINCLUDE)
+CPPFLAGS := -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS)
 head-y := arch/x86_64/kernel/head-xen.o arch/x86_64/kernel/head64-xen.o 
arch/x86_64/kernel/init_task.o
 LDFLAGS_vmlinux := -e _start
 boot := arch/i386/boot-xen
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c     Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c     Thu Mar 30 
21:48:08 2006 -0500
@@ -131,7 +131,7 @@ void xen_idle(void)
                smp_mb__after_clear_bit();
                stop_hz_timer();
                /* Blocking includes an implicit local_irq_enable(). */
-               HYPERVISOR_sched_op(SCHEDOP_block, 0);
+               HYPERVISOR_block();
                start_hz_timer();
                set_thread_flag(TIF_POLLING_NRFLAG);
        }
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Thu Mar 30 
21:48:08 2006 -0500
@@ -999,7 +999,7 @@ static int
 static int
 xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
-       HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+       HYPERVISOR_shutdown(SHUTDOWN_crash);
        /* we're never actually going to get here... */
        return NOTIFY_DONE;
 }
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig  Thu Mar 30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig  Thu Mar 30 21:48:08 2006 -0500
@@ -10,12 +10,11 @@ config XEN
        help
          This is the Linux Xen port.
 
-config NO_IDLE_HZ
-       bool
-       depends on XEN
-       default y
-
 if XEN
+config XEN_INTERFACE_VERSION
+       hex
+       default 0x00030101
+
 menu "XEN"
 
 config XEN_PRIVILEGED_GUEST
@@ -191,7 +190,6 @@ config XEN_DISABLE_SERIAL
 
 config XEN_SYSFS
        tristate "Export Xen attributes in sysfs"
-       depends on XEN
        depends on SYSFS
        default y
        help
@@ -207,4 +205,8 @@ config HAVE_ARCH_DEV_ALLOC_SKB
        bool
        default y
 
+config NO_IDLE_HZ
+       bool
+       default y
+
 endif
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Thu Mar 30 21:48:08 
2006 -0500
@@ -142,7 +142,7 @@ static int blkback_probe(struct xenbus_d
        if (err)
                goto fail;
 
-       err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
+       err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err)
                goto fail;
 
@@ -253,19 +253,24 @@ static void frontend_changed(struct xenb
 
        switch (frontend_state) {
        case XenbusStateInitialising:
+               break;
+
+       case XenbusStateInitialised:
        case XenbusStateConnected:
-               break;
-
-       case XenbusStateInitialised:
+               /* Ensure we connect even when two watches fire in 
+                  close successsion and we miss the intermediate value 
+                  of frontend_state. */
+               if (dev->state == XenbusStateConnected)
+                       break;
+
                err = connect_ring(be);
-               if (err) {
-                       return;
-               }
-               update_blkif_status(be->blkif); 
+               if (err)
+                       break;
+               update_blkif_status(be->blkif);
                break;
 
        case XenbusStateClosing:
-               xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
+               xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
        case XenbusStateClosed:
@@ -338,15 +343,17 @@ again:
                goto abort;
        }
 
-       err = xenbus_switch_state(dev, xbt, XenbusStateConnected);
-       if (err)
-               goto abort;
-
        err = xenbus_transaction_end(xbt, 0);
        if (err == -EAGAIN)
                goto again;
        if (err)
                xenbus_dev_fatal(dev, err, "ending transaction");
+
+       err = xenbus_switch_state(dev, XenbusStateConnected);
+       if (err)
+               xenbus_dev_fatal(dev, err, "switching to Connected state",
+                                dev->nodename);
+
        return;
  abort:
        xenbus_transaction_end(xbt, 1);
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Mar 30 
21:48:08 2006 -0500
@@ -176,10 +176,6 @@ again:
                goto abort_transaction;
        }
 
-       err = xenbus_switch_state(dev, xbt, XenbusStateInitialised);
-       if (err)
-               goto abort_transaction;
-
        err = xenbus_transaction_end(xbt, 0);
        if (err) {
                if (err == -EAGAIN)
@@ -187,6 +183,8 @@ again:
                xenbus_dev_fatal(dev, err, "completing transaction");
                goto destroy_blkring;
        }
+
+       xenbus_switch_state(dev, XenbusStateInitialised);
 
        return 0;
 
@@ -324,7 +322,7 @@ static void connect(struct blkfront_info
                return;
        }
 
-       (void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected);
+       (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
        /* Kick pending requests. */
        spin_lock_irq(&blkif_io_lock);
@@ -349,7 +347,7 @@ static void blkfront_closing(struct xenb
 
        xlvbd_del(info);
 
-       xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
+       xenbus_switch_state(dev, XenbusStateClosed);
 }
 
 
@@ -755,7 +753,7 @@ static void blkif_recover(struct blkfron
 
        kfree(copy);
 
-       (void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected);
+       (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 
        /* Now safe for us to use the shared ring */
        spin_lock_irq(&blkif_io_lock);
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Mar 30 21:48:08 
2006 -0500
@@ -42,7 +42,7 @@ void machine_emergency_restart(void)
 {
        /* We really want to get pending console data out before we die. */
        xencons_force_flush();
-       HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_reboot);
+       HYPERVISOR_shutdown(SHUTDOWN_reboot);
 }
 
 void machine_restart(char * __unused)
@@ -59,7 +59,7 @@ void machine_power_off(void)
 {
        /* We really want to get pending console data out before we die. */
        xencons_force_flush();
-       HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_poweroff);
+       HYPERVISOR_shutdown(SHUTDOWN_poweroff);
 }
 
 int reboot_thru_bios = 0;      /* for dmi_scan.c */
@@ -114,8 +114,8 @@ static int __do_suspend(void *ignore)
 
 #ifdef __i386__
        kmem_cache_shrink(pgd_cache);
+#endif
        mm_pin_all();
-#endif
 
        __cli();
        preempt_enable();
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Thu Mar 30 21:48:08 
2006 -0500
@@ -92,7 +92,7 @@ static int netback_probe(struct xenbus_d
        if (err)
                goto fail;
 
-       err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
+       err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err) {
                goto fail;
        }
@@ -209,7 +209,7 @@ static void frontend_changed(struct xenb
                break;
 
        case XenbusStateClosing:
-               xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
+               xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
        case XenbusStateClosed:
@@ -254,7 +254,7 @@ static void connect(struct backend_info 
                return;
        }
 
-       xenbus_switch_state(dev, XBT_NULL, XenbusStateConnected);
+       xenbus_switch_state(dev, XenbusStateConnected);
 }
 
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Mar 30 
21:48:08 2006 -0500
@@ -1216,7 +1216,7 @@ static void netfront_closing(struct xenb
 
        close_netdev(info);
 
-       xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
+       xenbus_switch_state(dev, XenbusStateClosed);
 }
 
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Thu Mar 30 21:48:08 
2006 -0500
@@ -137,7 +137,7 @@ static int pciback_attach(struct pciback
 
        dev_dbg(&pdev->xdev->dev, "Connecting...\n");
 
-       err = xenbus_switch_state(pdev->xdev, XBT_NULL, XenbusStateConnected);
+       err = xenbus_switch_state(pdev->xdev, XenbusStateConnected);
        if (err)
                xenbus_dev_fatal(pdev->xdev, err,
                                 "Error switching to connected state!");
@@ -165,7 +165,7 @@ static void pciback_frontend_changed(str
                break;
 
        case XenbusStateClosing:
-               xenbus_switch_state(xdev, XBT_NULL, XenbusStateClosing);
+               xenbus_switch_state(xdev, XenbusStateClosing);
                break;
 
        case XenbusStateClosed:
@@ -341,7 +341,7 @@ static int pciback_setup_backend(struct 
                goto out;
        }
 
-       err = xenbus_switch_state(pdev->xdev, XBT_NULL, XenbusStateInitialised);
+       err = xenbus_switch_state(pdev->xdev, XenbusStateInitialised);
        if (err)
                xenbus_dev_fatal(pdev->xdev, err,
                                 "Error switching to initialised state!");
@@ -386,7 +386,7 @@ static int pciback_xenbus_probe(struct x
        }
 
        /* wait for xend to configure us */
-       err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
+       err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err)
                goto out;
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c        Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c        Thu Mar 30 
21:48:08 2006 -0500
@@ -96,10 +96,6 @@ static int pcifront_publish_info(struct 
        if (!err)
                err = xenbus_printf(trans, pdev->xdev->nodename,
                                    "magic", XEN_PCI_MAGIC);
-       if (!err)
-               err =
-                   xenbus_switch_state(pdev->xdev, trans,
-                                       XenbusStateInitialised);
 
        if (err) {
                xenbus_transaction_end(trans, 1);
@@ -117,6 +113,8 @@ static int pcifront_publish_info(struct 
                        goto out;
                }
        }
+
+       xenbus_switch_state(pdev->xdev, XenbusStateInitialised);
 
        dev_dbg(&pdev->xdev->dev, "publishing successful!\n");
 
@@ -186,7 +184,7 @@ static int pcifront_try_connect(struct p
                }
        }
 
-       err = xenbus_switch_state(pdev->xdev, XBT_NULL, XenbusStateConnected);
+       err = xenbus_switch_state(pdev->xdev, XenbusStateConnected);
        if (err)
                goto out;
 
@@ -205,8 +203,7 @@ static int pcifront_try_disconnect(struc
        prev_state = xenbus_read_driver_state(pdev->xdev->nodename);
 
        if (prev_state < XenbusStateClosing)
-               err = xenbus_switch_state(pdev->xdev, XBT_NULL,
-                                       XenbusStateClosing);
+               err = xenbus_switch_state(pdev->xdev, XenbusStateClosing);
 
        if (!err && prev_state == XenbusStateConnected)
                pcifront_disconnect(pdev);
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Thu Mar 30 21:48:08 
2006 -0500
@@ -87,7 +87,7 @@ static int tpmback_probe(struct xenbus_d
                goto fail;
        }
 
-       err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
+       err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err) {
                goto fail;
        }
@@ -175,7 +175,7 @@ static void frontend_changed(struct xenb
                break;
 
        case XenbusStateClosing:
-               xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
+               xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
        case XenbusStateClosed:
@@ -247,18 +247,15 @@ again:
                goto abort;
        }
 
-       err = xenbus_switch_state(dev, xbt, XenbusStateConnected);
-       if (err)
-               goto abort;
-
-       be->tpmif->status = CONNECTED;
-
        err = xenbus_transaction_end(xbt, 0);
        if (err == -EAGAIN)
                goto again;
-       if (err) {
+       if (err)
                xenbus_dev_fatal(be->dev, err, "end of transaction");
-       }
+
+       err = xenbus_switch_state(dev, XenbusStateConnected);
+       if (!err)
+               be->tpmif->status = CONNECTED;
        return;
 abort:
        xenbus_transaction_end(xbt, 1);
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Thu Mar 30 
21:48:08 2006 -0500
@@ -84,9 +84,7 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path2);
 EXPORT_SYMBOL_GPL(xenbus_watch_path2);
 
 
-int xenbus_switch_state(struct xenbus_device *dev,
-                       xenbus_transaction_t xbt,
-                       XenbusState state)
+int xenbus_switch_state(struct xenbus_device *dev, XenbusState state)
 {
        /* We check whether the state is currently set to the given value, and
           if not, then the state is set.  We don't want to unconditionally
@@ -94,6 +92,12 @@ int xenbus_switch_state(struct xenbus_de
           unnecessarily.  Furthermore, if the node has gone, we don't write
           to it, as the device will be tearing down, and we don't want to
           resurrect that directory.
+
+          Note that, because of this cached value of our state, this function
+          will not work inside a Xenstore transaction (something it was
+          trying to in the past) because dev->state would not get reset if
+          the transaction was aborted.
+
         */
 
        int current_state;
@@ -102,12 +106,12 @@ int xenbus_switch_state(struct xenbus_de
        if (state == dev->state)
                return 0;
 
-       err = xenbus_scanf(xbt, dev->nodename, "state", "%d",
-                              &current_state);
+       err = xenbus_scanf(XBT_NULL, dev->nodename, "state", "%d",
+                          &current_state);
        if (err != 1)
                return 0;
 
-       err = xenbus_printf(xbt, dev->nodename, "state", "%d", state);
+       err = xenbus_printf(XBT_NULL, dev->nodename, "state", "%d", state);
        if (err) {
                if (state != XenbusStateClosing) /* Avoid looping */
                        xenbus_dev_fatal(dev, err, "writing new state");
@@ -193,7 +197,7 @@ void xenbus_dev_fatal(struct xenbus_devi
        _dev_error(dev, err, fmt, ap);
        va_end(ap);
 
-       xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
+       xenbus_switch_state(dev, XenbusStateClosing);
 }
 EXPORT_SYMBOL_GPL(xenbus_dev_fatal);
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Thu Mar 30 
21:48:08 2006 -0500
@@ -364,7 +364,7 @@ static int xenbus_dev_probe(struct devic
        return 0;
 fail:
        xenbus_dev_error(dev, err, "xenbus_dev_probe on %s", dev->nodename);
-       xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
+       xenbus_switch_state(dev, XenbusStateClosed);
        return -ENODEV;
 }
 
@@ -381,7 +381,7 @@ static int xenbus_dev_remove(struct devi
        if (drv->remove)
                drv->remove(dev);
 
-       xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
+       xenbus_switch_state(dev, XenbusStateClosed);
        return 0;
 }
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h    Thu Mar 
30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h    Thu Mar 
30 21:48:08 2006 -0500
@@ -33,10 +33,9 @@
 #ifndef __HYPERCALL_H__
 #define __HYPERCALL_H__
 
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/nmi.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
 
 #define __STR(x) #x
 #define STR(x) __STR(x)
@@ -167,35 +166,17 @@ HYPERVISOR_fpu_taskswitch(
 }
 
 static inline int
+HYPERVISOR_sched_op_compat(
+       int cmd, unsigned long arg)
+{
+       return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
+static inline int
 HYPERVISOR_sched_op(
-       int cmd, unsigned long arg)
+       int cmd, void *arg)
 {
        return _hypercall2(int, sched_op, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_sched_op_new(
-       int cmd, void *arg)
-{
-       return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
-       evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
-{
-       struct sched_poll sched_poll = {
-               .ports = ports,
-               .nr_ports = nr_ports,
-               .timeout = jiffies_to_st(timeout)
-       };
-
-       int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
-       if (rc == -ENOSYS)
-               rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
-       return rc;
 }
 
 static inline long
@@ -327,8 +308,18 @@ HYPERVISOR_suspend(
 HYPERVISOR_suspend(
        unsigned long srec)
 {
-       return _hypercall3(int, sched_op, SCHEDOP_shutdown,
-                          SHUTDOWN_suspend, srec);
+       struct sched_shutdown sched_shutdown = {
+               .reason = SHUTDOWN_suspend
+       };
+
+       int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+                            &sched_shutdown, srec);
+
+       if (rc == -ENOSYS)
+               rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+                                SHUTDOWN_suspend, srec);
+
+       return rc;
 }
 
 static inline int
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h   Thu Mar 
30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h   Thu Mar 
30 21:48:08 2006 -0500
@@ -37,8 +37,11 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/version.h>
+#include <linux/errno.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/dom0_ops.h>
+#include <xen/interface/sched.h>
+#include <xen/interface/nmi.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
 #if defined(__i386__)
@@ -115,6 +118,64 @@ u64 jiffies_to_st(unsigned long jiffies)
 
 #define xen_init()     (0)
 
+static inline int
+HYPERVISOR_yield(
+       void)
+{
+       int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+       return rc;
+}
+
+static inline int
+HYPERVISOR_block(
+       void)
+{
+       int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
+
+       return rc;
+}
+
+static inline int
+HYPERVISOR_shutdown(
+       unsigned int reason)
+{
+       struct sched_shutdown sched_shutdown = {
+               .reason = reason
+       };
+
+       int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+       return rc;
+}
+
+static inline int
+HYPERVISOR_poll(
+       evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+       struct sched_poll sched_poll = {
+               .ports = ports,
+               .nr_ports = nr_ports,
+               .timeout = jiffies_to_st(timeout)
+       };
+
+       int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+       return rc;
+}
+
 static inline void
 MULTI_update_va_mapping(
     multicall_entry_t *mcl, unsigned long va,
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Thu Mar 30 18:40:26 
2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Thu Mar 30 21:48:08 
2006 -0500
@@ -33,10 +33,9 @@
 #ifndef __HYPERCALL_H__
 #define __HYPERCALL_H__
 
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/dom0_ops.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
 
 /* FIXME: temp place to hold these page related macros */
 #include <asm/page.h>
@@ -164,35 +163,17 @@
 })
 
 static inline int
+HYPERVISOR_sched_op_compat(
+    int cmd, unsigned long arg)
+{
+       return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
+static inline int
 HYPERVISOR_sched_op(
-    int cmd, unsigned long arg)
+       int cmd, void *arg)
 {
        return _hypercall2(int, sched_op, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_sched_op_new(
-       int cmd, void *arg)
-{
-       return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
-       evtchn_port_t *ports, unsigned int nr_ports, unsigned long timeout)
-{
-       struct sched_poll sched_poll = {
-               .ports = ports,
-               .nr_ports = nr_ports,
-               .timeout = jiffies_to_st(timeout)
-       };
-
-       int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
-       if (rc == -ENOSYS)
-               rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
-       return rc;
 }
 
 static inline long
@@ -272,8 +253,18 @@ HYPERVISOR_suspend(
 HYPERVISOR_suspend(
        unsigned long srec)
 {
-    return _hypercall3(int, sched_op, SCHEDOP_shutdown,
-                       SHUTDOWN_suspend, srec);
+       struct sched_shutdown sched_shutdown = {
+               .reason = SHUTDOWN_suspend
+       };
+
+       int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+                            &sched_shutdown, srec);
+
+       if (rc == -ENOSYS)
+               rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+                                SHUTDOWN_suspend, srec);
+
+       return rc;
 }
 
 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Thu Mar 30 
18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Thu Mar 30 
21:48:08 2006 -0500
@@ -37,8 +37,10 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/version.h>
+#include <linux/errno.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/dom0_ops.h>
+#include <xen/interface/sched.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
 
@@ -53,6 +55,64 @@ int xen_init(void);
 #define jiffies_to_st(j)       0
 
 #include <asm/hypercall.h>
+
+static inline int
+HYPERVISOR_yield(
+       void)
+{
+       int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+       return rc;
+}
+
+static inline int
+HYPERVISOR_block(
+       void)
+{
+       int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
+
+       return rc;
+}
+
+static inline int
+HYPERVISOR_shutdown(
+       unsigned int reason)
+{
+       struct sched_shutdown sched_shutdown = {
+               .reason = reason
+       };
+
+       int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+       return rc;
+}
+
+static inline int
+HYPERVISOR_poll(
+       evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+       struct sched_poll sched_poll = {
+               .ports = ports,
+               .nr_ports = nr_ports,
+               .timeout = jiffies_to_st(timeout)
+       };
+
+       int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+
+       if (rc == -ENOSYS)
+               rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+       return rc;
+}
 
 // for drivers/xen/privcmd/privcmd.c
 #define direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h  Thu Mar 
30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h  Thu Mar 
30 21:48:08 2006 -0500
@@ -37,10 +37,9 @@
 #ifndef __HYPERCALL_H__
 #define __HYPERCALL_H__
 
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/nmi.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
 
 #define __STR(x) #x
 #define STR(x) __STR(x)
@@ -172,35 +171,17 @@ HYPERVISOR_fpu_taskswitch(
 }
 
 static inline int
+HYPERVISOR_sched_op_compat(
+       int cmd, unsigned long arg)
+{
+       return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
+static inline int
 HYPERVISOR_sched_op(
-       int cmd, unsigned long arg)
+       int cmd, void *arg)
 {
        return _hypercall2(int, sched_op, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_sched_op_new(
-       int cmd, void *arg)
-{
-       return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
-       evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
-{
-       struct sched_poll sched_poll = {
-               .ports = ports,
-               .nr_ports = nr_ports,
-               .timeout = jiffies_to_st(timeout)
-       };
-
-       int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
-       if (rc == -ENOSYS)
-               rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
-       return rc;
 }
 
 static inline long
@@ -328,8 +309,18 @@ HYPERVISOR_suspend(
 HYPERVISOR_suspend(
        unsigned long srec)
 {
-       return _hypercall3(int, sched_op, SCHEDOP_shutdown,
-                          SHUTDOWN_suspend, srec);
+       struct sched_shutdown sched_shutdown = {
+               .reason = SHUTDOWN_suspend
+       };
+
+       int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+                            &sched_shutdown, srec);
+
+       if (rc == -ENOSYS)
+               rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+                                SHUTDOWN_suspend, srec);
+
+       return rc;
 }
 
 static inline int
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a 
linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Thu Mar 30 18:40:26 2006 -0500
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Thu Mar 30 21:48:08 2006 -0500
@@ -204,14 +204,10 @@ int xenbus_watch_path2(struct xenbus_dev
 
 /**
  * Advertise in the store a change of the given driver to the given new_state.
- * Perform the change inside the given transaction xbt.  xbt may be NULL, in
- * which case this is performed inside its own transaction.  Return 0 on
- * success, or -errno on error.  On error, the device will switch to
- * XenbusStateClosing, and the error will be saved in the store.
- */
-int xenbus_switch_state(struct xenbus_device *dev,
-                       xenbus_transaction_t xbt,
-                       XenbusState new_state);
+ * Return 0 on success, or -errno on error.  On error, the device will switch
+ * to XenbusStateClosing, and the error will be saved in the store.
+ */
+int xenbus_switch_state(struct xenbus_device *dev, XenbusState new_state);
 
 
 /**
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/console/daemon/io.c Thu Mar 30 21:48:08 2006 -0500
@@ -434,25 +434,36 @@ void enum_domains(void)
        }
 }
 
+static int ring_free_bytes(struct domain *dom)
+{
+       struct xencons_interface *intf = dom->interface;
+       XENCONS_RING_IDX cons, prod, space;
+
+       cons = intf->in_cons;
+       prod = intf->in_prod;
+       mb();
+
+       space = prod - cons;
+       if (space > sizeof(intf->in))
+               return 0; /* ring is screwed: ignore it */
+
+       return (sizeof(intf->in) - space);
+}
+
 static void handle_tty_read(struct domain *dom)
 {
        ssize_t len = 0;
        char msg[80];
        int i;
        struct xencons_interface *intf = dom->interface;
-       XENCONS_RING_IDX cons, prod;
-
-       cons = intf->in_cons;
-       prod = intf->in_prod;
-       mb();
-
-       if (sizeof(intf->in) > (prod - cons))
-               len = sizeof(intf->in) - (prod - cons);
+       XENCONS_RING_IDX prod;
+
+       len = ring_free_bytes(dom);
+       if (len == 0)
+               return;
+
        if (len > sizeof(msg))
                len = sizeof(msg);
-
-       if (len == 0)
-               return;
 
        len = read(dom->tty_fd, msg, len);
        if (len < 1) {
@@ -465,6 +476,7 @@ static void handle_tty_read(struct domai
                        shutdown_domain(dom);
                }
        } else if (domain_is_valid(dom->domid)) {
+               prod = intf->in_prod;
                for (i = 0; i < len; i++) {
                        intf->in[MASK_XENCONS_IDX(prod++, intf->in)] =
                                msg[i];
@@ -514,7 +526,7 @@ static void handle_ring_read(struct doma
        (void)write_sync(dom->evtchn_fd, &v, sizeof(v));
 }
 
-static void handle_xs(int fd)
+static void handle_xs(void)
 {
        char **vec;
        int domid;
@@ -560,7 +572,7 @@ void handle_io(void)
                        }
 
                        if (d->tty_fd != -1) {
-                               if (!d->is_dead)
+                               if (!d->is_dead && ring_free_bytes(d))
                                        FD_SET(d->tty_fd, &readfds);
 
                                if (!buffer_empty(&d->buffer))
@@ -572,7 +584,7 @@ void handle_io(void)
                ret = select(max_fd + 1, &readfds, &writefds, 0, NULL);
 
                if (FD_ISSET(xs_fileno(xs), &readfds))
-                       handle_xs(xs_fileno(xs));
+                       handle_xs();
 
                for (d = dom_head; d; d = n) {
                        n = d->next;
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/examples/README.incompatibilities
--- a/tools/examples/README.incompatibilities   Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/examples/README.incompatibilities   Thu Mar 30 21:48:08 2006 -0500
@@ -24,6 +24,13 @@ xen-network-common.sh.
 xen-network-common.sh.
 
 
+ip
+--
+
+Newer ip commands (from iproute2) do not accept the abbreviated syntax "ip r a
+..." etc.  "ip route add ..." must be used instead.
+
+
 sed
 ---
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/examples/block
--- a/tools/examples/block      Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/examples/block      Thu Mar 30 21:48:08 2006 -0500
@@ -72,7 +72,7 @@ check_sharing()
   then
     toskip="^$"
   else
-    toskip="^[^ ]* [^ ]* [^ ]* ro "
+    toskip="^[^ ]* [^ ]* [^ ]* ro[, ]"
   fi
 
   for file in $(cat /proc/mounts | grep -v "$toskip" | cut -f 1 -d ' ')
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/examples/vif-route
--- a/tools/examples/vif-route  Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/examples/vif-route  Thu Mar 30 21:48:08 2006 -0500
@@ -29,11 +29,11 @@ case "$command" in
     online)
         ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
         echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
-        ipcmd='a'
+        ipcmd='add'
         ;;
     offline)
         ifdown ${vif}
-        ipcmd='d'
+        ipcmd='del'
         ;;
 esac
 
@@ -41,7 +41,7 @@ if [ "${ip}" ] ; then
     # If we've been given a list of IP addresses, then add routes from dom0 to
     # the guest using those addresses.
     for addr in ${ip} ; do
-      ip r ${ipcmd} ${addr} dev ${vif} src ${main_ip}
+      ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
     done 
 fi
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c   Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/libxc/xc_ptrace.c   Thu Mar 30 21:48:08 2006 -0500
@@ -153,190 +153,58 @@ online_vcpus_changed(cpumap_t cpumap)
 }
 
 /* --------------------- */
+/* XXX application state */
+static long                     nr_pages = 0;
+static unsigned long           *page_array = NULL;
 
 static void *
-map_domain_va_pae(
+map_domain_va_32(
     int xc_handle,
     int cpu,
     void *guest_va,
     int perm)
 {
-    unsigned long l2p, l1p, p, va = (unsigned long)guest_va;
-    uint64_t *l3, *l2, *l1;
-    static void *v;
-
-    if (fetch_regs(xc_handle, cpu, NULL))
-        return NULL;
-
-    l3 = xc_map_foreign_range(
-        xc_handle, current_domid, PAGE_SIZE, PROT_READ, ctxt[cpu].ctrlreg[3] 
>> PAGE_SHIFT);
-    if ( l3 == NULL )
-        return NULL;
-
-    l2p = l3[l3_table_offset_pae(va)] >> PAGE_SHIFT;
-    l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l2p);
-    if ( l2 == NULL )
-        return NULL;
-
-    l1p = l2[l2_table_offset_pae(va)] >> PAGE_SHIFT;
-    l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, l1p);
-    if ( l1 == NULL )
-        return NULL;
-
-    p = l1[l1_table_offset_pae(va)] >> PAGE_SHIFT;
-    if ( v != NULL )
-        munmap(v, PAGE_SIZE);
-    v = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, p);
-    if ( v == NULL )
-        return NULL;
-
-    return (void *)((unsigned long)v | (va & (PAGE_SIZE - 1)));
-}
-
-#ifdef __x86_64__
-static void *
-map_domain_va(
-    int xc_handle,
-    int cpu,
-    void *guest_va,
-    int perm)
-{
-    unsigned long l3p, l2p, l1p, p, va = (unsigned long)guest_va;
-    uint64_t *l4, *l3, *l2, *l1;
-    static void *v;
-
-    if ((ctxt[cpu].ctrlreg[4] & 0x20) == 0 ) /* legacy ia32 mode */
-        return map_domain_va_pae(xc_handle, cpu, guest_va, perm);
-
-    if (fetch_regs(xc_handle, cpu, NULL))
-        return NULL;
-
-    l4 = xc_map_foreign_range(
-        xc_handle, current_domid, PAGE_SIZE, PROT_READ, ctxt[cpu].ctrlreg[3] 
>> PAGE_SHIFT);
-    if ( l4 == NULL )
-        return NULL;
-
-    l3p = l4[l4_table_offset(va)] >> PAGE_SHIFT;
-    l3 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l3p);
-    if ( l3 == NULL )
-        return NULL;
-
-    l2p = l3[l3_table_offset(va)] >> PAGE_SHIFT;
-    l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l2p);
-    if ( l2 == NULL )
-        return NULL;
-
-    l1p = l2[l2_table_offset(va)] >> PAGE_SHIFT;
-    l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, l1p);
-    if ( l1 == NULL )
-        return NULL;
-
-    p = l1[l1_table_offset(va)] >> PAGE_SHIFT;
-    if ( v != NULL )
-        munmap(v, PAGE_SIZE);
-    v = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, p);
-    if ( v == NULL )
-        return NULL;
-
-    return (void *)((unsigned long)v | (va & (PAGE_SIZE - 1)));
-}
-#endif
-
-#ifdef __i386__
-/* XXX application state */
-static long                     nr_pages = 0;
-static unsigned long           *page_array = NULL;
-
-static void *
-map_domain_va(
-    int xc_handle,
-    int cpu,
-    void *guest_va,
-    int perm)
-{
-
     unsigned long pde, page;
     unsigned long va = (unsigned long)guest_va;
-    long npgs = xc_get_tot_pages(xc_handle, current_domid);
-
-
-    static uint32_t  cr3_phys[MAX_VIRT_CPUS];
-    static unsigned long *cr3_virt[MAX_VIRT_CPUS];
+
+    static unsigned long  cr3_phys[MAX_VIRT_CPUS];
+    static uint32_t *cr3_virt[MAX_VIRT_CPUS];
     static unsigned long  pde_phys[MAX_VIRT_CPUS];
-    static unsigned long *pde_virt[MAX_VIRT_CPUS];
+    static uint32_t *pde_virt[MAX_VIRT_CPUS];
     static unsigned long  page_phys[MAX_VIRT_CPUS];
-    static unsigned long *page_virt[MAX_VIRT_CPUS];    
+    static uint32_t *page_virt[MAX_VIRT_CPUS];    
     static int            prev_perm[MAX_VIRT_CPUS];
-    static enum { MODE_UNKNOWN, MODE_32, MODE_PAE, MODE_64 } mode;
-
-    if ( mode == MODE_UNKNOWN )
-    {
-        xen_capabilities_info_t caps;
-        (void)xc_version(xc_handle, XENVER_capabilities, caps);
-        if ( strstr(caps, "-x86_64") )
-            mode = MODE_64;
-        else if ( strstr(caps, "-x86_32p") )
-            mode = MODE_PAE;
-        else if ( strstr(caps, "-x86_32") ) 
-            mode = MODE_32;
-    }
-
-    if ( mode == MODE_PAE )
-        return map_domain_va_pae(xc_handle, cpu, guest_va, perm);
-
-    if ( nr_pages != npgs )
-    {
-        if ( nr_pages > 0 )
-            free(page_array);
-        nr_pages = npgs;
-        if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
-        {
-            printf("Could not allocate memory\n");
-            return NULL;
-        }
-        if ( xc_get_pfn_list(xc_handle, current_domid,
-                             page_array, nr_pages) != nr_pages )
-        {
-            printf("Could not get the page frame list\n");
-            return NULL;
-        }
-    }
-
-    if (fetch_regs(xc_handle, cpu, NULL))
-        return NULL;
-
-    if (paging_enabled(&ctxt[cpu])) {
-       if ( ctxt[cpu].ctrlreg[3] != cr3_phys[cpu] )
-        {
-            cr3_phys[cpu] = ctxt[cpu].ctrlreg[3];
-            if ( cr3_virt[cpu] )
-                munmap(cr3_virt[cpu], PAGE_SIZE);
-            cr3_virt[cpu] = xc_map_foreign_range(
-                xc_handle, current_domid, PAGE_SIZE, PROT_READ,
-                cr3_phys[cpu] >> PAGE_SHIFT);
-            if ( cr3_virt[cpu] == NULL )
-                return NULL;
-        }
-        if ( (pde = cr3_virt[cpu][vtopdi(va)]) == 0 )
-            return NULL;
-        if ( (ctxt[cpu].flags & VGCF_HVM_GUEST) && paging_enabled(&ctxt[cpu]) )
-            pde = page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
-        if ( pde != pde_phys[cpu] )
-        {
-            pde_phys[cpu] = pde;
-            if ( pde_virt[cpu] )
-                munmap(pde_virt[cpu], PAGE_SIZE);
-            pde_virt[cpu] = xc_map_foreign_range(
-                xc_handle, current_domid, PAGE_SIZE, PROT_READ,
-                pde_phys[cpu] >> PAGE_SHIFT);
-            if ( pde_virt[cpu] == NULL )
-                return NULL;
-        }
-        if ( (page = pde_virt[cpu][vtopti(va)]) == 0 )
-            return NULL;
-    } else {
-        page = va;
-    }
+
+   if (ctxt[cpu].ctrlreg[3] == 0)
+       return NULL;
+   if ( ctxt[cpu].ctrlreg[3] != cr3_phys[cpu] )
+    {
+        cr3_phys[cpu] = ctxt[cpu].ctrlreg[3];
+        if ( cr3_virt[cpu] )
+            munmap(cr3_virt[cpu], PAGE_SIZE);
+        cr3_virt[cpu] = xc_map_foreign_range(
+            xc_handle, current_domid, PAGE_SIZE, PROT_READ,
+            cr3_phys[cpu] >> PAGE_SHIFT);
+        if ( cr3_virt[cpu] == NULL )
+            return NULL;
+    }
+    if ( (pde = cr3_virt[cpu][vtopdi(va)]) == 0 )
+        return NULL;
+    if ( (ctxt[cpu].flags & VGCF_HVM_GUEST) && paging_enabled(&ctxt[cpu]) )
+        pde = page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
+    if ( pde != pde_phys[cpu] )
+    {
+        pde_phys[cpu] = pde;
+        if ( pde_virt[cpu] )
+            munmap(pde_virt[cpu], PAGE_SIZE);
+        pde_virt[cpu] = xc_map_foreign_range(
+            xc_handle, current_domid, PAGE_SIZE, PROT_READ,
+            pde_phys[cpu] >> PAGE_SHIFT);
+        if ( pde_virt[cpu] == NULL )
+            return NULL;
+    }
+    if ( (page = pde_virt[cpu][vtopti(va)]) == 0 )
+        return NULL;
     if (ctxt[cpu].flags & VGCF_HVM_GUEST)
         page = page_array[page >> PAGE_SHIFT] << PAGE_SHIFT;
     if ( (page != page_phys[cpu]) || (perm != prev_perm[cpu]) )
@@ -358,7 +226,180 @@ map_domain_va(
     return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK));
 }
 
+
+static void *
+map_domain_va_pae(
+    int xc_handle,
+    int cpu,
+    void *guest_va,
+    int perm)
+{
+    unsigned long l2p, l1p, p, va = (unsigned long)guest_va;
+    uint64_t *l3, *l2, *l1;
+    static void *v;
+
+    l3 = xc_map_foreign_range(
+        xc_handle, current_domid, PAGE_SIZE, PROT_READ, ctxt[cpu].ctrlreg[3] 
>> PAGE_SHIFT);
+    if ( l3 == NULL )
+        return NULL;
+
+    l2p = l3[l3_table_offset_pae(va)] >> PAGE_SHIFT;
+    l2p = page_array[l2p];
+    l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l2p);
+    munmap(l3, PAGE_SIZE);
+    if ( l2 == NULL )
+        return NULL;
+
+    l1p = l2[l2_table_offset_pae(va)] >> PAGE_SHIFT;
+    l1p = page_array[l1p];
+    l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, l1p);
+    munmap(l2, PAGE_SIZE);
+    if ( l1 == NULL )
+        return NULL;
+
+    p = l1[l1_table_offset_pae(va)] >> PAGE_SHIFT;
+    p = page_array[p];
+    if ( v != NULL )
+        munmap(v, PAGE_SIZE);
+    v = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, p);
+    munmap(l1, PAGE_SIZE);
+    if ( v == NULL )
+        return NULL;
+
+    return (void *)((unsigned long)v | (va & (PAGE_SIZE - 1)));
+}
+
+#ifdef __x86_64__
+static void *
+map_domain_va_64(
+    int xc_handle,
+    int cpu,
+    void *guest_va,
+    int perm)
+{
+    unsigned long l3p, l2p, l1p, l1e, p, va = (unsigned long)guest_va;
+    uint64_t *l4, *l3, *l2, *l1;
+    static void *v;
+
+    if ((ctxt[cpu].ctrlreg[4] & 0x20) == 0 ) /* legacy ia32 mode */
+        return map_domain_va_32(xc_handle, cpu, guest_va, perm);
+
+    l4 = xc_map_foreign_range( xc_handle, current_domid, PAGE_SIZE, 
+            PROT_READ, ctxt[cpu].ctrlreg[3] >> PAGE_SHIFT);
+    if ( l4 == NULL )
+        return NULL;
+
+    l3p = l4[l4_table_offset(va)] >> PAGE_SHIFT;
+    l3p = page_array[l3p];
+    l3 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l3p);
+    munmap(l4, PAGE_SIZE);
+    if ( l3 == NULL )
+        return NULL;
+
+    l2p = l3[l3_table_offset(va)] >> PAGE_SHIFT;
+    l2p = page_array[l2p];
+    l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l2p);
+    munmap(l3, PAGE_SIZE);
+    if ( l2 == NULL )
+        return NULL;
+
+    l1 = NULL;
+    l1e = l2[l2_table_offset(va)];
+    l1p = l1e >> PAGE_SHIFT;
+    if (l1e & 0x80)  { /* 2M pages */
+        p = (l1p + l1_table_offset(va));
+    } else { /* 4K pages */
+        l1p = page_array[l1p];
+        l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, 
l1p);
+        munmap(l2, PAGE_SIZE);
+        if ( l1 == NULL )
+            return NULL;
+
+        p = l1[l1_table_offset(va)] >> PAGE_SHIFT;
+    }
+    p = page_array[p];
+    if ( v != NULL )
+        munmap(v, PAGE_SIZE);
+    v = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, p);
+    if (l1)
+        munmap(l1, PAGE_SIZE);
+    if ( v == NULL )
+        return NULL;
+
+    return (void *)((unsigned long)v | (va & (PAGE_SIZE - 1)));
+}
 #endif
+
+static void *
+map_domain_va(
+    int xc_handle,
+    int cpu,
+    void *guest_va,
+    int perm)
+{
+    unsigned long va = (unsigned long) guest_va;
+    long npgs = xc_get_tot_pages(xc_handle, current_domid);
+    static enum { MODE_UNKNOWN, MODE_64, MODE_32, MODE_PAE } mode;
+
+    if ( mode == MODE_UNKNOWN )
+    {
+        xen_capabilities_info_t caps;
+        (void)xc_version(xc_handle, XENVER_capabilities, caps);
+        if ( strstr(caps, "-x86_64") )
+            mode = MODE_64;
+        else if ( strstr(caps, "-x86_32p") )
+            mode = MODE_PAE;
+        else if ( strstr(caps, "-x86_32") ) 
+            mode = MODE_32;
+    }
+
+    if ( nr_pages != npgs )
+    {
+        if ( nr_pages > 0 )
+            free(page_array);
+        nr_pages = npgs;
+        if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
+        {
+            printf("Could not allocate memory\n");
+            return NULL;
+        }
+        if ( xc_get_pfn_list(xc_handle, current_domid,
+                             page_array, nr_pages) != nr_pages )
+        {
+            printf("Could not get the page frame list\n");
+            return NULL;
+        }
+    }
+
+    if (fetch_regs(xc_handle, cpu, NULL))
+        return NULL;
+
+    if (!paging_enabled(&ctxt[cpu])) { 
+        static void * v;
+        unsigned long page;
+
+        if ( v != NULL )
+            munmap(v, PAGE_SIZE);
+
+        page = page_array[va >> PAGE_SHIFT] << PAGE_SHIFT;
+
+        v = xc_map_foreign_range( xc_handle, current_domid, PAGE_SIZE, 
+                perm, page >> PAGE_SHIFT);
+    
+        if ( v == NULL )
+            return NULL;
+
+        return (void *)(((unsigned long)v) | (va & BSD_PAGE_MASK));
+    }
+#ifdef __x86_64__
+    if ( mode == MODE_64 )
+        return map_domain_va_64(xc_handle, cpu, guest_va, perm);
+#endif
+    if ( mode == MODE_PAE )
+        return map_domain_va_pae(xc_handle, cpu, guest_va, perm);
+    /* else ( mode == MODE_32 ) */
+    return map_domain_va_32(xc_handle, cpu, guest_va, perm);
+}
 
 static int 
 __xc_waitdomain(
@@ -470,7 +511,7 @@ xc_ptrace(
         break;
 
     case PTRACE_SETREGS:
-        if (!current_isfile)
+        if (current_isfile)
                 goto out_unspported; /* XXX not yet supported */
         SET_XC_REGS(((struct gdb_regs *)data), ctxt[cpu].user_regs);
         if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu, 
@@ -492,7 +533,7 @@ xc_ptrace(
 
     case PTRACE_CONT:
     case PTRACE_DETACH:
-        if (!current_isfile)
+        if (current_isfile)
             goto out_unspported; /* XXX not yet supported */
         if ( request != PTRACE_SINGLESTEP )
         {
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/libxc/xc_ptrace.h
--- a/tools/libxc/xc_ptrace.h   Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/libxc/xc_ptrace.h   Thu Mar 30 21:48:08 2006 -0500
@@ -31,7 +31,7 @@ struct gdb_regs
   unsigned long orig_rax;
   unsigned long rip;
   unsigned long xcs;
-  unsigned long eflags;
+  unsigned long rflags;
   unsigned long rsp;
   unsigned long xss;
   unsigned long fs_base;
@@ -61,7 +61,7 @@ struct gdb_regs
     pt.rax = xc.rax;                            \
     pt.rip = xc.rip;                            \
     pt.xcs = xc.cs;                             \
-    pt.eflags = xc.eflags;                      \
+    pt.rflags = xc.rflags;                      \
     pt.rsp = xc.rsp;                            \
     pt.xss = xc.ss;                             \
     pt.xes = xc.es;                             \
@@ -89,7 +89,7 @@ struct gdb_regs
     xc.rax = pt->rax;                           \
     xc.rip = pt->rip;                           \
     xc.cs = pt->xcs;                            \
-    xc.eflags = pt->eflags;                     \
+    xc.rflags = pt->rflags & 0xffffffff;        \
     xc.rsp = pt->rsp;                           \
     xc.ss = pt->xss;                            \
     xc.es = pt->xes;                            \
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/python/xen/util/xmlrpclib2.py       Thu Mar 30 21:48:08 2006 -0500
@@ -23,8 +23,12 @@ from httplib import HTTPConnection, HTTP
 from httplib import HTTPConnection, HTTP
 from xmlrpclib import Transport
 from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
-import xmlrpclib, socket, os, traceback
+import xmlrpclib, socket, os, stat
 import SocketServer
+
+import xen.xend.XendClient
+from xen.xend.XendLogging import log
+
 
 # A new ServerProxy that also supports httpu urls.  An http URL comes in the
 # form:
@@ -60,8 +64,7 @@ class ServerProxy(xmlrpclib.ServerProxy)
                                        verbose, allow_none)
 
 # This is a base XML-RPC server for TCP.  It sets allow_reuse_address to
-# true, and has an improved marshaller that serializes unknown exceptions
-# with full traceback information.
+# true, and has an improved marshaller that logs and serializes exceptions.
 
 class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
     allow_reuse_address = True
@@ -80,10 +83,10 @@ class TCPXMLRPCServer(SocketServer.Threa
                                        allow_none=1)
         except xmlrpclib.Fault, fault:
             response = xmlrpclib.dumps(fault)
-        except:
+        except Exception, exn:
+            log.exception(exn)
             response = xmlrpclib.dumps(
-                xmlrpclib.Fault(1, traceback.format_exc())
-                )
+                xmlrpclib.Fault(xen.xend.XendClient.ERROR_INTERNAL, str(exn)))
 
         return response
 
@@ -102,10 +105,13 @@ class UnixXMLRPCServer(TCPXMLRPCServer):
     address_family = socket.AF_UNIX
 
     def __init__(self, addr, logRequests):
-        if self.allow_reuse_address:
-            try:
+        parent = os.path.dirname(addr)
+        if os.path.exists(parent):
+            os.chown(parent, os.geteuid(), os.getegid())
+            os.chmod(parent, stat.S_IRWXU)
+            if self.allow_reuse_address and os.path.exists(addr):
                 os.unlink(addr)
-            except OSError, exc:
-                pass
+        else:
+            os.makedirs(parent, stat.S_IRWXU)
         TCPXMLRPCServer.__init__(self, addr, UnixXMLRPCRequestHandler,
                                  logRequests)
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/python/xen/xend/XendClient.py
--- a/tools/python/xen/xend/XendClient.py       Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/python/xen/xend/XendClient.py       Thu Mar 30 21:48:08 2006 -0500
@@ -19,10 +19,10 @@
 
 from xen.util.xmlrpclib2 import ServerProxy
 
-XML_RPC_SOCKET = "/var/run/xend-xmlrpc.sock"
+XML_RPC_SOCKET = "/var/run/xend/xmlrpc.sock"
 
 ERROR_INTERNAL = 1
 ERROR_GENERIC = 2
 ERROR_INVALID_DOMAIN = 3
 
-server = ServerProxy('httpu:///var/run/xend-xmlrpc.sock')
+server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock')
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/python/xen/xend/XendDomain.py       Thu Mar 30 21:48:08 2006 -0500
@@ -34,7 +34,7 @@ import XendDomainInfo
 
 from xen.xend import XendRoot
 from xen.xend import XendCheckpoint
-from xen.xend.XendError import XendError
+from xen.xend.XendError import XendError, XendInvalidDomain
 from xen.xend.XendLogging import log
 from xen.xend.xenstore.xstransact import xstransact
 from xen.xend.xenstore.xswatch import xswatch
@@ -357,6 +357,8 @@ class XendDomain:
         """Unpause domain execution."""
         try:
             dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+            if not dominfo:
+                raise XendInvalidDomain(str(domid))
             log.info("Domain %s (%d) unpaused.", dominfo.getName(),
                      dominfo.getDomid())
             return dominfo.unpause()
@@ -368,6 +370,8 @@ class XendDomain:
         """Pause domain execution."""
         try:
             dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+            if not dominfo:
+                raise XendInvalidDomain(str(domid))
             log.info("Domain %s (%d) paused.", dominfo.getName(),
                      dominfo.getDomid())
             return dominfo.pause()
@@ -395,6 +399,8 @@ class XendDomain:
         """Start domain migration."""
 
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
 
         if dominfo.getDomid() == PRIV_DOMAIN:
             raise XendError("Cannot migrate privileged domain %i" % domid)
@@ -420,6 +426,8 @@ class XendDomain:
 
         try:
             dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+            if not dominfo:
+                raise XendInvalidDomain(str(domid))
 
             if dominfo.getDomid() == PRIV_DOMAIN:
                 raise XendError("Cannot save privileged domain %i" % domid)
@@ -440,9 +448,9 @@ class XendDomain:
         @param cpumap:  string repr of list of usable cpus
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
-        # convert cpumap string into a list of ints
-        cpumap = map(lambda x: int(x),
-                     cpumap.replace("[", "").replace("]", "").split(","))
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
+
         try:
             return xc.vcpu_setaffinity(dominfo.getDomid(), vcpu, cpumap)
         except Exception, ex:
@@ -453,6 +461,8 @@ class XendDomain:
         """Set BVT (Borrowed Virtual Time) scheduler parameters for a domain.
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
         try:
             return xc.bvtsched_domain_set(dom=dominfo.getDomid(),
                                           mcuadv=mcuadv,
@@ -466,6 +476,8 @@ class XendDomain:
         """Get BVT (Borrowed Virtual Time) scheduler parameters for a domain.
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
         try:
             return xc.bvtsched_domain_get(dominfo.getDomid())
         except Exception, ex:
@@ -477,6 +489,8 @@ class XendDomain:
         """Set Simple EDF scheduler parameters for a domain.
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
         try:
             return xc.sedf_domain_set(dominfo.getDomid(), period, slice_,
                                       latency, extratime, weight)
@@ -487,8 +501,9 @@ class XendDomain:
         """Get Simple EDF scheduler parameters for a domain.
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
-        try:
-            
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
+        try:
             sedf_info = xc.sedf_domain_get(dominfo.getDomid())
             # return sxpr
             return ['sedf',
@@ -509,6 +524,8 @@ class XendDomain:
         @return: 0 on success, -1 on error
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
         maxmem = int(mem) * 1024
         try:
             return xc.domain_setmaxmem(dominfo.getDomid(), maxmem)
@@ -523,6 +540,8 @@ class XendDomain:
         @return: 0 on success, -1 on error
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
         nr_ports = last - first + 1
         try:
             return xc.domain_ioport_permission(dominfo.getDomid(),
@@ -540,6 +559,8 @@ class XendDomain:
         @return: 0 on success, -1 on error
         """
         dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
         nr_ports = last - first + 1
         try:
             return xc.domain_ioport_permission(dominfo.getDomid(),
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/python/xen/xm/create.py     Thu Mar 30 21:48:08 2006 -0500
@@ -27,9 +27,11 @@ import commands
 import commands
 import time
 import re
+import xmlrpclib
 
 from xen.xend import sxp
 from xen.xend import PrettyPrint
+import xen.xend.XendClient
 from xen.xend.XendClient import server
 from xen.xend.XendBootloader import bootloader
 from xen.util import blkif
@@ -814,6 +816,14 @@ def make_domain(opts, config):
 
     try:
         dominfo = server.xend.domain.create(config)
+    except xmlrpclib.Fault, ex:
+        import signal
+        if vncpid:
+            os.kill(vncpid, signal.SIGKILL)
+        if ex.faultCode == xen.xend.XendClient.ERROR_INVALID_DOMAIN:
+            err("the domain '%s' does not exist." % ex.faultString)
+        else:
+            err("%s" % ex.faultString)
     except Exception, ex:
         import signal
         if vncpid:
@@ -824,6 +834,9 @@ def make_domain(opts, config):
 
     try:
         server.xend.domain.waitForDevices(dom)
+    except xmlrpclib.Fault, ex:
+        server.xend.domain.destroy(dom)
+        err("%s" % ex.faultString)
     except:
         server.xend.domain.destroy(dom)
         err("Device creation failed for domain %s" % dom)
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/python/xen/xm/main.py       Thu Mar 30 21:48:08 2006 -0500
@@ -291,18 +291,6 @@ def err(msg):
 def err(msg):
     print >>sys.stderr, "Error:", msg
 
-def handle_xend_error(cmd, args, ex):
-    non_option = filter(lambda x: x[0] != '-', args)
-    dom = len(non_option) > 0 and non_option[0] or None
-
-    error = str(ex)
-    if error == "Not found" and dom != None:
-        err("Domain '%s' not found when running 'xm %s'" % (dom, cmd))
-    else:
-        err(error)
-
-    sys.exit(1)
-    
 
 #########################################################################
 #
@@ -1106,9 +1094,10 @@ def main(argv=sys.argv):
             sys.exit(1)
         except xmlrpclib.Fault, ex:
             if ex.faultCode == xen.xend.XendClient.ERROR_INVALID_DOMAIN:
-                print "Error: the domain '%s' does not exist." % ex.faultString
+                print  >>sys.stderr, (
+                    "Error: the domain '%s' does not exist." % ex.faultString)
             else:
-                print "Error: %s" % ex.faultString
+                print  >>sys.stderr, "Error: %s" % ex.faultString
             sys.exit(1)
         except:
             print "Unexpected error:", sys.exc_info()[0]
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/xenstore/xenstored_core.c   Thu Mar 30 21:48:08 2006 -0500
@@ -469,6 +469,7 @@ static bool write_node(struct connection
 
        /* TDB should set errno, but doesn't even set ecode AFAICT. */
        if (tdb_store(tdb_context(conn), key, data, TDB_REPLACE) != 0) {
+               corrupt(conn, "Write of %s = %s failed", key, data);
                errno = ENOSPC;
                return false;
        }
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/xm-test/README
--- a/tools/xm-test/README      Thu Mar 30 18:40:26 2006 -0500
+++ b/tools/xm-test/README      Thu Mar 30 21:48:08 2006 -0500
@@ -140,9 +140,11 @@ and test lists as required. Default grou
    # ./runtest.sh -g <groupname> <logfile>
 
 * NOTE: There is a quick set of tests in group mode, that was added to
-run certain casenames and tests. It is not a substitute for the full
+run certain casenames and tests, and there is a "medium" group, which is a
+medium-length run (around 20 minutes).  Neither is a substitute for the full
 xm-test test suite.
    # ./runtest.sh -g quick <logfile>
+   # ./runtest.sh -g medium <logfile>
 
 
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/Rules.mk
--- a/xen/Rules.mk      Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/Rules.mk      Thu Mar 30 21:48:08 2006 -0500
@@ -57,10 +57,11 @@ CFLAGS-y               += -DMAX_PHYS_CPU
 CFLAGS-y               += -DMAX_PHYS_CPUS=$(max_phys_cpus)
 endif
 
-AFLAGS := -D__ASSEMBLY__
+AFLAGS-y               += -D__ASSEMBLY__
 
 ALL_OBJS := $(ALL_OBJS-y)
 CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y))
+AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y))
 
 %.o: %.c $(HDRS) Makefile
        $(CC) $(CFLAGS) -c $< -o $@
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/ia64/Makefile
--- a/xen/arch/ia64/Makefile    Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/ia64/Makefile    Thu Mar 30 21:48:08 2006 -0500
@@ -76,7 +76,7 @@ asm-xsi-offsets.s: asm-xsi-offsets.c
 
 # I'm sure a Makefile wizard would know a better way to do this
 xen.lds.s: xen/xen.lds.S
-       $(CC) -E $(CPPFLAGS) -P -DXEN -D__ASSEMBLY__ \
+       $(CC) -E $(CPPFLAGS) -P -DXEN $(AFLAGS) \
                -o xen.lds.s xen/xen.lds.S
 
 clean:: FORCE
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile     Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/x86/Makefile     Thu Mar 30 21:48:08 2006 -0500
@@ -72,7 +72,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-off
        $(CC) $(CFLAGS) -S -o $@ $<
 
 xen.lds: $(TARGET_SUBARCH)/xen.lds.S $(HDRS)
-       $(CC) $(CFLAGS) -P -E -Ui386 -D__ASSEMBLY__ -o $@ $<
+       $(CC) $(CFLAGS) -P -E -Ui386 $(AFLAGS) -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
        $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/x86/domain.c     Thu Mar 30 21:48:08 2006 -0500
@@ -393,7 +393,7 @@ int arch_set_info_guest(
     }
     else if ( test_bit(_VCPUF_initialised, &v->vcpu_flags) )
     {
-        hvm_modify_guest_state(v);
+        hvm_load_cpu_guest_regs(v, &v->arch.guest_context.user_regs);
     }
 
     if ( test_bit(_VCPUF_initialised, &v->vcpu_flags) )
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Mar 30 21:48:08 2006 -0500
@@ -382,11 +382,6 @@ static inline int long_mode_do_msr_write
     return 1;
 }
 
-void svm_modify_guest_state(struct vcpu *v)
-{
-    svm_modify_vmcb(v, &v->arch.guest_context.user_regs);
-}
-
 int svm_realmode(struct vcpu *v)
 {
     unsigned long cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
@@ -448,8 +443,6 @@ int start_svm(void)
 
     hvm_funcs.store_cpu_guest_regs = svm_store_cpu_guest_regs;
     hvm_funcs.load_cpu_guest_regs = svm_load_cpu_guest_regs;
-
-    hvm_funcs.modify_guest_state = svm_modify_guest_state;
 
     hvm_funcs.realmode = svm_realmode;
     hvm_funcs.paging_enabled = svm_paging_enabled;
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Thu Mar 30 21:48:08 2006 -0500
@@ -156,23 +156,6 @@ static int construct_vmcb_controls(struc
     vmcb->iopm_base_pa = (u64) virt_to_maddr(iopm);
     vmcb->msrpm_base_pa = (u64) virt_to_maddr(msrpm);
 
-    return 0;
-}
-
-
-/*
- * modify guest eflags and execption bitmap for gdb
- */
-int svm_modify_vmcb(struct vcpu *v, struct cpu_user_regs *regs)
-{
-    int error;
-    if ((error = load_vmcb(&v->arch.hvm_svm, v->arch.hvm_svm.host_save_pa))) 
-    {
-        printk("svm_modify_vmcb: load_vmcb failed: VMCB = %lx\n",
-                (unsigned long) v->arch.hvm_svm.host_save_pa);
-        return -EINVAL; 
-    }
-    svm_load_cpu_user_regs(v,regs);
     return 0;
 }
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Thu Mar 30 21:48:08 2006 -0500
@@ -487,32 +487,6 @@ void destroy_vmcs(struct arch_vmx_struct
     arch_vmx->io_bitmap_b = NULL;
 }
 
-/*
- * modify guest eflags and execption bitmap for gdb
- */
-int modify_vmcs(struct arch_vmx_struct *arch_vmx,
-                struct cpu_user_regs *regs)
-{
-    int error;
-    u64 vmcs_phys_ptr, old, old_phys_ptr;
-    vmcs_phys_ptr = (u64) virt_to_maddr(arch_vmx->vmcs);
-
-    old_phys_ptr = virt_to_maddr(&old);
-    __vmptrst(old_phys_ptr);
-    if ((error = load_vmcs(arch_vmx, vmcs_phys_ptr))) {
-        printk("modify_vmcs: load_vmcs failed: VMCS = %lx\n",
-               (unsigned long) vmcs_phys_ptr);
-        return -EINVAL;
-    }
-
-/* XXX VMX change modify_vmcs arg to v */
-    hvm_load_cpu_guest_regs(current, regs);
-
-    __vmptrld(old_phys_ptr);
-
-    return 0;
-}
-
 void vm_launch_fail(unsigned long eflags)
 {
     unsigned long error;
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Mar 30 21:48:08 2006 -0500
@@ -400,7 +400,7 @@ void vmx_migrate_timers(struct vcpu *v)
         migrate_timer(&(VLAPIC(v)->vlapic_timer), v->processor);
 }
 
-struct vmx_store_cpu_guest_regs_callback_info {
+struct vmx_cpu_guest_regs_callback_info {
     struct vcpu *v;
     struct cpu_user_regs *regs;
     unsigned long *crs;
@@ -409,10 +409,19 @@ static void vmx_store_cpu_guest_regs(
 static void vmx_store_cpu_guest_regs(
     struct vcpu *v, struct cpu_user_regs *regs, unsigned long *crs);
 
+static void vmx_load_cpu_guest_regs(
+    struct vcpu *v, struct cpu_user_regs *regs);
+
 static void vmx_store_cpu_guest_regs_callback(void *data)
 {
-    struct vmx_store_cpu_guest_regs_callback_info *info = data;
+    struct vmx_cpu_guest_regs_callback_info *info = data;
     vmx_store_cpu_guest_regs(info->v, info->regs, info->crs);
+}
+
+static void vmx_load_cpu_guest_regs_callback(void *data)
+{
+    struct vmx_cpu_guest_regs_callback_info *info = data;
+    vmx_load_cpu_guest_regs(info->v, info->regs);
 }
 
 static void vmx_store_cpu_guest_regs(
@@ -426,7 +435,7 @@ static void vmx_store_cpu_guest_regs(
         if ( v->arch.hvm_vmx.launch_cpu != smp_processor_id() )
         {
             /* Get register details from remote CPU. */
-            struct vmx_store_cpu_guest_regs_callback_info info = {
+            struct vmx_cpu_guest_regs_callback_info info = {
                 .v = v, .regs = regs, .crs = crs };
             cpumask_t cpumask = cpumask_of_cpu(v->arch.hvm_vmx.launch_cpu);
             on_selected_cpus(cpumask, vmx_store_cpu_guest_regs_callback,
@@ -479,8 +488,33 @@ static void vmx_store_cpu_guest_regs(
 
 void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs)
 {
+    if ( v != current )
+    {
+        /* Non-current VCPUs must be paused to set the register snapshot. */
+        ASSERT(atomic_read(&v->pausecnt) != 0);
+
+        if ( v->arch.hvm_vmx.launch_cpu != smp_processor_id() )
+        {
+            struct vmx_cpu_guest_regs_callback_info info = {
+                .v = v, .regs = regs };
+            cpumask_t cpumask = cpumask_of_cpu(v->arch.hvm_vmx.launch_cpu);
+            on_selected_cpus(cpumask, vmx_load_cpu_guest_regs_callback,
+                             &info, 1, 1);
+            return;
+        }
+
+        /* Register details are on this CPU. Load the correct VMCS. */
+        __vmptrld(virt_to_maddr(v->arch.hvm_vmx.vmcs));
+    }
+
+    ASSERT(v->arch.hvm_vmx.launch_cpu == smp_processor_id());
+
 #if defined (__x86_64__)
     __vmwrite(GUEST_SS_SELECTOR, regs->ss);
+    __vmwrite(GUEST_DS_SELECTOR, regs->ds);
+    __vmwrite(GUEST_ES_SELECTOR, regs->es);
+    __vmwrite(GUEST_GS_SELECTOR, regs->gs);
+    __vmwrite(GUEST_FS_SELECTOR, regs->fs);
     __vmwrite(GUEST_RSP, regs->rsp);
 
     __vmwrite(GUEST_RFLAGS, regs->rflags);
@@ -493,6 +527,11 @@ void vmx_load_cpu_guest_regs(struct vcpu
     __vmwrite(GUEST_RIP, regs->rip);
 #elif defined (__i386__)
     __vmwrite(GUEST_SS_SELECTOR, regs->ss);
+    __vmwrite(GUEST_DS_SELECTOR, regs->ds);
+    __vmwrite(GUEST_ES_SELECTOR, regs->es);
+    __vmwrite(GUEST_GS_SELECTOR, regs->gs);
+    __vmwrite(GUEST_FS_SELECTOR, regs->fs);
+
     __vmwrite(GUEST_RSP, regs->esp);
 
     __vmwrite(GUEST_RFLAGS, regs->eflags);
@@ -503,14 +542,11 @@ void vmx_load_cpu_guest_regs(struct vcpu
 
     __vmwrite(GUEST_CS_SELECTOR, regs->cs);
     __vmwrite(GUEST_RIP, regs->eip);
-#else
-#error Unsupported architecture
 #endif
-}
-
-void vmx_modify_guest_state(struct vcpu *v)
-{
-    modify_vmcs(&v->arch.hvm_vmx, &v->arch.guest_context.user_regs);
+
+    /* Reload current VCPU's VMCS if it was temporarily unloaded. */
+    if ( (v != current) && hvm_guest(current) )
+        __vmptrld(virt_to_maddr(current->arch.hvm_vmx.vmcs));
 }
 
 int vmx_realmode(struct vcpu *v)
@@ -660,8 +696,6 @@ int start_vmx(void)
 
     hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs;
     hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs;
-
-    hvm_funcs.modify_guest_state = vmx_modify_guest_state;
 
     hvm_funcs.realmode = vmx_realmode;
     hvm_funcs.paging_enabled = vmx_paging_enabled;
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/common/domain.c
--- a/xen/common/domain.c       Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/common/domain.c       Thu Mar 30 21:48:08 2006 -0500
@@ -19,6 +19,7 @@
 #include <xen/rangeset.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
+#include <xen/delay.h>
 #include <asm/debugger.h>
 #include <public/dom0_ops.h>
 #include <public/sched.h>
@@ -222,6 +223,13 @@ void domain_shutdown(struct domain *d, u
             printk("Domain 0 halted: halting machine.\n");
             machine_halt();
         }
+        else if ( reason == SHUTDOWN_crash )
+        {
+            printk("Domain 0 crashed: rebooting machine in 5 seconds.\n");
+            watchdog_disable();
+            mdelay(5000);
+            machine_restart(0);
+        }
         else
         {
             printk("Domain 0 shutdown: rebooting machine.\n");
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/include/asm-x86/config.h      Thu Mar 30 21:48:08 2006 -0500
@@ -212,13 +212,13 @@ extern unsigned long _end; /* standard E
  *                                                       ------ ------
  *  I/O remapping area                                   ( 4MB)
  *  Direct-map (1:1) area [Xen code/data/heap]           (12MB)
- *  Per-domain mappings (inc. 4MB map_domain_page cache) ( 4MB)
+ *  Per-domain mappings (inc. 4MB map_domain_page cache) ( 8MB)
  *  Shadow linear pagetable                              ( 4MB) ( 8MB)
  *  Guest linear pagetable                               ( 4MB) ( 8MB)
  *  Machine-to-physical translation table [writable]     ( 4MB) (16MB)
  *  Frame-info table                                     (24MB) (96MB)
  *   * Start of guest inaccessible area
- *  Machine-to-physical translation table [read-only]    ( 4MB)
+ *  Machine-to-physical translation table [read-only]    ( 4MB) (16MB)
  *   * Start of guest unmodifiable area
  */
 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/include/asm-x86/hvm/hvm.h     Thu Mar 30 21:48:08 2006 -0500
@@ -47,8 +47,6 @@ struct hvm_function_table {
         struct vcpu *v, struct cpu_user_regs *r, unsigned long *crs);
     void (*load_cpu_guest_regs)(
         struct vcpu *v, struct cpu_user_regs *r);
-    void (*modify_guest_state)(struct vcpu *v);
-
     /*
      * Examine specifics of the guest state:
      * 1) determine whether the guest is in real or vm8086 mode,
@@ -105,12 +103,6 @@ hvm_load_cpu_guest_regs(struct vcpu *v, 
     hvm_funcs.load_cpu_guest_regs(v, r);
 }
 
-static inline void
-hvm_modify_guest_state(struct vcpu *v)
-{
-    hvm_funcs.modify_guest_state(v);
-}
-
 static inline int
 hvm_realmode(struct vcpu *v)
 {
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/include/asm-x86/hvm/svm/svm.h Thu Mar 30 21:48:08 2006 -0500
@@ -39,7 +39,6 @@ extern void svm_stop(void);
 extern void svm_stop(void);
 extern void svm_save_cpu_user_regs(struct vcpu *v, struct cpu_user_regs *regs);
 extern void svm_load_cpu_user_regs(struct vcpu *v, struct cpu_user_regs *regs);
-extern int svm_modify_vmcb(struct vcpu *v, struct cpu_user_regs *regs);
 extern void svm_vmread(struct vcpu *v, int index, unsigned long *value);
 extern void svm_vmwrite(struct vcpu *v, int index, unsigned long value);
 extern void svm_final_setup_guest(struct vcpu *v); 
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h        Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h        Thu Mar 30 21:48:08 2006 -0500
@@ -89,8 +89,6 @@ struct arch_vmx_struct {
 
 void vmx_do_resume(struct vcpu *);
 struct vmcs_struct *alloc_vmcs(void);
-int modify_vmcs(struct arch_vmx_struct *arch_vmx,
-                struct cpu_user_regs *regs);
 void destroy_vmcs(struct arch_vmx_struct *arch_vmx);
 
 extern void vmx_request_clear_vmcs(struct vcpu *v);
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/include/asm-x86/shadow.h      Thu Mar 30 21:48:08 2006 -0500
@@ -135,6 +135,8 @@ extern int set_p2m_entry(
     struct domain_mmap_cache *l1cache);
 extern void remove_shadow(struct domain *d, unsigned long gpfn, u32 stype);
 
+extern void free_shadow_page(unsigned long smfn);
+
 extern void shadow_l1_normal_pt_update(struct domain *d,
                                        paddr_t pa, l1_pgentry_t l1e,
                                        struct domain_mmap_cache *cache);
@@ -660,54 +662,12 @@ static inline void shadow_sync_and_drop_
     if ( likely(!shadow_mode_refcounts(d)) )
         return;
 
-    shadow_lock(d);
-
     if ( page_out_of_sync(page) )
         __shadow_sync_mfn(d, page_to_mfn(page));
 
     shadow_remove_all_access(d, page_to_mfn(page));
-
-    shadow_unlock(d);
-}
-#endif
-
-static inline void guest_physmap_add_page(
-    struct domain *d, unsigned long gpfn, unsigned long mfn)
-{
-    struct domain_mmap_cache c1, c2;
-
-    if ( likely(!shadow_mode_translate(d)) )
-        return;
-
-    domain_mmap_cache_init(&c1);
-    domain_mmap_cache_init(&c2);
-    shadow_lock(d);
-    shadow_sync_and_drop_references(d, mfn_to_page(mfn));
-    set_p2m_entry(d, gpfn, mfn, &c1, &c2);
-    set_gpfn_from_mfn(mfn, gpfn);
-    shadow_unlock(d);
-    domain_mmap_cache_destroy(&c1);
-    domain_mmap_cache_destroy(&c2);
-}
-
-static inline void guest_physmap_remove_page(
-    struct domain *d, unsigned long gpfn, unsigned long mfn)
-{
-    struct domain_mmap_cache c1, c2;
-
-    if ( likely(!shadow_mode_translate(d)) )
-        return;
-
-    domain_mmap_cache_init(&c1);
-    domain_mmap_cache_init(&c2);
-    shadow_lock(d);
-    shadow_sync_and_drop_references(d, mfn_to_page(mfn));
-    set_p2m_entry(d, gpfn, -1, &c1, &c2);
-    set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
-    shadow_unlock(d);
-    domain_mmap_cache_destroy(&c1);
-    domain_mmap_cache_destroy(&c2);
-}
+}
+#endif
 
 /************************************************************************/
 
@@ -738,8 +698,6 @@ get_shadow_ref(unsigned long smfn)
 
     return 1;
 }
-
-extern void free_shadow_page(unsigned long smfn);
 
 /*
  * Drop a shadow reference to smfn.
@@ -1525,6 +1483,49 @@ static inline void set_shadow_status(
 
 /************************************************************************/
 
+static inline void guest_physmap_add_page(
+    struct domain *d, unsigned long gpfn, unsigned long mfn)
+{
+    struct domain_mmap_cache c1, c2;
+
+    if ( likely(!shadow_mode_translate(d)) )
+        return;
+
+    domain_mmap_cache_init(&c1);
+    domain_mmap_cache_init(&c2);
+    shadow_lock(d);
+    shadow_sync_and_drop_references(d, mfn_to_page(mfn));
+    set_p2m_entry(d, gpfn, mfn, &c1, &c2);
+    set_gpfn_from_mfn(mfn, gpfn);
+    shadow_unlock(d);
+    domain_mmap_cache_destroy(&c1);
+    domain_mmap_cache_destroy(&c2);
+}
+
+static inline void guest_physmap_remove_page(
+    struct domain *d, unsigned long gpfn, unsigned long mfn)
+{
+    struct domain_mmap_cache c1, c2;
+    unsigned long type;
+
+    if ( likely(!shadow_mode_translate(d)) )
+        return;
+
+    domain_mmap_cache_init(&c1);
+    domain_mmap_cache_init(&c2);
+    shadow_lock(d);
+    shadow_sync_and_drop_references(d, mfn_to_page(mfn));
+    while ( (type = shadow_max_pgtable_type(d, gpfn, NULL)) != PGT_none )
+        free_shadow_page(__shadow_status(d, gpfn, type));
+    set_p2m_entry(d, gpfn, -1, &c1, &c2);
+    set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
+    shadow_unlock(d);
+    domain_mmap_cache_destroy(&c1);
+    domain_mmap_cache_destroy(&c2);
+}
+
+/************************************************************************/
+
 void static inline
 shadow_update_min_max(unsigned long smfn, int index)
 {
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/public/xen.h
--- a/xen/include/public/xen.h  Thu Mar 30 18:40:26 2006 -0500
+++ b/xen/include/public/xen.h  Thu Mar 30 21:48:08 2006 -0500
@@ -39,7 +39,7 @@
 #define __HYPERVISOR_stack_switch          3
 #define __HYPERVISOR_set_callbacks         4
 #define __HYPERVISOR_fpu_taskswitch        5
-#define __HYPERVISOR_sched_op              6
+#define __HYPERVISOR_sched_op_compat       6 /* compat as of 0x00030101 */
 #define __HYPERVISOR_dom0_op               7
 #define __HYPERVISOR_set_debugreg          8
 #define __HYPERVISOR_get_debugreg          9
@@ -61,7 +61,7 @@
 #define __HYPERVISOR_mmuext_op            26
 #define __HYPERVISOR_acm_op               27
 #define __HYPERVISOR_nmi_op               28
-#define __HYPERVISOR_sched_op_new         29
+#define __HYPERVISOR_sched_op             29
 
 /* 
  * VIRTUAL INTERRUPTS
@@ -442,6 +442,8 @@ typedef uint8_t xen_domain_handle_t[16];
 
 #endif /* !__ASSEMBLY__ */
 
+#include "xen-compat.h"
+
 #endif /* __XEN_PUBLIC_XEN_H__ */
 
 /*
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a tools/xm-test/grouptest/medium
--- /dev/null   Thu Jan  1 00:00:00 1970 +0000
+++ b/tools/xm-test/grouptest/medium    Thu Mar 30 21:48:08 2006 -0500
@@ -0,0 +1,25 @@
+block-create 09_block_attach_and_dettach_device_check_data_pos.test
+block-list
+console
+destroy 01_destroy_basic_pos.test 02_destroy_noparm_neg.test 
03_destroy_nonexist_neg.test 04_destroy_badparm_neg.test 
05_destroy_byid_pos.test 06_destroy_dom0_neg.test
+dmesg
+domid
+domname
+enforce_dom0_cpus
+help
+info
+list
+memmax
+memset 01_memset_basic_pos.test 02_memset_badparm_neg.test 
04_memset_smallmem_pos.test
+migrate
+network-attach 03_network_attach_detach_multiple_pos.test
+reboot
+restore 02_restore_badparm_neg.test 03_restore_badfilename_neg.test 
04_restore_withdevices_pos.test
+save
+sedf
+shutdown
+sysrq 01_sysrq_basic_neg.test 02_sysrq_sync_pos.test
+unpause
+vcpu-disable
+vcpu-pin
+vtpm
diff -r 1bdd8ec03da55dd5d7a802a147d9e77d06d3a244 -r 
47dfa96d7e4dfd8fccd75d571b52c91c9e5aff2a xen/include/public/xen-compat.h
--- /dev/null   Thu Jan  1 00:00:00 1970 +0000
+++ b/xen/include/public/xen-compat.h   Thu Mar 30 21:48:08 2006 -0500
@@ -0,0 +1,21 @@
+/******************************************************************************
+ * xen-compat.h
+ * 
+ * Guest OS interface to Xen.  Compatibility layer.
+ * 
+ * Copyright (c) 2006, Christian Limpach
+ */
+
+#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
+#define __XEN_PUBLIC_XEN_COMPAT_H__
+
+#ifndef __XEN_INTERFACE_VERSION__
+#define __XEN_INTERFACE_VERSION__ 0x00000000
+#endif
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030101
+#undef __HYPERVISOR_sched_op
+#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
+#endif
+
+#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */



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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [pushed] [ppc] merge with xen-unstable.hg, jimix <=