Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] MErge with xenppc-unstable-merge.hg
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Jul 2006 16:21:57 +0000
Delivery-date: Fri, 28 Jul 2006 09:32:48 -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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID e5c84586c333c7be0a70228cca51865c29bab21c
# Parent  1eb42266de1b0a312dc5981381c1968581e6b243
# Parent  158db2446071c0d6aad69c12070a98a25092aa78
MErge with xenppc-unstable-merge.hg
---
 tools/libxc/xc_ia64_stubs.c                          |  756 --------
 xen/include/asm-ia64/linux/asm/asmmacro.h            |  111 -
 Config.mk                                            |    2 
 buildconfigs/linux-defconfig_xen0_ia64               |   28 
 buildconfigs/linux-defconfig_xen_ia64                |   28 
 linux-2.6-xen-sparse/arch/ia64/Kconfig               |    9 
 linux-2.6-xen-sparse/arch/ia64/kernel/gate.S         |  488 +++++
 linux-2.6-xen-sparse/arch/ia64/kernel/gate.lds.S     |  117 +
 linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c     |   77 
 linux-2.6-xen-sparse/arch/ia64/kernel/patch.c        |  268 +++
 linux-2.6-xen-sparse/arch/ia64/kernel/setup.c        |   24 
 linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S       |   56 
 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c      |   20 
 linux-2.6-xen-sparse/arch/ia64/xen/util.c            |    3 
 linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S        |   20 
 linux-2.6-xen-sparse/drivers/xen/core/reboot.c       |   27 
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c   |   11 
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |    2 
 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h    |   18 
 linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h   |    2 
 tools/ioemu/patches/domain-reset                     |    8 
 tools/ioemu/patches/domain-timeoffset                |   18 
 tools/ioemu/patches/hypervisor-pit                   |   10 
 tools/ioemu/patches/ioemu-ia64                       |   27 
 tools/ioemu/patches/qemu-bugfixes                    |   14 
 tools/ioemu/patches/qemu-logging                     |   16 
 tools/ioemu/patches/qemu-smp                         |   10 
 tools/ioemu/patches/qemu-target-i386-dm              |   20 
 tools/ioemu/patches/shared-vram                      |   16 
 tools/ioemu/patches/support-xm-console               |   12 
 tools/ioemu/patches/vnc-cleanup                      |   22 
 tools/ioemu/patches/vnc-fixes                        |    8 
 tools/ioemu/patches/vnc-start-vncviewer              |   18 
 tools/ioemu/patches/xen-domain-name                  |   14 
 tools/ioemu/patches/xen-domid                        |   15 
 tools/ioemu/patches/xen-mm                           |   12 
 tools/ioemu/patches/xen-network                      |    6 
 tools/ioemu/target-i386-dm/exec-dm.c                 |    8 
 tools/ioemu/vl.c                                     |    1 
 tools/libxc/Makefile                                 |    6 
 tools/libxc/ia64/Makefile                            |    5 
 tools/libxc/ia64/xc_ia64_hvm_build.c                 |  673 +++++++
 tools/libxc/ia64/xc_ia64_linux_restore.c             |  320 +++
 tools/libxc/ia64/xc_ia64_linux_save.c                |  509 ++++++
 tools/libxc/ia64/xc_ia64_stubs.c                     |  106 +
 tools/libxc/xc_hvm_build.c                           |   32 
 tools/libxc/xc_linux_build.c                         |   64 
 tools/libxc/xc_private.c                             |    2 
 tools/libxc/xenctrl.h                                |    3 
 xen/arch/ia64/Makefile                               |   14 
 xen/arch/ia64/asm-offsets.c                          |   11 
 xen/arch/ia64/linux-xen/Makefile                     |    2 
 xen/arch/ia64/linux-xen/README.origin                |    2 
 xen/arch/ia64/linux-xen/entry.S                      |   15 
 xen/arch/ia64/linux-xen/iosapic.c                    |    8 
 xen/arch/ia64/linux-xen/mca.c                        | 1600 +++++++++++++++++++
 xen/arch/ia64/linux-xen/mca_asm.S                    |  970 +++++++++++
 xen/arch/ia64/linux-xen/minstate.h                   |   46 
 xen/arch/ia64/linux-xen/tlb.c                        |    4 
 xen/arch/ia64/linux-xen/unwind.c                     |   22 
 xen/arch/ia64/tools/README.RunVT                     |   95 -
 xen/arch/ia64/vmx/mmio.c                             |   11 
 xen/arch/ia64/vmx/pal_emul.c                         |  591 +++----
 xen/arch/ia64/vmx/vlsapic.c                          |   49 
 xen/arch/ia64/vmx/vmmu.c                             |    8 
 xen/arch/ia64/vmx/vmx_entry.S                        |   64 
 xen/arch/ia64/vmx/vmx_init.c                         |   80 
 xen/arch/ia64/vmx/vmx_interrupt.c                    |    2 
 xen/arch/ia64/vmx/vmx_ivt.S                          |   51 
 xen/arch/ia64/vmx/vmx_minstate.h                     |   51 
 xen/arch/ia64/vmx/vmx_phy_mode.c                     |   22 
 xen/arch/ia64/vmx/vmx_process.c                      |   35 
 xen/arch/ia64/vmx/vmx_support.c                      |    2 
 xen/arch/ia64/vmx/vmx_utility.c                      |    2 
 xen/arch/ia64/vmx/vmx_vcpu.c                         |   59 
 xen/arch/ia64/vmx/vmx_virt.c                         |   51 
 xen/arch/ia64/xen/Makefile                           |    1 
 xen/arch/ia64/xen/dom0_ops.c                         |  183 +-
 xen/arch/ia64/xen/dom_fw.c                           |  187 +-
 xen/arch/ia64/xen/domain.c                           |  408 +++-
 xen/arch/ia64/xen/faults.c                           |  139 +
 xen/arch/ia64/xen/fw_emul.c                          |   17 
 xen/arch/ia64/xen/hypercall.c                        |   11 
 xen/arch/ia64/xen/irq.c                              |   13 
 xen/arch/ia64/xen/ivt.S                              |  181 +-
 xen/arch/ia64/xen/mm.c                               |  171 +-
 xen/arch/ia64/xen/privop.c                           |  420 ----
 xen/arch/ia64/xen/privop_stat.c                      |  389 ++++
 xen/arch/ia64/xen/regionreg.c                        |   19 
 xen/arch/ia64/xen/vcpu.c                             |  136 +
 xen/arch/ia64/xen/vhpt.c                             |   24 
 xen/arch/ia64/xen/xenasm.S                           |    4 
 xen/arch/ia64/xen/xenmisc.c                          |    4 
 xen/arch/ia64/xen/xensetup.c                         |   12 
 xen/arch/x86/hvm/vmx/vmx.c                           |   18 
 xen/arch/x86/shadow32.c                              |   24 
 xen/arch/x86/shadow_public.c                         |   19 
 xen/common/memory.c                                  |    2 
 xen/include/asm-ia64/bundle.h                        |  231 ++
 xen/include/asm-ia64/config.h                        |   20 
 xen/include/asm-ia64/dom_fw.h                        |    4 
 xen/include/asm-ia64/domain.h                        |  122 -
 xen/include/asm-ia64/iocap.h                         |    8 
 xen/include/asm-ia64/linux-xen/asm/README.origin     |    1 
 xen/include/asm-ia64/linux-xen/asm/asmmacro.h        |  119 +
 xen/include/asm-ia64/linux-xen/asm/mca_asm.h         |    4 
 xen/include/asm-ia64/linux-xen/asm/pgtable.h         |    5 
 xen/include/asm-ia64/linux-xen/asm/system.h          |    2 
 xen/include/asm-ia64/linux/asm/README.origin         |    1 
 xen/include/asm-ia64/mm.h                            |    7 
 xen/include/asm-ia64/privop.h                        |  225 --
 xen/include/asm-ia64/privop_stat.h                   |   66 
 xen/include/asm-ia64/regionreg.h                     |    1 
 xen/include/asm-ia64/shadow.h                        |   18 
 xen/include/asm-ia64/tlbflush.h                      |    6 
 xen/include/asm-ia64/vcpu.h                          |   25 
 xen/include/asm-ia64/vhpt.h                          |    3 
 xen/include/asm-ia64/vmx.h                           |    4 
 xen/include/asm-ia64/vmx_pal.h                       |    5 
 xen/include/asm-ia64/vmx_phy_mode.h                  |    1 
 xen/include/asm-ia64/vmx_vcpu.h                      |    1 
 xen/include/asm-ia64/vmx_vpd.h                       |    2 
 xen/include/asm-ia64/xenpage.h                       |    7 
 xen/include/asm-ia64/xensystem.h                     |    1 
 xen/include/asm-x86/hvm/vmx/vmx.h                    |   52 
 xen/include/asm-x86/mm.h                             |    5 
 xen/include/public/arch-ia64.h                       |  109 -
 xen/include/public/dom0_ops.h                        |    4 
 128 files changed, 8346 insertions(+), 3004 deletions(-)

diff -r 1eb42266de1b -r e5c84586c333 Config.mk
--- a/Config.mk Thu Jul 27 17:44:14 2006 -0500
+++ b/Config.mk Fri Jul 28 10:51:38 2006 +0100
@@ -36,6 +36,8 @@ CFLAGS    ?= -O2 -fomit-frame-pointer
 CFLAGS    ?= -O2 -fomit-frame-pointer
 CFLAGS    += -DNDEBUG
 else
+# Less than -O1 produces bad code and large stack frames
+CFLAGS    ?= -O1 -fno-omit-frame-pointer
 CFLAGS    += -g
 endif
 
diff -r 1eb42266de1b -r e5c84586c333 buildconfigs/linux-defconfig_xen0_ia64
--- a/buildconfigs/linux-defconfig_xen0_ia64    Thu Jul 27 17:44:14 2006 -0500
+++ b/buildconfigs/linux-defconfig_xen0_ia64    Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.16.13-xen0
-# Mon May 22 14:46:31 2006
+# Fri Jun 30 12:59:19 2006
 #
 
 #
@@ -721,21 +721,10 @@ CONFIG_SERIAL_NONSTANDARD=y
 #
 # Serial drivers
 #
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_ACPI=y
-CONFIG_SERIAL_8250_NR_UARTS=6
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-# CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_RSA is not set
 
 #
 # Non-8250 serial port support
 #
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
@@ -1516,8 +1505,16 @@ CONFIG_CRYPTO_DES=y
 #
 # Hardware crypto devices
 #
+# CONFIG_XEN_UTIL is not set
 CONFIG_HAVE_ARCH_ALLOC_SKB=y
 CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SKBUFF=y
+CONFIG_XEN_NETDEV_BACKEND=y
+CONFIG_XEN_NETDEV_FRONTEND=y
+# CONFIG_XEN_DEVMEM is not set
+# CONFIG_XEN_REBOOT is not set
+# CONFIG_XEN_SMPBOOT is not set
 CONFIG_XEN_INTERFACE_VERSION=0x00030202
 
 #
@@ -1525,20 +1522,21 @@ CONFIG_XEN_INTERFACE_VERSION=0x00030202
 #
 CONFIG_XEN_PRIVILEGED_GUEST=y
 # CONFIG_XEN_UNPRIVILEGED_GUEST is not set
+CONFIG_XEN_PRIVCMD=y
 CONFIG_XEN_BACKEND=y
 # CONFIG_XEN_PCIDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_XENBUS_DEV=y
 # CONFIG_XEN_BLKDEV_TAP is not set
-CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=y
-CONFIG_XEN_NETDEV_FRONTEND=y
 # CONFIG_XEN_SCRUB_PAGES is not set
-# CONFIG_XEN_DISABLE_SERIAL is not set
+CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
diff -r 1eb42266de1b -r e5c84586c333 buildconfigs/linux-defconfig_xen_ia64
--- a/buildconfigs/linux-defconfig_xen_ia64     Thu Jul 27 17:44:14 2006 -0500
+++ b/buildconfigs/linux-defconfig_xen_ia64     Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.16.13-xen
-# Mon May 22 14:15:20 2006
+# Thu Jun 29 16:23:48 2006
 #
 
 #
@@ -727,21 +727,10 @@ CONFIG_SERIAL_NONSTANDARD=y
 #
 # Serial drivers
 #
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_ACPI=y
-CONFIG_SERIAL_8250_NR_UARTS=6
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-# CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_RSA is not set
 
 #
 # Non-8250 serial port support
 #
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
@@ -1522,8 +1511,16 @@ CONFIG_CRYPTO_DES=y
 #
 # Hardware crypto devices
 #
+# CONFIG_XEN_UTIL is not set
 CONFIG_HAVE_ARCH_ALLOC_SKB=y
 CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SKBUFF=y
+CONFIG_XEN_NETDEV_BACKEND=y
+CONFIG_XEN_NETDEV_FRONTEND=y
+# CONFIG_XEN_DEVMEM is not set
+# CONFIG_XEN_REBOOT is not set
+# CONFIG_XEN_SMPBOOT is not set
 CONFIG_XEN_INTERFACE_VERSION=0x00030202
 
 #
@@ -1531,20 +1528,21 @@ CONFIG_XEN_INTERFACE_VERSION=0x00030202
 #
 CONFIG_XEN_PRIVILEGED_GUEST=y
 # CONFIG_XEN_UNPRIVILEGED_GUEST is not set
+CONFIG_XEN_PRIVCMD=y
 CONFIG_XEN_BACKEND=y
 # CONFIG_XEN_PCIDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_BACKEND=y
+CONFIG_XEN_XENBUS_DEV=y
 # CONFIG_XEN_BLKDEV_TAP is not set
-CONFIG_XEN_NETDEV_BACKEND=y
 # CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
 CONFIG_XEN_NETDEV_LOOPBACK=y
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=y
-CONFIG_XEN_NETDEV_FRONTEND=y
 # CONFIG_XEN_SCRUB_PAGES is not set
-# CONFIG_XEN_DISABLE_SERIAL is not set
+CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
 CONFIG_XEN_COMPAT_030002_AND_LATER=y
 # CONFIG_XEN_COMPAT_LATEST_ONLY is not set
 CONFIG_XEN_COMPAT_030002=y
+CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
 CONFIG_NO_IDLE_HZ=y
diff -r 1eb42266de1b -r e5c84586c333 linux-2.6-xen-sparse/arch/ia64/Kconfig
--- a/linux-2.6-xen-sparse/arch/ia64/Kconfig    Thu Jul 27 17:44:14 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig    Fri Jul 28 10:51:38 2006 +0100
@@ -70,6 +70,13 @@ config XEN_IA64_DOM0_NON_VP
        default y
        help
          dom0 P=M model
+
+config XEN_IA64_VDSO_PARAVIRT
+       bool
+       depends on XEN && !ITANIUM
+       default y
+       help
+         vDSO paravirtualization
 
 config SCHED_NO_NO_OMIT_FRAME_POINTER
        bool
@@ -518,7 +525,7 @@ config XEN_DEVMEM
        default n
 
 config XEN_REBOOT
-       default n
+       default y
 
 config XEN_SMPBOOT
        default n
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c  Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c  Fri Jul 28 10:51:38 
2006 +0100
@@ -31,6 +31,9 @@
 #include <linux/smp_lock.h>
 #include <linux/threads.h>
 #include <linux/bitops.h>
+#ifdef CONFIG_XEN
+#include <linux/cpu.h>
+#endif
 
 #include <asm/delay.h>
 #include <asm/intrinsics.h>
@@ -235,6 +238,9 @@ static struct irqaction ipi_irqaction = 
 #include <xen/evtchn.h>
 #include <xen/interface/callback.h>
 
+static DEFINE_PER_CPU(int, timer_irq) = -1;
+static DEFINE_PER_CPU(int, ipi_irq) = -1;
+static DEFINE_PER_CPU(int, resched_irq) = -1;
 static char timer_name[NR_CPUS][15];
 static char ipi_name[NR_CPUS][15];
 static char resched_name[NR_CPUS][15];
