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-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2007 05:30:35 -0700
Delivery-date: Fri, 23 Mar 2007 05:31:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Date 1173971063 21600
# Node ID 1584263f9fc50d16cfc5e060e996eb8025de3d31
# Parent  a230a1a167dc5e3a670cdaca0ca20c0ef91d244c
# Parent  809f36b1b68509a637b1fa75c596f1590dd9fbdf
merge with xen-unstable.hg
---
 xen/include/asm-x86/hvm/svm/vmmcall.h                      |   44 ---
 buildconfigs/conf.linux-native/00_xen_to_native            |    2 
 buildconfigs/linux-defconfig_xen0_ia64                     |    2 
 buildconfigs/linux-defconfig_xen0_x86_32                   |    2 
 buildconfigs/linux-defconfig_xen0_x86_64                   |    2 
 buildconfigs/linux-defconfig_xenU_ia64                     |    2 
 buildconfigs/linux-defconfig_xenU_x86_32                   |    2 
 buildconfigs/linux-defconfig_xenU_x86_64                   |    2 
 buildconfigs/linux-defconfig_xen_ia64                      |    2 
 buildconfigs/linux-defconfig_xen_x86_32                    |    2 
 buildconfigs/linux-defconfig_xen_x86_64                    |    2 
 docs/src/user.tex                                          |    5 
 docs/xen-api/todo.tex                                      |   11 
 docs/xen-api/xenapi-datamodel.tex                          |   67 -----
 linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c           |    2 
 linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c           |    4 
 linux-2.6-xen-sparse/drivers/xen/char/mem.c                |    6 
 linux-2.6-xen-sparse/drivers/xen/console/console.c         |    7 
 linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c     |   16 -
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c         |    2 
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pci.h   |    7 
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pci.h |    7 
 linux-2.6-xen-sparse/kernel/kexec.c                        |   23 +
 patches/linux-2.6.18/crash-kernel-32-on-64.patch           |    9 
 patches/linux-2.6.18/series                                |    1 
 tools/firmware/Makefile                                    |    6 
 tools/firmware/hvmloader/32bitbios_support.c               |   13 -
 tools/firmware/hvmloader/acpi/acpi2_0.h                    |   60 ++++
 tools/firmware/hvmloader/acpi/build.c                      |   48 ++-
 tools/firmware/hvmloader/hvmloader.c                       |   77 +++--
 tools/firmware/rombios/32bit/tcgbios/tcgbios.c             |   64 +---
 tools/firmware/rombios/32bitgateway.c                      |   29 --
 tools/firmware/rombios/rombios.c                           |    5 
 tools/firmware/rombios/tcgbios.c                           |    6 
 tools/ioemu/hw/usb-hid.c                                   |   47 +++
 tools/ioemu/hw/usb-ohci.c                                  |    2 
 tools/ioemu/hw/usb-uhci.c                                  |   50 +++
 tools/ioemu/hw/usb.c                                       |   40 +++
 tools/ioemu/hw/usb.h                                       |    6 
 tools/ioemu/vl.c                                           |   19 +
 tools/libxc/xc_dom_x86.c                                   |    4 
 tools/libxc/xc_hvm_build.c                                 |    8 
 tools/libxc/xc_linux_restore.c                             |    5 
 tools/libxen/include/xen_vm.h                              |   15 -
 tools/libxen/src/xen_vm.c                                  |   37 --
 tools/libxen/test/test_bindings.c                          |    1 
 tools/python/xen/util/xmlrpclib2.py                        |   12 
 tools/python/xen/xend/XendAPI.py                           |  128 +++++++--
 tools/python/xen/xend/XendCheckpoint.py                    |   23 +
 tools/python/xen/xend/XendConfig.py                        |   11 
 tools/python/xen/xend/XendDomainInfo.py                    |   19 -
 tools/python/xen/xend/XendNode.py                          |   53 +++-
 tools/python/xen/xend/XendVMMetrics.py                     |   70 +++++
 tools/python/xen/xend/image.py                             |    2 
 tools/python/xen/xend/server/SrvDaemon.py                  |    9 
 tools/python/xen/xend/server/vfbif.py                      |    2 
 tools/python/xen/xm/XenAPI.py                              |    2 
 tools/python/xen/xm/addlabel.py                            |    2 
 tools/python/xen/xm/main.py                                |  168 ++++++++++---
 tools/python/xen/xm/shutdown.py                            |   37 ++
 tools/xm-test/tests/destroy/01_destroy_basic_pos.py        |    2 
 tools/xm-test/tests/vtpm/09_vtpm-xapi.py                   |    2 
 tools/xm-test/tests/vtpm/vtpm_utils.py                     |    3 
 xen/arch/ia64/xen/domain.c                                 |    8 
 xen/arch/powerpc/domain.c                                  |    5 
 xen/arch/powerpc/domain_build.c                            |    1 
 xen/arch/x86/domain.c                                      |   35 +-
 xen/arch/x86/domain_build.c                                |    1 
 xen/arch/x86/domctl.c                                      |    2 
 xen/arch/x86/gdbstub.c                                     |   28 --
 xen/arch/x86/hvm/svm/svm.c                                 |   71 -----
 xen/arch/x86/hvm/vlapic.c                                  |    5 
 xen/arch/x86/mm.c                                          |  109 ++++----
 xen/arch/x86/mm/shadow/common.c                            |    6 
 xen/arch/x86/mm/shadow/multi.c                             |    2 
 xen/arch/x86/traps.c                                       |    7 
 xen/arch/x86/x86_64/compat_kexec.S                         |   13 -
 xen/arch/x86/x86_emulate.c                                 |   74 ++++-
 xen/common/domain.c                                        |    2 
 xen/common/domctl.c                                        |   20 -
 xen/common/grant_table.c                                   |    6 
 xen/drivers/char/console.c                                 |   11 
 xen/include/asm-ia64/grant_table.h                         |    3 
 xen/include/asm-powerpc/grant_table.h                      |   13 +
 xen/include/asm-x86/domain.h                               |    3 
 xen/include/asm-x86/grant_table.h                          |   10 
 xen/include/public/arch-x86/xen.h                          |    2 
 xen/include/public/foreign/structs.py                      |    2 
 88 files changed, 1103 insertions(+), 654 deletions(-)

diff -r a230a1a167dc -r 1584263f9fc5 
buildconfigs/conf.linux-native/00_xen_to_native
--- a/buildconfigs/conf.linux-native/00_xen_to_native   Thu Mar 15 09:00:42 
2007 -0600
+++ b/buildconfigs/conf.linux-native/00_xen_to_native   Thu Mar 15 09:04:23 
2007 -0600
@@ -74,8 +74,10 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_XEN_DISABLE_SERIAL is not set
 # CONFIG_XEN_SYSFS is not set
 # CONFIG_XEN_COMPAT_030002_AND_LATER is not set
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 # CONFIG_XEN_COMPAT_030002 is not set
+# CONFIG_XEN_COMPAT_030004 is not set
 # CONFIG_HAVE_ARCH_ALLOC_SKB is not set
 # CONFIG_HAVE_ARCH_DEV_ALLOC_SKB is not set
 # CONFIG_NO_IDLE_HZ is not set
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xen0_ia64
--- a/buildconfigs/linux-defconfig_xen0_ia64    Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xen0_ia64    Thu Mar 15 09:04:23 2007 -0600
@@ -1647,8 +1647,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_DEVMEM=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xen0_x86_32
--- a/buildconfigs/linux-defconfig_xen0_x86_32  Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xen0_x86_32  Thu Mar 15 09:04:23 2007 -0600
@@ -1411,8 +1411,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_UTIL=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xen0_x86_64
--- a/buildconfigs/linux-defconfig_xen0_x86_64  Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xen0_x86_64  Thu Mar 15 09:04:23 2007 -0600
@@ -1361,8 +1361,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_UTIL=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xenU_ia64
--- a/buildconfigs/linux-defconfig_xenU_ia64    Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xenU_ia64    Thu Mar 15 09:04:23 2007 -0600
@@ -1489,8 +1489,10 @@ CONFIG_XEN_KEYBOARD=y
 # CONFIG_XEN_DISABLE_SERIAL is not set
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_DEVMEM=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xenU_x86_32
--- a/buildconfigs/linux-defconfig_xenU_x86_32  Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xenU_x86_32  Thu Mar 15 09:04:23 2007 -0600
@@ -920,8 +920,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_UTIL=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xenU_x86_64
--- a/buildconfigs/linux-defconfig_xenU_x86_64  Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xenU_x86_64  Thu Mar 15 09:04:23 2007 -0600
@@ -1216,8 +1216,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_UTIL=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xen_ia64
--- a/buildconfigs/linux-defconfig_xen_ia64     Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xen_ia64     Thu Mar 15 09:04:23 2007 -0600
@@ -1648,8 +1648,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_DEVMEM=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xen_x86_32
--- a/buildconfigs/linux-defconfig_xen_x86_32   Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xen_x86_32   Thu Mar 15 09:04:23 2007 -0600
@@ -3271,8 +3271,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_UTIL=y
diff -r a230a1a167dc -r 1584263f9fc5 buildconfigs/linux-defconfig_xen_x86_64
--- a/buildconfigs/linux-defconfig_xen_x86_64   Thu Mar 15 09:00:42 2007 -0600
+++ b/buildconfigs/linux-defconfig_xen_x86_64   Thu Mar 15 09:04:23 2007 -0600
@@ -3101,8 +3101,10 @@ CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
+# CONFIG_XEN_COMPAT_030004_AND_LATER is not set
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_XEN_COMPAT_030004=y
 CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
 CONFIG_XEN_UTIL=y
diff -r a230a1a167dc -r 1584263f9fc5 docs/src/user.tex
--- a/docs/src/user.tex Thu Mar 15 09:00:42 2007 -0600
+++ b/docs/src/user.tex Thu Mar 15 09:04:23 2007 -0600
@@ -3179,6 +3179,11 @@ editing \path{grub.conf}.
   one of 80x25, 80x28, 80x30, 80x34, 80x43, 80x50, 80x60.
   \item[ keep ] Keep the VGA console even after domain 0 boots.
   \end{description}
+\item [ console\_to\_ring ] Place guest console output into the
+  hypervisor console ring buffer. This is disabled by default.
+  When enabled, both hypervisor output and guest console output
+  is available from the ring buffer. This can be useful for logging
+  and/or remote presentation of console data.
 \item [ sync\_console ] Force synchronous console output. This is
   useful if you system fails unexpectedly before it has sent all
   available output to the console. In most cases Xen will
diff -r a230a1a167dc -r 1584263f9fc5 docs/xen-api/todo.tex
--- a/docs/xen-api/todo.tex     Thu Mar 15 09:00:42 2007 -0600
+++ b/docs/xen-api/todo.tex     Thu Mar 15 09:04:23 2007 -0600
@@ -91,17 +91,10 @@ same subnet.
 
 \end{itemize}
 
-\item TPM
+\item ACM
 \begin{itemize}
 