@@ -252,6 +258,7 @@ static unsigned short saved_irq_cnt = 0;
 static unsigned short saved_irq_cnt = 0;
 static int xen_slab_ready = 0;
 
+#ifdef CONFIG_SMP
 /* Dummy stub. Though we may check RESCHEDULE_VECTOR before __do_IRQ,
  * it ends up to issue several memory accesses upon percpu data and
  * thus adds unnecessary traffic to other paths.
@@ -268,6 +275,7 @@ static struct irqaction resched_irqactio
        .flags =        SA_INTERRUPT,
        .name =         "RESCHED"
 };
+#endif
 
 /*
  * This is xen version percpu irq registration, which needs bind
@@ -294,6 +302,7 @@ xen_register_percpu_irq (unsigned int ir
                        ret = bind_virq_to_irqhandler(VIRQ_ITC, cpu,
                                action->handler, action->flags,
                                timer_name[cpu], action->dev_id);
+                       per_cpu(timer_irq,cpu) = ret;
                        printk(KERN_INFO "register VIRQ_ITC (%s) to xen irq 
(%d)\n", timer_name[cpu], ret);
                        break;
                case IA64_IPI_RESCHEDULE:
@@ -301,6 +310,7 @@ xen_register_percpu_irq (unsigned int ir
                        ret = bind_ipi_to_irqhandler(RESCHEDULE_VECTOR, cpu,
                                action->handler, action->flags,
                                resched_name[cpu], action->dev_id);
+                       per_cpu(resched_irq,cpu) = ret;
                        printk(KERN_INFO "register RESCHEDULE_VECTOR (%s) to 
xen irq (%d)\n", resched_name[cpu], ret);
                        break;
                case IA64_IPI_VECTOR:
@@ -308,6 +318,7 @@ xen_register_percpu_irq (unsigned int ir
                        ret = bind_ipi_to_irqhandler(IPI_VECTOR, cpu,
                                action->handler, action->flags,
                                ipi_name[cpu], action->dev_id);
+                       per_cpu(ipi_irq,cpu) = ret;
                        printk(KERN_INFO "register IPI_VECTOR (%s) to xen irq 
(%d)\n", ipi_name[cpu], ret);
                        break;
                case IA64_SPURIOUS_INT_VECTOR:
@@ -343,7 +354,7 @@ xen_bind_early_percpu_irq (void)
         */
        for (i = 0; i < late_irq_cnt; i++)
                xen_register_percpu_irq(saved_percpu_irqs[i].irq,
-                       saved_percpu_irqs[i].action, 0);
+                                       saved_percpu_irqs[i].action, 0);
 }
 
 /* FIXME: There's no obvious point to check whether slab is ready. So
@@ -352,6 +363,38 @@ extern void (*late_time_init)(void);
 extern void (*late_time_init)(void);
 extern char xen_event_callback;
 extern void xen_init_IRQ(void);
+
+#ifdef CONFIG_HOTPLUG_CPU
+static int __devinit
+unbind_evtchn_callback(struct notifier_block *nfb,
+                       unsigned long action, void *hcpu)
+{
+       unsigned int cpu = (unsigned long)hcpu;
+
+       if (action == CPU_DEAD) {
+               /* Unregister evtchn.  */
+               if (per_cpu(ipi_irq,cpu) >= 0) {
+                       unbind_from_irqhandler (per_cpu(ipi_irq, cpu), NULL);
+                       per_cpu(ipi_irq, cpu) = -1;
+               }
+               if (per_cpu(resched_irq,cpu) >= 0) {
+                       unbind_from_irqhandler (per_cpu(resched_irq, cpu),
+                                               NULL);
+                       per_cpu(resched_irq, cpu) = -1;
+               }
+               if (per_cpu(timer_irq,cpu) >= 0) {
+                       unbind_from_irqhandler (per_cpu(timer_irq, cpu), NULL);
+                       per_cpu(timer_irq, cpu) = -1;
+               }
+       }
+       return NOTIFY_OK;
+}
+
+static struct notifier_block unbind_evtchn_notifier = {
+       .notifier_call = unbind_evtchn_callback,
+       .priority = 0
+};
+#endif
 
 DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
 void xen_smp_intr_init(void)
@@ -363,21 +406,22 @@ void xen_smp_intr_init(void)
                .type = CALLBACKTYPE_event,
                .address = (unsigned long)&xen_event_callback,
        };
-       static cpumask_t registered_cpumask;
-
-       if (!cpu)
+
+       if (cpu == 0) {
+               /* Initialization was already done for boot cpu.  */
+#ifdef CONFIG_HOTPLUG_CPU
+               /* Register the notifier only once.  */
+               register_cpu_notifier(&unbind_evtchn_notifier);
+#endif
                return;
+       }
 
        /* This should be piggyback when setup vcpu guest context */
        BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
 
-       if (!cpu_isset(cpu, registered_cpumask)) {
-               cpu_set(cpu, registered_cpumask);
-               for (i = 0; i < saved_irq_cnt; i++)
-                       xen_register_percpu_irq(saved_percpu_irqs[i].irq,
-                                               saved_percpu_irqs[i].action,
-                                               0);
-       }
+       for (i = 0; i < saved_irq_cnt; i++)
+               xen_register_percpu_irq(saved_percpu_irqs[i].irq,
+                                       saved_percpu_irqs[i].action, 0);
 #endif /* CONFIG_SMP */
 }
 #endif /* CONFIG_XEN */
@@ -388,12 +432,13 @@ register_percpu_irq (ia64_vector vec, st
        irq_desc_t *desc;
        unsigned int irq;
 
+#ifdef CONFIG_XEN
+       if (is_running_on_xen())
+               return xen_register_percpu_irq(vec, action, 1);
+#endif
+
        for (irq = 0; irq < NR_IRQS; ++irq)
                if (irq_to_vector(irq) == vec) {
-#ifdef CONFIG_XEN
-                       if (is_running_on_xen())
-                               return xen_register_percpu_irq(vec, action, 1);
-#endif
                        desc = irq_descp(irq);
                        desc->status |= IRQ_PER_CPU;
                        desc->handler = &irq_type_ia64_lsapic;
@@ -441,6 +486,7 @@ ia64_send_ipi (int cpu, int vector, int 
         if (is_running_on_xen()) {
                int irq = -1;
 
+#ifdef CONFIG_SMP
                /* TODO: we need to call vcpu_up here */
                if (unlikely(vector == ap_wakeup_vector)) {
                        extern void xen_send_ipi (int cpu, int vec);
@@ -448,6 +494,7 @@ ia64_send_ipi (int cpu, int vector, int 
                        //vcpu_prepare_and_up(cpu);
                        return;
                }
+#endif
 
                switch(vector) {
                case IA64_IPI_VECTOR:
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c     Fri Jul 28 10:51:38 
2006 +0100
@@ -75,6 +75,20 @@ EXPORT_SYMBOL(__per_cpu_offset);
 EXPORT_SYMBOL(__per_cpu_offset);
 #endif
 
+#ifdef CONFIG_XEN
+static int
+xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
+{
+       HYPERVISOR_shutdown(SHUTDOWN_crash);
+       /* we're never actually going to get here... */
+       return NOTIFY_DONE;
+}
+
+static struct notifier_block xen_panic_block = {
+       xen_panic_event, NULL, 0 /* try to go last */
+};
+#endif
+
 extern void ia64_setup_printk_clock(void);
 
 DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
@@ -418,8 +432,11 @@ setup_arch (char **cmdline_p)
        unw_init();
 
 #ifdef CONFIG_XEN
-       if (is_running_on_xen())
+       if (is_running_on_xen()) {
                setup_xen_features();
+               /* Register a call for panic conditions. */
+               notifier_chain_register(&panic_notifier_list, &xen_panic_block);
+       }
 #endif
 
        ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) 
__end___vtop_patchlist);
@@ -523,15 +540,14 @@ setup_arch (char **cmdline_p)
                shared_info_t *s = HYPERVISOR_shared_info;
 
                xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
-               xen_start_info->flags = s->arch.flags;
 
                printk("Running on Xen! start_info_pfn=0x%lx nr_pages=%ld "
                       "flags=0x%x\n", s->arch.start_info_pfn,
                       xen_start_info->nr_pages, xen_start_info->flags);
 
                /* xen_start_info isn't setup yet, get the flags manually */
-               if (s->arch.flags & SIF_INITDOMAIN) {
-                       if (!(s->arch.flags & SIF_PRIVILEGED))
+               if (xen_start_info->flags & SIF_INITDOMAIN) {
+                       if (!(xen_start_info->flags & SIF_PRIVILEGED))
                                panic("Xen granted us console access "
                                      "but not privileged status");
                } else {
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S    Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S    Fri Jul 28 10:51:38 
2006 +0100
@@ -351,3 +351,59 @@ GLOBAL_ENTRY(xen_send_ipi)
         br.ret.sptk.many rp
         ;;
 END(xen_send_ipi)
+
+#ifdef CONFIG_XEN_IA64_VDSO_PARAVIRT
+// Those are vdso specialized.
+// In fsys mode, call, ret can't be used.
+GLOBAL_ENTRY(xen_rsm_be_i)
+       ld8 r22=[r22]
+       ;; 
+       st1 [r22]=r20
+       st4 [r23]=r0
+       XEN_HYPER_RSM_BE
+       st4 [r23]=r20
+       brl.cond.sptk   .vdso_rsm_be_i_ret
+       ;; 
+END(xen_rsm_be_i)
+
+GLOBAL_ENTRY(xen_get_psr)
+       mov r31=r8
+       mov r25=IA64_PSR_IC
+       st4 [r23]=r0
+       XEN_HYPER_GET_PSR
+       ;; 
+       st4 [r23]=r20
+       or r29=r8,r25 // vpsr.ic was cleared for hyperprivop
+       mov r8=r31
+       brl.cond.sptk   .vdso_get_psr_ret
+       ;; 
+END(xen_get_psr)
+
+GLOBAL_ENTRY(xen_ssm_i_0)
+       st4 [r22]=r20
+       ld4 r25=[r24]
+       ;;
+       cmp.ne.unc p11,p0=r0, r25
+       ;; 
+(p11)  st4 [r22]=r0
+(p11)  st4 [r23]=r0
+(p11)  XEN_HYPER_SSM_I
+       
+       brl.cond.sptk   .vdso_ssm_i_0_ret
+       ;; 
+END(xen_ssm_i_0)
+
+GLOBAL_ENTRY(xen_ssm_i_1)
+       st4 [r22]=r20
+       ld4 r25=[r24]
+       ;; 
+       cmp.ne.unc p11,p0=r0, r25
+       ;; 
+(p11)  st4 [r22]=r0
+(p11)  st4 [r23]=r0
+(p11)  XEN_HYPER_SSM_I
+       ;;
+       brl.cond.sptk   .vdso_ssm_i_1_ret
+       ;; 
+END(xen_ssm_i_1)
+#endif
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Fri Jul 28 10:51:38 
2006 +0100
@@ -198,7 +198,7 @@ __xen_create_contiguous_region(unsigned 
                .nr_exchanged = 0
        };
 
-       if (order > MAX_CONTIG_ORDER)
+       if (unlikely(order > MAX_CONTIG_ORDER))
                return -ENOMEM;
        
        set_xen_guest_handle(exchange.in.extent_start, in_frames);
@@ -299,7 +299,7 @@ __xen_destroy_contiguous_region(unsigned
        if (!test_bit(start_gpfn, contiguous_bitmap))
                return;
 
-       if (order > MAX_CONTIG_ORDER)
+       if (unlikely(order > MAX_CONTIG_ORDER))
                return;
 
        set_xen_guest_handle(exchange.in.extent_start, &in_frame);
@@ -547,8 +547,10 @@ xen_ia64_privcmd_entry_mmap(struct vm_ar
        unsigned long gpfn;
        unsigned long flags;
 
-       BUG_ON((addr & ~PAGE_MASK) != 0);
-       BUG_ON(mfn == INVALID_MFN);
+       if ((addr & ~PAGE_MASK) != 0 || mfn == INVALID_MFN) {
+               error = -EINVAL;
+               goto out;
+       }
 
        if (entry->gpfn != INVALID_GPFN) {
                error = -EBUSY;
@@ -793,3 +795,13 @@ direct_remap_pfn_range(struct vm_area_st
        return error;
 }
 
+
+/* Called after suspend, to resume time.  */
+void
+time_resume(void)
+{
+       extern void ia64_cpu_local_tick(void);
+
+       /* Just trigger a tick.  */
+       ia64_cpu_local_tick();
+}
diff -r 1eb42266de1b -r e5c84586c333 linux-2.6-xen-sparse/arch/ia64/xen/util.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/util.c Thu Jul 27 17:44:14 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/util.c Fri Jul 28 10:51:38 2006 +0100
@@ -71,6 +71,9 @@ void free_vm_area(struct vm_struct *area
        unsigned int order = get_order(area->size);
        unsigned long i;
 
+       /* xenbus_map_ring_valloc overrides this field!  */
+       area->phys_addr = __pa(area->addr);
+
        // This area is used for foreign page mappping.
        // So underlying machine page may not be assigned.
        for (i = 0; i < (1 << order); i++) {
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S     Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S     Fri Jul 28 10:51:38 
2006 +0100
@@ -33,3 +33,23 @@ GLOBAL_ENTRY(early_xen_setup)
        br.ret.sptk.many rp
        ;;
 END(early_xen_setup)
+
+#include <xen/interface/xen.h>
+
+/* Stub for suspend.
+   Just force the stacked registers to be written in memory.  */       
+GLOBAL_ENTRY(HYPERVISOR_suspend)
+       alloc r20=ar.pfs,0,0,0,0
+       mov r14=2
+       mov r15=r12
+       ;;
+       /* We don't want to deal with RSE.  */
+       flushrs
+       mov r2=__HYPERVISOR_sched_op
+       st4 [r12]=r14
+       ;;
+       break 0x1000
+       ;; 
+       mov ar.pfs=r20
+       br.ret.sptk.many b0
+END(HYPERVISOR_suspend)
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Fri Jul 28 10:51:38 
2006 +0100
@@ -39,6 +39,7 @@ extern void ctrl_alt_del(void);
  */
 #define SHUTDOWN_HALT      4
 
+#if defined(__i386__) || defined(__x86_64__)
 void machine_emergency_restart(void)
 {
        /* We really want to get pending console data out before we die. */
@@ -60,10 +61,8 @@ void machine_power_off(void)
 {
        /* We really want to get pending console data out before we die. */
        xencons_force_flush();
-#if defined(__i386__) || defined(__x86_64__)
        if (pm_power_off)
                pm_power_off();
-#endif
        HYPERVISOR_shutdown(SHUTDOWN_poweroff);
 }
 
@@ -71,7 +70,7 @@ EXPORT_SYMBOL(machine_restart);
 EXPORT_SYMBOL(machine_restart);
 EXPORT_SYMBOL(machine_halt);
 EXPORT_SYMBOL(machine_power_off);
-
+#endif
 
 /******************************************************************************
  * Stop/pickle callback handling.
@@ -82,6 +81,7 @@ static void __shutdown_handler(void *unu
 static void __shutdown_handler(void *unused);
 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
 
+#if defined(__i386__) || defined(__x86_64__)
 /* Ensure we run on the idle task page tables so that we will
    switch page tables before running user space. This is needed
    on architectures with separate kernel and user page tables
@@ -98,25 +98,30 @@ static void switch_idle_mm(void)
        current->active_mm = &init_mm;
        mmdrop(mm);
 }
+#endif
 
 static int __do_suspend(void *ignore)
 {
-       int i, j, k, fpp, err;
-
+       int err;
+#if defined(__i386__) || defined(__x86_64__)
+       int i, j, k, fpp;
        extern unsigned long max_pfn;
        extern unsigned long *pfn_to_mfn_frame_list_list;
        extern unsigned long *pfn_to_mfn_frame_list[];
+#endif
 
        extern void time_resume(void);
 
        BUG_ON(smp_processor_id() != 0);
        BUG_ON(in_interrupt());
 
+#if defined(__i386__) || defined(__x86_64__)
        if (xen_feature(XENFEAT_auto_translated_physmap)) {
                printk(KERN_WARNING "Cannot suspend in "
                       "auto_translated_physmap mode.\n");
                return -EOPNOTSUPP;
        }
+#endif
 
        err = smp_suspend();
        if (err)
@@ -129,18 +134,24 @@ static int __do_suspend(void *ignore)
 #ifdef __i386__
        kmem_cache_shrink(pgd_cache);
 #endif
+#if defined(__i386__) || defined(__x86_64__)
        mm_pin_all();
 
        __cli();
+#elif defined(__ia64__)
+       local_irq_disable();
+#endif
        preempt_enable();
 
        gnttab_suspend();
 
+#if defined(__i386__) || defined(__x86_64__)
        HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
        clear_fixmap(FIX_SHARED_INFO);
 
        xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
        xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
+#endif
 
        /*
         * We'll stop somewhere inside this hypercall. When it returns,
@@ -150,6 +161,7 @@ static int __do_suspend(void *ignore)
 
        shutting_down = SHUTDOWN_INVALID;
 
+#if defined(__i386__) || defined(__x86_64__)
        set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
 
        HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
@@ -171,6 +183,7 @@ static int __do_suspend(void *ignore)
                        virt_to_mfn(&phys_to_machine_mapping[i]);
        }
        HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
+#endif
 
        gnttab_resume();
 
@@ -178,9 +191,13 @@ static int __do_suspend(void *ignore)
 
        time_resume();
 
+#if defined(__i386__) || defined(__x86_64__)
        switch_idle_mm();
 
        __sti();
+#elif defined(__ia64__)
+       local_irq_enable();
+#endif
 
        xencons_resume();
 
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Jul 27 
17:44:14 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Fri Jul 28 
10:51:38 2006 +0100
@@ -99,24 +99,21 @@ static spinlock_t net_schedule_list_lock
 #define MAX_MFN_ALLOC 64
 static unsigned long mfn_list[MAX_MFN_ALLOC];
 static unsigned int alloc_index = 0;
-static DEFINE_SPINLOCK(mfn_lock);
 
 static unsigned long alloc_mfn(void)
 {
-       unsigned long mfn = 0, flags;
+       unsigned long mfn = 0;
        struct xen_memory_reservation reservation = {
                .nr_extents   = MAX_MFN_ALLOC,
                .extent_order = 0,
                .domid        = DOMID_SELF
        };
        set_xen_guest_handle(reservation.extent_start, mfn_list);
-       spin_lock_irqsave(&mfn_lock, flags);
        if ( unlikely(alloc_index == 0) )
                alloc_index = HYPERVISOR_memory_op(
                        XENMEM_increase_reservation, &reservation);
        if ( alloc_index != 0 )
                mfn = mfn_list[--alloc_index];
-       spin_unlock_irqrestore(&mfn_lock, flags);
        return mfn;
 }
 
@@ -222,9 +219,13 @@ static void net_rx_action(unsigned long 
        unsigned long vdata, old_mfn, new_mfn;
        struct sk_buff_head rxq;
        struct sk_buff *skb;
-       u16 notify_list[NET_RX_RING_SIZE];
        int notify_nr = 0;
        int ret;
+       /*
+        * Putting hundreds of bytes on the stack is considered rude.
+        * Static works because a tasklet can only be on one CPU at any time.
+        */
+       static u16 notify_list[NET_RX_RING_SIZE];
 
        skb_queue_head_init(&rxq);
 
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Jul 27 
17:44:14 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Jul 28 
10:51:38 2006 +0100
@@ -788,6 +788,8 @@ static int network_start_xmit(struct sk_
 
                gso->u.gso.size = skb_shinfo(skb)->gso_size;
                gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+               gso->u.gso.pad = 0;
+               gso->u.gso.features = 0;
 
                gso->type = XEN_NETIF_EXTRA_TYPE_GSO;
                gso->flags = 0;
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Thu Jul 27 17:44:14 
2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Fri Jul 28 10:51:38 
2006 +0100
@@ -302,23 +302,7 @@ HYPERVISOR_vcpu_op(
     return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
 }
 
-static inline int
-HYPERVISOR_suspend(
-       unsigned long srec)
-{
-       struct sched_shutdown sched_shutdown = {
-               .reason = SHUTDOWN_suspend
-       };
-
-       int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
-                            &sched_shutdown, srec);
-
-       if (rc == -ENOSYS)
-               rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
-                                SHUTDOWN_suspend, srec);
-
-       return rc;
-}
+extern int HYPERVISOR_suspend(unsigned long srec);
 
 static inline int
 HYPERVISOR_callback_op(
diff -r 1eb42266de1b -r e5c84586c333 
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Thu Jul 27 
17:44:14 2006 -0500
+++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Fri Jul 28 
10:51:38 2006 +0100
@@ -48,6 +48,8 @@
 #define        XEN_HYPER_GET_PMD               break HYPERPRIVOP_GET_PMD
 #define        XEN_HYPER_GET_EFLAG             break HYPERPRIVOP_GET_EFLAG
 #define        XEN_HYPER_SET_EFLAG             break HYPERPRIVOP_SET_EFLAG
+#define        XEN_HYPER_RSM_BE                break HYPERPRIVOP_RSM_BE
+#define        XEN_HYPER_GET_PSR               break HYPERPRIVOP_GET_PSR
 
 #define XSI_IFS                        (XSI_BASE + XSI_IFS_OFS)
 #define XSI_PRECOVER_IFS       (XSI_BASE + XSI_PRECOVER_IFS_OFS)
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/domain-reset
--- a/tools/ioemu/patches/domain-reset  Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/domain-reset  Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/target-i386-dm/helper2.c
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
---- ioemu.orig/target-i386-dm/helper2.c        2006-07-12 11:35:00.710827712 
+0100
-+++ ioemu/target-i386-dm/helper2.c     2006-07-12 11:35:02.419613627 +0100
+--- ioemu.orig/target-i386-dm/helper2.c        2006-07-27 11:16:57.527492229 
+0100
++++ ioemu/target-i386-dm/helper2.c     2006-07-27 11:16:59.381287013 +0100
 @@ -123,6 +123,25 @@
  /* called from main_cpu_reset */
  void cpu_reset(CPUX86State *env)
@@ -41,9 +41,9 @@ Index: ioemu/target-i386-dm/helper2.c
          /* Wait up to 10 msec. */
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:02.273631916 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:02.421613376 +0100
-@@ -4411,7 +4411,7 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.317294097 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.384286681 +0100
+@@ -4412,7 +4412,7 @@
  } QEMUResetEntry;
  
  static QEMUResetEntry *first_reset_entry;
@@ -54,8 +54,8 @@ Index: ioemu/vl.c
  
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-12 11:35:01.454734511 +0100
-+++ ioemu/vl.h 2006-07-12 11:35:02.422613251 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:16:58.127425816 +0100
++++ ioemu/vl.h 2006-07-27 11:16:59.384286681 +0100
 @@ -122,6 +122,7 @@
  
  void qemu_register_reset(QEMUResetHandler *func, void *opaque);
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/domain-timeoffset
--- a/tools/ioemu/patches/domain-timeoffset     Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/domain-timeoffset     Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/hw/mc146818rtc.c
 Index: ioemu/hw/mc146818rtc.c
 ===================================================================
---- ioemu.orig/hw/mc146818rtc.c        2006-07-26 15:17:35.110819901 +0100
-+++ ioemu/hw/mc146818rtc.c     2006-07-26 15:17:40.292255496 +0100
+--- ioemu.orig/hw/mc146818rtc.c        2006-07-27 11:17:18.007225084 +0100
++++ ioemu/hw/mc146818rtc.c     2006-07-27 11:17:48.250876949 +0100
 @@ -178,10 +178,27 @@
      }
  }
@@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
  static void rtc_copy_date(RTCState *s)
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-26 15:17:39.820306906 +0100
-+++ ioemu/hw/pc.c      2006-07-26 15:17:40.293255388 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:17:47.993905398 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:17:48.251876839 +0100
 @@ -151,7 +151,7 @@
  }
  
@@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
  QEMUMachine pc_machine = {
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 15:17:40.169268893 +0100
-+++ ioemu/vl.c 2006-07-26 15:17:40.296255061 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:17:48.126890676 +0100
++++ ioemu/vl.c 2006-07-27 11:17:48.254876507 +0100
 @@ -164,6 +164,8 @@
  
  int xc_handle;
@@ -128,7 +128,7 @@ Index: ioemu/vl.c
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
  extern int domid;
  
-@@ -4799,6 +4801,7 @@
+@@ -4800,6 +4802,7 @@
  #endif
             "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
           "-vnc display    start a VNC server on display\n"
@@ -136,7 +136,7 @@ Index: ioemu/vl.c
             "\n"
             "During emulation, the following keys are useful:\n"
             "ctrl-alt-f      toggle full screen\n"
-@@ -4889,6 +4892,7 @@
+@@ -4890,6 +4893,7 @@
  
      QEMU_OPTION_d,
      QEMU_OPTION_vcpus,
@@ -144,7 +144,7 @@ Index: ioemu/vl.c
  };
  
  typedef struct QEMUOption {
-@@ -4967,6 +4971,7 @@
+@@ -4968,6 +4972,7 @@
      
      { "d", HAS_ARG, QEMU_OPTION_d },
      { "vcpus", 1, QEMU_OPTION_vcpus },
@@ -152,7 +152,7 @@ Index: ioemu/vl.c
      { NULL },
  };
  
-@@ -5669,6 +5674,9 @@
+@@ -5670,6 +5675,9 @@
                  vcpus = atoi(optarg);
                  fprintf(logfile, "qemu: the number of cpus is %d\n", vcpus);
                  break;
@@ -162,7 +162,7 @@ Index: ioemu/vl.c
              }
          }
      }
-@@ -5992,7 +6000,8 @@
+@@ -5993,7 +6001,8 @@
  
      machine->init(ram_size, vga_ram_size, boot_device,
                    ds, fd_filename, snapshot,
@@ -174,8 +174,8 @@ Index: ioemu/vl.c
      qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock));
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 15:17:39.825306361 +0100
-+++ ioemu/vl.h 2006-07-26 15:17:40.297254952 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:17:47.998904845 +0100
++++ ioemu/vl.h 2006-07-27 11:17:48.254876507 +0100
 @@ -556,7 +556,7 @@
                                   int boot_device,
               DisplayState *ds, const char **fd_filename, int snapshot,
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/hypervisor-pit
--- a/tools/ioemu/patches/hypervisor-pit        Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/hypervisor-pit        Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-07-12 11:35:01.899678766 +0100
-+++ ioemu/Makefile.target      2006-07-12 11:35:02.711577049 +0100
+--- ioemu.orig/Makefile.target 2006-07-27 11:16:58.970332506 +0100
++++ ioemu/Makefile.target      2006-07-27 11:16:59.758245283 +0100
 @@ -333,7 +333,7 @@
  ifeq ($(TARGET_BASE_ARCH), i386)
  # Hardware support
@@ -13,8 +13,8 @@ Index: ioemu/Makefile.target
  endif
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-12 11:35:02.059658723 +0100
-+++ ioemu/hw/pc.c      2006-07-12 11:35:02.712576924 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:16:59.036325200 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:16:59.759245173 +0100
 @@ -38,7 +38,9 @@
  
  static fdctrl_t *floppy_controller;
@@ -38,9 +38,9 @@ Index: ioemu/hw/pc.c
          pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:02.649584815 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:02.715576548 +0100
-@@ -5033,6 +5033,7 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.614261222 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.762244841 +0100
+@@ -5034,6 +5034,7 @@
  
  #ifdef HAS_AUDIO
  struct soundhw soundhw[] = {
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
  #ifdef TARGET_I386
      {
          "pcspk",
-@@ -5042,6 +5043,7 @@
+@@ -5043,6 +5044,7 @@
          { .init_isa = pcspk_audio_init }
      },
  #endif
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/ioemu-ia64
--- a/tools/ioemu/patches/ioemu-ia64    Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/ioemu-ia64    Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/hw/iommu.c
 Index: ioemu/hw/iommu.c
 ===================================================================
---- ioemu.orig/hw/iommu.c      2006-07-26 15:17:35.639762285 +0100
-+++ ioemu/hw/iommu.c   2006-07-26 15:17:39.078387722 +0100
+--- ioemu.orig/hw/iommu.c      2006-07-28 09:56:58.571272016 +0100
++++ ioemu/hw/iommu.c   2006-07-28 10:02:10.171049510 +0100
 @@ -82,7 +82,11 @@
  #define IOPTE_VALID         0x00000002 /* IOPTE is valid */
  #define IOPTE_WAZ           0x00000001 /* Write as zeros */
@@ -16,8 +16,8 @@ Index: ioemu/hw/iommu.c
  
 Index: ioemu/cpu-all.h
 ===================================================================
---- ioemu.orig/cpu-all.h       2006-07-26 15:17:38.728425843 +0100
-+++ ioemu/cpu-all.h    2006-07-26 15:17:39.079387613 +0100
+--- ioemu.orig/cpu-all.h       2006-07-28 09:58:38.815935452 +0100
++++ ioemu/cpu-all.h    2006-07-28 10:02:10.171049510 +0100
 @@ -835,6 +835,31 @@
                  :"=m" (*(volatile long *)addr)
                  :"dIr" (nr));
@@ -52,9 +52,9 @@ Index: ioemu/cpu-all.h
  /* memory API */
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 15:17:39.011395020 +0100
-+++ ioemu/vl.c 2006-07-26 21:11:35.957492161 +0100
-@@ -5577,6 +5577,7 @@
+--- ioemu.orig/vl.c    2006-07-28 09:58:59.672577418 +0100
++++ ioemu/vl.c 2006-07-28 10:02:10.174049171 +0100
+@@ -5578,6 +5578,7 @@
          exit(-1);
      }
  
@@ -62,7 +62,7 @@ Index: ioemu/vl.c
      if (xc_get_pfn_list(xc_handle, domid, page_array, nr_pages) != nr_pages) {
          fprintf(logfile, "xc_get_pfn_list returned error %d\n", errno);
          exit(-1);
-@@ -5597,6 +5598,34 @@
+@@ -5598,6 +5599,34 @@
      fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", nr_pages - 1,
              (uint64_t)(page_array[nr_pages - 1]));
  
@@ -99,9 +99,9 @@ Index: ioemu/vl.c
  #ifdef CONFIG_SOFTMMU
 Index: ioemu/target-i386-dm/exec-dm.c
 ===================================================================
---- ioemu.orig/target-i386-dm/exec-dm.c        2006-07-26 15:17:38.283474311 
+0100
-+++ ioemu/target-i386-dm/exec-dm.c     2006-07-26 15:17:39.081387395 +0100
-@@ -340,6 +340,23 @@
+--- ioemu.orig/target-i386-dm/exec-dm.c        2006-07-28 09:58:22.882736989 
+0100
++++ ioemu/target-i386-dm/exec-dm.c     2006-07-28 10:03:19.972165675 +0100
+@@ -341,6 +341,23 @@
      return io_mem_read[io_index >> IO_MEM_SHIFT];
  }
  
@@ -125,20 +125,20 @@ Index: ioemu/target-i386-dm/exec-dm.c
  /* physical memory access (slow version, mainly for debug) */
  #if defined(CONFIG_USER_ONLY)
  void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, 
-@@ -455,6 +472,9 @@
+@@ -456,6 +473,9 @@
                  ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
                      (addr & ~TARGET_PAGE_MASK);
                  memcpy(buf, ptr, l);
 +#ifdef __ia64__
 +                sync_icache((unsigned long)ptr, l);
 +#endif 
-             }
-         }
-         len -= l;
+             } else {
+                 /* unreported MMIO space */
+                 memset(buf, 0xff, len);
 Index: ioemu/exec-all.h
 ===================================================================
---- ioemu.orig/exec-all.h      2006-07-26 15:17:38.200483351 +0100
-+++ ioemu/exec-all.h   2006-07-26 21:11:41.262898983 +0100
+--- ioemu.orig/exec-all.h      2006-07-28 09:56:58.572271903 +0100
++++ ioemu/exec-all.h   2006-07-28 10:02:10.175049059 +0100
 @@ -462,12 +462,13 @@
  }
  #endif