-\item Would it not be better to have a class TPM and a member TPMs ((TPM ref)
-Set) containing an array of zero or one references to TPMs? I assume that
-an empty array would make it clear that no TPM is associated with the VM
-instead of encoding its existence into TPM/instance or TPM/backend
-somehow. The current members instance and backend could then be moved into
-the TPM class.
-
-\item Also a Xen system can be running an access control policy where each
+\item A Xen system can be running an access control policy where each
 VM's run-time access to resources is restricted by the label it has been given
 compared to those of the resources. Currently a VM's configuration file may
 contain a line like access\_control[policy='$<$name of the system's
diff -r a230a1a167dc -r 1584263f9fc5 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Thu Mar 15 09:00:42 2007 -0600
+++ b/docs/xen-api/xenapi-datamodel.tex Thu Mar 15 09:04:23 2007 -0600
@@ -1039,7 +1039,6 @@ Quals & Field & Type & Description \\
 $\mathit{RW}$ &  {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\
 $\mathit{RW}$ &  {\tt memory/dynamic\_min} & int & Dynamic minimum (bytes) \\
 $\mathit{RW}$ &  {\tt memory/static\_min} & int & Statically-set (i.e. 
absolute) mininum (bytes) \\
-$\mathit{RW}$ &  {\tt VCPUs/policy} & string & the name of the VCPU scheduling 
policy to be applied \\
 $\mathit{RW}$ &  {\tt VCPUs/params} & (string $\rightarrow$ string) Map & 
configuration parameters for the selected VCPU policy \\
 $\mathit{RW}$ &  {\tt VCPUs/max} & int & Max number of VCPUs \\
 $\mathit{RW}$ &  {\tt VCPUs/at\_startup} & int & Boot number of VCPUs \\
@@ -2163,72 +2162,6 @@ Set the memory/static\_min field of the 
 {\tt VM ref } & self & reference to the object \\ \hline 
 
 {\tt int } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_policy}
-
-{\bf Overview:} 
-Get the VCPUs/policy field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_VCPUs_policy (session_id s, VM ref 
self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_policy}
-
-{\bf Overview:} 
-Set the VCPUs/policy field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_VCPUs_policy (session_id s, VM ref self, string 
value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-{\tt string } & value & New value to set \\ \hline 
 
 \end{tabular}
 
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Thu Mar 15 09:00:42 
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c  Thu Mar 15 09:04:23 
2007 -0600
@@ -1010,7 +1010,7 @@ static void stop_hz_timer(void)
        singleshot.timeout_abs_ns = jiffies_to_st(j);
        singleshot.flags = 0;
        rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
-#ifdef XEN_COMPAT_030004
+#ifdef CONFIG_XEN_COMPAT_030004
        if (rc) {
                BUG_ON(rc != -ENOSYS);
                rc = HYPERVISOR_set_timer_op(singleshot.timeout_abs_ns);
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Thu Mar 15 09:00:42 
2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Thu Mar 15 09:04:23 
2007 -0600
@@ -299,7 +299,9 @@ static void tap_backend_changed(struct x
         * and disk info to xenstore
         */
        err = xenbus_gather(XBT_NIL, dev->nodename, "info", "%lu", &info, 
-                           NULL);      
+                           NULL);
+       if (XENBUS_EXIST_ERR(err))
+               return;
        if (err) {
                xenbus_dev_error(dev, err, "getting info");
                return;
diff -r a230a1a167dc -r 1584263f9fc5 linux-2.6-xen-sparse/drivers/xen/char/mem.c
--- a/linux-2.6-xen-sparse/drivers/xen/char/mem.c       Thu Mar 15 09:00:42 
2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/char/mem.c       Thu Mar 15 09:04:23 
2007 -0600
@@ -27,7 +27,7 @@
 #include <asm/hypervisor.h>
 
 #ifndef ARCH_HAS_VALID_PHYS_ADDR_RANGE
-static inline int valid_phys_addr_range(unsigned long addr, size_t *count)
+static inline int valid_phys_addr_range(unsigned long addr, size_t count)
 {
        return 1;
 }
@@ -44,7 +44,7 @@ static ssize_t read_mem(struct file * fi
        ssize_t read = 0, sz;
        void __iomem *v;
 
-       if (!valid_phys_addr_range(p, &count))
+       if (!valid_phys_addr_range(p, count))
                return -EFAULT;
 
        while (count > 0) {
@@ -95,7 +95,7 @@ static ssize_t write_mem(struct file * f
        ssize_t written = 0, sz;
        void __iomem *v;
 
-       if (!valid_phys_addr_range(p, &count))
+       if (!valid_phys_addr_range(p, count))
                return -EFAULT;
 
        while (count > 0) {
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Thu Mar 15 
09:00:42 2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Thu Mar 15 
09:04:23 2007 -0600
@@ -348,8 +348,11 @@ void xencons_rx(char *buf, unsigned len,
 #ifdef CONFIG_MAGIC_SYSRQ
                if (sysrq_enabled) {
                        if (buf[i] == '\x0f') { /* ^O */
-                               sysrq_requested = jiffies;
-                               continue; /* don't print the sysrq key */
+                               if (!sysrq_requested) {
+                                       sysrq_requested = jiffies;
+                                       continue; /* don't print sysrq key */
+                               }
+                               sysrq_requested = 0;
                        } else if (sysrq_requested) {
                                unsigned long sysrq_timeout =
                                        sysrq_requested + HZ*2;
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c    Thu Mar 15 
09:00:42 2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c    Thu Mar 15 
09:04:23 2007 -0600
@@ -84,7 +84,7 @@ static void post_suspend(int suspend_can
                        pfn_to_mfn(xen_start_info->console.domU.mfn);
        } else {
 #ifdef CONFIG_SMP
-               cpu_initialized_map = cpumask_of_cpu(0);
+               cpu_initialized_map = cpu_online_map;
 #endif
        }
 
@@ -180,20 +180,6 @@ static int take_machine_down(void *p_fas
        time_resume();
        local_irq_enable();
 
-       if (fast_suspend && !suspend_cancelled) {
-               /*
-                * In fast-suspend mode the APs may not be brought back online
-                * when we resume. In that case we do it here.
-                */
-               for_each_online_cpu(cpu) {
-                       if (cpu == 0)
-                               continue;
-                       cpu_set_initialized(cpu);
-                       err = HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL);
-                       BUG_ON(err);
-               }
-       }
-
        return suspend_cancelled;
 }
 
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Mar 15 
09:00:42 2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Mar 15 
09:04:23 2007 -0600
@@ -110,6 +110,7 @@ static unsigned int alloc_index = 0;
 
 static inline unsigned long alloc_mfn(void)
 {
+       BUG_ON(alloc_index == 0);
        return mfn_list[--alloc_index];
 }
 
@@ -552,6 +553,7 @@ static void net_rx_action(unsigned long 
                *(int *)skb->cb = nr_frags;
 
                if (!xen_feature(XENFEAT_auto_translated_physmap) &&
+                   !((netif_t *)netdev_priv(skb->dev))->copying_receiver &&
                    check_mfn(nr_frags + 1)) {
                        /* Memory squeeze? Back off for an arbitrary while. */
                        if ( net_ratelimit() )
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pci.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pci.h  Thu Mar 15 
09:00:42 2007 -0600
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pci.h  Thu Mar 15 
09:04:23 2007 -0600
@@ -143,11 +143,4 @@ static inline void pci_dma_burst_advice(
 /* generic pci stuff */
 #include <asm-generic/pci.h>
 
-/* On Xen we have to scan all functions since Xen hides bridges from
- * us.  If a bridge is at fn=0 and that slot has a multifunction
- * device, we won't find the additional devices without scanning all
- * functions. */
-#undef pcibios_scan_all_fns
-#define pcibios_scan_all_fns(a, b)     1
-
 #endif /* __i386_PCI_H */
diff -r a230a1a167dc -r 1584263f9fc5 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pci.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pci.h        Thu Mar 
15 09:00:42 2007 -0600
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pci.h        Thu Mar 
15 09:04:23 2007 -0600
@@ -163,11 +163,4 @@ static inline void pcibios_add_platform_
 #include <asm-generic/pci.h>
 #endif
 
-/* On Xen we have to scan all functions since Xen hides bridges from
- * us.  If a bridge is at fn=0 and that slot has a multifunction
- * device, we won't find the additional devices without scanning all
- * functions. */
-#undef pcibios_scan_all_fns
-#define pcibios_scan_all_fns(a, b)     1
-
 #endif /* __x8664_PCI_H */
diff -r a230a1a167dc -r 1584263f9fc5 linux-2.6-xen-sparse/kernel/kexec.c
--- a/linux-2.6-xen-sparse/kernel/kexec.c       Thu Mar 15 09:00:42 2007 -0600
+++ b/linux-2.6-xen-sparse/kernel/kexec.c       Thu Mar 15 09:04:23 2007 -0600
@@ -330,13 +330,27 @@ static int kimage_is_destination_range(s
        return 0;
 }
 
-static struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order)
+static struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order, 
unsigned long limit)
 {
        struct page *pages;
 
        pages = alloc_pages(gfp_mask, order);
        if (pages) {
                unsigned int count, i;
+#ifdef CONFIG_XEN
+               int address_bits;
+
+               if (limit == ~0UL)
+                       address_bits = BITS_PER_LONG;
+               else
+                       address_bits = long_log2(limit);
+
+               if (xen_create_contiguous_region((unsigned 
long)page_address(pages),
+                                                order, address_bits) < 0) {
+                       __free_pages(pages, order);
+                       return NULL;
+               }
+#endif
                pages->mapping = NULL;
                set_page_private(pages, order);
                count = 1 << order;
@@ -355,6 +369,9 @@ static void kimage_free_pages(struct pag
        count = 1 << order;
        for (i = 0; i < count; i++)
                ClearPageReserved(page + i);
+#ifdef CONFIG_XEN
+       xen_destroy_contiguous_region((unsigned long)page_address(page), order);
+#endif
        __free_pages(page, order);
 }
 
@@ -400,7 +417,7 @@ static struct page *kimage_alloc_normal_
        do {
                unsigned long pfn, epfn, addr, eaddr;
 
-               pages = kimage_alloc_pages(GFP_KERNEL, order);
+               pages = kimage_alloc_pages(GFP_KERNEL, order, 
KEXEC_CONTROL_MEMORY_LIMIT);
                if (!pages)
                        break;
                pfn   = kexec_page_to_pfn(pages);
@@ -709,7 +726,7 @@ static struct page *kimage_alloc_page(st
                kimage_entry_t *old;
 
                /* Allocate a page, if we run out of memory give up */
-               page = kimage_alloc_pages(gfp_mask, 0);
+               page = kimage_alloc_pages(gfp_mask, 0, 
KEXEC_SOURCE_MEMORY_LIMIT);
                if (!page)
                        return NULL;
                /* If the page cannot be used file it away */
diff -r a230a1a167dc -r 1584263f9fc5 
patches/linux-2.6.18/crash-kernel-32-on-64.patch
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/linux-2.6.18/crash-kernel-32-on-64.patch  Thu Mar 15 09:04:23 
2007 -0600
@@ -0,0 +1,11 @@
+--- pristine-linux-2.6.18/include/asm-i386/elf.h       2006-09-20 
04:42:06.000000000 +0100
++++ linux-2.6.18-xen/include/asm-i386/elf.h    2007-03-14 16:42:30.000000000 
+0000
+@@ -36,7 +36,7 @@
+  * This is used to ensure we don't load something for the wrong architecture.
+  */
+ #define elf_check_arch(x) \
+-      (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
++      (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486) || 
((x)->e_machine == EM_X86_64))
+ 
+ /*
+  * These are used to set parameters in the core dumps.
diff -r a230a1a167dc -r 1584263f9fc5 patches/linux-2.6.18/series
--- a/patches/linux-2.6.18/series       Thu Mar 15 09:00:42 2007 -0600
+++ b/patches/linux-2.6.18/series       Thu Mar 15 09:04:23 2007 -0600
@@ -19,3 +19,4 @@ fixaddr-top.patch
 fixaddr-top.patch
 git-c06cb8b1c4d25e5b4d7a2d7c2462619de1e0dbc4.patch
 softlockup-no-idle-hz.patch
+crash-kernel-32-on-64.patch
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/Makefile
--- a/tools/firmware/Makefile   Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/Makefile   Thu Mar 15 09:04:23 2007 -0600
@@ -14,10 +14,10 @@ SUBDIRS += hvmloader
 
 .PHONY: all
 all:
-       @set -e; if ! `which bcc 1>/dev/null 2>/dev/null`; then \
+       @set -e; if [ $$((`bcc -v 2>&1 | grep version | cut -d' ' -f 3 | awk 
-F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
        echo "***********************************************************"; \
-       echo "WARNING: Install dev86 package to build firmware!"; \
-       echo "         (http://www.cix.co.uk/~mayday)"; \
+       echo "Require dev86 package version >= 0.16.14 to build firmware!"; \
+       echo "(visit http://www.cix.co.uk/~mayday for more information)"; \
        echo "***********************************************************"; \
        else \
        for subdir in $(SUBDIRS); do \
diff -r a230a1a167dc -r 1584263f9fc5 
tools/firmware/hvmloader/32bitbios_support.c
--- a/tools/firmware/hvmloader/32bitbios_support.c      Thu Mar 15 09:00:42 
2007 -0600
+++ b/tools/firmware/hvmloader/32bitbios_support.c      Thu Mar 15 09:04:23 
2007 -0600
@@ -45,22 +45,21 @@ static int relocate_elf(unsigned char *e
         return -1;
     }
 
-    for (i = 0; i < ehdr->e_shnum; i++) {
-        if (!(shdr[i]).sh_flags & SHF_ALLOC) {
-            shdr[i].sh_addr = 0;
-            continue;
-        }
+    for (i = 0; i < ehdr->e_shnum; i++)
         shdr[i].sh_addr = (Elf32_Addr)&elfarray[shdr[i].sh_offset];
-    }
 
     for (i = 0; i < ehdr->e_shnum; i++) {
-        if (shdr[i].sh_type == SHT_REL && shdr[i].sh_addr != 0) {
+        if (shdr[i].sh_type == SHT_REL) {
             Elf32_Shdr *targetsec = (Elf32_Shdr *)&(shdr[shdr[i].sh_info]);
             Elf32_Shdr *symtabsec = (Elf32_Shdr *)&(shdr[shdr[i].sh_link]);
             Elf32_Sym  *syms      = (Elf32_Sym *)symtabsec->sh_addr;
             Elf32_Rel  *rels      = (Elf32_Rel *)shdr[i].sh_addr;
             unsigned char *code   = (unsigned char *)targetsec->sh_addr;
             int j;
+
+            /* must not have been stripped */
+            if (shdr[i].sh_size == 0)
+                return -6;
 
             for (j = 0; j < shdr[i].sh_size / sizeof(Elf32_Rel); j++) {
                 int idx           = ELF32_R_SYM(rels[j].r_info);
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h   Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h   Thu Mar 15 09:04:23 2007 -0600
@@ -49,8 +49,8 @@ struct acpi_header {
     uint32_t length;
     uint8_t  revision;
     uint8_t  checksum;
-    uint8_t  oem_id[6];
-    uint8_t  oem_table_id[8];
+    char     oem_id[6];
+    char     oem_table_id[8];
     uint32_t oem_revision;
     uint32_t creator_id;
     uint32_t creator_revision;
@@ -90,7 +90,7 @@ struct acpi_10_rsdp {
 struct acpi_10_rsdp {
     uint64_t signature;
     uint8_t  checksum;
-    uint8_t  oem_id[6];
+    char     oem_id[6];
     uint8_t  reserved;
     uint32_t rsdt_address;
 };
@@ -101,7 +101,7 @@ struct acpi_20_rsdp {
 struct acpi_20_rsdp {
     uint64_t signature;
     uint8_t  checksum;
-    uint8_t  oem_id[6];
+    char     oem_id[6];
     uint8_t  revision;
     uint32_t rsdt_address;
     uint32_t length;
@@ -143,9 +143,9 @@ struct acpi_20_tcpa {
 #define ACPI_2_0_TCPA_LAML_SIZE (64*1024)
 
 /*
- * Fixed ACPI Description Table Structure (FADT).
- */
-struct acpi_20_fadt {
+ * Fixed ACPI Description Table Structure (FADT) in ACPI 1.0.
+ */
+struct acpi_10_fadt {
     struct acpi_header header;
     uint32_t firmware_ctrl;
     uint32_t dsdt;
@@ -185,6 +185,51 @@ struct acpi_20_fadt {
     uint16_t iapc_boot_arch;
     uint8_t  reserved1;
     uint32_t flags;
+};
+
+/*
+ * Fixed ACPI Description Table Structure (FADT).
+ */
+struct acpi_20_fadt {
+    struct acpi_header header;
+    uint32_t firmware_ctrl;
+    uint32_t dsdt;
+    uint8_t  reserved0;
+    uint8_t  preferred_pm_profile;
+    uint16_t sci_int;
+    uint32_t smi_cmd;
+    uint8_t  acpi_enable;
+    uint8_t  acpi_disable;
+    uint8_t  s4bios_req;
+    uint8_t  pstate_cnt;
+    uint32_t pm1a_evt_blk;
+    uint32_t pm1b_evt_blk;
+    uint32_t pm1a_cnt_blk;
+    uint32_t pm1b_cnt_blk;
+    uint32_t pm2_cnt_blk;
+    uint32_t pm_tmr_blk;
+    uint32_t gpe0_blk;
+    uint32_t gpe1_blk;
+    uint8_t  pm1_evt_len;
+    uint8_t  pm1_cnt_len;
+    uint8_t  pm2_cnt_len;
+    uint8_t  pm_tmr_len;
+    uint8_t  gpe0_blk_len;
+    uint8_t  gpe1_blk_len;
+    uint8_t  gpe1_base;
+    uint8_t  cst_cnt;
+    uint16_t p_lvl2_lat;
+    uint16_t p_lvl3_lat;
+    uint16_t flush_size;
+    uint16_t flush_stride;
+    uint8_t  duty_offset;
+    uint8_t  duty_width;
+    uint8_t  day_alrm;
+    uint8_t  mon_alrm;
+    uint8_t  century;
+    uint16_t iapc_boot_arch;
+    uint8_t  reserved1;
+    uint32_t flags;
     struct acpi_20_generic_address reset_reg;
     uint8_t  reset_value;
     uint8_t  reserved2[3];
@@ -345,6 +390,7 @@ struct acpi_20_madt_intsrcovr {
 #define ACPI_2_0_XSDT_REVISION 0x01
 #define ACPI_2_0_TCPA_REVISION 0x02
 #define ACPI_2_0_HPET_REVISION 0x01
+#define ACPI_1_0_FADT_REVISION 0x01
 
 #pragma pack ()
 
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/hvmloader/acpi/build.c     Thu Mar 15 09:04:23 2007 -0600
@@ -22,7 +22,8 @@
 #include "../util.h"
 #include <xen/hvm/e820.h>
 
-#define align16(sz) (((sz) + 15) & ~15)
+#define align16(sz)        (((sz) + 15) & ~15)
+#define fixed_strcpy(d, s) strncpy((d), (s), sizeof(d))
 
 extern struct acpi_20_rsdp Rsdp;
 extern struct acpi_20_rsdt Rsdt;
@@ -57,8 +58,8 @@ int construct_madt(struct acpi_20_madt *
     memset(madt, 0, sizeof(*madt));
     madt->header.signature    = ACPI_2_0_MADT_SIGNATURE;
     madt->header.revision     = ACPI_2_0_MADT_REVISION;
-    strncpy(madt->header.oem_id, ACPI_OEM_ID, 6);
-    strncpy(madt->header.oem_table_id, ACPI_OEM_TABLE_ID, 8);
+    fixed_strcpy(madt->header.oem_id, ACPI_OEM_ID);
+    fixed_strcpy(madt->header.oem_table_id, ACPI_OEM_TABLE_ID);
     madt->header.oem_revision = ACPI_OEM_REVISION;
     madt->header.creator_id   = ACPI_CREATOR_ID;
     madt->header.creator_revision = ACPI_CREATOR_REVISION;
@@ -131,8 +132,8 @@ int construct_hpet(struct acpi_20_hpet *
     memset(hpet, 0, sizeof(*hpet));
     hpet->header.signature    = ACPI_2_0_HPET_SIGNATURE;
     hpet->header.revision     = ACPI_2_0_HPET_REVISION;
-    strncpy(hpet->header.oem_id, ACPI_OEM_ID, 6);
-    strncpy(hpet->header.oem_table_id, ACPI_OEM_TABLE_ID, 8);
+    fixed_strcpy(hpet->header.oem_id, ACPI_OEM_ID);
+    fixed_strcpy(hpet->header.oem_table_id, ACPI_OEM_TABLE_ID);
     hpet->header.oem_revision = ACPI_OEM_REVISION;
     hpet->header.creator_id   = ACPI_CREATOR_ID;
     hpet->header.creator_revision = ACPI_CREATOR_REVISION;
@@ -150,6 +151,7 @@ int construct_processor_objects(uint8_t 
 {
     static const char pdat[13] = { 0x5b, 0x83, 0x0b, 0x50, 0x52 };
     static const char hex[] = "0123456789ABCDEF";
+    static const char pr_scope[] = "\\_PR_";
     unsigned int i, length, nr_cpus = get_vcpu_nr();
     struct acpi_header *hdr;
     uint8_t *p = buf;
@@ -161,8 +163,8 @@ int construct_processor_objects(uint8_t 
     hdr = (struct acpi_header *)p;
     hdr->signature = ASCII32('S','S','D','T');
     hdr->revision  = 2;
-    strncpy(hdr->oem_id, ACPI_OEM_ID, 6);
-    strncpy(hdr->oem_table_id, ACPI_OEM_TABLE_ID, 8);
+    fixed_strcpy(hdr->oem_id, ACPI_OEM_ID);
+    fixed_strcpy(hdr->oem_table_id, ACPI_OEM_TABLE_ID);
     hdr->oem_revision = ACPI_OEM_REVISION;
     hdr->creator_id = ACPI_CREATOR_ID;
     hdr->creator_revision = ACPI_CREATOR_REVISION;
@@ -176,7 +178,7 @@ int construct_processor_objects(uint8_t 
     *p++ = 0x10;
 
     /* PkgLength (includes length bytes!). */
-    length = 1 + 5 + (nr_cpus * sizeof(pdat));
+    length = 1 + strlen(pr_scope) + (nr_cpus * sizeof(pdat));
     if ( length <= 0x3f )
     {
         *p++ = length;
@@ -195,8 +197,8 @@ int construct_processor_objects(uint8_t 
     }
 
     /* NameString */
-    strncpy(p, "\\_PR_", 5);
-    p += 5;
+    strncpy(p, pr_scope, strlen(pr_scope));
+    p += strlen(pr_scope);
 
     /*
      * 3. Processor Objects.
@@ -263,8 +265,8 @@ int construct_secondary_tables(uint8_t *
         tcpa->header.signature = ACPI_2_0_TCPA_SIGNATURE;
         tcpa->header.length    = sizeof(*tcpa);
         tcpa->header.revision  = ACPI_2_0_TCPA_REVISION;
-        strncpy(tcpa->header.oem_id, ACPI_OEM_ID, 6);
-        strncpy(tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID, 8);
+        fixed_strcpy(tcpa->header.oem_id, ACPI_OEM_ID);
+        fixed_strcpy(tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID);
         tcpa->header.oem_revision = ACPI_OEM_REVISION;
         tcpa->header.creator_id   = ACPI_CREATOR_ID;
         tcpa->header.creator_revision = ACPI_CREATOR_REVISION;
@@ -291,6 +293,7 @@ int acpi_build_tables(uint8_t *buf)
     struct acpi_20_rsdt *rsdt;
     struct acpi_20_xsdt *xsdt;
     struct acpi_20_fadt *fadt;
+    struct acpi_10_fadt *fadt_10;
     struct acpi_20_facs *facs;
     unsigned char       *dsdt;
     unsigned long        secondary_tables[16];
@@ -303,6 +306,25 @@ int acpi_build_tables(uint8_t *buf)
     dsdt = (unsigned char *)&buf[offset];
     memcpy(dsdt, &AmlCode, DsdtLen);
     offset += align16(DsdtLen);
+
+    /*
+     * N.B. ACPI 1.0 operating systems may not handle FADT with revision 2
+     * or above properly, notably Windows 2000, which tries to copy FADT
+     * into a 116 bytes buffer thus causing an overflow. The solution is to
+     * link the higher revision FADT with the XSDT only and introduce a
+     * compatible revision 1 FADT that is linked with the RSDT. Refer to:
+     *     http://www.acpi.info/presentations/S01USMOBS169_OS%20new.ppt
+     */
+    fadt_10 = (struct acpi_10_fadt *)&buf[offset];
+    memcpy(fadt_10, &Fadt, sizeof(struct acpi_10_fadt));
+    offset += align16(sizeof(struct acpi_10_fadt));
+    fadt_10->header.length = sizeof(struct acpi_10_fadt);
+    fadt_10->header.revision = ACPI_1_0_FADT_REVISION;
+    fadt_10->dsdt          = (unsigned long)dsdt;
+    fadt_10->firmware_ctrl = (unsigned long)facs;
+    set_checksum(fadt_10,
+                 offsetof(struct acpi_header, checksum),
+                 sizeof(struct acpi_10_fadt));
 
     fadt = (struct acpi_20_fadt *)&buf[offset];
     memcpy(fadt, &Fadt, sizeof(struct acpi_20_fadt));
@@ -330,7 +352,7 @@ int acpi_build_tables(uint8_t *buf)
 
     rsdt = (struct acpi_20_rsdt *)&buf[offset];
     memcpy(rsdt, &Rsdt, sizeof(struct acpi_header));
-    rsdt->entry[0] = (unsigned long)fadt;
+    rsdt->entry[0] = (unsigned long)fadt_10;
     for ( i = 0; secondary_tables[i]; i++ )
         rsdt->entry[i+1] = secondary_tables[i];
     rsdt->header.length = sizeof(struct acpi_header) + (i+1)*sizeof(uint32_t);
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/hvmloader/hvmloader.c      Thu Mar 15 09:04:23 2007 -0600
@@ -38,23 +38,53 @@
 #define VMXASSIST_PHYSICAL_ADDRESS    0x000D0000
 #define ROMBIOS_PHYSICAL_ADDRESS      0x000F0000
 
-/* invoke SVM's paged realmode support */
-#define SVM_VMMCALL_RESET_TO_REALMODE 0x80000001
-
-/*
- * C runtime start off
- */
 asm(
     "    .text                       \n"
     "    .globl _start               \n"
     "_start:                         \n"
+    /* C runtime kickoff. */
     "    cld                         \n"
     "    cli                         \n"
+    "    movl $stack_top,%esp        \n"
+    "    movl %esp,%ebp              \n"
+    "    call main                   \n"
+    /* Relocate real-mode trampoline to 0x0. */
+    "    mov  $trampoline_start,%esi \n"
+    "    xor  %edi,%edi              \n"
+    "    mov  $trampoline_end,%ecx   \n"
+    "    sub  %esi,%ecx              \n"
+    "    rep  movsb                  \n"
+    /* Load real-mode compatible segment state (base 0x0000, limit 0xffff). */
     "    lgdt gdt_desr               \n"
-    "    movl $stack_top, %esp       \n"
-    "    movl %esp, %ebp             \n"
-    "    call main                   \n"
-    "    ud2                         \n"
+    "    mov  $0x0010,%ax            \n"
+    "    mov  %ax,%ds                \n"
+    "    mov  %ax,%es                \n"
+    "    mov  %ax,%fs                \n"
+    "    mov  %ax,%gs                \n"
+    "    mov  %ax,%ss                \n"
+    /* Initialise all 32-bit GPRs to zero. */
+    "    xor  %eax,%eax              \n"
+    "    xor  %ebx,%ebx              \n"
+    "    xor  %ecx,%ecx              \n"
+    "    xor  %edx,%edx              \n"
+    "    xor  %esp,%esp              \n"
+    "    xor  %ebp,%ebp              \n"
+    "    xor  %esi,%esi              \n"
+    "    xor  %edi,%edi              \n"
+    /* Enter real mode, reload all segment registers and IDT. */
+    "    ljmp $0x8,$0x0              \n"
+    "trampoline_start: .code16       \n"
+    "    mov  %eax,%cr0              \n"
+    "    ljmp $0,$1f-trampoline_start\n"
+    "1:  mov  %ax,%ds                \n"
+    "    mov  %ax,%es                \n"
+    "    mov  %ax,%fs                \n"
+    "    mov  %ax,%gs                \n"
+    "    mov  %ax,%ss                \n"
+    "    lidt 1f-trampoline_start    \n"
+    "    ljmp $0xf000,$0xfff0        \n"
+    "1:  .word 0x3ff,0,0             \n"
+    "trampoline_end:   .code32       \n"
     "                                \n"
     "gdt_desr:                       \n"
     "    .word gdt_end - gdt - 1     \n"
@@ -63,8 +93,8 @@ asm(
     "    .align 8                    \n"
     "gdt:                            \n"
     "    .quad 0x0000000000000000    \n"
-    "    .quad 0x00CF92000000FFFF    \n"
-    "    .quad 0x00CF9A000000FFFF    \n"
+    "    .quad 0x00009a000000ffff    \n" /* Ring 0 code, base 0 limit 0xffff */
+    "    .quad 0x000092000000ffff    \n" /* Ring 0 data, base 0 limit 0xffff */
     "gdt_end:                        \n"
     "                                \n"
     "    .bss                        \n"
@@ -81,19 +111,6 @@ cirrus_check(void)
 {
     outw(0x3C4, 0x9206);
     return inb(0x3C5) == 0x12;
-}
-
-static int
-vmmcall(int function, int edi, int esi, int edx, int ecx, int ebx)
-{
-    int eax;
-
-    __asm__ __volatile__ (
-        ".byte 0x0F,0x01,0xD9"
-        : "=a" (eax)
-        : "a"(function),
-        "b"(ebx), "c"(ecx), "d"(edx), "D"(edi), "S"(esi) );
-    return eax;
 }
 
 static int
@@ -349,13 +366,7 @@ int main(void)
         ASSERT((ACPI_PHYSICAL_ADDRESS + acpi_sz) <= 0xF0000);
     }
 
-    if ( check_amd() )
-    {
-        /* AMD implies this is SVM */
-        printf("SVM go ...\n");
-        vmmcall(SVM_VMMCALL_RESET_TO_REALMODE, 0, 0, 0, 0, 0);
-    }
-    else
+    if ( !check_amd() )
     {
         printf("Loading VMXAssist ...\n");
         memcpy((void *)VMXASSIST_PHYSICAL_ADDRESS,
@@ -368,7 +379,7 @@ int main(void)
             );
     }
 
-    printf("Failed to invoke ROMBIOS\n");
+    printf("Invoking ROMBIOS ...\n");
     return 0;
 }
 
diff -r a230a1a167dc -r 1584263f9fc5 
tools/firmware/rombios/32bit/tcgbios/tcgbios.c
--- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c    Thu Mar 15 09:00:42 
2007 -0600
+++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c    Thu Mar 15 09:04:23 
2007 -0600
@@ -95,13 +95,15 @@ struct ptti_cust *TCG_CommandList[] = {
 };
 
 /* local function prototypes */
-static void sha1(const unsigned char *data, uint32_t length, unsigned char 
*hash);
+static void sha1(const unsigned char *data, uint32_t length,
+                 unsigned char *hash);
 static uint32_t TCG_ShutdownPreBootInterface(uint32_t ebx);
 static uint32_t HashAll32(struct hai *hai, unsigned char *hash,
                           uint32_t magic, uint32_t ecx, uint32_t edx);
 static uint32_t HashLogExtendEvent32(struct hleei_short *hleei_s,
                                      struct hleeo *hleeo,
-                                     uint32_t magic, uint32_t ecx, uint32_t 
edx);
+                                     uint32_t magic, uint32_t ecx,
+                                     uint32_t edx);
 static uint32_t HashLogEvent32(struct hlei *hlei, struct hleo *hleo,
                                uint32_t ebx, uint32_t ecx, uint32_t edx);
 static uint32_t PassThroughToTPM32(struct pttti *pttti, struct pttto *pttto,
@@ -181,8 +183,7 @@ uint32_t MA_InitTPM(uint16_t startupcode
 }
 
 static
-uint32_t MA_Transmit(unsigned char *cmdbuffer,
-                     unsigned char *respbuffer,
+uint32_t MA_Transmit(unsigned char *cmdbuffer, unsigned char *respbuffer,
                      uint32_t respbufferlen)
 {
        uint32_t rc = 0;
@@ -289,15 +290,14 @@ void tcpa_acpi_init(void)
                uint32_t ctr = 0;
                /* get RSDT from RSDP */
                rsdt   = (struct acpi_20_rsdt *)rsdp->rsdt_address;
-               /* rsdt may be anywhere in 32bit space */
                length = rsdt->header.length;
                off = 36;
                while ((off + 3) < length) {
                        /* try all pointers to structures */
                        tcpa = (struct acpi_20_tcpa *)rsdt->entry[ctr];
                        /* valid TCPA ACPI table ? */
-                       if (ACPI_2_0_TCPA_SIGNATURE == tcpa->header.signature &&
-                           acpi_validate_entry(&tcpa->header) == 0) {
+                       if (ACPI_2_0_TCPA_SIGNATURE == tcpa->header.signature
+                           && acpi_validate_entry(&tcpa->header) == 0) {
                                found = 1;
                                break;
                        }
@@ -311,7 +311,6 @@ void tcpa_acpi_init(void)
                tcpa = 0;
        }
 
-       /* initialize the TCPA part of the EBDA with our data */
        tcpa_acpi.tcpa_ptr = tcpa;
        tcpa_acpi.lasa_last_ptr = 0;
        tcpa_acpi.entry_count = 0;
@@ -748,9 +747,7 @@ void tcpa_measure_post(Bit32u from, Bit3
 }
 
 static
-uint32_t SendCommand32(uint32_t idx,
-                     struct pttto *pttto,
-                     uint32_t size_ptto)
+uint32_t SendCommand32(uint32_t idx, struct pttto *pttto, uint32_t size_ptto)
 {
        uint32_t rc = 0;
        struct pttti *pttti = (struct pttti *)TCG_CommandList[idx];
@@ -796,7 +793,8 @@ uint32_t tcpa_initialize_tpm(uint32_t ph
        uint32_t pttto_size = sizeof(_pttto);
 
        if (rc == 0) {
-               rc = SendCommand32(IDX_CMD_TPM_Startup_0x01, pttto, pttto_size);
+               rc = SendCommand32(IDX_CMD_TPM_Startup_0x01, pttto,
+                                  pttto_size);
        }
 
        if (rc == 0 && physpres != 0) {
@@ -884,11 +882,8 @@ uint32_t _TCG_TPM_Extend(unsigned char *
 
 
 static
-uint32_t HashLogExtendEvent32(struct hleei_short *hleei_s,
-                            struct hleeo *hleeo,
-                            uint32_t magic,
-                            uint32_t ecx,
-                            uint32_t edx)
+uint32_t HashLogExtendEvent32(struct hleei_short *hleei_s, struct hleeo *hleeo,
+                              uint32_t magic, uint32_t ecx, uint32_t edx)
 {
        uint32_t rc = 0;
        uint16_t size;
@@ -978,11 +973,8 @@ uint32_t HashLogExtendEvent32(struct hle
 
 
 static
-uint32_t PassThroughToTPM32(struct pttti *pttti,
-                          struct pttto *pttto,
-                          uint32_t magic,
-                          uint32_t ecx,
-                          uint32_t edx)
+uint32_t PassThroughToTPM32(struct pttti *pttti, struct pttto *pttto,
+                            uint32_t magic, uint32_t ecx, uint32_t edx)
 {
        uint32_t rc = 0;
        uint8_t *cmd32;
@@ -1047,9 +1039,7 @@ uint32_t TCG_ShutdownPreBootInterface(ui
 
 static
 uint32_t HashLogEvent32(struct hlei *hlei, struct hleo *hleo,
-                      uint32_t ebx,
-                      uint32_t ecx,
-                      uint32_t edx)
+                        uint32_t ebx, uint32_t ecx, uint32_t edx)
 {
        uint32_t rc = 0;
        uint16_t size;
@@ -1144,9 +1134,7 @@ uint32_t HashLogEvent32(struct hlei *hle
 
 static
 uint32_t HashAll32(struct hai *hai, unsigned char *hash,
-                 uint32_t magic,
-                 uint32_t ecx,
-                 uint32_t edx)
+                   uint32_t magic, uint32_t ecx, uint32_t edx)
 {
        uint32_t rc = 0;
 
@@ -1187,9 +1175,7 @@ uint32_t HashAll32(struct hai *hai, unsi
 
 static
 uint32_t TSS32(struct ti *ti, struct to *to,
-             uint32_t ebx,
-             uint32_t ecx,
-             uint32_t edx)
+               uint32_t ebx, uint32_t ecx, uint32_t edx)
 {
        uint32_t rc = 0;
        if (TCG_IsShutdownPreBootInterface() == 0) {
@@ -1209,11 +1195,11 @@ uint32_t TSS32(struct ti *ti, struct to 
 
 static
 uint32_t CompactHashLogExtendEvent32(unsigned char *buffer,
-                                   uint32_t info,
-                                   uint32_t magic,
-                                   uint32_t length,
-                                   uint32_t pcrindex,
-                                   uint32_t *edx_ptr)
+                                     uint32_t info,
+                                     uint32_t magic,
+                                     uint32_t length,
+                                     uint32_t pcrindex,
+                                     uint32_t *edx_ptr)
 {
        uint32_t rc = 0;
        struct hleeo hleeo;
@@ -1356,9 +1342,7 @@ void sha1_do(sha1_ctx *ctx, const unsign
 
        /* treat data in 64-byte chunks */
        for (offset = 0; length - offset >= 64; offset += 64) {
-               /* copy into the 'w' array */
                memcpy(w, data32 + offset, 64);
-               /* hash the block in the 'w' array */
                sha1_block((uint32_t *)w, ctx);
                bits += (64 * 8);
        }
@@ -1408,7 +1392,8 @@ void sha1(const unsigned char *data, uin
 }
 
 
-uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds, uint32_t 
flags_ptr)
+uint32_t TCGInterruptHandler(pushad_regs_t *regs, uint32_t esds,
+                             uint32_t flags_ptr)
 {
        uint16_t DS = esds >> 16;
        uint16_t ES = esds & 0xffff;
@@ -1435,7 +1420,6 @@ uint32_t TCGInterruptHandler(pushad_regs
                        }
                }
                break;
-
        case 0x01:
                regs->u.r32.eax =
                        HashLogExtendEvent32((struct hleei_short*)
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/rombios/32bitgateway.c
--- a/tools/firmware/rombios/32bitgateway.c     Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/rombios/32bitgateway.c     Thu Mar 15 09:04:23 2007 -0600
@@ -153,26 +153,17 @@ realmode_gdtdesc:                         ;to be used in 
real
 
 switch_to_realmode:
     ; Implementation of switching from protected mode to real mode
-    ; restores all registers and prepares cs, es, ds, ss to be used
-    ; in real mode
+    ; prepares cs, es, ds, ss to be used in real mode
+    ; spills   eax
     START_PM_CODE
 
     ; need to fix up the stack to return in 16 bit mode
     ; currently the 32 bit return address is on the stack
-    push bp                                    ;pop@A1
-    mov bp, sp
-    push eax                                   ;pop@X
-
-    mov eax, [bp]                              ; return address low 16bits
-                                               ; and 'bp' are being moved
-    mov 2[bp], eax
-
-    pop eax                                    ;@X
-    add sp, #2                                 ; adjust stack for 'lost' bytes
-
-    push eax                                   ;pop@1
-    push bx                                    ;pop@2
-    push si                                    ;pop@3
+    pop eax
+    push ax
+
+    push bx                                    ;pop@1
+    push si                                    ;pop@2
 
     call _ebda_ss_offset32                     ; get the offset of the ss
     mov bx, ax                                 ; entry within the ebda.
@@ -229,10 +220,8 @@ switch_to_realmode_goon_2:
 
     sti                                                ; allow interrupts
 
-    pop si                                     ;@3
-    pop bx                                     ;@2
-    pop eax                                    ;@1
-    pop bp                                     ;@A1
+    pop si                                     ;@2
+    pop bx                                     ;@1
 
     ret
 
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/rombios/rombios.c  Thu Mar 15 09:04:23 2007 -0600
@@ -7792,10 +7792,11 @@ ASM_END
 
     bootdrv = (Bit8u)(status>>8);
     bootseg = read_word(ebda_seg,&EbdaData->cdemu.load_segment);
-    /* Canonicalize bootseg:bootip */
 #if BX_TCGBIOS
     tcpa_add_bootdevice((Bit32u)1L, (Bit32u)0L);
 #endif
+
+    /* Canonicalize bootseg:bootip */
     bootip = (bootseg & 0x0fff) << 4;
     bootseg &= 0xf000;
     break;
@@ -7812,8 +7813,6 @@ ASM_END
 #if BX_TCGBIOS
   tcpa_ipl((Bit32u)bootseg);               /* specs: 8.2.3 steps 4 and 5 */
 #endif
-  /* Debugging info */
-  printf("Booting from %x:%x\n", bootseg, bootip);
   
   /* Jump to the boot vector */
 ASM_START
diff -r a230a1a167dc -r 1584263f9fc5 tools/firmware/rombios/tcgbios.c
--- a/tools/firmware/rombios/tcgbios.c  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/firmware/rombios/tcgbios.c  Thu Mar 15 09:04:23 2007 -0600
@@ -227,6 +227,8 @@ int1a_function32(regs, ES, DS, FLAGS)
   Bit16u ES, DS, FLAGS;
 {
        Bit16u rc;
+
+       BX_DEBUG_INT1A("int1a_32: AX=%04x\n", regs.u.r16.ax);
 
        switch (regs.u.r8.ah) {
        case 0xbb:
@@ -256,8 +258,10 @@ int1a_function32(regs, ES, DS, FLAGS)
                default:
                        SET_CF();
                }
+               break;
        default:
                SET_CF();
                break;
        }
-}
+       BX_DEBUG_INT1A("int1a_32: FLAGS=%04x\n", FLAGS);
+}
diff -r a230a1a167dc -r 1584263f9fc5 tools/ioemu/hw/usb-hid.c
--- a/tools/ioemu/hw/usb-hid.c  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/ioemu/hw/usb-hid.c  Thu Mar 15 09:04:23 2007 -0600
@@ -517,6 +517,49 @@ static void usb_mouse_handle_destroy(USB
     qemu_free(s);
 }
 
+void usb_mouse_save(QEMUFile *f, void *opaque)
+{
+    USBMouseState *s = (USBMouseState*)opaque;
+
+    qemu_put_be32s(f, &s->dx);
+    qemu_put_be32s(f, &s->dy);
+    qemu_put_be32s(f, &s->dz);
+    qemu_put_be32s(f, &s->buttons_state);
+    qemu_put_be32s(f, &s->x);
+    qemu_put_be32s(f, &s->y);
+    qemu_put_be32s(f, &s->kind);
+    qemu_put_be32s(f, &s->mouse_grabbed);
+    qemu_put_be32s(f, &s->status_changed);
+
+}
+
+int usb_mouse_load(QEMUFile *f, void *opaque, int version_id)
+{
+    USBMouseState *s = (USBMouseState*)opaque;
+
+    if (version_id != 1)
+        return -EINVAL;
+
+    qemu_get_be32s(f, &s->dx);
+    qemu_get_be32s(f, &s->dy);
+    qemu_get_be32s(f, &s->dz);
+    qemu_get_be32s(f, &s->buttons_state);
+    qemu_get_be32s(f, &s->x);
+    qemu_get_be32s(f, &s->y);
+    qemu_get_be32s(f, &s->kind);
+    qemu_get_be32s(f, &s->mouse_grabbed);
+    qemu_get_be32s(f, &s->status_changed);
+
+    if ( s->kind == USB_TABLET) {
+        fprintf(logfile, "usb_mouse_load:add usb_tablet_event.\n");
+        qemu_add_mouse_event_handler(usb_tablet_event, s, 1);
+    } else if ( s->kind == USB_MOUSE) {
+        fprintf(logfile, "usb_mouse_load:add usb_mouse_event.\n");
+        qemu_add_mouse_event_handler(usb_mouse_event, s, 0);
+    }
+}
+
+
 USBDevice *usb_tablet_init(void)
 {
     USBMouseState *s;
@@ -536,6 +579,8 @@ USBDevice *usb_tablet_init(void)
 
     pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Tablet");
 
+    register_savevm("USB tablet dev", 0, 1, usb_mouse_save, usb_mouse_load, s);
+
     return (USBDevice *)s;
 }
 
@@ -558,5 +603,7 @@ USBDevice *usb_mouse_init(void)
 
     pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Mouse");
 
+    register_savevm("USB mouse dev", 0, 1, usb_mouse_save, usb_mouse_load, s);
+
     return (USBDevice *)s;
 }
diff -r a230a1a167dc -r 1584263f9fc5 tools/ioemu/hw/usb-ohci.c
--- a/tools/ioemu/hw/usb-ohci.c Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/ioemu/hw/usb-ohci.c Thu Mar 15 09:04:23 2007 -0600
@@ -1186,5 +1186,7 @@ void usb_ohci_init(struct PCIBus *bus, i
         qemu_register_usb_port(&ohci->rhport[i].port, ohci, i, ohci_attach);
     }
 
+    register_savevm("OHCI USB", 0, 1, generic_pci_save, generic_pci_load, 
ohci);
+
     ohci_reset(ohci);
 }
diff -r a230a1a167dc -r 1584263f9fc5 tools/ioemu/hw/usb-uhci.c
--- a/tools/ioemu/hw/usb-uhci.c Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/ioemu/hw/usb-uhci.c Thu Mar 15 09:04:23 2007 -0600
@@ -658,6 +658,50 @@ static void uhci_map(PCIDevice *pci_dev,
     register_ioport_read(addr, 32, 1, uhci_ioport_readb, s);
 }
 
+void uhci_usb_save(QEMUFile *f, void *opaque)
+{
+    int i;
+    UHCIState *s = (UHCIState*)opaque;
+
+    qemu_put_be16s(f, &s->cmd);
+    qemu_put_be16s(f, &s->status);
+    qemu_put_be16s(f, &s->intr);
+    qemu_put_be16s(f, &s->frnum);
+    qemu_put_be32s(f, &s->fl_base_addr);
+    qemu_put_8s(f, &s->sof_timing);
+    qemu_put_8s(f, &s->status2);
+
+    for(i = 0; i < NB_PORTS; i++) {
+        qemu_put_be16s(f, &s->ports[i].ctrl);
+    }
+
+    qemu_put_timer(f, s->frame_timer);
+}
+
+int uhci_usb_load(QEMUFile *f, void *opaque, int version_id)
+{
+    int i;
+    UHCIState *s = (UHCIState*)opaque;
+
+    if (version_id != 1)
+        return -EINVAL;
+
+    qemu_get_be16s(f, &s->cmd);
+    qemu_get_be16s(f, &s->status);
+    qemu_get_be16s(f, &s->intr);
+    qemu_get_be16s(f, &s->frnum);
+    qemu_get_be32s(f, &s->fl_base_addr);
+    qemu_get_8s(f, &s->sof_timing);
+    qemu_get_8s(f, &s->status2);
+
+    for(i = 0; i < NB_PORTS; i++) {
+        qemu_get_be16s(f, &s->ports[i].ctrl);
+    }
+
+    qemu_get_timer(f, s->frame_timer);
+
+}
+
 void usb_uhci_init(PCIBus *bus, int devfn)
 {
     UHCIState *s;
@@ -693,4 +737,8 @@ void usb_uhci_init(PCIBus *bus, int devf
        to rely on this.  */
     pci_register_io_region(&s->dev, 4, 0x20, 
                            PCI_ADDRESS_SPACE_IO, uhci_map);
-}
+
+    register_savevm("UHCI_usb_pci", 0, 1, generic_pci_save, generic_pci_load, 
s);
+
+    register_savevm("UHCI usb controller", 0, 1, uhci_usb_save, uhci_usb_load, 
s);
+}
diff -r a230a1a167dc -r 1584263f9fc5 tools/ioemu/hw/usb.c
--- a/tools/ioemu/hw/usb.c      Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/ioemu/hw/usb.c      Thu Mar 15 09:04:23 2007 -0600
@@ -191,3 +191,43 @@ int set_usb_string(uint8_t *buf, const c
     }
     return q - buf;
 }
+
+void generic_usb_save(QEMUFile* f, void *opaque)
+{
+    USBDevice *s = (USBDevice*)opaque;
+
+    qemu_put_be32s(f, &s->speed);
+    qemu_put_8s(f, &s->addr);
+    qemu_put_be32s(f, &s->state);
+
+    qemu_put_buffer(f, s->setup_buf, 8);
+    qemu_put_buffer(f, s->data_buf, 1024);
+
+    qemu_put_be32s(f, &s->remote_wakeup);
+    qemu_put_be32s(f, &s->setup_state);
+    qemu_put_be32s(f, &s->setup_len);
+    qemu_put_be32s(f, &s->setup_index);
+
+}
+
+int generic_usb_load(QEMUFile* f, void *opaque, int version_id)
+{
+    USBDevice *s = (USBDevice*)opaque;
+
+    if (version_id != 1)
+        return -EINVAL;
+
+    qemu_get_be32s(f, &s->speed);
+    qemu_get_8s(f, &s->addr);
+    qemu_get_be32s(f, &s->state);
+
+    qemu_get_buffer(f, s->setup_buf, 8);
+    qemu_get_buffer(f, s->data_buf, 1024);
+
+    qemu_get_be32s(f, &s->remote_wakeup);
+    qemu_get_be32s(f, &s->setup_state);
+    qemu_get_be32s(f, &s->setup_len);
+    qemu_get_be32s(f, &s->setup_index);
+
+    return 0;
+}
diff -r a230a1a167dc -r 1584263f9fc5 tools/ioemu/hw/usb.h
--- a/tools/ioemu/hw/usb.h      Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/ioemu/hw/usb.h      Thu Mar 15 09:04:23 2007 -0600
@@ -176,3 +176,9 @@ USBDevice *usb_tablet_init(void);
 
 /* usb-msd.c */
 USBDevice *usb_msd_init(const char *filename);
+
+/* usb.c */
+void generic_usb_save(QEMUFile* f, void *opaque);
+int generic_usb_load(QEMUFile* f, void *opaque, int version_id);
+
+
diff -r a230a1a167dc -r 1584263f9fc5 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/ioemu/vl.c  Thu Mar 15 09:04:23 2007 -0600
@@ -841,10 +841,22 @@ void qemu_get_timer(QEMUFile *f, QEMUTim
 #ifdef CONFIG_DM
 static void timer_save(QEMUFile *f, void *opaque)
 {
+    /* need timer for save/restoe qemu_timer in usb_uhci */
+    if (cpu_ticks_enabled) {
+        hw_error("cannot save state if virtual timers are running");
+    }
+    qemu_put_be64s(f, &cpu_clock_offset);
 }
 
 static int timer_load(QEMUFile *f, void *opaque, int version_id)
 {
+    if (version_id != 1)
+        return -EINVAL;
+    if (cpu_ticks_enabled) {
+        return -EINVAL;
+    }
+
+    qemu_get_be64s(f, &cpu_clock_offset);
     return 0;
 }
 #else  /* !CONFIG_DM */
@@ -3900,6 +3912,7 @@ static int usb_device_add(const char *de
     const char *p;
     USBDevice *dev;
     USBPort *port;
+    char usb_name[256] = "USB ";
 
     if (!free_usb_ports)
         return -1;
@@ -3936,6 +3949,12 @@ static int usb_device_add(const char *de
     free_usb_ports = port->next;
     port->next = used_usb_ports;
     used_usb_ports = port;
+
+    pstrcpy(usb_name + strlen(usb_name), 
+            sizeof(usb_name) - strlen(usb_name), 
+            devname);
+    register_savevm(usb_name, 0, 1, generic_usb_save, generic_usb_load, dev);
+    
     usb_attach(port, dev);
     return 0;
 }
diff -r a230a1a167dc -r 1584263f9fc5 tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/libxc/xc_dom_x86.c  Thu Mar 15 09:04:23 2007 -0600
@@ -455,7 +455,7 @@ static int vcpu_x86_32(struct xc_dom_ima
     ctxt->kernel_ss = ctxt->user_regs.ss;
     ctxt->kernel_sp = ctxt->user_regs.esp;
 
-    ctxt->flags = VGCF_in_kernel_X86_32;
+    ctxt->flags = VGCF_in_kernel_X86_32 | VGCF_online_X86_32;
     if ( dom->parms.pae == 2 /* extended_cr3 */ ||
          dom->parms.pae == 3 /* bimodal */ )
         ctxt->vm_assist |= (1UL << VMASST_TYPE_pae_extended_cr3);
@@ -494,7 +494,7 @@ static int vcpu_x86_64(struct xc_dom_ima
     ctxt->kernel_ss = ctxt->user_regs.ss;
     ctxt->kernel_sp = ctxt->user_regs.esp;
 
-    ctxt->flags = VGCF_in_kernel_X86_64;
+    ctxt->flags = VGCF_in_kernel_X86_64 | VGCF_online_X86_64;
     cr3_pfn = xc_dom_p2m_guest(dom, dom->pgtables_seg.pfn);
     ctxt->ctrlreg[3] = xen_pfn_to_cr3_x86_64(cr3_pfn);
     xc_dom_printf("%s: cr3: pfn 0x%" PRIpfn " mfn 0x%" PRIpfn "\n",
diff -r a230a1a167dc -r 1584263f9fc5 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/libxc/xc_hvm_build.c        Thu Mar 15 09:04:23 2007 -0600
@@ -302,9 +302,15 @@ static int setup_guest(int xc_handle,
 
     /* Set [er]ip in the way that's right for Xen */
     if ( strstr(caps, "x86_64") )
+    {
         ctxt->c64.user_regs.rip = elf_uval(&elf, elf.ehdr, e_entry); 
+        ctxt->c64.flags = VGCF_online;
+    }
     else
+    {
         ctxt->c32.user_regs.eip = elf_uval(&elf, elf.ehdr, e_entry);
+        ctxt->c32.flags = VGCF_online;
+    }
 
     return 0;
 
@@ -344,7 +350,7 @@ static int xc_hvm_build_internal(int xc_
 
     memset(&launch_domctl, 0, sizeof(launch_domctl));
     launch_domctl.domain = (domid_t)domid;
-    launch_domctl.u.vcpucontext.vcpu   = 0;
+    launch_domctl.u.vcpucontext.vcpu = 0;
     set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, &ctxt.c);
     launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
     rc = xc_domctl(xc_handle, &launch_domctl);
diff -r a230a1a167dc -r 1584263f9fc5 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/libxc/xc_linux_restore.c    Thu Mar 15 09:04:23 2007 -0600
@@ -189,6 +189,7 @@ int xc_linux_restore(int xc_handle, int 
 
     uint64_t vcpumap = 1ULL;
     unsigned int max_vcpu_id = 0;
+    int new_ctxt_format = 0;
 
     max_pfn = nr_pfns;
 
@@ -372,6 +373,7 @@ int xc_linux_restore(int xc_handle, int 
         }
 
         if (j == -2) {
+            new_ctxt_format = 1;
             if (!read_exact(io_fd, &max_vcpu_id, sizeof(int)) ||
                 (max_vcpu_id >= 64) ||
                 !read_exact(io_fd, &vcpumap, sizeof(uint64_t))) {
@@ -797,6 +799,9 @@ int xc_linux_restore(int xc_handle, int 
             goto out;
         }
 
+        if ( !new_ctxt_format )
+            ctxt.flags |= VGCF_online;
+
         if (i == 0) {
             /*
              * Uncanonicalise the suspend-record frame number and poke
diff -r a230a1a167dc -r 1584263f9fc5 tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/libxen/include/xen_vm.h     Thu Mar 15 09:04:23 2007 -0600
@@ -87,7 +87,6 @@ typedef struct xen_vm_record
     int64_t memory_dynamic_max;
     int64_t memory_dynamic_min;
     int64_t memory_static_min;
-    char *vcpus_policy;
     xen_string_string_map *vcpus_params;
     int64_t vcpus_max;
     int64_t vcpus_at_startup;
@@ -323,13 +322,6 @@ xen_vm_get_memory_static_min(xen_session
 
 
 /**
- * Get the VCPUs/policy field of the given VM.
- */
-extern bool
-xen_vm_get_vcpus_policy(xen_session *session, char **result, xen_vm vm);
-
-
-/**
  * Get the VCPUs/params field of the given VM.
  */
 extern bool
@@ -565,13 +557,6 @@ xen_vm_set_memory_dynamic_min(xen_sessio
  */
 extern bool
 xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t 
static_min);
-
-
-/**
- * Set the VCPUs/policy field of the given VM.
- */
-extern bool
-xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy);
 
 
 /**
diff -r a230a1a167dc -r 1584263f9fc5 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/libxen/src/xen_vm.c Thu Mar 15 09:04:23 2007 -0600
@@ -88,9 +88,6 @@ static const struct_member xen_vm_record
         { .key = "memory_static_min",
           .type = &abstract_type_int,
           .offset = offsetof(xen_vm_record, memory_static_min) },
-        { .key = "VCPUs_policy",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_vm_record, vcpus_policy) },
         { .key = "VCPUs_params",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_vm_record, vcpus_params) },
@@ -191,7 +188,6 @@ xen_vm_record_free(xen_vm_record *record
     free(record->name_description);
     xen_vdi_record_opt_free(record->suspend_vdi);
     xen_host_record_opt_free(record->resident_on);
-    free(record->vcpus_policy);
     xen_string_string_map_free(record->vcpus_params);
     xen_console_record_opt_set_free(record->consoles);
     xen_vif_record_opt_set_free(record->vifs);
@@ -498,23 +494,6 @@ xen_vm_get_memory_static_min(xen_session
 
 
 bool
-xen_vm_get_vcpus_policy(xen_session *session, char **result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VM.get_VCPUs_policy");
-    return session->ok;
-}
-
-
-bool
 xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, 
xen_vm vm)
 {
     abstract_value param_values[] =
@@ -1074,22 +1053,6 @@ xen_vm_set_memory_static_min(xen_session
 
 
 bool
-xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_string,
-              .u.string_val = policy }
-        };
-
-    xen_call_(session, "VM.set_VCPUs_policy", param_values, 2, NULL, NULL);
-    return session->ok;
-}
-
-
-bool
 xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map 
*params)
 {
     abstract_value param_values[] =
diff -r a230a1a167dc -r 1584263f9fc5 tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/libxen/test/test_bindings.c Thu Mar 15 09:04:23 2007 -0600
@@ -373,7 +373,6 @@ static xen_vm create_new_vm(xen_session 
             .memory_dynamic_max = 256,
             .memory_dynamic_min = 128,
             .memory_static_min = 128,
-            .vcpus_policy = "credit",
             .vcpus_params = vcpus_params,
             .vcpus_max = 4,
             .vcpus_at_startup = 2,
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/util/xmlrpclib2.py       Thu Mar 15 09:04:23 2007 -0600
@@ -199,6 +199,18 @@ class TCPXMLRPCServer(SocketServer.Threa
                 response = dispatch_method(method, params)
             else:
                 response = self._dispatch(method, params)
+
+            if self.xenapi and \
+               (response is None or
+                not isinstance(response, dict) or
+                'Status' not in response):
+                log.exception('Internal error handling %s: Invalid result %s',
+                              method, response)
+                response = { "Status": "Failure",
+                             "ErrorDescription":
+                             ['INTERNAL_ERROR',
+                              'Invalid result %s handling %s' %
+                              (response, method)]}
 
             # With either Unicode or normal strings, we can only transmit
             # \t, \n, \r, \u0020-\ud7ff, \ue000-\ufffd, and \u10000-\u10ffff
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/XendAPI.py  Thu Mar 15 09:04:23 2007 -0600
@@ -31,6 +31,7 @@ from xen.xend.XendClient import ERROR_IN
 from xen.xend.XendClient import ERROR_INVALID_DOMAIN
 from xen.xend.XendLogging import log
 from xen.xend.XendTask import XendTask
+from xen.xend.XendVMMetrics import XendVMMetrics
 
 from xen.xend.XendAPIConstants import *
 from xen.util.xmlrpclib2 import stringify
@@ -192,6 +193,16 @@ def valid_vm(func):
            _check_ref(XendDomain.instance().is_valid_vm,
                       'VM', func, *args, **kwargs)
 
+def valid_vm_metrics(func):
+    """Decorator to verify if vm_metrics_ref is valid before calling method.
+
+    @param func: function with params: (self, session, vm_metrics_ref, ...)
+    @rtype: callable object
+    """    
+    return lambda *args, **kwargs: \
+           _check_ref(XendVMMetrics.is_valid_vm_metrics,
+                      'VM_metrics', func, *args, **kwargs)
+
 def valid_network(func):
     """Decorator to verify if network_ref is valid before calling method.
 
@@ -400,6 +411,7 @@ class XendAPI(object):
             'host_metrics' : valid_host_metrics,
             'network'      : valid_network,
             'VM'           : valid_vm,
+            'VM_metrics'   : valid_vm_metrics,
             'VBD'          : valid_vbd,
             'VBD_metrics'  : valid_vbd_metrics,
             'VIF'          : valid_vif,
@@ -629,6 +641,7 @@ class XendAPI(object):
     host_attr_ro = ['software_version',
                     'resident_VMs',
                     'host_CPUs',
+                    'cpu_configuration',
                     'metrics',
                     'capabilities',
                     'supported_bootloaders',
@@ -638,6 +651,7 @@ class XendAPI(object):
                     'API_version_vendor_implementation']
     
     host_attr_rw = ['name_label',
+                    'sched_policy',
                     'name_description',
                     'other_config']
 
@@ -647,7 +661,8 @@ class XendAPI(object):
                     ('shutdown', None),
                     ('add_to_other_config', None),
                     ('remove_from_other_config', None),
-                    ('dmesg', 'String')]
+                    ('dmesg', 'String'),
+                    ('get_log', 'String')]
     
     host_funcs = [('get_by_name_label', 'Set(host)')]
 
@@ -700,7 +715,13 @@ class XendAPI(object):
         return xen_api_success(XendNode.instance().get_capabilities())
     def host_get_supported_bootloaders(self, session, host_ref):
         return xen_api_success(['pygrub'])
-
+    def host_get_sched_policy(self, _, host_ref):
+        return xen_api_success(XendNode.instance().get_vcpus_policy())
+    def host_set_sched_policy(self, _, host_ref, policy):
+        return xen_api_todo()
+    def host_get_cpu_configuration(self, _, host_ref):
+        return xen_api_success(XendNode.instance().get_cpu_configuration())
+    
     # object methods
     def host_disable(self, session, host_ref):
         XendDomain.instance().set_allow_new_domains(False)
@@ -717,8 +738,16 @@ class XendAPI(object):
             return xen_api_error(XEND_ERROR_HOST_RUNNING)
         return xen_api_error(XEND_ERROR_UNSUPPORTED)        
 
-    def host_dmesg(self, session, host_ref):
-        return xen_api_success(XendDmesg.instance().info())
+    def host_dmesg(self, session, host_ref, clear):
+        if clear:
+            return xen_api_success(XendDmesg.instance().clear())
+        else:
+            return xen_api_success(XendDmesg.instance().info())
+
+    def host_get_log(self, session, host_ref):
+        log_file = open(XendLogging.getLogFilename())
+        log_buffer = log_file.read()
+        return xen_api_success(log_buffer)
 
     def host_get_record(self, session, host_ref):
         node = XendNode.instance()
@@ -735,9 +764,11 @@ class XendAPI(object):
                   'other_config': node.other_config,
                   'resident_VMs': dom.get_domain_refs(),
                   'host_CPUs': node.get_host_cpu_refs(),
+                  'cpu_configuration': node.get_cpu_configuration(),
                   'metrics': node.host_metrics_uuid,
                   'capabilities': node.get_capabilities(),
-                  'supported_bootloaders': 'pygrub'}
+                  'supported_bootloaders': 'pygrub',
+                  'sched_policy': node.get_vcpus_policy()}
         return xen_api_success(record)
 
     # class methods
@@ -759,7 +790,8 @@ class XendAPI(object):
                         'modelname',
                         'stepping',
                         'flags',
-                        'utilisation']
+                        'utilisation',
+                        'features']
 
     # attributes
     def _host_cpu_get(self, ref, field):
@@ -768,6 +800,8 @@ class XendAPI(object):
 
     def host_cpu_get_host(self, _, ref):
         return xen_api_success(XendNode.instance().uuid)
+    def host_cpu_get_features(self, _, ref):
+        return self._host_cpu_get(ref, 'features')
     def host_cpu_get_number(self, _, ref):
         return self._host_cpu_get(ref, 'number')
     def host_cpu_get_vendor(self, _, ref):
@@ -990,11 +1024,9 @@ class XendAPI(object):
 
     VM_attr_ro = ['power_state',
                   'resident_on',
-                  'memory_actual',
                   'memory_static_max',                  
                   'memory_static_min',
                   'VCPUs_number',
-                  'VCPUs_utilisation',
                   'consoles',
                   'VIFs',
                   'VBDs',
@@ -1002,6 +1034,7 @@ class XendAPI(object):
                   'tools_version',
                   'domid',
                   'is_control_domain',
+                  'metrics'
                   ]
                   
     VM_attr_rw = ['name_label',
@@ -1011,7 +1044,6 @@ class XendAPI(object):
                   'auto_power_on',
                   'memory_dynamic_max',
                   'memory_dynamic_min',
-                  'VCPUs_policy',
                   'VCPUs_params',
                   'actions_after_shutdown',
                   'actions_after_reboot',
@@ -1040,6 +1072,8 @@ class XendAPI(object):
                   ('resume', None),
                   ('add_to_HVM_boot_params', None),
                   ('remove_from_HVM_boot_params', None),
+                  ('add_to_VCPUs_params', None),
+                  ('remove_from_VCPUs_params', None),
                   ('add_to_platform', None),
                   ('remove_from_platform', None),
                   ('add_to_other_config', None),
@@ -1058,7 +1092,6 @@ class XendAPI(object):
         'memory_dynamic_max',
         'memory_dynamic_min',
         'memory_static_min',
-        'VCPUs_policy',
         'VCPUs_params',
         'actions_after_shutdown',
         'actions_after_reboot',
@@ -1096,11 +1129,7 @@ class XendAPI(object):
     
     def VM_get_resident_on(self, session, vm_ref):
         return xen_api_success(XendNode.instance().uuid)
-    
-    def VM_get_memory_actual(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_todo() # unsupported by xc
-    
+       
     def VM_get_memory_static_max(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_memory_static_max())
@@ -1113,10 +1142,6 @@ class XendAPI(object):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.getVCpuCount())
     
-    def VM_get_VCPUs_utilisation(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_vcpus_util())
-    
     def VM_get_VIFs(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_vifs())
@@ -1136,6 +1161,10 @@ class XendAPI(object):
     def VM_get_tools_version(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return dom.get_tools_version()
+
+    def VM_get_metrics(self, _, vm_ref):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        return xen_api_success(dom.get_metrics())
 
     # attributes (rw)
     def VM_get_name_label(self, session, vm_ref):
@@ -1160,11 +1189,7 @@ class XendAPI(object):
 
     def VM_get_memory_dynamic_min(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_memory_dynamic_min())        
-    
-    def VM_get_VCPUs_policy(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_vcpus_policy())
+        return xen_api_success(dom.get_memory_dynamic_min())
     
     def VM_get_VCPUs_params(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
@@ -1255,13 +1280,24 @@ class XendAPI(object):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_todo()
     
-    def VM_set_VCPUs_policy(self, session, vm_ref, policy):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_todo()
-    
-    def VM_set_VCPUs_params(self, session, vm_ref, params):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_todo()
+    def VM_set_VCPUs_params(self, session, vm_ref, value):
+        return self.VM_set('vcpus_params', session, vm_ref, value)
+
+    def VM_add_to_VCPUs_params(self, session, vm_ref, key, value):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        if 'vcpus_params' not in dom.info:
+            dom.info['vcpus_params'] = {}
+        dom.info['vcpus_params'][key] = value
+        return self._VM_save(dom)
+
+    def VM_remove_from_VCPUs_params(self, session, vm_ref, key):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        if 'vcpus_params' in dom.info \
+               and key in dom.info['vcpus_params']:
+            del dom.info['vcpus_params'][key]
+            return self._VM_save(dom)
+        else:
+            return xen_api_success_void()
     
     def VM_set_actions_after_shutdown(self, session, vm_ref, action):
         if action not in XEN_API_ON_NORMAL_EXIT:
@@ -1401,11 +1437,8 @@ class XendAPI(object):
             'memory_static_max': xeninfo.get_memory_static_max(),
             'memory_dynamic_min': xeninfo.get_memory_dynamic_min(),
             'memory_dynamic_max': xeninfo.get_memory_dynamic_max(),
-            'memory_actual': xeninfo.get_memory_static_min(),
-            'VCPUs_policy': xeninfo.get_vcpus_policy(),
             'VCPUs_params': xeninfo.get_vcpus_params(),
             'VCPUs_number': xeninfo.getVCpuCount(),
-            'VCPUs_utilisation': xeninfo.get_vcpus_util(),
             'actions_after_shutdown': xeninfo.get_on_shutdown(),
             'actions_after_reboot': xeninfo.get_on_reboot(),
             'actions_after_suspend': xeninfo.get_on_suspend(),
@@ -1480,6 +1513,33 @@ class XendAPI(object):
         return XendTask.log_progress(0, 100, do_vm_func,
                                      "domain_unpause", vm_ref)
 
+    # Xen API: Class VM_metrics
+    # ----------------------------------------------------------------
+
+    VM_metrics_attr_ro = ['memory_actual',
+                           'vcpus_number',
+                           'vcpus_utilisation']
+    VM_metrics_attr_rw = []
+    VM_metrics_methods = []
+
+    def _VM_metrics_get(self, ref):
+        return XendVMMetrics.get_by_uuid(ref)
+
+    def VM_metrics_get_all(self, _):
+        return xen_api_success(XendVMMetrics.get_all())
+
+    def VM_metrics_get_record(self, _, ref):
+        return xen_api_success(self._VM_metrics_get(ref).get_record())
+
+    def VM_metrics_get_memory_actual(self, _, ref):
+        return xen_api_success(self._VM_metrics_get(ref).get_memory_actual())
+
+    def VM_metrics_get_vcpus_number(self, _, ref):
+        return xen_api_success(self._VM_metrics_get(ref).get_vcpus_number())
+
+    def VM_metrics_get_vcpus_utilisation(self, _, ref):
+        return 
xen_api_success(self._VM_metrics_get(ref).get_metrics_get_vcpus_utilisation())
+
     # Xen API: Class VBD
     # ----------------------------------------------------------------
 
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/XendCheckpoint.py   Thu Mar 15 09:04:23 2007 -0600
@@ -9,6 +9,7 @@ import re
 import re
 import string
 import threading
+import fcntl
 from struct import pack, unpack, calcsize
 
 from xen.util.xpopen import xPopen3
@@ -73,13 +74,14 @@ def save(fd, dominfo, network, live, dst
         write_exact(fd, config, "could not write guest state file: config")
 
         image_cfg = dominfo.info.get('image', {})
-        hvm = image_cfg.has_key('hvm')
+        hvm = dominfo.info.is_hvm()
         stdvga = 0
 
         if hvm:
             log.info("save hvm domain")
-            if image_cfg['hvm']['devices']['stdvga'] == 1:
-                stdvga = 1
+            if dominfo.info['platform'].has_key('stdvga'):
+                if dominfo.info['platform']['stdvga'] == 1:
+                    stdvga = 1
 
         # xc_save takes three customization parameters: maxit, max_f, and
         # flags the last controls whether or not save is 'live', while the
@@ -188,11 +190,11 @@ def restore(xd, fd, dominfo = None, paus
 
     # if hvm, pass mem size to calculate the store_mfn
     image_cfg = dominfo.info.get('image', {})
-    is_hvm  = image_cfg.has_key('hvm')
+    is_hvm = dominfo.info.is_hvm()
     if is_hvm:
         hvm  = dominfo.info['memory_static_min']
-        apic = dominfo.info['image']['hvm'].get('apic', 0)
-        pae  = dominfo.info['image']['hvm'].get('pae',  0)
+        apic = dominfo.info['platform'].get('apic', 0)
+        pae  = dominfo.info['platform'].get('pae',  0)
         log.info("restore hvm domain %d, mem=%d, apic=%d, pae=%d",
                  dominfo.domid, hvm, apic, pae)
     else:
@@ -228,6 +230,15 @@ def restore(xd, fd, dominfo = None, paus
         handler = RestoreInputHandler()
 
         forkHelper(cmd, fd, handler.handler, True)
+
+        # We don't want to pass this fd to any other children -- we 
+        # might need to recover ths disk space that backs it.
+        try:
+            flags = fcntl.fcntl(fd, fcntl.F_GETFD)
+            flags |= fcntl.FD_CLOEXEC
+            fcntl.fcntl(fd, fcntl.F_SETFD, flags)
+        except:
+            pass
 
         if handler.store_mfn is None:
             raise XendError('Could not read store MFN')
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/XendConfig.py       Thu Mar 15 09:04:23 2007 -0600
@@ -118,11 +118,12 @@ LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(
 LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(XENAPI_CFG_TO_LEGACY_CFG)
 
 # Platform configuration keys.
-XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'device_model', 'display', 'fda',
-                        'fdb', 'keymap', 'isa', 'localtime', 'nographic',
-                        'pae', 'serial', 'sdl', 'soundhw','stdvga', 'usb',
-                        'usbdevice', 'vnc', 'vncconsole', 'vncdisplay',
-                        'vnclisten', 'vncpasswd', 'vncunused', 'xauthority']
+XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'boot', 'device_model', 'display', 
+                        'fda', 'fdb', 'keymap', 'isa', 'localtime',
+                        'nographic', 'pae', 'serial', 'sdl',
+                        'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
+                        'vncconsole', 'vncdisplay', 'vnclisten',
+                        'vncpasswd', 'vncunused', 'xauthority']
 
 # List of XendConfig configuration keys that have no direct equivalent
 # in the old world.
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Mar 15 09:04:23 2007 -0600
@@ -50,6 +50,8 @@ from xen.xend.xenstore.xswatch import xs
 from xen.xend.xenstore.xswatch import xswatch
 from xen.xend.XendConstants import *
 from xen.xend.XendAPIConstants import *
+
+from xen.xend.XendVMMetrics import XendVMMetrics
 
 MIGRATE_TIMEOUT = 30.0
 BOOTLOADER_LOOPBACK_DEVICE = '/dev/xvdp'
@@ -369,6 +371,8 @@ class XendDomainInfo:
             self._augmentInfo(priv)
 
         self._checkName(self.info['name_label'])
+
+        self.metrics = XendVMMetrics(uuid.createString(), self)
             
 
     #
@@ -626,6 +630,10 @@ class XendDomainInfo:
 
         except RuntimeError, exn:
             raise XendError(str(exn))
+
+
+    def getDomInfo(self):
+        return dom_get(self.domid)
 
     #
     # internal functions ... TODO: re-categorised
@@ -2037,15 +2045,6 @@ class XendDomainInfo:
         return self.info.get('memory_dynamic_max', 0)
     def get_memory_dynamic_min(self):
         return self.info.get('memory_dynamic_min', 0)
-
-    def get_vcpus_policy(self):
-        sched_id = xc.sched_id_get()
-        if sched_id == xen.lowlevel.xc.XEN_SCHEDULER_SEDF:
-            return 'sedf'
-        elif sched_id == xen.lowlevel.xc.XEN_SCHEDULER_CREDIT:
-            return 'credit'
-        else:
-            return 'unknown'
     def get_vcpus_params(self):
         if self.getDomid() is None:
             return self.info['vcpus_params']
@@ -2060,6 +2059,8 @@ class XendDomainInfo:
         return self.info.get('pci_bus', '')
     def get_tools_version(self):
         return self.info.get('tools_version', {})
+    def get_metrics(self):
+        return self.metrics.get_uuid();
     
     def get_on_shutdown(self):
         after_shutdown = self.info.get('actions_after_shutdown')
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/XendNode.py Thu Mar 15 09:04:23 2007 -0600
@@ -75,6 +75,11 @@ class XendNode:
             self.other_config = {}
             self.cpus = {}
             self.host_metrics_uuid = uuid.createString()
+
+        # put some arbitrary params in other_config as this
+        # is directly exposed via XenAPI
+        self.other_config["xen_pagesize"] = self.xeninfo_dict()["xen_pagesize"]
+        self.other_config["platform_params"] = 
self.xeninfo_dict()["platform_params"]
             
         # load CPU UUIDs
         saved_cpus = self.state_store.load_state('cpu')
@@ -353,13 +358,36 @@ class XendNode:
 
     def xen_version(self):
         info = self.xc.xeninfo()
+
         try:
             from xen import VERSION
-            return {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
+            info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
                     'Xend': VERSION}
         except (ImportError, AttributeError):
-            return {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
+            info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
                     'Xend': '3.0.3'}
+
+        # Add xend_config_format
+        info.update(self.xendinfo_dict())
+
+        # Add version info about machine
+        info.update(self.nodeinfo_dict())
+
+        # Add specific xen version info
+        xeninfo_dict = self.xeninfo_dict()
+
+        info.update({
+            "xen_major":         xeninfo_dict["xen_major"],
+            "xen_minor":         xeninfo_dict["xen_minor"],
+            "xen_extra":         xeninfo_dict["xen_extra"],
+            "cc_compiler":       xeninfo_dict["cc_compiler"],
+            "cc_compile_by":     xeninfo_dict["cc_compile_by"],
+            "cc_compile_domain": xeninfo_dict["cc_compile_domain"],
+            "cc_compile_date":   xeninfo_dict["cc_compile_date"],
+            "xen_changeset":     xeninfo_dict["xen_changeset"]
+            })
+        
+        return info
 
     def get_name(self):
         return self.name
@@ -415,6 +443,27 @@ class XendNode:
 
         return 0.0
 
+    def get_vcpus_policy(self):
+        sched_id = self.xc.sched_id_get()
+        if sched_id == xen.lowlevel.xc.XEN_SCHEDULER_SEDF:
+            return 'sedf'
+        elif sched_id == xen.lowlevel.xc.XEN_SCHEDULER_CREDIT:
+            return 'credit'
+        else:
+            return 'unknown'
+
+    def get_cpu_configuration(self):
+        phys_info = self.physinfo_dict()
+
+        cpu_info = {
+            "nr_nodes":         phys_info["nr_nodes"],
+            "sockets_per_node": phys_info["sockets_per_node"],
+            "cores_per_socket": phys_info["cores_per_socket"],
+            "threads_per_core": phys_info["threads_per_core"]
+            }
+
+        return cpu_info
+    
     #
     # Network Functions
     #
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/XendVMMetrics.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/xend/XendVMMetrics.py    Thu Mar 15 09:04:23 2007 -0600
@@ -0,0 +1,70 @@
+#============================================================================
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#============================================================================
+# Copyright (c) 2006-2007 Xensource Inc.
+#============================================================================
+
+from xen.xend.XendLogging import log
+
+instances = {}
+
+class XendVMMetrics:
+    """VM Metrics."""
+
+    def get_by_uuid(_, uuid):
+        return instances[uuid]
+
+    get_by_uuid = classmethod(get_by_uuid)
+
+    def is_valid_vm_metrics(_, uuid):
+        return uuid in instances
+
+    is_valid_vm_metrics = classmethod(is_valid_vm_metrics)
+
+    def get_all(_):
+        return instances.keys()
+
+    get_all = classmethod(get_all)
+   
+    def __init__(self, uuid, xend_domain_instance):
+        self.uuid = uuid
+        self.xend_domain_instance = xend_domain_instance
+        instances[uuid] = self
+
+    def get_uuid(self):
+        return self.uuid
+
+    def get_memory_actual(self):
+        return self.get_record()["memory_actual"]
+
+    def get_vcpus_number(self):
+        return self.get_record()["vcpus_number"]
+    
+    def get_vcpus_utilisation(self):
+        return self.xend_domain_instance.get_vcpus_util()
+
+    def get_record(self):
+        domInfo = self.xend_domain_instance.getDomInfo()
+        if domInfo:
+            return { 'uuid'              : self.uuid,
+                     'memory_actual'     : domInfo["mem_kb"] * 1024,
+                     'vcpus_number'      : domInfo["online_vcpus"],
+                     'vcpus_utilisation' : self.get_vcpus_utilisation()
+                   }
+        else:
+            return { 'uuid'              : self.uuid,
+                     'memory_actual'     : 0,
+                     'vcpus_number'      : 0,
+                     'vcpus_utilisation' : {}
+                   }
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/image.py    Thu Mar 15 09:04:23 2007 -0600
@@ -392,7 +392,7 @@ class HVMImageHandler(ImageHandler):
         # Find RFB console device, and if it exists, make QEMU enable
         # the VNC console.
         #
-        if vmConfig['platform'].get('nographic'):
+        if int(vmConfig['platform'].get('nographic', 0)) != 0:
             # skip vnc init if nographic is set
             ret.append('-nographic')
             return ret
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/server/SrvDaemon.py Thu Mar 15 09:04:23 2007 -0600
@@ -276,9 +276,12 @@ class Daemon:
             if not m:
                 return None
             modulename = m.group(1)
-            if re.search('sxp.py', modulename):
-                return None
-            if re.search('SrvServer.py', modulename):
+            if modulename.endswith('.pyc'):
+                modulename = modulename[:-1]
+            if modulename == 'sxp.py' or \
+               modulename == 'XendLogging.py' or \
+               modulename == 'XendMonitor.py' or \
+               modulename == 'server/SrvServer.py':
                 return None
             self.traceindent += 1
             self.print_trace("> %s:%s\n"
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xend/server/vfbif.py
--- a/tools/python/xen/xend/server/vfbif.py     Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xend/server/vfbif.py     Thu Mar 15 09:04:23 2007 -0600
@@ -46,7 +46,7 @@ class VfbifController(DevController):
 
     def createDevice(self, config):
         DevController.createDevice(self, config)
-        if self.vm.info.get('HVM_boot_policy'):
+        if self.vm.info.is_hvm():
             # is HVM, so qemu-dm will handle the vfb.
             return
         
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xm/XenAPI.py
--- a/tools/python/xen/xm/XenAPI.py     Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xm/XenAPI.py     Thu Mar 15 09:04:23 2007 -0600
@@ -155,7 +155,7 @@ class Session(xen.util.xmlrpclib2.Server
 
 def _parse_result(result):
     if type(result) != dict or 'Status' not in result:
-        raise xmlrpclib.Fault(500, 'Missing Status in response from server' + 
result)
+        raise xmlrpclib.Fault(500, 'Missing Status in response from server: ' 
+ str(result))
     if result['Status'] == 'Success':
         if 'Value' in result:
             return result['Value']
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xm/addlabel.py
--- a/tools/python/xen/xm/addlabel.py   Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xm/addlabel.py   Thu Mar 15 09:04:23 2007 -0600
@@ -17,7 +17,7 @@
 # Author: Bryan D. Payne <bdpayne@xxxxxxxxxx>
 #============================================================================
 
-"""Labeling a domain configuration file or a resoruce.
+"""Labeling a domain configuration file or a resource.
 """
 import os
 import sys
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xm/main.py       Thu Mar 15 09:04:23 2007 -0600
@@ -139,7 +139,7 @@ SUBCOMMAND_HELP = {
                      'Send a trigger to a domain.'),
     'vcpu-list'   : ('[<Domain>]',
                      'List the VCPUs for a domain or all domains.'),
-    'vcpu-pin'    : ('<Domain> <VCPU> <CPUs>',
+    'vcpu-pin'    : ('<Domain> <VCPU> <CPUs|all>',
                      'Set which CPUs a VCPU can use.'),
     'vcpu-set'    : ('<Domain> <vCPUs>',
                      'Set the number of active VCPUs for allowed for the'
@@ -557,7 +557,7 @@ class Shell(cmd.Cmd):
         if serverType == SERVER_XEN_API:
             res = server.xenapi._UNSUPPORTED_list_all_methods()
             for f in res:
-                setattr(Shell, 'do_' + f, self.default)
+                setattr(Shell, 'do_' + f + ' ', self.default)
 
     def preloop(self):
         cmd.Cmd.preloop(self)
@@ -750,11 +750,14 @@ def parse_doms_info(info):
         }
 
 def check_sched_type(sched):
-    current = 'unknown'
-    for x in server.xend.node.info()[1:]:
-        if len(x) > 1 and x[0] == 'xen_scheduler':
-            current = x[1]
-            break
+    if serverType == SERVER_XEN_API:
+        current = 
server.xenapi.host.get_sched_policy(server.xenapi.session.get_this_host())
+    else:
+        current = 'unknown'
+        for x in server.xend.node.info()[1:]:
+            if len(x) > 1 and x[0] == 'xen_scheduler':
+                current = x[1]
+                break
     if sched != current:
         err("Xen is running with the %s scheduler" % current)
         sys.exit(1)
@@ -1084,7 +1087,10 @@ def xm_vcpu_pin(args):
 
     dom  = args[0]
     vcpu = args[1]
-    cpumap = cpu_make_map(args[2])
+    if args[2] == 'all':
+        cpumap = cpu_make_map('0-63')
+    else:
+        cpumap = cpu_make_map(args[2])
     
     server.xend.domain.pincpu(dom, vcpu, cpumap)
 
@@ -1092,49 +1098,69 @@ def xm_mem_max(args):
     arg_check(args, "mem-max", 2)
 
     dom = args[0]
-    mem = int_unit(args[1], 'm')
-
-    server.xend.domain.maxmem_set(dom, mem)
+
+    if serverType == SERVER_XEN_API:
+        mem = int_unit(args[1], 'k') * 1024
+        server.xenapi.VM.set_memory_static_max(get_single_vm(dom), mem)
+    else:
+        mem = int_unit(args[1], 'm')
+        server.xend.domain.maxmem_set(dom, mem)
     
 def xm_mem_set(args):
     arg_check(args, "mem-set", 2)
 
     dom = args[0]
-    mem_target = int_unit(args[1], 'm')
-
-    server.xend.domain.setMemoryTarget(dom, mem_target)
+
+    if serverType == SERVER_XEN_API:
+        mem_target = int_unit(args[1], 'k') * 1024
+        server.xenapi.VM.set_memory_dynamic_max(get_single_vm(dom), mem_target)
+        server.xenapi.VM.set_memory_dynamic_min(get_single_vm(dom), mem_target)
+    else:
+        mem_target = int_unit(args[1], 'm')
+        server.xend.domain.setMemoryTarget(dom, mem_target)
     
 def xm_vcpu_set(args):
     arg_check(args, "vcpu-set", 2)
-    
-    server.xend.domain.setVCpuCount(args[0], int(args[1]))
-
+
+    dom = args[0]
+    vcpus = int(args[1])
+
+    if serverType == SERVER_XEN_API:
+        server.xenapi.VM.set_vcpus_live(get_single_vm(dom), vcpus)
+    else:
+        server.xend.domain.setVCpuCount(dom, vcpus)
 
 def xm_destroy(args):
     arg_check(args, "destroy", 1)
 
     dom = args[0]
+    
     if serverType == SERVER_XEN_API:
         server.xenapi.VM.hard_shutdown(get_single_vm(dom))
     else:
         server.xend.domain.destroy(dom)
 
-
 def xm_domid(args):
     arg_check(args, "domid", 1)
 
     name = args[0]
 
-    dom = server.xend.domain(name)
-    print sxp.child_value(dom, 'domid')
+    if serverType == SERVER_XEN_API:
+        print server.xenapi.VM.get_domid(get_single_vm(name))
+    else:
+        dom = server.xend.domain(name)
+        print sxp.child_value(dom, 'domid')
     
 def xm_domname(args):
     arg_check(args, "domname", 1)
 
     name = args[0]
-
-    dom = server.xend.domain(name)
-    print sxp.child_value(dom, 'name')
+    
+    if serverType == SERVER_XEN_API:
+        print server.xenapi.VM.get_name_label(get_single_vm(name))
+    else:
+        dom = server.xend.domain(name)
+        print sxp.child_value(dom, 'name')
 
 def xm_sched_sedf(args):
     def ns_to_ms(val):
@@ -1282,13 +1308,59 @@ def xm_info(args):
 def xm_info(args):
     arg_check(args, "info", 0)
 
-    info = server.xend.node.info()
-    
-    for x in info[1:]:
-        if len(x) < 2: 
-            print "%-23s: (none)" % x[0]
-        else: 
-            print "%-23s:" % x[0], x[1]
+    if serverType == SERVER_XEN_API:
+
+        # Need to fake out old style xm info as people rely on parsing it
+        
+        host_record = server.xenapi.host.get_record(
+            server.xenapi.session.get_this_host())        
+
+        host_cpu_records = map(server.xenapi.host_cpu.get_record, 
host_record["host_CPUs"])
+
+        host_metrics_record = 
server.xenapi.host_metrics.get_record(host_record["metrics"])
+
+        info = {
+            "host":              host_record["name_label"],
+            "release":           host_record["software_version"]["release"],
+            "version":           host_record["software_version"]["version"],
+            "machine":           host_record["software_version"]["machine"],
+            "nr_cpus":           len(host_record["host_CPUs"]),
+            "nr_nodes":          host_record["cpu_configuration"]["nr_nodes"],
+            "sockets_per_node":  
host_record["cpu_configuration"]["sockets_per_node"],
+            "cores_per_socket":  
host_record["cpu_configuration"]["cores_per_socket"],
+            "threads_per_core":  
host_record["cpu_configuration"]["threads_per_core"],
+            "cpu_mhz":           sum([int(host_cpu_record["speed"]) for 
host_cpu_record in host_cpu_records])
+                                   / len(host_cpu_records),
+            "hw_caps":           host_cpu_records[0]["features"],
+            "total_memory":      
int(host_metrics_record["memory_total"])/1024/1024,
+            "free_memory":       
int(host_metrics_record["memory_free"])/1024/1024,
+            "xen_major":         host_record["software_version"]["xen_major"],
+            "xen_minor":         host_record["software_version"]["xen_minor"],
+            "xen_extra":         host_record["software_version"]["xen_extra"],
+            "xen_caps":          " ".join(host_record["capabilities"]),
+            "xen_scheduler":     host_record["sched_policy"],
+            "xen_pagesize":      host_record["other_config"]["xen_pagesize"],
+            "platform_params":   
host_record["other_config"]["platform_params"],
+            "xen_changeset":     
host_record["software_version"]["xen_changeset"],
+            "cc_compiler":       
host_record["software_version"]["cc_compiler"],
+            "cc_compile_by":     
host_record["software_version"]["cc_compile_by"],
+            "cc_compile_domain": 
host_record["software_version"]["cc_compile_domain"],
+            "cc_compile_date":   
host_record["software_version"]["cc_compile_date"],
+            
"xend_config_format":host_record["software_version"]["xend_config_format"]      
                          
+        }
+
+        sorted = info.items()
+        sorted.sort(lambda (x1,y1), (x2,y2): -cmp(x1,x2))
+        
+        for (k, v) in sorted:
+           print "%-23s:" % k, v 
+    else:
+        info = server.xend.node.info()
+        for x in info[1:]:
+            if len(x) < 2: 
+                print "%-23s: (none)" % x[0]
+            else: 
+                print "%-23s:" % x[0], x[1]
 
 def xm_console(args):
     arg_check(args, "console", 1, 2)
@@ -1314,13 +1386,17 @@ def xm_console(args):
     dom = params[0]
 
     try:
-        info = server.xend.domain(dom)
+        if serverType == SERVER_XEN_API:
+            domid = int(server.xenapi.VM.get_domid(get_single_vm(dom)))
+        else:
+            info = server.xend.domain(dom)
+            domid = int(sxp.child_value(info, 'domid', '-1'))
     except:
         if quiet:
             sys.exit(1)
         else:
             raise
-    domid = int(sxp.child_value(info, 'domid', '-1'))
+        
     if domid == -1:
         if quiet:
             sys.exit(1)
@@ -1428,17 +1504,33 @@ def xm_dmesg(args):
         err("No parameter required")
         usage('dmesg')
 
-    if not use_clear:
-        print server.xend.node.dmesg.info()
-    else:
-        server.xend.node.dmesg.clear()
+    if serverType == SERVER_XEN_API:
+        if not use_clear:
+            print server.xenapi.host.dmesg(
+                server.xenapi.session.get_this_host(),0)
+        else:
+            server.xenapi.host.dmesg(
+                server.xenapi.session.get_this_host(),1)
+    else:
+        if not use_clear:
+            print server.xend.node.dmesg.info()
+        else:
+            server.xend.node.dmesg.clear()
 
 def xm_log(args):
     arg_check(args, "log", 0)
-    
-    print server.xend.node.log()
+
+    if serverType == SERVER_XEN_API:
+        print server.xenapi.host.get_log(
+            server.xenapi.session.get_this_host())
+    else:
+        print server.xend.node.log()
 
 def xm_serve(args):
+    if serverType == SERVER_XEN_API:
+        print "Not supported with XenAPI"
+        sys.exit(-1)
+
     arg_check(args, "serve", 0)
 
     from fcntl import fcntl, F_SETFL
diff -r a230a1a167dc -r 1584263f9fc5 tools/python/xen/xm/shutdown.py
--- a/tools/python/xen/xm/shutdown.py   Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/python/xen/xm/shutdown.py   Thu Mar 15 09:04:23 2007 -0600
@@ -21,7 +21,8 @@ import time
 
 from xen.xend import sxp
 from opts import *
-from main import server
+from main import server, serverType, SERVER_XEN_API, get_single_vm
+from xen.xend.XendAPIConstants import *
 
 gopts = Opts(use="""[options] [DOM]
 
@@ -49,6 +50,9 @@ gopts.opt('reboot', short='R',
           use='Shutdown and reboot.')
 
 def wait_reboot(opts, doms, rcs):
+    if serverType == SERVER_XEN_API:
+           opts.err("Cannot wait for reboot w/ XenAPI (yet)")
+
     while doms:
         alive = server.xend.domains(0)
         reboot = []
@@ -68,7 +72,12 @@ def wait_reboot(opts, doms, rcs):
 
 def wait_shutdown(opts, doms):
     while doms:
-        alive = server.xend.domains(0)
+        if serverType == SERVER_XEN_API:
+                   alive = [dom for dom in server.xenapi.VM.get_all()
+                     if server.xenapi.VM.get_power_state(dom) ==
+                     XEN_API_VM_POWER_STATE[XEN_API_VM_POWER_STATE_RUNNING]]
+        else:
+            alive = server.xend.domains(0)
         dead = []
         for d in doms:
             if d in alive: continue
@@ -82,8 +91,16 @@ def shutdown(opts, doms, mode, wait):
 def shutdown(opts, doms, mode, wait):
     rcs = {}
     for d in doms:
-        rcs[d] = server.xend.domain.getRestartCount(d)
-        server.xend.domain.shutdown(d, mode)
+               if serverType == SERVER_XEN_API:
+                       if mode == 'halt':
+                               server.xenapi.VM.clean_shutdown(d)
+                       if mode == 'reboot':
+                               server.xenapi.VM.clean_reboot(d)
+                       if mode == 'poweroff':
+                               server.xenapi.VM.clean_shutdown(d)              
                
+               else:
+                       rcs[d] = server.xend.domain.getRestartCount(d)
+                       server.xend.domain.shutdown(d, mode)
 
     if wait:
         if mode == 'reboot':
@@ -103,9 +120,13 @@ def shutdown_mode(opts):
         return 'poweroff'
 
 def main_all(opts, args):
-    doms = server.xend.domains(0)
-    dom0_name = sxp.child_value(server.xend.domain(0), 'name')
-    doms.remove(dom0_name)
+    if serverType == SERVER_XEN_API:
+        doms = [dom for dom in server.xenapi.VM.get_all()
+                if not server.xenapi.VM.get_is_control_domain(dom)]
+    else:
+        doms = server.xend.domains(0)
+        dom0_name = sxp.child_value(server.xend.domain(0), 'name')
+        doms.remove(dom0_name)
     mode = shutdown_mode(opts)  
     shutdown(opts, doms, mode, opts.vals.wait)
 
@@ -113,6 +134,8 @@ def main_dom(opts, args):
     if len(args) == 0: opts.err('No domain parameter given')
     if len(args) >  1: opts.err('No multiple domain parameters allowed')
     dom = args[0]
+    if serverType == SERVER_XEN_API:
+               dom = get_single_vm(dom)
     mode = shutdown_mode(opts)  
     shutdown(opts, [ dom ], mode, opts.vals.wait)
     
diff -r a230a1a167dc -r 1584263f9fc5 
tools/xm-test/tests/destroy/01_destroy_basic_pos.py
--- a/tools/xm-test/tests/destroy/01_destroy_basic_pos.py       Thu Mar 15 
09:00:42 2007 -0600
+++ b/tools/xm-test/tests/destroy/01_destroy_basic_pos.py       Thu Mar 15 
09:04:23 2007 -0600
@@ -37,4 +37,4 @@ if not re.search("proc", run["output"]):
 # destroy domain - positive test
 status, output = traceCommand("xm destroy %s" % domain.getName())
 if status != 0:
-    FAIL("xm destroy returned invalud %i != 0" % status)
+    FAIL("xm destroy returned invalid %i != 0" % status)
diff -r a230a1a167dc -r 1584263f9fc5 tools/xm-test/tests/vtpm/09_vtpm-xapi.py
--- a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py  Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py  Thu Mar 15 09:04:23 2007 -0600
@@ -91,7 +91,7 @@ try:
 try:
     console = domain.start()
 except DomainError, e:
-    FAIL("Unable to create domain (%s)" % domName)
+    FAIL("Unable to create domain (%s)")
 
 try:
     console.sendInput("input")
diff -r a230a1a167dc -r 1584263f9fc5 tools/xm-test/tests/vtpm/vtpm_utils.py
--- a/tools/xm-test/tests/vtpm/vtpm_utils.py    Thu Mar 15 09:00:42 2007 -0600
+++ b/tools/xm-test/tests/vtpm/vtpm_utils.py    Thu Mar 15 09:04:23 2007 -0600
@@ -8,7 +8,8 @@ if ENABLE_HVM_SUPPORT:
 if ENABLE_HVM_SUPPORT:
     SKIP("vtpm tests not supported for HVM domains")
 
-status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep")
+status, output = traceCommand("COLUMNS=200 ; "
+                              "ps aux | grep vtpm_manager | grep -v grep")
 if output == "":
     SKIP("virtual TPM manager must be started to run this test; might "
          "need /dev/tpm0")
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/ia64/xen/domain.c        Thu Mar 15 09:04:23 2007 -0600
@@ -676,8 +676,11 @@ int arch_set_info_guest(struct vcpu *v, 
        /* This overrides some registers. */
        vcpu_init_regs(v);
 
-       /* Don't redo final setup */
-       set_bit(_VCPUF_initialised, &v->vcpu_flags);
+       /* Don't redo final setup. Auto-online VCPU0. */
+       if (!test_and_set_bit(_VCPUF_initialised, &v->vcpu_flags) &&
+           (v->vcpu_id == 0))
+               clear_bit(_VCPUF_down, &v->vcpu_flags);
+
        return 0;
 }
 
@@ -1186,6 +1189,7 @@ int construct_dom0(struct domain *d,
        printk("Dom0: 0x%lx\n", (u64)dom0);
 
        set_bit(_VCPUF_initialised, &v->vcpu_flags);
+       clear_bit(_VCPUF_down, &v->vcpu_flags);
 
        /* Build firmware.
           Note: Linux kernel reserve memory used by start_info, so there is
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/powerpc/domain.c Thu Mar 15 09:04:23 2007 -0600
@@ -168,7 +168,10 @@ int arch_set_info_guest(struct vcpu *v, 
     d->shared_info->wc_nsec = dom0->shared_info->wc_nsec;
     d->shared_info->arch.boot_timebase = dom0->shared_info->arch.boot_timebase;
 
-    set_bit(_VCPUF_initialised, &v->vcpu_flags);
+    /* Auto-online VCPU0 when it is initialised. */
+    if ( !test_and_set_bit(_VCPUF_initialised, &v->vcpu_flags) &&
+         (v->vcpu_id == 0) )
+        clear_bit(_VCPUF_down, &v->vcpu_flags);
 
     cpu_init_vcpu(v);
 
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/powerpc/domain_build.c   Thu Mar 15 09:04:23 2007 -0600
@@ -274,6 +274,7 @@ int construct_dom0(struct domain *d,
     ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr);
 
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
+    clear_bit(_VCPUF_down, &v->vcpu_flags);
 
     rc = 0;
 
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/domain.c     Thu Mar 15 09:04:23 2007 -0600
@@ -601,7 +601,7 @@ int arch_set_info_guest(
     }
 
     if ( test_bit(_VCPUF_initialised, &v->vcpu_flags) )
-        return 0;
+        goto out;
 
     memset(v->arch.guest_context.debugreg, 0,
            sizeof(v->arch.guest_context.debugreg));
@@ -706,6 +706,11 @@ int arch_set_info_guest(
 
     update_cr3(v);
 
+ out:
+    if ( flags & VGCF_online )
+        clear_bit(_VCPUF_down, &v->vcpu_flags);
+    else
+        set_bit(_VCPUF_down, &v->vcpu_flags);
     return 0;
 #undef c
 }
@@ -1381,7 +1386,8 @@ int hypercall_xlat_continuation(unsigned
 }
 #endif
 
-static void relinquish_memory(struct domain *d, struct list_head *list)
+static void relinquish_memory(struct domain *d, struct list_head *list,
+                              unsigned long type)
 {
     struct list_head *ent;
     struct page_info  *page;
@@ -1410,23 +1416,24 @@ static void relinquish_memory(struct dom
             put_page(page);
 
         /*
-         * Forcibly invalidate base page tables at this point to break circular
-         * 'linear page table' references. This is okay because MMU structures
-         * are not shared across domains and this domain is now dead. Thus base
-         * tables are not in use so a non-zero count means circular reference.
+         * Forcibly invalidate top-most, still valid page tables at this point
+         * to break circular 'linear page table' references. This is okay
+         * because MMU structures are not shared across domains and this domain
+         * is now dead. Thus top-most valid tables are not in use so a non-zero
+         * count means circular reference.
          */
         y = page->u.inuse.type_info;
         for ( ; ; )
         {
             x = y;
             if ( likely((x & (PGT_type_mask|PGT_validated)) !=
-                        (PGT_base_page_table|PGT_validated)) )
+                        (type|PGT_validated)) )
                 break;
 
             y = cmpxchg(&page->u.inuse.type_info, x, x & ~PGT_validated);
             if ( likely(y == x) )
             {
-                free_page_type(page, PGT_base_page_table);
+                free_page_type(page, type);
                 break;
             }
         }
@@ -1524,8 +1531,16 @@ void domain_relinquish_resources(struct 
         destroy_gdt(v);
 
     /* Relinquish every page of memory. */
-    relinquish_memory(d, &d->xenpage_list);
-    relinquish_memory(d, &d->page_list);
+#if CONFIG_PAGING_LEVELS >= 4
+    relinquish_memory(d, &d->xenpage_list, PGT_l4_page_table);
+    relinquish_memory(d, &d->page_list, PGT_l4_page_table);
+#endif
+#if CONFIG_PAGING_LEVELS >= 3
+    relinquish_memory(d, &d->xenpage_list, PGT_l3_page_table);
+    relinquish_memory(d, &d->page_list, PGT_l3_page_table);
+#endif
+    relinquish_memory(d, &d->xenpage_list, PGT_l2_page_table);
+    relinquish_memory(d, &d->page_list, PGT_l2_page_table);
 
     /* Free page used by xen oprofile buffer */
     free_xenoprof_pages(d);
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/domain_build.c       Thu Mar 15 09:04:23 2007 -0600
@@ -902,6 +902,7 @@ int construct_dom0(struct domain *d,
     update_domain_wallclock_time(d);
 
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
+    clear_bit(_VCPUF_down, &v->vcpu_flags);
 
     /*
      * Initial register values:
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c     Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/domctl.c     Thu Mar 15 09:04:23 2007 -0600
@@ -450,6 +450,8 @@ void arch_get_info_guest(struct vcpu *v,
     c(flags &= ~(VGCF_i387_valid|VGCF_in_kernel));
     if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
         c(flags |= VGCF_i387_valid);
+    if ( !test_bit(_VCPUF_down, &v->vcpu_flags) )
+        c(flags |= VGCF_online);
 
     if ( is_hvm_vcpu(v) )
     {
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/gdbstub.c
--- a/xen/arch/x86/gdbstub.c    Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/gdbstub.c    Thu Mar 15 09:04:23 2007 -0600
@@ -73,38 +73,16 @@ gdb_arch_read_reg(unsigned long regnum, 
 
 /* Like copy_from_user, but safe to call with interrupts disabled.
    Trust me, and don't look behind the curtain. */
-unsigned 
+unsigned int
 gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
 {
-    int __d0, __d1, __d2;
-    ASSERT(!local_irq_is_enabled());
-    __asm__ __volatile__(
-        "1: rep; movsb\n"
-        "2:\n"
-        ".section .fixup,\"ax\"\n"
-        "3:     addl $4, %%esp\n"
-        "       jmp 2b\n"
-        ".previous\n"
-        ".section __pre_ex_table,\"a\"\n"
-        "   "__FIXUP_ALIGN"\n"
-        "   "__FIXUP_WORD" 1b,3b\n"
-        ".previous\n"
-        ".section __ex_table,\"a\"\n"
-        "   "__FIXUP_ALIGN"\n"
-        "   "__FIXUP_WORD" 1b,2b\n"
-        ".previous\n"
-        : "=c"(__d2), "=D" (__d0), "=S" (__d1)
-        : "0"(len), "1"(dest), "2"(src)
-        : "memory");
-    ASSERT(!local_irq_is_enabled());
-    return __d2;
+    return copy_from_user(dest, src, len);
 }
 
 unsigned int 
 gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
 {
-    /* XXX  */
-    return len;
+    return copy_to_user(dest, src, len);
 }
 
 void 
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Mar 15 09:04:23 2007 -0600
@@ -43,7 +43,6 @@
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/svm/emulate.h>
-#include <asm/hvm/svm/vmmcall.h>
 #include <asm/hvm/svm/intr.h>
 #include <asm/x86_emulate.h>
 #include <public/sched.h>
@@ -2587,65 +2586,6 @@ static int svm_do_vmmcall_reset_to_realm
     vmcb->rax = 0;
     vmcb->rsp = 0;
 
-    return 0;
-}
-
-
-/*
- * svm_do_vmmcall - SVM VMMCALL handler
- *
- * returns 0 on success, non-zero otherwise
- */
-static int svm_do_vmmcall(struct vcpu *v, struct cpu_user_regs *regs)
-{
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
-    int inst_len;
-
-    ASSERT(vmcb);
-    ASSERT(regs);
-
-    inst_len = __get_instruction_length(v, INSTR_VMCALL, NULL);
-    ASSERT(inst_len > 0);
-
-    HVMTRACE_1D(VMMCALL, v, regs->eax);
-
-    if ( regs->eax & 0x80000000 )
-    {
-        /* VMMCALL sanity check */
-        if ( vmcb->cpl > get_vmmcall_cpl(regs->edi) )
-        {
-            printk("VMMCALL CPL check failed\n");
-            return -1;
-        }
-
-        /* handle the request */
-        switch ( regs->eax )
-        {
-        case VMMCALL_RESET_TO_REALMODE:
-            if ( svm_do_vmmcall_reset_to_realmode(v, regs) )
-            {
-                printk("svm_do_vmmcall_reset_to_realmode() failed\n");
-                return -1;
-            }
-            /* since we just reset the VMCB, return without adjusting
-             * the eip */
-            return 0;
-
-        case VMMCALL_DEBUG:
-            printk("DEBUG features not implemented yet\n");
-            break;
-        default:
-            break;
-        }
-
-        hvm_print_line(v, regs->eax); /* provides the current domain */
-    }
-    else
-    {
-        hvm_do_hypercall(regs);
-    }
-
-    __update_guest_eip(vmcb, inst_len);
     return 0;
 }
 
@@ -3152,9 +3092,14 @@ asmlinkage void svm_vmexit_handler(struc
         svm_handle_invlpg(1, regs);
         break;
 
-    case VMEXIT_VMMCALL:
-        svm_do_vmmcall(v, regs);
-        break;
+    case VMEXIT_VMMCALL: {
+        int inst_len = __get_instruction_length(v, INSTR_VMCALL, NULL);
+        ASSERT(inst_len > 0);
+        HVMTRACE_1D(VMMCALL, v, regs->eax);
+        __update_guest_eip(vmcb, inst_len);
+        hvm_do_hypercall(regs);
+        break;
+    }
 
     case VMEXIT_CR0_READ:
         svm_cr_access(v, 0, TYPE_MOV_FROM_CR, regs);
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/hvm/vlapic.c Thu Mar 15 09:04:23 2007 -0600
@@ -195,8 +195,9 @@ int vlapic_match_logical_addr(struct vla
             result = 1;
         break;
     default:
-        gdprintk(XENLOG_WARNING, "Bad DFR value for lapic of vcpu %d\n",
-                 vlapic_vcpu(vlapic)->vcpu_id);
+        gdprintk(XENLOG_WARNING, "Bad DFR value for lapic of vcpu %d: %08x\n",
+                 vlapic_vcpu(vlapic)->vcpu_id,
+                 vlapic_get_reg(vlapic, APIC_DFR));
         break;
     }
 
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/mm.c Thu Mar 15 09:04:23 2007 -0600
@@ -517,7 +517,6 @@ static int get_page_and_type_from_pagenr
     return 1;
 }
 
-#ifndef CONFIG_X86_PAE /* We do not support guest linear mappings on PAE. */
 /*
  * We allow root tables to map each other (a.k.a. linear page tables). It
  * needs some special care with reference counts and access permissions:
@@ -530,48 +529,48 @@ static int get_page_and_type_from_pagenr
  *     frame if it is mapped by a different root table. This is sufficient and
  *     also necessary to allow validation of a root table mapping itself.
  */
-static int 
-get_linear_pagetable(
-    root_pgentry_t re, unsigned long re_pfn, struct domain *d)
-{
-    unsigned long x, y;
-    struct page_info *page;
-    unsigned long pfn;
-
-    if ( (root_get_flags(re) & _PAGE_RW) )
-    {
-        MEM_LOG("Attempt to create linear p.t. with write perms");
-        return 0;
-    }
-
-    if ( (pfn = root_get_pfn(re)) != re_pfn )
-    {
-        /* Make sure the mapped frame belongs to the correct domain. */
-        if ( unlikely(!get_page_from_pagenr(pfn, d)) )
-            return 0;
-
-        /*
-         * Make sure that the mapped frame is an already-validated L2 table. 
-         * If so, atomically increment the count (checking for overflow).
-         */
-        page = mfn_to_page(pfn);
-        y = page->u.inuse.type_info;
-        do {
-            x = y;
-            if ( unlikely((x & PGT_count_mask) == PGT_count_mask) ||
-                 unlikely((x & (PGT_type_mask|PGT_validated)) != 
-                          (PGT_root_page_table|PGT_validated)) )
-            {
-                put_page(page);
-                return 0;
-            }
-        }
-        while ( (y = cmpxchg(&page->u.inuse.type_info, x, x + 1)) != x );
-    }
-
-    return 1;
-}
-#endif /* !CONFIG_X86_PAE */
+#define define_get_linear_pagetable(level)                                  \
+static int                                                                  \
+get_##level##_linear_pagetable(                                             \
+    level##_pgentry_t pde, unsigned long pde_pfn, struct domain *d)         \
+{                                                                           \
+    unsigned long x, y;                                                     \
+    struct page_info *page;                                                 \
+    unsigned long pfn;                                                      \
+                                                                            \
+    if ( (level##e_get_flags(pde) & _PAGE_RW) )                             \
+    {                                                                       \
+        MEM_LOG("Attempt to create linear p.t. with write perms");          \
+        return 0;                                                           \
+    }                                                                       \
+                                                                            \
+    if ( (pfn = level##e_get_pfn(pde)) != pde_pfn )                         \
+    {                                                                       \
+        /* Make sure the mapped frame belongs to the correct domain. */     \
+        if ( unlikely(!get_page_from_pagenr(pfn, d)) )                      \
+            return 0;                                                       \
+                                                                            \
+        /*                                                                  \
+         * Ensure that the mapped frame is an already-validated page table. \
+         * If so, atomically increment the count (checking for overflow).   \
+         */                                                                 \
+        page = mfn_to_page(pfn);                                            \
+        y = page->u.inuse.type_info;                                        \
+        do {                                                                \
+            x = y;                                                          \
+            if ( unlikely((x & PGT_count_mask) == PGT_count_mask) ||        \
+                 unlikely((x & (PGT_type_mask|PGT_validated)) !=            \
+                          (PGT_##level##_page_table|PGT_validated)) )       \
+            {                                                               \
+                put_page(page);                                             \
+                return 0;                                                   \
+            }                                                               \
+        }                                                                   \
+        while ( (y = cmpxchg(&page->u.inuse.type_info, x, x + 1)) != x );   \
+    }                                                                       \
+                                                                            \
+    return 1;                                                               \
+}
 
 int
 get_page_from_l1e(
@@ -633,7 +632,8 @@ get_page_from_l1e(
 
 
 /* NB. Virtual address 'l2e' maps to a machine address within frame 'pfn'. */
-static int 
+define_get_linear_pagetable(l2);
+static int
 get_page_from_l2e(
     l2_pgentry_t l2e, unsigned long pfn, struct domain *d)
 {
@@ -649,16 +649,16 @@ get_page_from_l2e(
     }
 
     rc = get_page_and_type_from_pagenr(l2e_get_pfn(l2e), PGT_l1_page_table, d);
-#if CONFIG_PAGING_LEVELS == 2
     if ( unlikely(!rc) )
-        rc = get_linear_pagetable(l2e, pfn, d);
-#endif
+        rc = get_l2_linear_pagetable(l2e, pfn, d);
+
     return rc;
 }
 
 
 #if CONFIG_PAGING_LEVELS >= 3
-static int 
+define_get_linear_pagetable(l3);
+static int
 get_page_from_l3e(
     l3_pgentry_t l3e, unsigned long pfn, struct domain *d)
 {
@@ -674,12 +674,16 @@ get_page_from_l3e(
     }
 
     rc = get_page_and_type_from_pagenr(l3e_get_pfn(l3e), PGT_l2_page_table, d);
+    if ( unlikely(!rc) )
+        rc = get_l3_linear_pagetable(l3e, pfn, d);
+
     return rc;
 }
 #endif /* 3 level */
 
 #if CONFIG_PAGING_LEVELS >= 4
-static int 
+define_get_linear_pagetable(l4);
+static int
 get_page_from_l4e(
     l4_pgentry_t l4e, unsigned long pfn, struct domain *d)
 {
@@ -695,9 +699,8 @@ get_page_from_l4e(
     }
 
     rc = get_page_and_type_from_pagenr(l4e_get_pfn(l4e), PGT_l3_page_table, d);
-
     if ( unlikely(!rc) )
-        rc = get_linear_pagetable(l4e, pfn, d);
+        rc = get_l4_linear_pagetable(l4e, pfn, d);
 
     return rc;
 }
@@ -2765,7 +2768,9 @@ int do_update_va_mapping(unsigned long v
             flush_tlb_one_mask(d->domain_dirty_cpumask, va);
             break;
         default:
-            if ( unlikely(get_user(vmask, (unsigned long *)bmap_ptr)) )
+            if ( unlikely(!IS_COMPAT(d) ?
+                          get_user(vmask, (unsigned long *)bmap_ptr) :
+                          get_user(vmask, (unsigned int *)bmap_ptr)) )
                 rc = -EFAULT;
             pmask = vcpumask_to_pcpumask(d, vmask);
             flush_tlb_one_mask(pmask, va);
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/mm/shadow/common.c   Thu Mar 15 09:04:23 2007 -0600
@@ -2813,7 +2813,11 @@ shadow_write_p2m_entry(struct vcpu *v, u
        This is pretty heavy handed, but this is a rare operation
        (it might happen a dozen times during boot and then never
        again), so it doesn't matter too much. */
-    shadow_blow_tables(d);
+    if ( d->arch.paging.shadow.has_fast_mmio_entries )
+    {
+        shadow_blow_tables(d);
+        d->arch.paging.shadow.has_fast_mmio_entries = 0;
+    }
 #endif
 
     shadow_unlock(d);
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c    Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/mm/shadow/multi.c    Thu Mar 15 09:04:23 2007 -0600
@@ -660,6 +660,8 @@ _sh_propagate(struct vcpu *v,
     {
         /* Guest l1e maps MMIO space */
         *sp = sh_l1e_mmio(guest_l1e_get_gfn(*gp), gflags);
+        if ( !d->arch.paging.shadow.has_fast_mmio_entries )
+            d->arch.paging.shadow.has_fast_mmio_entries = 1;
         goto done;
     }
 
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/traps.c      Thu Mar 15 09:04:23 2007 -0600
@@ -905,6 +905,10 @@ static int fixup_page_fault(unsigned lon
     struct vcpu   *v = current;
     struct domain *d = v->domain;
 
+    /* No fixups in interrupt context or when interrupts are disabled. */
+    if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
+        return 0;
+
     if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
     {
         if ( paging_mode_external(d) && guest_mode(regs) )
@@ -914,9 +918,6 @@ static int fixup_page_fault(unsigned lon
                 addr - GDT_LDT_VIRT_START, regs);
         return 0;
     }
-
-    ASSERT(!in_irq());
-    ASSERT(regs->eflags & X86_EFLAGS_IF);
 
     if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
          guest_kernel_mode(v, regs) &&
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/x86_64/compat_kexec.S
--- a/xen/arch/x86/x86_64/compat_kexec.S        Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/x86_64/compat_kexec.S        Thu Mar 15 09:04:23 2007 -0600
@@ -103,13 +103,13 @@ compat_page_list:
 
         /*
          * These compat page tables contain an identity mapping of the
-         * first 1G of the physical address space.
+         * first 4G of the physical address space.
          */
 compat_pg_table:
         .long compat_pg_table_l2 + 0*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
-        .long 0, 0
-        .long 0, 0
-        .long 0, 0
+        .long compat_pg_table_l2 + 1*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
+        .long compat_pg_table_l2 + 2*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
+        .long compat_pg_table_l2 + 3*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
 
         .align 4096,0
 
@@ -123,4 +123,7 @@ compat_pg_table_l2:
         .endif
         .endm
 
-        identmap
+        identmap 0x00000000
+        identmap 0x40000000
+        identmap 0x80000000
+        identmap 0xc0000000
diff -r a230a1a167dc -r 1584263f9fc5 xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c        Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/arch/x86/x86_emulate.c        Thu Mar 15 09:04:23 2007 -0600
@@ -726,7 +726,7 @@ x86_emulate(
     uint8_t modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0;
     unsigned int op_bytes, def_op_bytes, ad_bytes, def_ad_bytes;
     unsigned int lock_prefix = 0, rep_prefix = 0;
-    int rc = X86EMUL_OKAY;
+    int override_seg = -1, rc = X86EMUL_OKAY;
     struct operand src, dst;
 
     /* Data operand effective address (usually computed from ModRM). */
@@ -758,22 +758,22 @@ x86_emulate(
             ad_bytes = def_ad_bytes ^ (mode_64bit() ? 12 : 6);
             break;
         case 0x2e: /* CS override */
-            ea.mem.seg = x86_seg_cs;
+            override_seg = x86_seg_cs;
             break;
         case 0x3e: /* DS override */
-            ea.mem.seg = x86_seg_ds;
+            override_seg = x86_seg_ds;
             break;
         case 0x26: /* ES override */
-            ea.mem.seg = x86_seg_es;
+            override_seg = x86_seg_es;
             break;
         case 0x64: /* FS override */
-            ea.mem.seg = x86_seg_fs;
+            override_seg = x86_seg_fs;
             break;
         case 0x65: /* GS override */
-            ea.mem.seg = x86_seg_gs;
+            override_seg = x86_seg_gs;
             break;
         case 0x36: /* SS override */
-            ea.mem.seg = x86_seg_ss;
+            override_seg = x86_seg_ss;
             break;
         case 0xf0: /* LOCK */
             lock_prefix = 1;
@@ -839,14 +839,35 @@ x86_emulate(
             /* 16-bit ModR/M decode. */
             switch ( modrm_rm )
             {
-            case 0: ea.mem.off = _regs.ebx + _regs.esi; break;
-            case 1: ea.mem.off = _regs.ebx + _regs.edi; break;
-            case 2: ea.mem.off = _regs.ebp + _regs.esi; break;
-            case 3: ea.mem.off = _regs.ebp + _regs.edi; break;
-            case 4: ea.mem.off = _regs.esi; break;
-            case 5: ea.mem.off = _regs.edi; break;
-            case 6: ea.mem.off = _regs.ebp; break;
-            case 7: ea.mem.off = _regs.ebx; break;
+            case 0:
+                ea.mem.off = _regs.ebx + _regs.esi;
+                break;
+            case 1:
+                ea.mem.off = _regs.ebx + _regs.edi;
+                break;
+            case 2:
+                ea.mem.seg = x86_seg_ss;
+                ea.mem.off = _regs.ebp + _regs.esi;
+                break;
+            case 3:
+                ea.mem.seg = x86_seg_ss;
+                ea.mem.off = _regs.ebp + _regs.edi;
+                break;
+            case 4:
+                ea.mem.off = _regs.esi;
+                break;
+            case 5:
+                ea.mem.off = _regs.edi;
+                break;
+            case 6:
+                if ( modrm_mod == 0 )
+                    break;
+                ea.mem.seg = x86_seg_ss;
+                ea.mem.off = _regs.ebp;
+                break;
+            case 7:
+                ea.mem.off = _regs.ebx;
+                break;
             }
             switch ( modrm_mod )
             {
@@ -876,10 +897,20 @@ x86_emulate(
                 ea.mem.off <<= (sib >> 6) & 3;
                 if ( (modrm_mod == 0) && ((sib_base & 7) == 5) )
                     ea.mem.off += insn_fetch_type(int32_t);
-                else if ( (sib_base == 4) && !twobyte && (b == 0x8f) )
-                    /* POP <rm> must have its EA calculated post increment. */
-                    ea.mem.off += _regs.esp +
-                        ((mode_64bit() && (op_bytes == 4)) ? 8 : op_bytes);
+                else if ( sib_base == 4 )
+                {
+                    ea.mem.seg  = x86_seg_ss;
+                    ea.mem.off += _regs.esp;
+                    if ( !twobyte && (b == 0x8f) )
+                        /* POP <rm> computes its EA post increment. */
+                        ea.mem.off += ((mode_64bit() && (op_bytes == 4))
+                                       ? 8 : op_bytes);
+                }
+                else if ( sib_base == 5 )
+                {
+                    ea.mem.seg  = x86_seg_ss;
+                    ea.mem.off += _regs.ebp;
+                }
                 else
                     ea.mem.off += *(long*)decode_register(sib_base, &_regs, 0);
             }
@@ -887,6 +918,8 @@ x86_emulate(
             {
                 modrm_rm |= (rex_prefix & 1) << 3;
                 ea.mem.off = *(long *)decode_register(modrm_rm, &_regs, 0);
+                if ( (modrm_rm == 5) && (modrm_mod != 0) )
+                    ea.mem.seg = x86_seg_ss;
             }
             switch ( modrm_mod )
             {
@@ -919,6 +952,9 @@ x86_emulate(
             ea.mem.off = truncate_ea(ea.mem.off);
         }
     }
+
+    if ( override_seg != -1 )
+        ea.mem.seg = override_seg;
 
     /* Special instructions do their own operand decoding. */
     if ( (d & DstMask) == ImplicitOps )
diff -r a230a1a167dc -r 1584263f9fc5 xen/common/domain.c
--- a/xen/common/domain.c       Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/common/domain.c       Thu Mar 15 09:04:23 2007 -0600
@@ -102,7 +102,7 @@ struct vcpu *alloc_vcpu(
     v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
     v->runstate.state_entry_time = NOW();
 
-    if ( (vcpu_id != 0) && !is_idle_domain(d) )
+    if ( !is_idle_domain(d) )
         set_bit(_VCPUF_down, &v->vcpu_flags);
 
     if ( sched_init_vcpu(v, cpu_id) != 0 )
diff -r a230a1a167dc -r 1584263f9fc5 xen/common/domctl.c
--- a/xen/common/domctl.c       Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/common/domctl.c       Thu Mar 15 09:04:23 2007 -0600
@@ -268,18 +268,14 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
     case XEN_DOMCTL_unpausedomain:
     {
         struct domain *d = rcu_lock_domain_by_id(op->domain);
-        ret = -ESRCH;
-        if ( d != NULL )
-        {
-            ret = -EINVAL;
-            if ( (d != current->domain) && (d->vcpu[0] != NULL) &&
-                 test_bit(_VCPUF_initialised, &d->vcpu[0]->vcpu_flags) )
-            {
-                domain_unpause_by_systemcontroller(d);
-                ret = 0;
-            }
-            rcu_unlock_domain(d);
-        }
+
+        ret = -ESRCH;
+        if ( d == NULL )
+            break;
+
+        domain_unpause_by_systemcontroller(d);
+        rcu_unlock_domain(d);
+        ret = 0;
     }
     break;
 
diff -r a230a1a167dc -r 1584263f9fc5 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/common/grant_table.c  Thu Mar 15 09:04:23 2007 -0600
@@ -1392,8 +1392,7 @@ gnttab_release_mappings(
             {
                 BUG_ON(!(act->pin & GNTPIN_hstr_mask));
                 act->pin -= GNTPIN_hstr_inc;
-                /* Done implicitly when page tables are destroyed. */
-                /* put_page(mfn_to_page(act->frame)); */
+                gnttab_release_put_page(mfn_to_page(act->frame));
             }
         }
         else
@@ -1409,8 +1408,7 @@ gnttab_release_mappings(
             {
                 BUG_ON(!(act->pin & GNTPIN_hstw_mask));
                 act->pin -= GNTPIN_hstw_inc;
-                /* Done implicitly when page tables are destroyed. */
-                /* put_page_and_type(mfn_to_page(act->frame)); */
+                gnttab_release_put_page_and_type(mfn_to_page(act->frame));
             }
 
             if ( (act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0 )
diff -r a230a1a167dc -r 1584263f9fc5 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/drivers/char/console.c        Thu Mar 15 09:04:23 2007 -0600
@@ -48,6 +48,10 @@ static int opt_sync_console;
 static int opt_sync_console;
 boolean_param("sync_console", opt_sync_console);
 
+/* console_to_ring: send guest (incl. dom 0) console data to console ring. */
+static int opt_console_to_ring;
+boolean_param("console_to_ring", opt_console_to_ring);
+
 #define CONRING_SIZE 16384
 #define CONRING_IDX_MASK(i) ((i)&(CONRING_SIZE-1))
 static char conring[CONRING_SIZE];
@@ -329,7 +333,14 @@ static long guest_console_write(XEN_GUES
         sercon_puts(kbuf);
 
         for ( kptr = kbuf; *kptr != '\0'; kptr++ )
+        {
             vga_putchar(*kptr);
+            if ( opt_console_to_ring )
+                putchar_console_ring(*kptr);
+        }
+
+        if ( opt_console_to_ring )
+            send_guest_global_virq(dom0, VIRQ_CON_RING);
 
         guest_handle_add_offset(buffer, kcount);
         count -= kcount;
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h        Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/include/asm-ia64/grant_table.h        Thu Mar 15 09:04:23 2007 -0600
@@ -64,4 +64,7 @@ static inline void gnttab_clear_flag(uns
        clear_bit(nr, addr);
 }
 
+#define gnttab_release_put_page(page)           put_page((page))
+#define gnttab_release_put_page_and_type(page)  put_page_and_type((page))
+
 #endif /* __ASM_GRANT_TABLE_H__ */
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/asm-powerpc/grant_table.h
--- a/xen/include/asm-powerpc/grant_table.h     Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/include/asm-powerpc/grant_table.h     Thu Mar 15 09:04:23 2007 -0600
@@ -69,4 +69,17 @@ static inline uint cpu_foreign_map_order
     /* 16 GiB */
     return 34 - PAGE_SHIFT;
 }
+
+#if 0
+/*
+ * without put_page()/put_page_and_type() page might be leaked.
+ * with put_page()/put_page_and_type() freed page might be accessed.
+ */
+#define gnttab_release_put_page(page)           put_page((page))
+#define gnttab_release_put_page_and_type(page)  put_page_and_type((page))
+#else
+#define gnttab_release_put_page(page)           do { } while (0)
+#define gnttab_release_put_page_and_type(page)  do { } while (0)
+#endif
+
 #endif  /* __ASM_PPC_GRANT_TABLE_H__ */
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h      Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/include/asm-x86/domain.h      Thu Mar 15 09:04:23 2007 -0600
@@ -78,6 +78,9 @@ struct shadow_domain {
     /* Shadow hashtable */
     struct shadow_page_info **hash_table;
     int hash_walking;  /* Some function is walking the hash table */
+
+    /* Fast MMIO path heuristic */
+    int has_fast_mmio_entries;
 
     /* Shadow log-dirty bitmap */
     unsigned long *dirty_bitmap;
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/include/asm-x86/grant_table.h Thu Mar 15 09:04:23 2007 -0600
@@ -38,4 +38,14 @@ static inline void gnttab_clear_flag(uns
     clear_bit(nr, addr);
 }
 
+#define gnttab_release_put_page(page)                           \
+    do {                                                        \
+        /* Done implicitly when page tables are destroyed. */   \
+    } while (0)
+
+#define gnttab_release_put_page_and_type(page)                  \
+    do {                                                        \
+        /* Done implicitly when page tables are destroyed. */   \
+    } while (0)
+
 #endif /* __ASM_GRANT_TABLE_H__ */
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/asm-x86/hvm/svm/vmmcall.h
--- a/xen/include/asm-x86/hvm/svm/vmmcall.h     Thu Mar 15 09:00:42 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * vmmcall.h: VMMCALL instruction support
- *
- * Travis Betak, travis.betak@xxxxxxx
- * Copyright (c) 2005, AMD Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- */
-
-#ifndef __ASM_X86_HVM_SVM_VMMCALL_H__
-#define __ASM_X86_HVM_SVM_VMMCALL_H__
-
-/* VMMCALL command fields */
-#define VMMCALL_CODE_CPL_MASK     0x60000000
-#define VMMCALL_CODE_MBZ_MASK     0x1FFF0000
-#define VMMCALL_CODE_COMMAND_MASK 0x0000FFFF
-
-#define MAKE_VMMCALL_CODE(cpl,func) ((cpl << 29) | (func) | 0x80000000)
-
-/* CPL=0 VMMCALL Requests */
-#define VMMCALL_RESET_TO_REALMODE   MAKE_VMMCALL_CODE(0,1)
-
-/* CPL=3 VMMCALL Requests */
-#define VMMCALL_DEBUG           MAKE_VMMCALL_CODE(3,1)
-
-/* return the cpl required for the vmmcall cmd */
-static inline int get_vmmcall_cpl(int cmd)
-{
-    return (cmd & VMMCALL_CODE_CPL_MASK) >> 29;
-}
-
-#endif /* __ASM_X86_HVM_SVM_VMMCALL_H__ */
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/include/public/arch-x86/xen.h Thu Mar 15 09:04:23 2007 -0600
@@ -126,6 +126,8 @@ struct vcpu_guest_context {
 #define VGCF_failsafe_disables_events  (1<<_VGCF_failsafe_disables_events)
 #define _VGCF_syscall_disables_events  4
 #define VGCF_syscall_disables_events   (1<<_VGCF_syscall_disables_events)
+#define _VGCF_online                   5
+#define VGCF_online                    (1<<_VGCF_online)
     unsigned long flags;                    /* VGCF_* flags                 */
     struct cpu_user_regs user_regs;         /* User-level CPU registers     */
     struct trap_info trap_ctxt[256];        /* Virtual IDT                  */
diff -r a230a1a167dc -r 1584263f9fc5 xen/include/public/foreign/structs.py
--- a/xen/include/public/foreign/structs.py     Thu Mar 15 09:00:42 2007 -0600
+++ b/xen/include/public/foreign/structs.py     Thu Mar 15 09:04:23 2007 -0600
@@ -41,6 +41,8 @@ defines = [ "__i386__",
             "VGCF_failsafe_disables_events",
             "_VGCF_syscall_disables_events",
             "VGCF_syscall_disables_events",
+            "_VGCF_online",
+            "VGCF_online",
 
             # ia64
             "VGCF_EXTRA_REGS",

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