@@ -158,8 +158,8 @@ Index: ioemu/exec-all.h
  
 Index: ioemu/target-i386-dm/cpu.h
 ===================================================================
---- ioemu.orig/target-i386-dm/cpu.h    2006-07-26 15:17:38.282474420 +0100
-+++ ioemu/target-i386-dm/cpu.h 2006-07-26 15:17:39.082387287 +0100
+--- ioemu.orig/target-i386-dm/cpu.h    2006-07-28 09:56:58.572271903 +0100
++++ ioemu/target-i386-dm/cpu.h 2006-07-28 10:02:10.175049059 +0100
 @@ -80,7 +80,11 @@
  /* helper2.c */
  int main_loop(void);
@@ -175,7 +175,7 @@ Index: ioemu/ia64_intrinsic.h
 Index: ioemu/ia64_intrinsic.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/ia64_intrinsic.h     2006-07-26 15:17:39.083387178 +0100
++++ ioemu/ia64_intrinsic.h     2006-07-28 10:02:10.176048946 +0100
 @@ -0,0 +1,276 @@
 +#ifndef IA64_INTRINSIC_H
 +#define IA64_INTRINSIC_H
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/qemu-bugfixes
--- a/tools/ioemu/patches/qemu-bugfixes Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/qemu-bugfixes Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/console.c
 Index: ioemu/console.c
 ===================================================================
---- ioemu.orig/console.c       2006-07-26 13:39:11.999009495 +0100
-+++ ioemu/console.c    2006-07-26 14:15:19.413719225 +0100
+--- ioemu.orig/console.c       2006-07-27 11:16:53.732912290 +0100
++++ ioemu/console.c    2006-07-27 11:16:57.753467214 +0100
 @@ -449,7 +449,7 @@
              c++;
          }
@@ -50,8 +50,8 @@ Index: ioemu/console.c
      s->y_base = 0;
 Index: ioemu/usb-linux.c
 ===================================================================
---- ioemu.orig/usb-linux.c     2006-07-26 13:39:11.999009495 +0100
-+++ ioemu/usb-linux.c  2006-07-26 13:39:16.622514851 +0100
+--- ioemu.orig/usb-linux.c     2006-07-27 11:16:53.732912290 +0100
++++ ioemu/usb-linux.c  2006-07-27 11:16:57.754467103 +0100
 @@ -26,6 +26,7 @@
  #if defined(__linux__)
  #include <dirent.h>
@@ -60,3 +60,15 @@ Index: ioemu/usb-linux.c
  #include <linux/usbdevice_fs.h>
  #include <linux/version.h>
  
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:16:57.681475183 +0100
++++ ioemu/vl.c 2006-07-27 11:17:33.279534373 +0100
+@@ -3201,6 +3201,7 @@
+             if (net_tap_fd_init(vlan, fd))
+                 ret = 0;
+         } else {
++            ifname[0] = '\0';
+             get_param_value(ifname, sizeof(ifname), "ifname", p);
+             if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
+                 pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/qemu-logging
--- a/tools/ioemu/patches/qemu-logging  Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/qemu-logging  Fri Jul 28 10:51:38 2006 +0100
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-14 15:55:59.491503372 +0100
-+++ ioemu/vl.c 2006-07-14 15:55:59.693480386 +0100
-@@ -4697,7 +4697,7 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:57.756466882 +0100
++++ ioemu/vl.c 2006-07-27 11:16:57.828458912 +0100
+@@ -4698,7 +4698,7 @@
             "-S              freeze CPU at startup (use 'c' to start 
execution)\n"
             "-s              wait gdb connection to port %d\n"
             "-p port         change gdb connection port\n"
@@ -11,7 +11,7 @@ Index: ioemu/vl.c
             "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the 
optional BIOS\n"
             "                translation (t=none or lba) (usually qemu can 
guess them)\n"
             "-L path         set the directory for the BIOS and VGA BIOS\n"
-@@ -4775,7 +4775,7 @@
+@@ -4776,7 +4776,7 @@
      QEMU_OPTION_S,
      QEMU_OPTION_s,
      QEMU_OPTION_p,
@@ -20,7 +20,7 @@ Index: ioemu/vl.c
      QEMU_OPTION_hdachs,
      QEMU_OPTION_L,
  #ifdef USE_CODE_COPY
-@@ -4844,7 +4844,7 @@
+@@ -4845,7 +4845,7 @@
      { "S", 0, QEMU_OPTION_S },
      { "s", 0, QEMU_OPTION_s },
      { "p", HAS_ARG, QEMU_OPTION_p },
@@ -29,7 +29,7 @@ Index: ioemu/vl.c
      { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
      { "L", HAS_ARG, QEMU_OPTION_L },
  #ifdef USE_CODE_COPY
-@@ -5095,6 +5095,8 @@
+@@ -5096,6 +5096,8 @@
      char usb_devices[MAX_VM_USB_PORTS][128];
      int usb_devices_index;
  
@@ -38,7 +38,7 @@ Index: ioemu/vl.c
      LIST_INIT (&vm_change_state_head);
  #if !defined(CONFIG_SOFTMMU)
      /* we never want that malloc() uses mmap() */
-@@ -5144,6 +5146,11 @@
+@@ -5145,6 +5147,11 @@
      nb_nics = 0;
      /* default mac address of the first network interface */
      
@@ -50,7 +50,7 @@ Index: ioemu/vl.c
      optind = 1;
      for(;;) {
          if (optind >= argc)
-@@ -5329,7 +5336,7 @@
+@@ -5330,7 +5337,7 @@
                      exit(1);
                  }
                  break;
@@ -59,7 +59,7 @@ Index: ioemu/vl.c
                  {
                      int mask;
                      CPULogItem *item;
-@@ -5700,7 +5707,7 @@
+@@ -5701,7 +5708,7 @@
          stk.ss_flags = 0;
  
          if (sigaltstack(&stk, NULL) < 0) {
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/qemu-smp
--- a/tools/ioemu/patches/qemu-smp      Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/qemu-smp      Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:01.687705323 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:01.753697055 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.619371357 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.823348777 +0100
 @@ -159,6 +159,8 @@
  #define MAX_CPUS 1
  #endif
@@ -11,7 +11,7 @@ Index: ioemu/vl.c
  int xc_handle;
  
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
-@@ -4635,6 +4637,7 @@
+@@ -4636,6 +4638,7 @@
             "-m megs         set virtual RAM size to megs MB [default=%d]\n"
             "-smp n          set the number of CPUs to 'n' [default=1]\n"
             "-nographic      disable graphical output and redirect serial I/Os 
to console\n"
@@ -19,7 +19,7 @@ Index: ioemu/vl.c
  #ifndef _WIN32
           "-k language     use keyboard layout (for example \"fr\" for 
French)\n"
  #endif
-@@ -4809,6 +4812,7 @@
+@@ -4810,6 +4813,7 @@
      QEMU_OPTION_vnc,
  
      QEMU_OPTION_d,
@@ -27,7 +27,7 @@ Index: ioemu/vl.c
  };
  
  typedef struct QEMUOption {
-@@ -4886,6 +4890,7 @@
+@@ -4887,6 +4891,7 @@
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
      
      { "d", HAS_ARG, QEMU_OPTION_d },
@@ -35,7 +35,7 @@ Index: ioemu/vl.c
      { NULL },
  };
  
-@@ -5508,6 +5513,10 @@
+@@ -5509,6 +5514,10 @@
                  domid = atoi(optarg);
                  fprintf(logfile, "domid: %d\n", domid);
                  break;
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/qemu-target-i386-dm
--- a/tools/ioemu/patches/qemu-target-i386-dm   Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/qemu-target-i386-dm   Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-07-26 11:45:57.572129351 +0100
-+++ ioemu/Makefile.target      2006-07-26 11:45:57.589127569 +0100
+--- ioemu.orig/Makefile.target 2006-07-28 09:56:49.468301708 +0100
++++ ioemu/Makefile.target      2006-07-28 09:56:58.486281629 +0100
 @@ -57,6 +57,8 @@
  QEMU_SYSTEM=qemu-fast
  endif
@@ -32,8 +32,8 @@ Index: ioemu/Makefile.target
  endif
 Index: ioemu/configure
 ===================================================================
---- ioemu.orig/configure       2006-07-26 11:45:57.573129246 +0100
-+++ ioemu/configure    2006-07-26 11:45:57.590127464 +0100
+--- ioemu.orig/configure       2006-07-28 09:56:49.469301595 +0100
++++ ioemu/configure    2006-07-28 09:56:49.486299672 +0100
 @@ -359,6 +359,8 @@
      if [ "$user" = "yes" ] ; then
          target_list="i386-user arm-user armeb-user sparc-user ppc-user 
mips-user mipsel-user $target_list"
@@ -45,8 +45,8 @@ Index: ioemu/configure
  fi
 Index: ioemu/monitor.c
 ===================================================================
---- ioemu.orig/monitor.c       2006-07-26 11:45:57.576128931 +0100
-+++ ioemu/monitor.c    2006-07-26 11:45:57.591127359 +0100
+--- ioemu.orig/monitor.c       2006-07-28 09:56:49.472301255 +0100
++++ ioemu/monitor.c    2006-07-28 09:56:58.720255164 +0100
 @@ -1142,6 +1142,10 @@
        "", "show host USB devices", },
      { "profile", "", do_info_profile,
@@ -60,8 +60,8 @@ Index: ioemu/monitor.c
  
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 11:45:57.579128617 +0100
-+++ ioemu/vl.c 2006-07-26 11:45:57.593127149 +0100
+--- ioemu.orig/vl.c    2006-07-28 09:56:49.475300916 +0100
++++ ioemu/vl.c 2006-07-28 09:56:58.917232883 +0100
 @@ -87,7 +87,7 @@
  
  #include "exec-all.h"
@@ -98,8 +98,8 @@ Index: ioemu/vl.c
  {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 11:45:39.289045710 +0100
-+++ ioemu/vl.h 2006-07-26 11:45:57.594127044 +0100
+--- ioemu.orig/vl.h    2006-07-28 09:56:49.281322859 +0100
++++ ioemu/vl.h 2006-07-28 09:56:58.917232883 +0100
 @@ -38,6 +38,8 @@
  #include <fcntl.h>
  #include <sys/stat.h>
@@ -132,7 +132,7 @@ Index: ioemu/target-i386-dm/cpu.h
 Index: ioemu/target-i386-dm/cpu.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/cpu.h 2006-07-26 11:45:57.594127044 +0100
++++ ioemu/target-i386-dm/cpu.h 2006-07-28 09:56:58.572271903 +0100
 @@ -0,0 +1,86 @@
 +/*
 + * i386 virtual CPU header
@@ -223,8 +223,8 @@ Index: ioemu/target-i386-dm/exec-dm.c
 Index: ioemu/target-i386-dm/exec-dm.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/exec-dm.c     2006-07-26 11:46:01.059763730 +0100
-@@ -0,0 +1,512 @@
++++ ioemu/target-i386-dm/exec-dm.c     2006-07-28 09:58:22.882736989 +0100
+@@ -0,0 +1,516 @@
 +/*
 + *  virtual page mapping and translated block handling
 + * 
@@ -291,6 +291,7 @@ Index: ioemu/target-i386-dm/exec-dm.c
 +#endif /* !CONFIG_DM */
 +
 +uint64_t phys_ram_size;
++extern uint64_t ram_size;
 +int phys_ram_fd;
 +uint8_t *phys_ram_base;
 +uint8_t *phys_ram_dirty;
@@ -632,7 +633,7 @@ Index: ioemu/target-i386-dm/exec-dm.c
 +            l = len;
 +      
 +        pd = page;
-+        io_index = iomem_index(page);
++        io_index = iomem_index(addr);
 +        if (is_write) {
 +            if (io_index) {
 +                if (l >= 4 && ((addr & 3) == 0)) {
@@ -677,11 +678,14 @@ Index: ioemu/target-i386-dm/exec-dm.c
 +                    stb_raw(buf, val);
 +                    l = 1;
 +                }
-+            } else {
++            } else if (addr < ram_size) {
 +                /* RAM case */
 +                ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
 +                    (addr & ~TARGET_PAGE_MASK);
 +                memcpy(buf, ptr, l);
++            } else {
++                /* unreported MMIO space */
++                memset(buf, 0xff, len);
 +            }
 +        }
 +        len -= l;
@@ -740,7 +744,7 @@ Index: ioemu/target-i386-dm/helper2.c
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/helper2.c     2006-07-26 11:45:57.596126835 +0100
++++ ioemu/target-i386-dm/helper2.c     2006-07-28 09:56:58.312301309 +0100
 @@ -0,0 +1,464 @@
 +/*
 + *  i386 helpers (without register variable usage)
@@ -1209,7 +1213,7 @@ Index: ioemu/target-i386-dm/i8259-dm.c
 Index: ioemu/target-i386-dm/i8259-dm.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/i8259-dm.c    2006-07-26 11:45:57.596126835 +0100
++++ ioemu/target-i386-dm/i8259-dm.c    2006-07-28 09:56:49.492298993 +0100
 @@ -0,0 +1,107 @@
 +/* Xen 8259 stub for interrupt controller emulation
 + * 
@@ -1321,7 +1325,7 @@ Index: ioemu/target-i386-dm/qemu-dm.debu
 Index: ioemu/target-i386-dm/qemu-dm.debug
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/qemu-dm.debug 2006-07-26 11:45:57.596126835 +0100
++++ ioemu/target-i386-dm/qemu-dm.debug 2006-07-28 09:56:49.493298880 +0100
 @@ -0,0 +1,5 @@
 +#!/bin/sh
 +
@@ -1331,7 +1335,7 @@ Index: ioemu/target-i386-dm/qemu-ifup
 Index: ioemu/target-i386-dm/qemu-ifup
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/qemu-ifup     2006-07-26 11:45:57.597126730 +0100
++++ ioemu/target-i386-dm/qemu-ifup     2006-07-28 09:56:49.493298880 +0100
 @@ -0,0 +1,10 @@
 +#!/bin/sh
 +
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/shared-vram
--- a/tools/ioemu/patches/shared-vram   Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/shared-vram   Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/hw/cirrus_vga.c
 Index: ioemu/hw/cirrus_vga.c
 ===================================================================
---- ioemu.orig/hw/cirrus_vga.c 2006-07-26 15:17:35.230806831 +0100
-+++ ioemu/hw/cirrus_vga.c      2006-07-26 15:17:39.819307015 +0100
+--- ioemu.orig/hw/cirrus_vga.c 2006-07-27 11:16:53.059986783 +0100
++++ ioemu/hw/cirrus_vga.c      2006-07-27 11:16:59.923227020 +0100
 @@ -28,6 +28,9 @@
   */
  #include "vl.h"
@@ -176,8 +176,8 @@ Index: ioemu/hw/cirrus_vga.c
  }
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-26 15:17:39.752314312 +0100
-+++ ioemu/hw/pc.c      2006-07-26 15:17:39.820306906 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:16:59.759245173 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:16:59.924226909 +0100
 @@ -783,14 +783,14 @@
      if (cirrus_vga_enabled) {
          if (pci_enabled) {
@@ -198,8 +198,8 @@ Index: ioemu/hw/pc.c
  
 Index: ioemu/hw/vga.c
 ===================================================================
---- ioemu.orig/hw/vga.c        2006-07-26 15:17:39.352357879 +0100
-+++ ioemu/hw/vga.c     2006-07-26 15:17:39.821306797 +0100
+--- ioemu.orig/hw/vga.c        2006-07-27 11:16:59.103317784 +0100
++++ ioemu/hw/vga.c     2006-07-27 11:16:59.925226798 +0100
 @@ -1799,6 +1799,7 @@
      /* TODO: add vbe support if enabled */
  }
@@ -217,7 +217,7 @@ Index: ioemu/hw/vga.c
      s->vram_offset = vga_ram_offset;
      s->vram_size = vga_ram_size;
      s->ds = ds;
-@@ -1941,6 +1942,31 @@
+@@ -1943,6 +1944,31 @@
      return 0;
  }
  
@@ -251,8 +251,8 @@ Index: ioemu/hw/vga.c
  
 Index: ioemu/hw/vga_int.h
 ===================================================================
---- ioemu.orig/hw/vga_int.h    2006-07-26 15:17:38.201483242 +0100
-+++ ioemu/hw/vga_int.h 2006-07-26 15:17:39.822306688 +0100
+--- ioemu.orig/hw/vga_int.h    2006-07-27 11:16:57.447501084 +0100
++++ ioemu/hw/vga_int.h 2006-07-27 11:16:59.925226798 +0100
 @@ -166,5 +166,6 @@
                               unsigned int color0, unsigned int color1,
                               unsigned int color_xor);
@@ -262,9 +262,9 @@ Index: ioemu/hw/vga_int.h
  extern const uint8_t gr_mask[16];
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 15:17:39.755313985 +0100
-+++ ioemu/vl.c 2006-07-26 15:17:39.824306470 +0100
-@@ -5148,6 +5148,78 @@
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.762244841 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.928226466 +0100
+@@ -5149,6 +5149,78 @@
  
  #define MAX_NET_CLIENTS 32
  
@@ -345,8 +345,8 @@ Index: ioemu/vl.c
  #ifdef CONFIG_GDBSTUB
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 15:17:39.621328580 +0100
-+++ ioemu/vl.h 2006-07-26 15:17:39.825306361 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:16:59.549268417 +0100
++++ ioemu/vl.h 2006-07-27 11:16:59.929226356 +0100
 @@ -136,6 +136,13 @@
  
  void main_loop_wait(int timeout);
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/support-xm-console
--- a/tools/ioemu/patches/support-xm-console    Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/support-xm-console    Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,8 @@ diff -r d08c08f8fbf3 vl.c
-diff -r d08c08f8fbf3 vl.c
---- a/vl.c     Mon Jun 26 15:18:25 2006 +0100
-+++ b/vl.c     Mon Jun 26 15:18:37 2006 +0100
-@@ -1535,26 +1535,65 @@ CharDriverState *qemu_chr_open_stdio(voi
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:16:59.384286681 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.614261222 +0100
+@@ -1535,26 +1535,65 @@
      return chr;
  }
  
@@ -65,19 +66,18 @@ diff -r d08c08f8fbf3 vl.c
 -    tty.c_cc[VMIN] = 1;
 -    tty.c_cc[VTIME] = 0;
 -    tcsetattr (master_fd, TCSAFLUSH, &tty);
--
--    fprintf(stderr, "char device redirected to %s\n", slave_name);
 +    /* Set raw attributes on the pty. */
 +    cfmakeraw(&tty);
 +    tcsetattr(slave_fd, TCSAFLUSH, &tty);
 +    
 +    fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd));
 +    store_console_dev(domid, ptsname(master_fd));
-+
+ 
+-    fprintf(stderr, "char device redirected to %s\n", slave_name);
      return qemu_chr_open_fd(master_fd, master_fd);
  }
  
-@@ -5297,7 +5336,9 @@ int main(int argc, char **argv)
+@@ -5298,7 +5337,9 @@
                  break;
              case QEMU_OPTION_nographic:
                  pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/vnc-cleanup
--- a/tools/ioemu/patches/vnc-cleanup   Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/vnc-cleanup   Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,8 @@ diff -r c84300f3abc2 vnc.c
-diff -r c84300f3abc2 vnc.c
---- a/vnc.c    Wed Jul 05 18:11:23 2006 +0100
-+++ b/vnc.c    Thu Jul 06 14:27:28 2006 +0100
-@@ -83,13 +83,16 @@ static void vnc_dpy_update(DisplayState 
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2006-07-27 11:16:52.783017443 +0100
++++ ioemu/vnc.c        2006-07-27 11:17:00.722138579 +0100
+@@ -83,13 +83,16 @@
  static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
  {
      VncState *vs = ds->opaque;
@@ -21,7 +22,7 @@ diff -r c84300f3abc2 vnc.c
  }
  
  static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
-@@ -262,6 +265,7 @@ static void vnc_update_client(void *opaq
+@@ -262,6 +265,7 @@
  static void vnc_update_client(void *opaque)
  {
      VncState *vs = opaque;
@@ -29,7 +30,7 @@ diff -r c84300f3abc2 vnc.c
  
      if (vs->need_update && vs->csock != -1) {
        int y;
-@@ -282,7 +286,7 @@ static void vnc_update_client(void *opaq
+@@ -282,7 +286,7 @@
        row = vs->ds->data;
        old_row = vs->old_data;
  
@@ -38,7 +39,7 @@ diff -r c84300f3abc2 vnc.c
            if (vs->dirty_row[y] & width_mask) {
                int x;
                char *ptr, *old_ptr;
-@@ -307,10 +311,8 @@ static void vnc_update_client(void *opaq
+@@ -307,10 +311,8 @@
            old_row += vs->ds->linesize;
        }
  
@@ -51,7 +52,7 @@ diff -r c84300f3abc2 vnc.c
  
        /* Count rectangles */
        n_rectangles = 0;
-@@ -348,7 +350,9 @@ static void vnc_update_client(void *opaq
+@@ -348,7 +350,9 @@
        vnc_flush(vs);
  
      }
@@ -62,10 +63,11 @@ diff -r c84300f3abc2 vnc.c
  }
  
  static void vnc_timer_init(VncState *vs)
-diff -r c84300f3abc2 vl.c
---- a/vl.c     Wed Jul 05 18:11:23 2006 +0100
-+++ b/vl.c     Thu Jul 06 14:27:28 2006 +0100
-@@ -4586,10 +4586,10 @@ void main_loop_wait(int timeout)
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:17:00.311184072 +0100
++++ ioemu/vl.c 2006-07-27 11:17:00.724138358 +0100
+@@ -4587,10 +4587,10 @@
          /* XXX: better handling of removal */
          for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
              ioh_next = ioh->next;
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/vnc-fixes
--- a/tools/ioemu/patches/vnc-fixes     Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/vnc-fixes     Fri Jul 28 10:51:38 2006 +0100
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 14:29:04.481598583 +0100
-+++ ioemu/vl.c 2006-07-26 14:31:22.668325993 +0100
-@@ -6003,8 +6003,10 @@
+--- ioemu.orig/vl.c    2006-07-27 11:17:00.724138358 +0100
++++ ioemu/vl.c 2006-07-27 11:17:00.874121755 +0100
+@@ -6004,8 +6004,10 @@
                    kernel_filename, kernel_cmdline, initrd_filename,
                    timeoffset);
  
@@ -17,8 +17,8 @@ Index: ioemu/vl.c
      if (use_gdbstub) {
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-07-26 14:29:04.479598804 +0100
-+++ ioemu/vnc.c        2006-07-26 14:31:22.669325883 +0100
+--- ioemu.orig/vnc.c   2006-07-27 11:17:00.722138579 +0100
++++ ioemu/vnc.c        2006-07-27 11:17:00.875121644 +0100
 @@ -3,6 +3,7 @@
   * 
   * Copyright (C) 2006 Anthony Liguori <anthony@xxxxxxxxxxxxx>
@@ -493,8 +493,8 @@ Index: ioemu/vnc.c
  }
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 14:31:22.669325883 +0100
-+++ ioemu/vl.h 2006-07-26 14:32:44.505279724 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:17:00.311184072 +0100
++++ ioemu/vl.h 2006-07-27 11:17:00.875121644 +0100
 @@ -301,6 +301,7 @@
  int is_graphic_console(void);
  CharDriverState *text_console_init(DisplayState *ds);
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/vnc-start-vncviewer
--- a/tools/ioemu/patches/vnc-start-vncviewer   Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/vnc-start-vncviewer   Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-07-26 14:33:08.166663983 +0100
-+++ ioemu/vnc.c        2006-07-26 14:33:08.225657462 +0100
+--- ioemu.orig/vnc.c   2006-07-27 11:17:00.875121644 +0100
++++ ioemu/vnc.c        2006-07-27 11:17:01.032104266 +0100
 @@ -1002,3 +1002,25 @@
  
      vnc_dpy_resize(vs->ds, 640, 400);
@@ -30,8 +30,8 @@ Index: ioemu/vnc.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-26 14:33:08.165664094 +0100
-+++ ioemu/vl.c 2006-07-26 14:33:08.227657240 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:17:00.874121755 +0100
++++ ioemu/vl.c 2006-07-27 11:17:01.035103934 +0100
 @@ -121,6 +121,7 @@
  int bios_size;
  static DisplayState display_state;
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
  const char* keyboard_layout = NULL;
  int64_t ticks_per_sec;
  int boot_device = 'c';
-@@ -4801,6 +4802,7 @@
+@@ -4802,6 +4803,7 @@
  #endif
             "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
           "-vnc display    start a VNC server on display\n"
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
             "-timeoffset     time offset (in seconds) from local time\n"
             "\n"
             "During emulation, the following keys are useful:\n"
-@@ -4889,6 +4891,7 @@
+@@ -4890,6 +4892,7 @@
      QEMU_OPTION_usbdevice,
      QEMU_OPTION_smp,
      QEMU_OPTION_vnc,
@@ -56,7 +56,7 @@ Index: ioemu/vl.c
  
      QEMU_OPTION_d,
      QEMU_OPTION_vcpus,
-@@ -4964,6 +4967,7 @@
+@@ -4965,6 +4968,7 @@
      { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
      { "smp", HAS_ARG, QEMU_OPTION_smp },
      { "vnc", HAS_ARG, QEMU_OPTION_vnc },
@@ -64,7 +64,7 @@ Index: ioemu/vl.c
      
      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
-@@ -5294,6 +5298,7 @@
+@@ -5295,6 +5299,7 @@
  #endif
      snapshot = 0;
      nographic = 0;
@@ -72,7 +72,7 @@ Index: ioemu/vl.c
      kernel_filename = NULL;
      kernel_cmdline = "";
  #ifdef TARGET_PPC
-@@ -5663,6 +5668,9 @@
+@@ -5664,6 +5669,9 @@
                    exit(1);
                }
                break;
@@ -82,7 +82,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_domainname:
                  strncat(domain_name, optarg, sizeof(domain_name) - 20);
                  break;
-@@ -5910,6 +5918,8 @@
+@@ -5911,6 +5919,8 @@
          dumb_display_init(ds);
      } else if (vnc_display != -1) {
        vnc_display_init(ds, vnc_display);
@@ -93,8 +93,8 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-26 14:33:08.167663873 +0100
-+++ ioemu/vl.h 2006-07-26 14:33:08.228657130 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:17:00.875121644 +0100
++++ ioemu/vl.h 2006-07-27 11:17:01.036103823 +0100
 @@ -733,6 +733,7 @@
  
  /* vnc.c */
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/xen-domain-name
--- a/tools/ioemu/patches/xen-domain-name       Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/xen-domain-name       Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/sdl.c
 Index: ioemu/sdl.c
 ===================================================================
---- ioemu.orig/sdl.c   2006-07-12 11:33:54.665109493 +0100
-+++ ioemu/sdl.c        2006-07-12 11:35:01.450735012 +0100
+--- ioemu.orig/sdl.c   2006-07-27 11:16:53.590928008 +0100
++++ ioemu/sdl.c        2006-07-27 11:16:58.124426148 +0100
 @@ -268,14 +268,14 @@
  static void sdl_update_caption(void)
  {
@@ -21,8 +21,8 @@ Index: ioemu/sdl.c
  static void sdl_hide_cursor(void)
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:01.094779608 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:01.453734636 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:57.828458912 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.126425927 +0100
 @@ -159,6 +159,8 @@
  #define MAX_CPUS 1
  #endif
@@ -32,7 +32,7 @@ Index: ioemu/vl.c
  /***********************************************************/
  /* x86 ISA bus support */
  
-@@ -4698,6 +4700,7 @@
+@@ -4699,6 +4701,7 @@
             "-s              wait gdb connection to port %d\n"
             "-p port         change gdb connection port\n"
             "-l item1,...    output log to %s (use -d ? for a list of log 
items)\n"
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
             "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the 
optional BIOS\n"
             "                translation (t=none or lba) (usually qemu can 
guess them)\n"
             "-L path         set the directory for the BIOS and VGA BIOS\n"
-@@ -4787,6 +4790,7 @@
+@@ -4788,6 +4791,7 @@
      QEMU_OPTION_g,
      QEMU_OPTION_std_vga,
      QEMU_OPTION_monitor,
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
      QEMU_OPTION_serial,
      QEMU_OPTION_parallel,
      QEMU_OPTION_loadvm,
-@@ -4860,6 +4864,7 @@
+@@ -4861,6 +4865,7 @@
      { "localtime", 0, QEMU_OPTION_localtime },
      { "std-vga", 0, QEMU_OPTION_std_vga },
      { "monitor", 1, QEMU_OPTION_monitor },
@@ -56,7 +56,7 @@ Index: ioemu/vl.c
      { "serial", 1, QEMU_OPTION_serial },
      { "parallel", 1, QEMU_OPTION_parallel },
      { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
-@@ -5483,6 +5488,9 @@
+@@ -5484,6 +5489,9 @@
                    exit(1);
                }
                break;
@@ -68,8 +68,8 @@ Index: ioemu/vl.c
      }
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-07-12 11:35:00.955797021 +0100
-+++ ioemu/vl.h 2006-07-12 11:35:01.454734511 +0100
+--- ioemu.orig/vl.h    2006-07-27 11:16:57.682475072 +0100
++++ ioemu/vl.h 2006-07-27 11:16:58.127425816 +0100
 @@ -1094,4 +1094,5 @@
  
  void kqemu_record_dump(void);
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/xen-domid
--- a/tools/ioemu/patches/xen-domid     Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/xen-domid     Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,8 @@ diff -r 03705e837ce8 vl.c
-diff -r 03705e837ce8 vl.c
---- a/vl.c     Tue May 30 14:10:44 2006 +0100
-+++ b/vl.c     Tue May 30 14:11:16 2006 +0100
-@@ -160,6 +160,7 @@ int vnc_display = -1;
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.126425927 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.296407110 +0100
+@@ -160,6 +160,7 @@
  #endif
  
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
@@ -9,7 +10,7 @@ diff -r 03705e837ce8 vl.c
  
  /***********************************************************/
  /* x86 ISA bus support */
-@@ -4700,6 +4701,7 @@ void help(void)
+@@ -4701,6 +4702,7 @@
             "-s              wait gdb connection to port %d\n"
             "-p port         change gdb connection port\n"
             "-l item1,...    output log to %s (use -d ? for a list of log 
items)\n"
@@ -17,7 +18,7 @@ diff -r 03705e837ce8 vl.c
             "-domain-name    domain name that we're serving\n"
             "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the 
optional BIOS\n"
             "                translation (t=none or lba) (usually qemu can 
guess them)\n"
-@@ -4803,6 +4805,8 @@ enum {
+@@ -4804,6 +4806,8 @@
      QEMU_OPTION_usbdevice,
      QEMU_OPTION_smp,
      QEMU_OPTION_vnc,
@@ -26,7 +27,7 @@ diff -r 03705e837ce8 vl.c
  };
  
  typedef struct QEMUOption {
-@@ -4878,6 +4882,8 @@ const QEMUOption qemu_options[] = {
+@@ -4879,6 +4883,8 @@
      /* temporary options */
      { "usb", 0, QEMU_OPTION_usb },
      { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
@@ -35,7 +36,7 @@ diff -r 03705e837ce8 vl.c
      { NULL },
  };
  
-@@ -5491,6 +5497,10 @@ int main(int argc, char **argv)
+@@ -5492,6 +5498,10 @@
              case QEMU_OPTION_domainname:
                  strncat(domain_name, optarg, sizeof(domain_name) - 20);
                  break;
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/xen-mm
--- a/tools/ioemu/patches/xen-mm        Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/xen-mm        Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/hw/pc.c
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-07-14 15:55:59.489503600 +0100
-+++ ioemu/hw/pc.c      2006-07-14 15:56:00.354405169 +0100
+--- ioemu.orig/hw/pc.c 2006-07-27 11:16:57.678475515 +0100
++++ ioemu/hw/pc.c      2006-07-27 11:16:58.447390396 +0100
 @@ -639,7 +639,9 @@
      }
  
@@ -25,8 +25,8 @@ Index: ioemu/hw/pc.c
      isa_bios_size = bios_size;
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-14 15:56:00.271414614 +0100
-+++ ioemu/vl.c 2006-07-14 15:56:00.358404714 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.296407110 +0100
++++ ioemu/vl.c 2006-07-27 11:16:58.450390064 +0100
 @@ -159,6 +159,8 @@
  #define MAX_CPUS 1
  #endif
@@ -36,7 +36,7 @@ Index: ioemu/vl.c
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
  extern int domid;
  
-@@ -5105,6 +5107,9 @@
+@@ -5106,6 +5108,9 @@
      QEMUMachine *machine;
      char usb_devices[MAX_VM_USB_PORTS][128];
      int usb_devices_index;
@@ -46,7 +46,7 @@ Index: ioemu/vl.c
  
      char qemu_dm_logfilename[64];
  
-@@ -5341,11 +5346,13 @@
+@@ -5342,11 +5347,13 @@
                  ram_size = atol(optarg) * 1024 * 1024;
                  if (ram_size <= 0)
                      help();
@@ -60,7 +60,7 @@ Index: ioemu/vl.c
                  break;
              case QEMU_OPTION_l:
                  {
-@@ -5559,6 +5566,39 @@
+@@ -5560,6 +5567,39 @@
      /* init the memory */
      phys_ram_size = ram_size + vga_ram_size + bios_size;
  
@@ -100,7 +100,7 @@ Index: ioemu/vl.c
  #ifdef CONFIG_SOFTMMU
      phys_ram_base = qemu_vmalloc(phys_ram_size);
      if (!phys_ram_base) {
-@@ -5599,6 +5639,8 @@
+@@ -5600,6 +5640,8 @@
      }
  #endif
  
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/patches/xen-network
--- a/tools/ioemu/patches/xen-network   Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/patches/xen-network   Fri Jul 28 10:51:38 2006 +0100
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-07-12 11:35:01.753697055 +0100
-+++ ioemu/vl.c 2006-07-12 11:35:02.126650330 +0100
+--- ioemu.orig/vl.c    2006-07-27 11:16:58.823348777 +0100
++++ ioemu/vl.c 2006-07-27 11:16:59.169310479 +0100
 @@ -89,6 +89,7 @@
  #include "exec-all.h"
  
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
          int fd;
          if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
              fd = strtol(buf, NULL, 0);
-@@ -3212,7 +3215,10 @@
+@@ -3213,7 +3216,10 @@
              if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
                  pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
              }
@@ -52,7 +52,7 @@ Index: ioemu/vl.c
          }
      } else
  #endif
-@@ -4671,7 +4677,7 @@
+@@ -4672,7 +4678,7 @@
             "-net tap[,vlan=n],ifname=name\n"
             "                connect the host TAP network interface to VLAN 
'n'\n"
  #else
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/target-i386-dm/exec-dm.c
--- a/tools/ioemu/target-i386-dm/exec-dm.c      Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/target-i386-dm/exec-dm.c      Fri Jul 28 10:51:38 2006 +0100
@@ -64,6 +64,7 @@ uint8_t *code_gen_ptr;
 #endif /* !CONFIG_DM */
 
 uint64_t phys_ram_size;
+extern uint64_t ram_size;
 int phys_ram_fd;
 uint8_t *phys_ram_base;
 uint8_t *phys_ram_dirty;
@@ -422,7 +423,7 @@ void cpu_physical_memory_rw(target_phys_
             l = len;
        
         pd = page;
-        io_index = iomem_index(page);
+        io_index = iomem_index(addr);
         if (is_write) {
             if (io_index) {
                 if (l >= 4 && ((addr & 3) == 0)) {
@@ -467,7 +468,7 @@ void cpu_physical_memory_rw(target_phys_
                     stb_raw(buf, val);
                     l = 1;
                 }
-            } else {
+            } else if (addr < ram_size) {
                 /* RAM case */
                 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
                     (addr & ~TARGET_PAGE_MASK);
@@ -475,6 +476,9 @@ void cpu_physical_memory_rw(target_phys_
 #ifdef __ia64__
                 sync_icache((unsigned long)ptr, l);
 #endif 
+            } else {
+                /* unreported MMIO space */
+                memset(buf, 0xff, len);
             }
         }
         len -= l;
diff -r 1eb42266de1b -r e5c84586c333 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/ioemu/vl.c  Fri Jul 28 10:51:38 2006 +0100
@@ -3284,6 +3284,7 @@ int net_client_init(const char *str)
             if (net_tap_fd_init(vlan, fd))
                 ret = 0;
         } else {
+            ifname[0] = '\0';
             get_param_value(ifname, sizeof(ifname), "ifname", p);
             if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
                 pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
diff -r 1eb42266de1b -r e5c84586c333 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/libxc/Makefile      Fri Jul 28 10:51:38 2006 +0100
@@ -31,9 +31,12 @@ GUEST_SRCS-y += xg_private.c
 GUEST_SRCS-y += xg_private.c
 GUEST_SRCS-$(CONFIG_POWERPC) += xc_ppc_linux_build.c
 GUEST_SRCS-$(CONFIG_X86) += xc_linux_build.c
-GUEST_SRCS-$(CONFIG_IA64) += xc_ia64_stubs.c xc_linux_build.c
+GUEST_SRCS-$(CONFIG_IA64) += xc_linux_build.c
 GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c xc_linux_save.c
 GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c
+
+# This Makefile only adds files if CONFIG_IA64 is y.
+include ia64/Makefile
 
 CFLAGS   += -Werror
 CFLAGS   += -fno-strict-aliasing
@@ -99,6 +102,7 @@ TAGS:
 .PHONY: clean
 clean:
        rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
+       rm -rf ia64/*.o ia64/*.opic
 
 .PHONY: rpm
 rpm: build
diff -r 1eb42266de1b -r e5c84586c333 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/libxc/xc_hvm_build.c        Fri Jul 28 10:51:38 2006 +0100
@@ -15,12 +15,6 @@
 
 #define HVM_LOADER_ENTR_ADDR  0x00100000
 
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#ifdef __x86_64__
-#define L3_PROT (_PAGE_PRESENT)
-#endif
-
 #define E820MAX     128
 
 #define E820_RAM          1
@@ -41,9 +35,6 @@ struct e820entry {
     uint32_t type;
 } __attribute__((packed));
 
-#define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
-#define round_pgdown(_p)  ((_p)&PAGE_MASK)
-
 static int
 parseelfimage(
     char *elfbase, unsigned long elfsize, struct domain_setup_info *dsi);
@@ -52,7 +43,7 @@ loadelfimage(
     char *elfbase, int xch, uint32_t dom, unsigned long *parray,
     struct domain_setup_info *dsi);
 
-static unsigned char build_e820map(void *e820_page, unsigned long long 
mem_size)
+static void build_e820map(void *e820_page, unsigned long long mem_size)
 {
     struct e820entry *e820entry =
         (struct e820entry *)(((unsigned char *)e820_page) + E820_MAP_OFFSET);
@@ -115,7 +106,7 @@ static unsigned char build_e820map(void 
     e820entry[nr_map].type = E820_IO;
     nr_map++;
 
-    return (*(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map);
+    *(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
 }
 
 static void set_hvm_info_checksum(struct hvm_info_table *t)
@@ -186,7 +177,6 @@ static int setup_guest(int xc_handle,
 
     shared_info_t *shared_info;
     void *e820_page;
-    unsigned char e820_map_nr;
 
     struct domain_setup_info dsi;
     uint64_t v_end;
@@ -261,7 +251,7 @@ static int setup_guest(int xc_handle,
               page_array[E820_MAP_PAGE >> PAGE_SHIFT])) == 0 )
         goto error_out;
     memset(e820_page, 0, PAGE_SIZE);
-    e820_map_nr = build_e820map(e820_page, v_end);
+    build_e820map(e820_page, v_end);
     munmap(e820_page, PAGE_SIZE);
 
     /* shared_info page starts its life empty. */
@@ -311,23 +301,7 @@ static int setup_guest(int xc_handle,
     /*
      * Initial register values:
      */
-    ctxt->user_regs.ds = 0;
-    ctxt->user_regs.es = 0;
-    ctxt->user_regs.fs = 0;
-    ctxt->user_regs.gs = 0;
-    ctxt->user_regs.ss = 0;
-    ctxt->user_regs.cs = 0;
     ctxt->user_regs.eip = dsi.v_kernentry;
-    ctxt->user_regs.edx = 0;
-    ctxt->user_regs.eax = 0;
-    ctxt->user_regs.esp = 0;
-    ctxt->user_regs.ebx = 0; /* startup_32 expects this to be 0 to signal boot 
cpu */
-    ctxt->user_regs.ecx = 0;
-    ctxt->user_regs.esi = 0;
-    ctxt->user_regs.edi = 0;
-    ctxt->user_regs.ebp = 0;
-
-    ctxt->user_regs.eflags = 0;
 
     return 0;
 
diff -r 1eb42266de1b -r e5c84586c333 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/libxc/xc_linux_build.c      Fri Jul 28 10:51:38 2006 +0100
@@ -2,6 +2,7 @@
  * xc_linux_build.c
  */
 
+#include <stddef.h>
 #include "xg_private.h"
 #include "xc_private.h"
 #include <xenctrl.h>
@@ -473,6 +474,11 @@ static int setup_guest(int xc_handle,
     unsigned long v_end;
     unsigned long start_page, pgnr;
     start_info_t *start_info;
+    unsigned long start_info_mpa;
+    struct xen_ia64_boot_param *bp;
+    shared_info_t *shared_info;
+    int i;
+    DECLARE_DOM0_OP;
     int rc;
 
     rc = probeimageformat(image, image_size, &load_funcs);
@@ -489,6 +495,18 @@ static int setup_guest(int xc_handle,
     vinitrd_start    = round_pgup(dsi.v_end);
     vinitrd_end      = vinitrd_start + initrd->len;
     v_end            = round_pgup(vinitrd_end);
+    start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
+
+    /* Build firmware.  */
+    memset(&op.u.domain_setup, 0, sizeof(op.u.domain_setup));
+    op.u.domain_setup.flags = 0;
+    op.u.domain_setup.domain = (domid_t)dom;
+    op.u.domain_setup.bp = start_info_mpa + sizeof (start_info_t);
+    op.u.domain_setup.maxmem = (nr_pages - 3) << PAGE_SHIFT;
+    
+    op.cmd = DOM0_DOMAIN_SETUP;
+    if ( xc_dom0_op(xc_handle, &op) )
+        goto error_out;
 
     start_page = dsi.v_start >> PAGE_SHIFT;
     pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
@@ -539,7 +557,7 @@ static int setup_guest(int xc_handle,
     IPRINTF("start_info: 0x%lx at 0x%lx, "
            "store_mfn: 0x%lx at 0x%lx, "
            "console_mfn: 0x%lx at 0x%lx\n",
-           page_array[0], nr_pages,
+           page_array[0], nr_pages - 3,
            *store_mfn,    nr_pages - 2,
            *console_mfn,  nr_pages - 1);
 
@@ -554,22 +572,34 @@ static int setup_guest(int xc_handle,
     start_info->console_mfn   = nr_pages - 1;
     start_info->console_evtchn = console_evtchn;
     start_info->nr_pages       = nr_pages; // FIXME?: nr_pages - 2 ????
+
+    bp = (struct xen_ia64_boot_param *)(start_info + 1);
+    bp->command_line = start_info_mpa + offsetof(start_info_t, cmd_line);
+    if ( cmdline != NULL )
+    {
+        strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
+        start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = 0;
+    }
     if ( initrd->len != 0 )
     {
-        ctxt->initrd.start    = vinitrd_start;
-        ctxt->initrd.size     = initrd->len;
-    }
-    else
-    {
-        ctxt->initrd.start    = 0;
-        ctxt->initrd.size     = 0;
-    }
-    if ( cmdline != NULL )
-    {
-        strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
-        ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
-    }
+        bp->initrd_start    = vinitrd_start;
+        bp->initrd_size     = initrd->len;
+    }
+    ctxt->user_regs.r28 = start_info_mpa + sizeof (start_info_t);
     munmap(start_info, PAGE_SIZE);
+
+    /* shared_info page starts its life empty. */
+    shared_info = xc_map_foreign_range(
+        xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame);
+    printf("shared_info = %p, err=%s frame=%lx\n",
+           shared_info, strerror (errno), shared_info_frame);
+    //memset(shared_info, 0, sizeof(shared_info_t));
+    /* Mask all upcalls... */
+    for ( i = 0; i < MAX_VIRT_CPUS; i++ )
+        shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
+    shared_info->arch.start_info_pfn = nr_pages - 3;
+
+    munmap(shared_info, PAGE_SIZE);
 
     free(page_array);
     return 0;
@@ -1150,16 +1180,10 @@ static int xc_linux_build_internal(int x
 #ifdef __ia64__
     /* based on new_thread in xen/arch/ia64/domain.c */
     ctxt->flags = 0;
-    ctxt->shared.flags = flags;
-    ctxt->shared.start_info_pfn = nr_pages - 3; /* metaphysical */
     ctxt->user_regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */
     ctxt->user_regs.cr_iip = vkern_entry;
     ctxt->user_regs.cr_ifs = 1UL << 63;
     ctxt->user_regs.ar_fpsr = xc_ia64_fpsr_default();
-    /* currently done by hypervisor, should move here */
-    /* ctxt->regs.r28 = dom_fw_setup(); */
-    ctxt->privregs = 0;
-    ctxt->sys_pgnr = 3;
     i = 0; /* silence unused variable warning */
 #else /* x86 */
     /*
diff -r 1eb42266de1b -r e5c84586c333 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/libxc/xc_private.c  Fri Jul 28 10:51:38 2006 +0100
@@ -262,6 +262,7 @@ long long xc_domain_get_cpu_usage( int x
 }
 
 
+#ifndef __ia64__
 int xc_get_pfn_list(int xc_handle,
                     uint32_t domid,
                     xen_pfn_t *pfn_buf,
@@ -305,6 +306,7 @@ int xc_get_pfn_list(int xc_handle,
 
     return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
 }
+#endif
 
 long xc_get_tot_pages(int xc_handle, uint32_t domid)
 {
diff -r 1eb42266de1b -r e5c84586c333 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu Jul 27 17:44:14 2006 -0500
+++ b/tools/libxc/xenctrl.h     Fri Jul 28 10:51:38 2006 +0100
@@ -524,9 +524,6 @@ int xc_clear_domain_page(int xc_handle, 
 int xc_clear_domain_page(int xc_handle, uint32_t domid,
                          unsigned long dst_pfn);
 
-int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
-        void* src_page, unsigned long dst_pfn, int nr_pages);
-
 long xc_get_max_pages(int xc_handle, uint32_t domid);
 
 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/Makefile
--- a/xen/arch/ia64/Makefile    Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/Makefile    Fri Jul 28 10:51:38 2006 +0100
@@ -50,22 +50,22 @@ asm-xsi-offsets.s: asm-xsi-offsets.c $(H
 $(BASEDIR)/include/asm-ia64/.offsets.h.stamp:
 # Need such symbol link to make linux headers available
        [ -e $(BASEDIR)/include/linux ] \
-        || ln -s $(BASEDIR)/include/xen $(BASEDIR)/include/linux
+        || ln -sf $(BASEDIR)/include/xen $(BASEDIR)/include/linux
        [ -e $(BASEDIR)/include/asm-ia64/xen ] \
-        || ln -s $(BASEDIR)/include/asm-ia64/linux 
$(BASEDIR)/include/asm-ia64/xen
+        || ln -sf $(BASEDIR)/include/asm-ia64/linux 
$(BASEDIR)/include/asm-ia64/xen
 # Link to HVM files in Xen for ia64/vti
        [ -e $(BASEDIR)/include/asm-ia64/hvm ] \
         || mkdir $(BASEDIR)/include/asm-ia64/hvm
        [ -e $(BASEDIR)/include/asm-ia64/hvm/support.h ] \
-        || ln -s ../../../include/asm-x86/hvm/support.h 
$(BASEDIR)/include/asm-ia64/hvm/support.h
+        || ln -sf ../../../include/asm-x86/hvm/support.h 
$(BASEDIR)/include/asm-ia64/hvm/support.h
        [ -e $(BASEDIR)/include/asm-ia64/hvm/io.h ] \
-        || ln -s ../../../include/asm-x86/hvm/io.h 
$(BASEDIR)/include/asm-ia64/hvm/io.h
+        || ln -sf ../../../include/asm-x86/hvm/io.h 
$(BASEDIR)/include/asm-ia64/hvm/io.h
        [ -e $(BASEDIR)/include/asm-ia64/hvm/vpic.h ] \
-        || ln -s ../../../include/asm-x86/hvm/vpic.h 
$(BASEDIR)/include/asm-ia64/hvm/vpic.h
+        || ln -sf ../../../include/asm-x86/hvm/vpic.h 
$(BASEDIR)/include/asm-ia64/hvm/vpic.h
        [ -e $(BASEDIR)/include/asm-ia64/hvm/vioapic.h ] \
-        || ln -s ../../../include/asm-x86/hvm/vioapic.h 
$(BASEDIR)/include/asm-ia64/hvm/vioapic.h
+        || ln -sf ../../../include/asm-x86/hvm/vioapic.h 
$(BASEDIR)/include/asm-ia64/hvm/vioapic.h
        [ -e $(BASEDIR)/arch/ia64/vmx/hvm_vioapic.c ] \
-        || ln -s ../../../arch/x86/hvm/vioapic.c 
$(BASEDIR)/arch/ia64/vmx/hvm_vioapic.c
+        || ln -sf ../../../arch/x86/hvm/vioapic.c 
$(BASEDIR)/arch/ia64/vmx/hvm_vioapic.c
 
 # I'm sure a Makefile wizard would know a better way to do this
 xen.lds.s: xen/xen.lds.S
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/asm-offsets.c
--- a/xen/arch/ia64/asm-offsets.c       Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/asm-offsets.c       Fri Jul 28 10:51:38 2006 +0100
@@ -8,6 +8,7 @@
 #include <xen/sched.h>
 #include <asm/processor.h>
 #include <asm/ptrace.h>
+#include <asm/mca.h>
 #include <public/xen.h>
 #include <asm/tlb.h>
 #include <asm/regs.h>
@@ -31,6 +32,9 @@ void foo(void)
        DEFINE(IA64_CPU_SIZE, sizeof (struct cpuinfo_ia64));
        DEFINE(UNW_FRAME_INFO_SIZE, sizeof (struct unw_frame_info));
        DEFINE(SHARED_INFO_SIZE, sizeof (struct shared_info));
+
+       BLANK();
+       DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET, offsetof (struct ia64_mca_cpu, 
init_stack));
 
        BLANK();
 #ifdef   VTI_DEBUG
@@ -61,6 +65,11 @@ void foo(void)
        DEFINE(IA64_VCPU_DTLB_OFFSET, offsetof (struct vcpu, arch.dtlb));
 
        BLANK();
+
+       DEFINE(IA64_DOMAIN_SHADOW_BITMAP_OFFSET, offsetof (struct domain, 
arch.shadow_bitmap));
+
+       BLANK();
+
        DEFINE(IA64_CPUINFO_ITM_NEXT_OFFSET, offsetof (struct cpuinfo_ia64, 
itm_next));
        DEFINE(IA64_CPUINFO_KSOFTIRQD_OFFSET, offsetof (struct cpuinfo_ia64, 
ksoftirqd));
 
@@ -123,7 +132,6 @@ void foo(void)
        DEFINE(IA64_PT_REGS_R6_OFFSET, offsetof (struct pt_regs, r6));
        DEFINE(IA64_PT_REGS_R7_OFFSET, offsetof (struct pt_regs, r7));
        DEFINE(IA64_PT_REGS_EML_UNAT_OFFSET, offsetof (struct pt_regs, 
eml_unat));
-       DEFINE(IA64_PT_REGS_RFI_PFS_OFFSET, offsetof (struct pt_regs, rfi_pfs));
        DEFINE(IA64_VCPU_IIPA_OFFSET, offsetof (struct vcpu, 
arch.arch_vmx.cr_iipa));
        DEFINE(IA64_VCPU_ISR_OFFSET, offsetof (struct vcpu, 
arch.arch_vmx.cr_isr));
        DEFINE(IA64_VCPU_CAUSE_OFFSET, offsetof (struct vcpu, 
arch.arch_vmx.cause));
@@ -180,6 +188,7 @@ void foo(void)
        BLANK();
 
        DEFINE(IA64_VPD_BASE_OFFSET, offsetof (struct vcpu, arch.privregs));
+       DEFINE(IA64_VPD_VIFS_OFFSET, offsetof (mapped_regs_t, ifs));
        DEFINE(IA64_VLSAPIC_INSVC_BASE_OFFSET, offsetof (struct vcpu, 
arch.insvc[0]));
        DEFINE(IA64_VPD_CR_VPTA_OFFSET, offsetof (cr_t, pta));
        DEFINE(XXX_THASH_SIZE, sizeof (thash_data_t));
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/Makefile
--- a/xen/arch/ia64/linux-xen/Makefile  Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/Makefile  Fri Jul 28 10:51:38 2006 +0100
@@ -1,6 +1,8 @@ obj-y += efi.o
 obj-y += efi.o
 obj-y += entry.o
 obj-y += irq_ia64.o
+obj-y += mca.o
+obj-y += mca_asm.o
 obj-y += mm_contig.o
 obj-y += pal.o
 obj-y += process-linux-xen.o
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/README.origin
--- a/xen/arch/ia64/linux-xen/README.origin     Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/README.origin     Fri Jul 28 10:51:38 2006 +0100
@@ -11,6 +11,8 @@ head.S                        -> linux/arch/ia64/kernel/head.
 head.S                 -> linux/arch/ia64/kernel/head.S
 hpsim_ssc.h            -> linux/arch/ia64/hp/sim/hpsim_ssc.h
 irq_ia64.c             -> linux/arch/ia64/kernel/irq_ia64.c
+mca.c                  -> linux/arch/ia64/kernel/mca.c
+mca_asm.S              -> linux/arch/ia64/kernel/mca_asm.S
 minstate.h             -> linux/arch/ia64/kernel/minstate.h
 mm_contig.c            -> linux/arch/ia64/mm/contig.c
 pal.S                  -> linux/arch/ia64/kernel/pal.S
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/entry.S
--- a/xen/arch/ia64/linux-xen/entry.S   Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/entry.S   Fri Jul 28 10:51:38 2006 +0100
@@ -652,17 +652,8 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
     ld8 r16 = [r16]
     ;;
     cmp.ne p6,p7 = r16, r0
- (p6) br.cond.spnt ia64_leave_hypervisor
- (p7) br.cond.spnt ia64_leave_kernel
-    ;;
-//    adds r16 = IA64_VCPU_FLAGS_OFFSET, r13
-//    ;;
-//    ld8 r16 = [r16]
-//    ;;
-//    cmp.ne p6,p7 = r16, r0
-//     (p6) br.cond.spnt ia64_leave_hypervisor
-//     (p7) br.cond.spnt ia64_leave_kernel
-//    ;;
+ (p6) br.cond.spnt ia64_leave_hypervisor       /* VTi */
+ (p7) br.cond.spnt ia64_leave_kernel           /* !VTi */
 #else
 .ret8:
        adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
@@ -901,7 +892,7 @@ GLOBAL_ENTRY(ia64_leave_kernel)
 #ifdef XEN
        ;;
 (pUStk) ssm psr.i
-(pUStk)    br.call.sptk.many b0=process_soft_irq
+(pUStk)    br.call.sptk.many b0=do_softirq
 (pUStk) rsm psr.i
     ;;
        alloc loc0=ar.pfs,0,1,1,0
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/iosapic.c Fri Jul 28 10:51:38 2006 +0100
@@ -1155,7 +1155,7 @@ int iosapic_guest_read(unsigned long phy
 
 int iosapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
 {
-       unsigned int id, gsi, vec, dest, high32;
+       unsigned int id, gsi, vec, xen_vec, dest, high32;
        char rte_index;
        struct iosapic *ios;
        struct iosapic_intr_info *info;
@@ -1185,13 +1185,17 @@ int iosapic_guest_write(unsigned long ph
 
        /* Sanity check. Vector should be allocated before this update */
        if ((rte_index > ios->num_rte) ||
-           test_bit(vec, ia64_xen_vector) ||
            ((vec > IA64_FIRST_DEVICE_VECTOR) &&
             (vec < IA64_LAST_DEVICE_VECTOR) &&
             (!test_bit(vec - IA64_FIRST_DEVICE_VECTOR, ia64_vector_mask))))
            return -EINVAL;
 
        gsi = ios->gsi_base + rte_index;
+       xen_vec = gsi_to_vector(gsi);
+       if (xen_vec >= 0 && test_bit(xen_vec, ia64_xen_vector)) {
+               printk("WARN: GSI %d in use by Xen.\n", gsi);
+               return -EINVAL;
+       }
        info = &iosapic_intr_info[vec];
        spin_lock_irqsave(&irq_descp(vec)->lock, flags);
        spin_lock(&iosapic_lock);
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/minstate.h
--- a/xen/arch/ia64/linux-xen/minstate.h        Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/minstate.h        Fri Jul 28 10:51:38 2006 +0100
@@ -36,7 +36,31 @@
  * For mca_asm.S we want to access the stack physically since the state is 
saved before we
  * go virtual and don't want to destroy the iip or ipsr.
  */
-#define MINSTATE_START_SAVE_MIN_PHYS                                           
                \
+#ifdef XEN
+# define MINSTATE_START_SAVE_MIN_PHYS                                          
                \
+(pKStk)        movl r3=THIS_CPU(ia64_mca_data);;                               
                        \
+(pKStk)        tpa r3 = r3;;                                                   
                        \
+(pKStk)        ld8 r3 = [r3];;                                                 
                        \
+(pKStk)        addl r3=IA64_MCA_CPU_INIT_STACK_OFFSET,r3;;                     
                        \
+(pKStk)        addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r3;                   
                        \
+(pUStk)        mov ar.rsc=0;           /* set enforced lazy mode, pl 0, 
little-endian, loadrs=0 */     \
+(pUStk)        addl r22=IA64_RBS_OFFSET,r1;            /* compute base of 
register backing store */    \
+       ;;                                                                      
                \
+(pUStk)        mov r24=ar.rnat;                                                
                        \
+(pUStk)        addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;   /* compute base 
of memory stack */      \
+(pUStk)        mov r23=ar.bspstore;                            /* save 
ar.bspstore */                  \
+(pUStk)        dep r22=-1,r22,60,4;                    /* compute Xen virtual 
addr of RBS */   \
+       ;;                                                                      
                \
+(pUStk)        mov ar.bspstore=r22;                    /* switch to Xen RBS */ 
                \
+       ;;                                                                      
                \
+(pUStk)        mov r18=ar.bsp;                                                 
                        \
+(pUStk)        mov ar.rsc=0x3;  /* set eager mode, pl 0, little-endian, 
loadrs=0 */                    \
+
+# define MINSTATE_END_SAVE_MIN_PHYS                                            
                \
+       dep r12=-1,r12,60,4;        /* make sp a Xen virtual address */         
        \
+       ;;
+#else
+# define MINSTATE_START_SAVE_MIN_PHYS                                          
                \
 (pKStk) mov r3=IA64_KR(PER_CPU_DATA);;                                         
                \
 (pKStk) addl r3=THIS_CPU(ia64_mca_data),r3;;                                   
                \
 (pKStk) ld8 r3 = [r3];;                                                        
                        \
@@ -55,15 +79,17 @@
 (pUStk)        mov r18=ar.bsp;                                                 
                        \
 (pUStk)        mov ar.rsc=0x3;         /* set eager mode, pl 0, little-endian, 
loadrs=0 */             \
 
-#define MINSTATE_END_SAVE_MIN_PHYS                                             
                \
+# define MINSTATE_END_SAVE_MIN_PHYS                                            
                \
        dep r12=-1,r12,61,3;            /* make sp a kernel virtual address */  
                \
        ;;
+#endif /* XEN */
 
 #ifdef MINSTATE_VIRT
 #ifdef XEN
 # define MINSTATE_GET_CURRENT(reg)                                     \
                movl reg=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;      \
                ld8 reg=[reg]
+# define MINSTATE_GET_CURRENT_VIRT(reg)        MINSTATE_GET_CURRENT(reg)
 #else
 # define MINSTATE_GET_CURRENT(reg)     mov reg=IA64_KR(CURRENT)
 #endif
@@ -72,7 +98,19 @@
 #endif
 
 #ifdef MINSTATE_PHYS
+# ifdef XEN
+# define MINSTATE_GET_CURRENT(reg)                                     \
+       movl reg=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;              \
+       tpa reg=reg;;                                                   \
+       ld8 reg=[reg];;                                                 \
+       tpa reg=reg;;
+# define MINSTATE_GET_CURRENT_VIRT(reg)                                        
\
+       movl reg=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;              \
+       tpa reg=reg;;                                                   \
+       ld8 reg=[reg];;
+#else
 # define MINSTATE_GET_CURRENT(reg)     mov reg=IA64_KR(CURRENT);; tpa reg=reg
+#endif /* XEN */
 # define MINSTATE_START_SAVE_MIN       MINSTATE_START_SAVE_MIN_PHYS
 # define MINSTATE_END_SAVE_MIN         MINSTATE_END_SAVE_MIN_PHYS
 #endif
@@ -175,8 +213,8 @@
        ;;                                                                      
                \
 .mem.offset 0,0; st8.spill [r16]=r13,16;                                       
                \
 .mem.offset 8,0; st8.spill [r17]=r21,16;       /* save ar.fpsr */              
                \
-       /* XEN mov r13=IA64_KR(CURRENT);*/      /* establish `current' */       
                        \
-       MINSTATE_GET_CURRENT(r13);              /* XEN establish `current' */   
                        \
+       /* XEN mov r13=IA64_KR(CURRENT);*/      /* establish `current' */       
                \
+       MINSTATE_GET_CURRENT_VIRT(r13);         /* XEN establish `current' */   
                \
        ;;                                                                      
                \
 .mem.offset 0,0; st8.spill [r16]=r15,16;                                       
                \
 .mem.offset 8,0; st8.spill [r17]=r14,16;                                       
                \
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/tlb.c
--- a/xen/arch/ia64/linux-xen/tlb.c     Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/tlb.c     Fri Jul 28 10:51:38 2006 +0100
@@ -173,7 +173,11 @@ void __devinit
 void __devinit
 ia64_tlb_init (void)
 {
+#ifndef XEN
        ia64_ptce_info_t ptce_info;
+#else
+       ia64_ptce_info_t ptce_info = { 0 };
+#endif
        unsigned long tr_pgbits;
        long status;
 
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/linux-xen/unwind.c
--- a/xen/arch/ia64/linux-xen/unwind.c  Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/linux-xen/unwind.c  Fri Jul 28 10:51:38 2006 +0100
@@ -2056,6 +2056,28 @@ init_frame_info (struct unw_frame_info *
 }
 
 void
+unw_init_from_interruption (struct unw_frame_info *info, struct task_struct *t,
+                           struct pt_regs *pt, struct switch_stack *sw)
+{
+       unsigned long sof;
+
+       init_frame_info(info, t, sw, pt->r12);
+       info->cfm_loc = &pt->cr_ifs;
+       info->unat_loc = &pt->ar_unat;
+       info->pfs_loc = &pt->ar_pfs;
+       sof = *info->cfm_loc & 0x7f;
+       info->bsp = (unsigned long) ia64_rse_skip_regs((unsigned long *) 
info->regstk.top, -sof);
+       info->ip = pt->cr_iip + ia64_psr(pt)->ri;
+       info->pt = (unsigned long) pt;
+       UNW_DPRINT(3, "unwind.%s:\n"
+                  "  bsp    0x%lx\n"
+                  "  sof    0x%lx\n"
+                  "  ip     0x%lx\n",
+                  __FUNCTION__, info->bsp, sof, info->ip);
+       find_save_locs(info);
+}
+
+void
 unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t, 
struct switch_stack *sw)
 {
        unsigned long sol;
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/tools/README.RunVT
--- a/xen/arch/ia64/tools/README.RunVT  Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/tools/README.RunVT  Fri Jul 28 10:51:38 2006 +0100
@@ -1,59 +1,46 @@ INSTRUCTIONS FOR Running IPF/Xen with VT
 INSTRUCTIONS FOR Running IPF/Xen with VT-enabled Tiger4 pltform
 
-Note: the Domain0 must be an unmodified Linux
+1. Install a Linux Disk, VT_Disk, to be used by VT
+2. Setup the target VT_Disk
+       1. Boot VT_Disk
+       2. modify following files of VT_Disk
+               /boot/efi/efi/redhat/elilo.conf -
+                       modify "append=" line to have "root=/dev/hda3"
+                       ** note /dev/hda3 must reflect VT_Disk /root partition
 
-1) Perform operations in README.xenia64 to get a flattened Xen IPF source tree
+               /etc/fstab -
+                       LABEL=/     /     ext3    DEFAULTS  1   1
+                 to
+                       /dev/hda3   /     ext3    DEFAULTS  1   1
+                  and other entries accordingly
+3. Install Xen and boot XenLinux on your standard Linux disk
+        1. modify /boot/efi/efi/redhat/elilo.conf -
+                       "append=" entry to have "root=/dev/sda3"
+       2. modify /etc/fstab -
+                        LABEL=/     /     ext3    DEFAULTS  1   1
+                  to
+                        /dev/sda3   /     ext3    DEFAULTS  1   1
+                  and other entries accordingly
+4. Reboot XenLinux with VT_Disk in /dev/sdb slot
+       1. copy Guest_Firmware.bin into /usr/lib/xen/boot/guest_firmware.bin
+       2. modify /etc/xen/xmexample.vti
+               disk = [ 'phy:/dev/sdb,ioemu:hda,w' ]
+          and make sure
+               kernel=/usr/lib/xen/boot/guest_firmware.bin
+5. Make sure XenLinux has SDL installed by
+       > rpm -q -a | grep SDL
+               SDL-1.2.7-8 SDL-devel-1.2.7-8 
+6. Start vncserver from XenLinux
+       1. ifconfig  to get XenLinux IP address
+       2. vncserver
+7. Start VT Domain
+       1. From a remote system connect to XenLinux through vnc viewer
+       2. On vnc windows
+               > xend start
+               > xm create /etc/xen/xmexample.vti
+          an EFI shell will popup
+               > fs0:
+               fs0:> cd efi\redhat
+               fs0:> elilo linux
 
-2) Build an unmodified Linux 2.6 kernel
-       a) tar xvfz  linux-2.6.11.tar.gz
-        b) cp arch/ia64/configs/tiger_defconfig .config
-       c) Build linux.
-               1) yes "" | make oldconfig
-               2) make
 
-3) Build IPF VT-enabled Xen image
-       edit xen/arch/ia64/Rules.mk for
-               CONFIG_VTI      ?= y    to enable VT-enable build
-4) Setup ELILO.CONF
-       image=xen
-               label=xen
-               initrd=vmlinux2.6.11            // unmodified Linux kernel image
-               read-only
-               append="nomca root=/dev/sda3"
-
-STATUS as 4/28/05 - Features implemented for Domain0
-
-0. Runs unmodified Linux kernel as Domain0
-    Validated with Linux 2.6.11 to run Xwindow and NIC on UP logical processor
-
-1. Take advantage of VT-enabled processor
-   a. Processor intercepts guest privileged instruction and deliver 
Opcode/Cause to Hypervisor
-   b. One VPD (Virtual Processor Descriptor) per Virtual Processor
-   c. Domains are in a different virtual address space from hypervisor. 
Domains have one less VA bit than hypervisor, where hypervisor runs in 
0xF00000... address protected by the processor from Domains.
-
-2. vTLB and guest_VHPT
-   a. vTLB extending machine TLB entries through hypervisor internal data 
structure
-      vTLB caches Domains installed TR's and TC's, and then installs TC's for 
Domains instead.
-      vTLB implements collision chains
-   b. Processor walks hypervisor internal VHPT, not the domain VHPT.  On TLB 
miss, vTLB is consulted first to put hypervisor cached entry into VHPT without 
inject TLB miss to domain.
-
-3. Region ID fix-partitioning
-   a. currently hard partition 24bits of RIDs into 16 partitions by using top 
4bit.
-   b. Hypervisor uses the very last partition RIDs, i.e., 0xFxxxxx RIDs
-   c. Effectively supports Domain0 and 14 other DomainN
-
-4. HyperVisor is mapped with 2 sets of RIDs during runtime, its own RIDs and 
the active Domain RIDs
-   a. Domain RIDs are used by processor to access guest_VHPT during Domain 
runtime
-   b. Hypervisor RIDs are used when Hypervisor is running
-   c. Implies there are some Region registers transition on entering/exiting 
hypervisor
-
-5. Linux styled pt_regs with minor modification for VT and instruction 
emulation
-   a. Part of Domain registers are saved/restored from VPD
-   b. Extended pt_regs to include r4~r7 and Domain's iipa & isr for possible 
instruction emulation, so no need to save a complete set of switch_stack on IVT 
entry
-
-6. Linux styled per virtual processor memory/RSE stacks, which is the same as 
non-VT domain0
-
-7. Handles splitted I/DCache design
-   Newer IPF processors has split I/Dcaches.  The design takes this into 
consideration when Xen recopy Domain0 to target address for execution
-
-
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c  Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/vmx/mmio.c  Fri Jul 28 10:51:38 2006 +0100
@@ -27,7 +27,7 @@
 #include <asm/gcc_intrin.h>
 #include <linux/interrupt.h>
 #include <asm/vmx_vcpu.h>
-#include <asm/privop.h>
+#include <asm/bundle.h>
 #include <asm/types.h>
 #include <public/hvm/ioreq.h>
 #include <asm/mm.h>
@@ -386,20 +386,16 @@ static void write_ipi (VCPU *vcpu, uint6
         struct pt_regs *targ_regs = vcpu_regs (targ);
         struct vcpu_guest_context c;
 
-        printf ("arch_boot_vcpu: %p %p\n",
-                (void *)d->arch.boot_rdv_ip,
-                (void *)d->arch.boot_rdv_r1);
         memset (&c, 0, sizeof (c));
 
-        c.flags = VGCF_VMX_GUEST;
         if (arch_set_info_guest (targ, &c) != 0) {
             printf ("arch_boot_vcpu: failure\n");
             return;
         }
         /* First or next rendez-vous: set registers.  */
         vcpu_init_regs (targ);
-        targ_regs->cr_iip = d->arch.boot_rdv_ip;
-        targ_regs->r1 = d->arch.boot_rdv_r1;
+        targ_regs->cr_iip = d->arch.sal_data->boot_rdv_ip;
+        targ_regs->r1 = d->arch.sal_data->boot_rdv_r1;
 
         if (test_and_clear_bit(_VCPUF_down,&targ->vcpu_flags)) {
             vcpu_wake(targ);
@@ -425,7 +421,6 @@ static void write_ipi (VCPU *vcpu, uint6
    dir 1: read 0:write
     inst_type 0:integer 1:floating point
  */
-extern IA64_BUNDLE __vmx_get_domain_bundle(u64 iip);
 #define SL_INTEGER  0        // store/load interger
 #define SL_FLOATING    1       // store/load floating
 
diff -r 1eb42266de1b -r e5c84586c333 xen/arch/ia64/vmx/pal_emul.c
--- a/xen/arch/ia64/vmx/pal_emul.c      Thu Jul 27 17:44:14 2006 -0500
+++ b/xen/arch/ia64/vmx/pal_emul.c      Fri Jul 28 10:51:38 2006 +0100
@@ -24,18 +24,39 @@
 #include <asm/dom_fw.h>
 #include <asm/tlb.h>
 #include <asm/vmx_mm_def.h>
+#include <xen/hypercall.h>
+#include <public/sched.h>
+
+/*
+ * Handy macros to make sure that the PAL return values start out
+ * as something meaningful.
+ */
+#define INIT_PAL_STATUS_UNIMPLEMENTED(x)               \
+       {                                               \
+               x.status = PAL_STATUS_UNIMPLEMENTED;    \
+               x.v0 = 0;                               \
+               x.v1 = 0;                               \
+               x.v2 = 0;                               \
+       }
+
+#define INIT_PAL_STATUS_SUCCESS(x)                     \
+       {                                               \
+               x.status = PAL_STATUS_SUCCESS;          \
+               x.v0 = 0;                               \
+               x.v1 = 0;                               \
+               x.v2 = 0;                               \
+       }
 
 static void
-get_pal_parameters (VCPU *vcpu, UINT64 *gr29,
-                       UINT64 *gr30, UINT64 *gr31) {
-
-       vcpu_get_gr_nat(vcpu,29,gr29);
-       vcpu_get_gr_nat(vcpu,30,gr30); 
-       vcpu_get_gr_nat(vcpu,31,gr31);
+get_pal_parameters(VCPU *vcpu, UINT64 *gr29, UINT64 *gr30, UINT64 *gr31) {
+
+       vcpu_get_gr_nat(vcpu,29,gr29);
+       vcpu_get_gr_nat(vcpu,30,gr30); 
+       vcpu_get_gr_nat(vcpu,31,gr31);
 }
 
 static void
-set_pal_result (VCPU *vcpu,struct ia64_pal_retval result) {
+set_pal_result(VCPU *vcpu,struct ia64_pal_retval result) {
 
        vcpu_set_gr(vcpu,8, result.status,0);
        vcpu_set_gr(vcpu,9, result.v0,0);
@@ -44,58 +65,60 @@ set_pal_result (VCPU *vcpu,struct ia64_p
 }
 
 static void
-set_sal_result (VCPU *vcpu,struct sal_ret_values result) {
+set_sal_result(VCPU *vcpu,struct sal_ret_values result) {
 
        vcpu_set_gr(vcpu,8, result.r8,0);
        vcpu_set_gr(vcpu,9, result.r9,0);
        vcpu_set_gr(vcpu,10, result.r10,0);
        vcpu_set_gr(vcpu,11, result.r11,0);
 }
-static struct ia64_pal_retval
-pal_cache_flush (VCPU *vcpu) {
+
+static struct ia64_pal_retval
+pal_cache_flush(VCPU *vcpu) {
        UINT64 gr28,gr29, gr30, gr31;
        struct ia64_pal_retval result;
 
-       get_pal_parameters (vcpu, &gr29, &gr30, &gr31);
-       vcpu_get_gr_nat(vcpu,28,&gr28);
+       get_pal_parameters(vcpu, &gr29, &gr30, &gr31);
+       vcpu_get_gr_nat(vcpu, 28, &gr28);
 
        /* Always call Host Pal in int=1 */
-       gr30 = gr30 &(~(0x2UL));
-
-       /* call Host PAL cache flush */
-       result=ia64_pal_call_static(gr28 ,gr29, gr30,gr31,1);  // Clear psr.ic 
when call PAL_CACHE_FLUSH
+       gr30 = gr30 & ~0x2UL;
+
+       /*
+        * Call Host PAL cache flush
+        * Clear psr.ic when call PAL_CACHE_FLUSH
+        */
+       result = ia64_pal_call_static(gr28 ,gr29, gr30, gr31, 1);
 
        /* If host PAL call is interrupted, then loop to complete it */
-//     while (result.status == 1) {
-//             ia64_pal_call_static(gr28 ,gr29, gr30, 
-//                             result.v1,1LL);
-//     }
-       if(result.status != 0) {
-               panic_domain(vcpu_regs(vcpu),"PAL_CACHE_FLUSH ERROR, status 
%ld", result.status);
-       }
-
-       return result;
-}
-
-static struct ia64_pal_retval
-pal_vm_tr_read (VCPU *vcpu ) {
-       struct ia64_pal_retval result;
-
-       result.status= -1; //unimplemented
-
-       return result;
-}
-
-
-static struct ia64_pal_retval
-pal_prefetch_visibility (VCPU *vcpu)  {
+//     while (result.status == 1)
+//             ia64_pal_call_static(gr28 ,gr29, gr30, result.v1, 1LL);
+//
+       if (result.status != 0)
+               panic_domain(vcpu_regs(vcpu), "PAL_CACHE_FLUSH ERROR, "
+                            "status %ld", result.status);
+
+       return result;
+}
+
+static struct ia64_pal_retval
+pal_vm_tr_read(VCPU *vcpu) {
+       struct ia64_pal_retval result;
+
+       INIT_PAL_STATUS_UNIMPLEMENTED(result);
+
+       return result;
+}
+
+static struct ia64_pal_retval
+pal_prefetch_visibility(VCPU *vcpu) {
        /* Due to current MM virtualization algorithm,
         * We do not allow guest to change mapping attribute.
         * Thus we will not support PAL_PREFETCH_VISIBILITY
         */
        struct ia64_pal_retval result;
 
-       result.status= -1; //unimplemented
+       INIT_PAL_STATUS_UNIMPLEMENTED(result);
 
        return result;
 }
@@ -104,288 +127,315 @@ pal_platform_addr(VCPU *vcpu) {
 pal_platform_addr(VCPU *vcpu) {
        struct ia64_pal_retval result;
 
-       result.status= 0; //success
-
-       return result;
-}
-
-static struct ia64_pal_retval
-pal_halt (VCPU *vcpu) {
+       INIT_PAL_STATUS_SUCCESS(result);
+
+       return result;
+}
+
+static struct ia64_pal_retval
+pal_halt(VCPU *vcpu) {
        //bugbug: to be implement. 
        struct ia64_pal_retval result;
 
-       result.status= -1; //unimplemented
-
-       return result;
-}
-
-
-static struct ia64_pal_retval
-pal_halt_light (VCPU *vcpu) {
-       st