WARNING - OLD ARCHIVES

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

xen-ppc-devel

[XenPPC] [xenppc-unstable] merge with changeset: 12460:317e71a06828

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] merge with changeset: 12460:317e71a06828
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 20:51:19 +0000
Delivery-date: Tue, 17 Oct 2006 13:57:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID a1fdeb2c6d77d626010533b7111c93f24e86201e
# Parent  3dfeb3e4a03f0f1eb6b015b89e7d7cc2f2d50207
# Parent  317e71a06828aa729be7e9fbd371fff1c50e9d65
merge with changeset:   12460:317e71a06828
---
 tools/misc/mbootpack/GPL                                              |  340 
---
 tools/misc/mbootpack/Makefile                                         |   67 
 tools/misc/mbootpack/README                                           |   75 
 tools/misc/mbootpack/bin2c.c                                          |  356 
---
 tools/misc/mbootpack/bootsect.S                                       |  136 -
 tools/misc/mbootpack/buildimage.c                                     |  176 -
 tools/misc/mbootpack/mb_header.h                                      |   90 
 tools/misc/mbootpack/mb_info.h                                        |  217 --
 tools/misc/mbootpack/mbootpack.c                                      |  704 
------
 tools/misc/mbootpack/mbootpack.h                                      |  109 -
 tools/misc/mbootpack/setup.S                                          | 1064 
----------
 .hgignore                                                             |    3 
 .hgtags                                                               |    1 
 Config.mk                                                             |   47 
 Makefile                                                              |    5 
 buildconfigs/Rules.mk                                                 |    7 
 config/Linux.mk                                                       |   41 
 config/SunOS.mk                                                       |   37 
 config/ia64.mk                                                        |    2 
 config/powerpc64.mk                                                   |    1 
 config/x86_32.mk                                                      |    4 
 config/x86_64.mk                                                      |    6 
 docs/Makefile                                                         |    5 
 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c                       |   14 
 linux-2.6-xen-sparse/drivers/xen/netback/common.h                     |    2 
 linux-2.6-xen-sparse/drivers/xen/netback/interface.c                  |   28 
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c                    |   71 
 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c                     |   89 
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c                  |  124 -
 linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c                    |   27 
 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h                    |    1 
 tools/Makefile                                                        |    2 
 tools/Rules.mk                                                        |    8 
 tools/blktap/drivers/Makefile                                         |    6 
 tools/blktap/lib/Makefile                                             |    8 
 tools/check/chk                                                       |    2 
 tools/console/Makefile                                                |    8 
 tools/console/daemon/io.c                                             |    2 
 tools/console/daemon/utils.c                                          |    2 
 tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c |    2 
 tools/examples/Makefile                                               |    5 
 tools/firmware/Makefile                                               |    6 
 tools/firmware/acpi/Makefile                                          |    2 
 tools/firmware/acpi/acpi_dsdt.asl                                     |   66 
 tools/firmware/acpi/acpi_dsdt.c                                       |  470 
++--
 tools/firmware/hvmloader/smbios.c                                     |    1 
 tools/guest-headers/Makefile                                          |   12 
 tools/ioemu/Makefile.target                                           |    8 
 tools/ioemu/vl.c                                                      |    8 
 tools/libxc/Makefile                                                  |   18 
 tools/libxc/ia64/xc_ia64_linux_restore.c                              |   44 
 tools/libxc/ia64/xc_ia64_linux_save.c                                 |   64 
 tools/libxc/xc_linux_restore.c                                        |   94 
 tools/libxc/xc_linux_save.c                                           |  104 
 tools/libxc/xc_private.h                                              |   10 
 tools/libxc/xc_ptrace.c                                               |    2 
 tools/libxc/xc_ptrace.h                                               |   24 
 tools/libxc/xc_ptrace_core.c                                          |    2 
 tools/libxc/xc_solaris.c                                              |  235 ++
 tools/libxc/xenctrl.h                                                 |   35 
 tools/libxc/xg_private.c                                              |    1 
 tools/libxc/xg_private.h                                              |    4 
 tools/misc/Makefile                                                   |   10 
 tools/misc/lomount/Makefile                                           |    5 
 tools/misc/miniterm/Makefile                                          |    4 
 tools/misc/xend                                                       |   10 
 tools/python/xen/util/auxbin.py                                       |    2 
 tools/python/xen/xend/XendRoot.py                                     |    5 
 tools/python/xen/xend/arch.py                                         |    1 
 tools/python/xen/xend/image.py                                        |    5 
 tools/python/xen/xend/osdep.py                                        |   36 
 tools/python/xen/xend/server/SrvDaemon.py                             |    9 
 tools/vnet/doc/Makefile                                               |    5 
 tools/vnet/examples/Makefile                                          |    6 
 tools/vnet/libxutil/Makefile                                          |    7 
 tools/vnet/scripts/Makefile                                           |    6 
 tools/vnet/vnetd/Makefile                                             |    2 
 tools/vtpm/Rules.mk                                                   |    5 
 tools/vtpm_manager/Rules.mk                                           |    5 
 tools/xcutils/Makefile                                                |    4 
 tools/xcutils/readnotes.c                                             |    6 
 tools/xenmon/Makefile                                                 |    9 
 tools/xenstat/libxenstat/Makefile                                     |   12 
 tools/xenstat/xentop/Makefile                                         |    7 
 tools/xenstat/xentop/xentop.c                                         |   15 
 tools/xenstore/Makefile                                               |   20 
 tools/xenstore/xenstore_client.c                                      |   21 
 tools/xenstore/xenstored_core.c                                       |    7 
 tools/xenstore/xenstored_core.h                                       |    3 
 tools/xenstore/xenstored_linux.c                                      |    4 
 tools/xenstore/xenstored_solaris.c                                    |   66 
 tools/xenstore/xenstored_transaction.c                                |    2 
 tools/xenstore/xs_lib.c                                               |    9 
 tools/xenstore/xsls.c                                                 |    1 
 tools/xentrace/Makefile                                               |    5 
 xen/Makefile                                                          |    2 
 xen/Rules.mk                                                          |   10 
 xen/arch/x86/domain_build.c                                           |    4 
 xen/arch/x86/hvm/hvm.c                                                |    4 
 xen/arch/x86/hvm/i8259.c                                              |   45 
 xen/arch/x86/hvm/platform.c                                           |   20 
 xen/arch/x86/hvm/svm/svm.c                                            |   10 
 xen/arch/x86/i387.c                                                   |    9 
 xen/arch/x86/mm/shadow/common.c                                       |    4 
 xen/arch/x86/mm/shadow/multi.c                                        |  134 -
 xen/arch/x86/oprofile/xenoprof.c                                      |   90 
 xen/include/acpi/platform/acenv.h                                     |    2 
 xen/include/asm-x86/msr.h                                             |    8 
 xen/include/asm-x86/perfc_defn.h                                      |    4 
 xen/include/asm-x86/x86_64/asm_defns.h                                |    6 
 xen/include/public/io/ring.h                                          |   22 
 111 files changed, 1416 insertions(+), 4376 deletions(-)

diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 .hgignore
--- a/.hgignore Fri Oct 13 11:00:32 2006 -0400
+++ b/.hgignore Tue Oct 17 16:44:57 2006 -0400
@@ -15,8 +15,11 @@
 .*\.rej$
 .*/a\.out$
 .*/cscope\..*$
+^cscope.*$
 ^[^/]*\.bz2$
+^\.config$
 ^TAGS$
+^tags$
 ^dist/.*$
 ^docs/.*\.aux$
 ^docs/.*\.dvi$
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 .hgtags
--- a/.hgtags   Fri Oct 13 11:00:32 2006 -0400
+++ b/.hgtags   Tue Oct 17 16:44:57 2006 -0400
@@ -15,3 +15,4 @@ c8fdb0caa77b429cf47f9707926e83947778cb48
 c8fdb0caa77b429cf47f9707926e83947778cb48 RELEASE-3.0.0
 af0573e9e5258db0a9d28aa954dd302ddd2c2d23 3.0.2-rc
 d0d3fef37685be264a7f52201f8ef44c030daad3 3.0.2-branched
+6ed4368b4a9e1924c983774c4b1a2b6baf8e98a6 3.0.3-branched
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 Config.mk
--- a/Config.mk Fri Oct 13 11:00:32 2006 -0400
+++ b/Config.mk Tue Oct 17 16:44:57 2006 -0400
@@ -4,43 +4,21 @@ debug ?= n
 debug ?= n
 
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
-                                              -e s/ppc/powerpc/)
+                         -e s/ppc/powerpc/ -e s/i86pc/x86_32/)
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
 XEN_TARGET_X86_PAE  ?= n
+XEN_OS              ?= $(shell uname -s)
+
+CONFIG_$(XEN_OS) := y
 
 # Tools to run on system hosting the build
 HOSTCC     = gcc
 HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 
-AS         = $(CROSS_COMPILE)as
-LD         = $(CROSS_COMPILE)ld
-CC         = $(CROSS_COMPILE)gcc
-CPP        = $(CROSS_COMPILE)gcc -E
-AR         = $(CROSS_COMPILE)ar
-RANLIB     = $(CROSS_COMPILE)ranlib
-NM         = $(CROSS_COMPILE)nm
-STRIP      = $(CROSS_COMPILE)strip
-OBJCOPY    = $(CROSS_COMPILE)objcopy
-OBJDUMP    = $(CROSS_COMPILE)objdump
-
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
 
-INSTALL      = install
-INSTALL_DIR  = $(INSTALL) -d -m0755
-INSTALL_DATA = $(INSTALL) -m0644
-INSTALL_PROG = $(INSTALL) -m0755
-
-ifneq ($(debug),y)
-# Optimisation flags are overridable
-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
-
+include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
 ifneq ($(EXTRA_PREFIX),)
@@ -48,18 +26,25 @@ EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
 endif
 
-test-gcc-flag = $(shell $(1) -v --help 2>&1 | grep -q " $(2) " && echo $(2))
+test-gcc-flag = $(shell $(1) -v --help 2>&1 | $(GREP) -q " $(2) " && echo $(2))
+
+ifneq ($(debug),y)
+CFLAGS += -DNDEBUG
+else
+CFLAGS += -g
+endif
 
 CFLAGS += -Wall -Wstrict-prototypes
+
+# -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
+# result of any casted expression causes a warning.
+CFLAGS += -Wno-unused-value
 
 HOSTCFLAGS += $(call test-gcc-flag,$(HOSTCC),-Wdeclaration-after-statement)
 CFLAGS     += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement)
 
 LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
-
-# Choose the best mirror to download linux kernel
-KERNEL_REPO = http://www.kernel.org
 
 # If ACM_SECURITY = y, then the access control module is compiled
 # into Xen and the policy type can be set by the boot policy file
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 Makefile
--- a/Makefile  Fri Oct 13 11:00:32 2006 -0400
+++ b/Makefile  Tue Oct 17 16:44:57 2006 -0400
@@ -1,11 +1,6 @@
 #
 # Grand Unified Makefile for Xen.
 #
-
-KERNELS ?= linux-2.6-xen
-# You may use wildcards in the above e.g. KERNELS=*2.6*
-
-XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst 
buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) )
 
 # Export target architecture overrides to Xen and Linux sub-trees.
 ifneq ($(XEN_TARGET_ARCH),)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 buildconfigs/Rules.mk
--- a/buildconfigs/Rules.mk     Fri Oct 13 11:00:32 2006 -0400
+++ b/buildconfigs/Rules.mk     Tue Oct 17 16:44:57 2006 -0400
@@ -2,6 +2,9 @@ include Config.mk
 include Config.mk
 
 export DESTDIR
+
+# Choose the best mirror to download linux kernel
+KERNEL_REPO = http://www.kernel.org
 
 ALLKERNELS = $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.*))
 ALLSPARSETREES = $(patsubst %-xen-sparse,%,$(wildcard *-xen-sparse))
@@ -19,7 +22,7 @@ endif
 
 # Expand Linux series to Linux version
 LINUX_SERIES   ?= 2.6
-LINUX_VER      ?= $(shell grep "^LINUX_VER " buildconfigs/mk.linux-2.6-xen | 
sed -e 's/.*=[ ]*//')
+LINUX_VER      ?= $(shell $(GREP) "^LINUX_VER " buildconfigs/mk.linux-2.6-xen 
| sed -e 's/.*=[ ]*//')
 
 # Setup Linux search path
 LINUX_SRC_PATH ?= .:..
@@ -122,7 +125,7 @@ ifeq ($(XEN_TARGET_X86_PAE),y)
 ifeq ($(XEN_TARGET_X86_PAE),y)
        sed -e 's!^CONFIG_HIGHMEM4G=y$$!\# CONFIG_HIGHMEM4G is not set!;s!^\# 
CONFIG_HIGHMEM64G is not set$$!CONFIG_HIGHMEM64G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE)
 else
-       grep '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 
's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# 
CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true
+       $(GREP) '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 
's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# 
CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true
 endif
 
 # never delete any intermediate files.
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 config/ia64.mk
--- a/config/ia64.mk    Fri Oct 13 11:00:32 2006 -0400
+++ b/config/ia64.mk    Tue Oct 17 16:44:57 2006 -0400
@@ -1,4 +1,6 @@ CONFIG_IA64 := y
 CONFIG_IA64 := y
+CONFIG_IA64_$(XEN_OS) := y
+
 CONFIG_IOEMU := y
 CONFIG_XCUTILS := y
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 config/powerpc64.mk
--- a/config/powerpc64.mk       Fri Oct 13 11:00:32 2006 -0400
+++ b/config/powerpc64.mk       Tue Oct 17 16:44:57 2006 -0400
@@ -1,4 +1,5 @@ CONFIG_POWERPC := y
 CONFIG_POWERPC := y
+CONFIG_POWERPC_$(XEN_OS) := y
 
 CFLAGS += -DELFSIZE=64
 LIBDIR := lib
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 config/x86_32.mk
--- a/config/x86_32.mk  Fri Oct 13 11:00:32 2006 -0400
+++ b/config/x86_32.mk  Tue Oct 17 16:44:57 2006 -0400
@@ -1,9 +1,11 @@ CONFIG_X86 := y
 CONFIG_X86 := y
+CONFIG_X86_$(XEN_OS) := y
+
 CONFIG_HVM := y
 CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
 CONFIG_IOEMU := y
-CONFIG_MBOOTPACK := y
 
 CFLAGS += -m32 -march=i686
+LDFLAGS += -m32
 LIBDIR := lib
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 config/x86_64.mk
--- a/config/x86_64.mk  Fri Oct 13 11:00:32 2006 -0400
+++ b/config/x86_64.mk  Tue Oct 17 16:44:57 2006 -0400
@@ -1,9 +1,11 @@ CONFIG_X86 := y
 CONFIG_X86 := y
+CONFIG_X86_$(XEN_OS) := y
+
 CONFIG_HVM := y
 CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
 CONFIG_IOEMU := y
-CONFIG_MBOOTPACK := y
 
 CFLAGS += -m64
-LIBDIR = lib64
+LDFLAGS += -m64
+LIBDIR = $(LIB64DIR)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 docs/Makefile
--- a/docs/Makefile     Fri Oct 13 11:00:32 2006 -0400
+++ b/docs/Makefile     Tue Oct 17 16:44:57 2006 -0400
@@ -1,8 +1,9 @@
 #!/usr/bin/make -f
 
+XEN_ROOT=..
+include $(XEN_ROOT)/Config.mk
+
 VERSION                = xen-unstable
-INSTALL                = install
-INSTALL_DIR    = $(INSTALL) -d -m0755
 
 PS2PDF         := ps2pdf
 DVIPS          := dvips
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Fri Oct 13 11:00:32 
2006 -0400
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c   Tue Oct 17 16:44:57 
2006 -0400
@@ -546,6 +546,7 @@ struct xen_ia64_privcmd_range {
 };
 
 struct xen_ia64_privcmd_vma {
+       int                             is_privcmd_mmapped;
        struct xen_ia64_privcmd_range*  range;
 
        unsigned long                   num_entries;
@@ -684,12 +685,15 @@ static void
 static void
 xen_ia64_privcmd_vma_open(struct vm_area_struct* vma)
 {
+       struct xen_ia64_privcmd_vma* old_privcmd_vma = (struct 
xen_ia64_privcmd_vma*)vma->vm_private_data;
        struct xen_ia64_privcmd_vma* privcmd_vma = (struct 
xen_ia64_privcmd_vma*)vma->vm_private_data;
        struct xen_ia64_privcmd_range* privcmd_range = privcmd_vma->range;
 
        atomic_inc(&privcmd_range->ref_count);
        // vm_op->open() can't fail.
        privcmd_vma = kmalloc(sizeof(*privcmd_vma), GFP_KERNEL | __GFP_NOFAIL);
+       // copy original value if necessary
+       privcmd_vma->is_privcmd_mmapped = old_privcmd_vma->is_privcmd_mmapped;
 
        __xen_ia64_privcmd_vma_open(vma, privcmd_vma, privcmd_range);
 }
@@ -722,6 +726,14 @@ xen_ia64_privcmd_vma_close(struct vm_are
                kfree(privcmd_range->res);
                vfree(privcmd_range);
        }
+}
+
+int
+privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
+{
+       struct xen_ia64_privcmd_vma* privcmd_vma =
+               (struct xen_ia64_privcmd_vma *)vma->vm_private_data;
+       return (xchg(&privcmd_vma->is_privcmd_mmapped, 1) == 0);
 }
 
 int
@@ -749,6 +761,8 @@ privcmd_mmap(struct file * file, struct 
        if (privcmd_vma == NULL) {
                goto out_enomem1;
        }
+       privcmd_vma->is_privcmd_mmapped = 0;
+
        res = kzalloc(sizeof(*res), GFP_KERNEL);
        if (res == NULL) {
                goto out_enomem1;
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/drivers/xen/netback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h Fri Oct 13 11:00:32 
2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h Tue Oct 17 16:44:57 
2006 -0400
@@ -106,7 +106,7 @@ typedef struct netif_st {
 
 void netif_disconnect(netif_t *netif);
 
-netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]);
+netif_t *netif_alloc(domid_t domid, unsigned int handle);
 int netif_map(netif_t *netif, unsigned long tx_ring_ref,
              unsigned long rx_ring_ref, unsigned int evtchn);
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Fri Oct 13 
11:00:32 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Tue Oct 17 
16:44:57 2006 -0400
@@ -126,9 +126,9 @@ static struct ethtool_ops network_ethtoo
        .get_link = ethtool_op_get_link,
 };
 
-netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN])
-{
-       int err = 0, i;
+netif_t *netif_alloc(domid_t domid, unsigned int handle)
+{
+       int err = 0;
        struct net_device *dev;
        netif_t *netif;
        char name[IFNAMSIZ] = {};
@@ -169,20 +169,14 @@ netif_t *netif_alloc(domid_t domid, unsi
                printk(KERN_WARNING "netbk: WARNING: device '%s' has non-zero "
                       "queue length (%lu)!\n", dev->name, dev->tx_queue_len);
 
-       for (i = 0; i < ETH_ALEN; i++)
-               if (be_mac[i] != 0)
-                       break;
-       if (i == ETH_ALEN) {
-               /*
-                * Initialise a dummy MAC address. We choose the numerically
-                * largest non-broadcast address to prevent the address getting
-                * stolen by an Ethernet bridge for STP purposes.
-                * (FE:FF:FF:FF:FF:FF)
-                */ 
-               memset(dev->dev_addr, 0xFF, ETH_ALEN);
-               dev->dev_addr[0] &= ~0x01;
-       } else
-               memcpy(dev->dev_addr, be_mac, ETH_ALEN);
+       /*
+        * Initialise a dummy MAC address. We choose the numerically
+        * largest non-broadcast address to prevent the address getting
+        * stolen by an Ethernet bridge for STP purposes.
+        * (FE:FF:FF:FF:FF:FF)
+        */ 
+       memset(dev->dev_addr, 0xFF, ETH_ALEN);
+       dev->dev_addr[0] &= ~0x01;
 
        rtnl_lock();
        err = register_netdevice(dev);
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Fri Oct 13 
11:00:32 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Tue Oct 17 
16:44:57 2006 -0400
@@ -78,7 +78,7 @@ static inline unsigned long idx_to_kaddr
 
 #define PKT_PROT_LEN 64
 
-static struct {
+static struct pending_tx_info {
        netif_tx_request_t req;
        netif_t *netif;
 } pending_tx_info[MAX_PENDING_REQS];
@@ -374,14 +374,22 @@ static u16 netbk_gop_frag(netif_t *netif
                   flipped. */
                meta->copy = 1;
                copy_gop = npo->copy + npo->copy_prod++;
-               copy_gop->source.domid = DOMID_SELF;
+               copy_gop->flags = GNTCOPY_dest_gref;
+               if (PageForeign(page)) {
+                       struct pending_tx_info *src_pend =
+                               &pending_tx_info[page->index];
+                       copy_gop->source.domid = src_pend->netif->domid;
+                       copy_gop->source.u.ref = src_pend->req.gref;
+                       copy_gop->flags |= GNTCOPY_source_gref;
+               } else {
+                       copy_gop->source.domid = DOMID_SELF;
+                       copy_gop->source.u.gmfn = old_mfn;
+               }
                copy_gop->source.offset = offset;
-               copy_gop->source.u.gmfn = old_mfn;
                copy_gop->dest.domid = netif->domid;
                copy_gop->dest.offset = 0;
                copy_gop->dest.u.ref = req->gref;
                copy_gop->len = size;
-               copy_gop->flags = GNTCOPY_dest_gref;
        } else {
                meta->copy = 0;
                if (!xen_feature(XENFEAT_auto_translated_physmap)) {
@@ -875,20 +883,28 @@ static void netbk_tx_err(netif_t *netif,
        netif_put(netif);
 }
 
-static int netbk_count_requests(netif_t *netif, netif_tx_request_t *txp,
-                               int work_to_do)
-{
-       netif_tx_request_t *first = txp;
+static int netbk_count_requests(netif_t *netif, netif_tx_request_t *first,
+                               netif_tx_request_t *txp, int work_to_do)
+{
        RING_IDX cons = netif->tx.req_cons;
        int frags = 0;
 
-       while (txp->flags & NETTXF_more_data) {
+       if (!(first->flags & NETTXF_more_data))
+               return 0;
+
+       do {
                if (frags >= work_to_do) {
                        DPRINTK("Need more frags\n");
                        return -frags;
                }
 
-               txp = RING_GET_REQUEST(&netif->tx, cons + frags);
+               if (unlikely(frags >= MAX_SKB_FRAGS)) {
+                       DPRINTK("Too many frags\n");
+                       return -frags;
+               }
+
+               memcpy(txp, RING_GET_REQUEST(&netif->tx, cons + frags),
+                      sizeof(*txp));
                if (txp->size > first->size) {
                        DPRINTK("Frags galore\n");
                        return -frags;
@@ -902,27 +918,25 @@ static int netbk_count_requests(netif_t 
                                txp->offset, txp->size);
                        return -frags;
                }
-       }
+       } while ((txp++)->flags & NETTXF_more_data);
 
        return frags;
 }
 
 static gnttab_map_grant_ref_t *netbk_get_requests(netif_t *netif,
                                                  struct sk_buff *skb,
+                                                 netif_tx_request_t *txp,
                                                  gnttab_map_grant_ref_t *mop)
 {
        struct skb_shared_info *shinfo = skb_shinfo(skb);
        skb_frag_t *frags = shinfo->frags;
-       netif_tx_request_t *txp;
        unsigned long pending_idx = *((u16 *)skb->data);
-       RING_IDX cons = netif->tx.req_cons;
        int i, start;
 
        /* Skip first skb fragment if it is on same page as header fragment. */
        start = ((unsigned long)shinfo->frags[0].page == pending_idx);
 
-       for (i = start; i < shinfo->nr_frags; i++) {
-               txp = RING_GET_REQUEST(&netif->tx, cons++);
+       for (i = start; i < shinfo->nr_frags; i++, txp++) {
                pending_idx = pending_ring[MASK_PEND_IDX(pending_cons++)];
 
                gnttab_set_map_op(mop++, idx_to_kaddr(pending_idx),
@@ -1036,7 +1050,7 @@ int netbk_get_extras(netif_t *netif, str
 int netbk_get_extras(netif_t *netif, struct netif_extra_info *extras,
                     int work_to_do)
 {
-       struct netif_extra_info *extra;
+       struct netif_extra_info extra;
        RING_IDX cons = netif->tx.req_cons;
 
        do {
@@ -1045,18 +1059,18 @@ int netbk_get_extras(netif_t *netif, str
                        return -EBADR;
                }
 
-               extra = (struct netif_extra_info *)
-                       RING_GET_REQUEST(&netif->tx, cons);
-               if (unlikely(!extra->type ||
-                            extra->type >= XEN_NETIF_EXTRA_TYPE_MAX)) {
+               memcpy(&extra, RING_GET_REQUEST(&netif->tx, cons),
+                      sizeof(extra));
+               if (unlikely(!extra.type ||
+                            extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) {
                        netif->tx.req_cons = ++cons;
-                       DPRINTK("Invalid extra type: %d\n", extra->type);
+                       DPRINTK("Invalid extra type: %d\n", extra.type);
                        return -EINVAL;
                }
 
-               memcpy(&extras[extra->type - 1], extra, sizeof(*extra));
+               memcpy(&extras[extra.type - 1], &extra, sizeof(extra));
                netif->tx.req_cons = ++cons;
-       } while (extra->flags & XEN_NETIF_EXTRA_FLAG_MORE);
+       } while (extra.flags & XEN_NETIF_EXTRA_FLAG_MORE);
 
        return work_to_do;
 }
@@ -1091,6 +1105,7 @@ static void net_tx_action(unsigned long 
        struct sk_buff *skb;
        netif_t *netif;
        netif_tx_request_t txreq;
+       netif_tx_request_t txfrags[MAX_SKB_FRAGS];
        struct netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX - 1];
        u16 pending_idx;
        RING_IDX i;
@@ -1167,18 +1182,12 @@ static void net_tx_action(unsigned long 
                        }
                }
 
-               ret = netbk_count_requests(netif, &txreq, work_to_do);
+               ret = netbk_count_requests(netif, &txreq, txfrags, work_to_do);
                if (unlikely(ret < 0)) {
                        netbk_tx_err(netif, &txreq, i - ret);
                        continue;
                }
                i += ret;
-
-               if (unlikely(ret > MAX_SKB_FRAGS)) {
-                       DPRINTK("Too many frags\n");
-                       netbk_tx_err(netif, &txreq, i);
-                       continue;
-               }
 
                if (unlikely(txreq.size < ETH_HLEN)) {
                        DPRINTK("Bad packet size: %d\n", txreq.size);
@@ -1248,7 +1257,7 @@ static void net_tx_action(unsigned long 
 
                pending_cons++;
 
-               mop = netbk_get_requests(netif, skb, mop);
+               mop = netbk_get_requests(netif, skb, txfrags, mop);
 
                netif->tx.req_cons = i;
                netif_schedule_work(netif);
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Oct 13 11:00:32 
2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Tue Oct 17 16:44:57 
2006 -0400
@@ -28,29 +28,20 @@
     printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
 #endif
 
-struct backend_info
-{
+struct backend_info {
        struct xenbus_device *dev;
        netif_t *netif;
-       struct xenbus_watch backend_watch;
        enum xenbus_state frontend_state;
 };
 
 static int connect_rings(struct backend_info *);
 static void connect(struct backend_info *);
-static void maybe_connect(struct backend_info *);
-static void backend_changed(struct xenbus_watch *, const char **,
-                           unsigned int);
+static void backend_create_netif(struct backend_info *be);
 
 static int netback_remove(struct xenbus_device *dev)
 {
        struct backend_info *be = dev->dev.driver_data;
 
-       if (be->backend_watch.node) {
-               unregister_xenbus_watch(&be->backend_watch);
-               kfree(be->backend_watch.node);
-               be->backend_watch.node = NULL;
-       }
        if (be->netif) {
                netif_disconnect(be->netif);
                be->netif = NULL;
@@ -63,8 +54,7 @@ static int netback_remove(struct xenbus_
 
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
- * structures, and watch the store waiting for the hotplug scripts to tell us
- * the device's handle.  Switch to InitWait.
+ * structures and switch to InitWait.
  */
 static int netback_probe(struct xenbus_device *dev,
                         const struct xenbus_device_id *id)
@@ -83,11 +73,6 @@ static int netback_probe(struct xenbus_d
        be->dev = dev;
        dev->dev.driver_data = be;
 
-       err = xenbus_watch_path2(dev, dev->nodename, "handle",
-                                &be->backend_watch, backend_changed);
-       if (err)
-               goto fail;
-
        do {
                err = xenbus_transaction_start(&xbt);
                if (err) {
@@ -108,7 +93,8 @@ static int netback_probe(struct xenbus_d
                        goto abort_transaction;
                }
 
-               err = xenbus_printf(xbt, dev->nodename, "feature-rx-copy", 
"%d", 1);
+               err = xenbus_printf(xbt, dev->nodename,
+                                   "feature-rx-copy", "%d", 1);
                if (err) {
                        message = "writing feature-copying";
                        goto abort_transaction;
@@ -123,9 +109,11 @@ static int netback_probe(struct xenbus_d
        }
 
        err = xenbus_switch_state(dev, XenbusStateInitWait);
-       if (err) {
+       if (err)
                goto fail;
-       }
+
+       /* This kicks hotplug scripts, so do it immediately. */
+       backend_create_netif(be);
 
        return 0;
 
@@ -175,48 +163,30 @@ static int netback_uevent(struct xenbus_
 }
 
 
-/**
- * Callback received when the hotplug scripts have placed the handle node.
- * Read it, and create a netif structure.  If the frontend is ready, connect.
- */
-static void backend_changed(struct xenbus_watch *watch,
-                           const char **vec, unsigned int len)
+static void backend_create_netif(struct backend_info *be)
 {
        int err;
        long handle;
-       struct backend_info *be
-               = container_of(watch, struct backend_info, backend_watch);
        struct xenbus_device *dev = be->dev;
 
-       DPRINTK("");
+       if (be->netif != NULL)
+               return;
 
        err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle);
-       if (XENBUS_EXIST_ERR(err)) {
-               /* Since this watch will fire once immediately after it is
-                  registered, we expect this.  Ignore it, and wait for the
-                  hotplug scripts. */
-               return;
-       }
        if (err != 1) {
                xenbus_dev_fatal(dev, err, "reading handle");
                return;
        }
 
-       if (be->netif == NULL) {
-               u8 be_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
-
-               be->netif = netif_alloc(dev->otherend_id, handle, be_mac);
-               if (IS_ERR(be->netif)) {
-                       err = PTR_ERR(be->netif);
-                       be->netif = NULL;
-                       xenbus_dev_fatal(dev, err, "creating interface");
-                       return;
-               }
-
-               kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
-
-               maybe_connect(be);
-       }
+       be->netif = netif_alloc(dev->otherend_id, handle);
+       if (IS_ERR(be->netif)) {
+               err = PTR_ERR(be->netif);
+               be->netif = NULL;
+               xenbus_dev_fatal(dev, err, "creating interface");
+               return;
+       }
+
+       kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
 }
 
 
@@ -249,11 +219,9 @@ static void frontend_changed(struct xenb
                break;
 
        case XenbusStateConnected:
-               if (!be->netif) {
-                       /* reconnect: setup be->netif */
-                       backend_changed(&be->backend_watch, NULL, 0);
-               }
-               maybe_connect(be);
+               backend_create_netif(be);
+               if (be->netif)
+                       connect(be);
                break;
 
        case XenbusStateClosing:
@@ -279,15 +247,6 @@ static void frontend_changed(struct xenb
 }
 
 
-/* ** Connection ** */
-
-
-static void maybe_connect(struct backend_info *be)
-{
-       if (be->netif && (be->frontend_state == XenbusStateConnected))
-               connect(be);
-}
-
 static void xen_net_read_rate(struct xenbus_device *dev,
                              unsigned long *bytes, unsigned long *usec)
 {
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Oct 13 
11:00:32 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Tue Oct 17 
16:44:57 2006 -0400
@@ -141,7 +141,6 @@ struct netfront_info {
        spinlock_t   tx_lock;
        spinlock_t   rx_lock;
 
-       unsigned int handle;
        unsigned int evtchn, irq;
        unsigned int copying_receiver;
 
@@ -230,9 +229,8 @@ static inline grant_ref_t xennet_get_rx_
 #define WPRINTK(fmt, args...)                          \
        printk(KERN_WARNING "netfront: " fmt, ##args)
 
-static int talk_to_backend(struct xenbus_device *, struct netfront_info *);
 static int setup_device(struct xenbus_device *, struct netfront_info *);
-static struct net_device *create_netdev(int, int, struct xenbus_device *);
+static struct net_device *create_netdev(struct xenbus_device *);
 
 static void netfront_closing(struct xenbus_device *);
 
@@ -242,7 +240,7 @@ static void close_netdev(struct netfront
 static void close_netdev(struct netfront_info *);
 static void netif_free(struct netfront_info *);
 
-static void network_connect(struct net_device *);
+static int network_connect(struct net_device *);
 static void network_tx_buf_gc(struct net_device *);
 static void network_alloc_rx_buffers(struct net_device *);
 static int send_fake_arp(struct net_device *);
@@ -265,8 +263,7 @@ static inline int xennet_can_sg(struct n
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
  * structures and the ring buffers for communication with the backend, and
- * inform the backend of the appropriate details for those.  Switch to
- * Connected state.
+ * inform the backend of the appropriate details for those.
  */
 static int __devinit netfront_probe(struct xenbus_device *dev,
                                    const struct xenbus_device_id *id)
@@ -274,32 +271,8 @@ static int __devinit netfront_probe(stru
        int err;
        struct net_device *netdev;
        struct netfront_info *info;
-       unsigned int handle, feature_rx_copy, feature_rx_flip, use_copy;
-
-       err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%u", &handle);
-       if (err != 1) {
-               xenbus_dev_fatal(dev, err, "reading handle");
-               return err;
-       }
-
-       err = xenbus_scanf(XBT_NIL, dev->otherend, "feature-rx-copy", "%u",
-                          &feature_rx_copy);
-       if (err != 1)
-               feature_rx_copy = 0;
-       err = xenbus_scanf(XBT_NIL, dev->otherend, "feature-rx-flip", "%u",
-                          &feature_rx_flip);
-       if (err != 1)
-               feature_rx_flip = 1;
-
-       /*
-        * Copy packets on receive path if:
-        *  (a) This was requested by user, and the backend supports it; or
-        *  (b) Flipping was requested, but this is unsupported by the backend.
-        */
-       use_copy = (MODPARM_rx_copy && feature_rx_copy) ||
-               (MODPARM_rx_flip && !feature_rx_flip);
-
-       netdev = create_netdev(handle, use_copy, dev);
+
+       netdev = create_netdev(dev);
        if (IS_ERR(netdev)) {
                err = PTR_ERR(netdev);
                xenbus_dev_fatal(dev, err, "creating netdev");
@@ -309,23 +282,13 @@ static int __devinit netfront_probe(stru
        info = netdev_priv(netdev);
        dev->dev.driver_data = info;
 
-       err = talk_to_backend(dev, info);
-       if (err)
-               goto fail_backend;
-
        err = open_netdev(info);
        if (err)
-               goto fail_open;
-
-       IPRINTK("Created netdev %s with %sing receive path.\n",
-               netdev->name, info->copying_receiver ? "copy" : "flipp");
+               goto fail;
 
        return 0;
 
- fail_open:
-       xennet_sysfs_delif(info->netdev);
-       unregister_netdev(netdev);
- fail_backend:
+ fail:
        free_netdev(netdev);
        dev->dev.driver_data = NULL;
        return err;
@@ -345,7 +308,7 @@ static int netfront_resume(struct xenbus
        DPRINTK("%s\n", dev->nodename);
 
        netif_disconnect_backend(info);
-       return talk_to_backend(dev, info);
+       return 0;
 }
 
 static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
@@ -456,7 +419,7 @@ again:
        xenbus_transaction_end(xbt, 1);
        xenbus_dev_fatal(dev, err, "%s", message);
  destroy_ring:
-       netif_free(info);
+       netif_disconnect_backend(info);
  out:
        return err;
 }
@@ -546,7 +509,10 @@ static void backend_changed(struct xenbu
                break;
 
        case XenbusStateInitWait:
-               network_connect(netdev);
+               if (network_connect(netdev) != 0) {
+                       netif_free(np);
+                       break;
+               }
                xenbus_switch_state(dev, XenbusStateConnected);
                (void)send_fake_arp(netdev);
                break;
@@ -1120,6 +1086,7 @@ static int xennet_get_responses(struct n
                        if (net_ratelimit())
                                WPRINTK("rx->offset: %x, size: %u\n",
                                        rx->offset, rx->status);
+                       xennet_move_rx_slot(np, skb, ref);
                        err = -EINVAL;
                        goto next;
                }
@@ -1130,7 +1097,8 @@ static int xennet_get_responses(struct n
                 * situation to the system controller to reboot the backed.
                 */
                if (ref == GRANT_INVALID_REF) {
-                       WPRINTK("Bad rx response id %d.\n", rx->id);
+                       if (net_ratelimit())
+                               WPRINTK("Bad rx response id %d.\n", rx->id);
                        err = -EINVAL;
                        goto next;
                }
@@ -1201,6 +1169,9 @@ next:
                        WPRINTK("Too many frags\n");
                err = -E2BIG;
        }
+
+       if (unlikely(err))
+               np->rx.rsp_cons = cons + frags;
 
        *pages_flipped_p = pages_flipped;
 
@@ -1306,9 +1277,9 @@ static int netif_poll(struct net_device 
        rp = np->rx.sring->rsp_prod;
        rmb(); /* Ensure we see queued responses up to 'rp'. */
 
-       for (i = np->rx.rsp_cons, work_done = 0;
-            (i != rp) && (work_done < budget);
-            np->rx.rsp_cons = ++i, work_done++) {
+       i = np->rx.rsp_cons;
+       work_done = 0;
+       while ((i != rp) && (work_done < budget)) {
                memcpy(rx, RING_GET_RESPONSE(&np->rx, i), sizeof(*rx));
                memset(extras, 0, sizeof(extras));
 
@@ -1316,12 +1287,11 @@ static int netif_poll(struct net_device 
                                           &pages_flipped);
 
                if (unlikely(err)) {
-err:
-                       i = np->rx.rsp_cons + skb_queue_len(&tmpq) - 1;
-                       work_done--;
+err:   
                        while ((skb = __skb_dequeue(&tmpq)))
                                __skb_queue_tail(&errq, skb);
                        np->stats.rx_errors++;
+                       i = np->rx.rsp_cons;
                        continue;
                }
 
@@ -1333,6 +1303,7 @@ err:
 
                        if (unlikely(xennet_set_skb_gso(skb, gso))) {
                                __skb_queue_head(&tmpq, skb);
+                               np->rx.rsp_cons += skb_queue_len(&tmpq);
                                goto err;
                        }
                }
@@ -1396,6 +1367,9 @@ err:
                np->stats.rx_bytes += skb->len;
 
                __skb_queue_tail(&rxq, skb);
+
+               np->rx.rsp_cons = ++i;
+               work_done++;
        }
 
        if (pages_flipped) {
@@ -1643,15 +1617,40 @@ static void xennet_set_features(struct n
                xennet_set_tso(dev, 1);
 }
 
-static void network_connect(struct net_device *dev)
+static int network_connect(struct net_device *dev)
 {
        struct netfront_info *np = netdev_priv(dev);
-       int i, requeue_idx;
+       int i, requeue_idx, err;
        struct sk_buff *skb;
        grant_ref_t ref;
        netif_rx_request_t *req;
+       unsigned int feature_rx_copy, feature_rx_flip;
+
+       err = xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+                          "feature-rx-copy", "%u", &feature_rx_copy);
+       if (err != 1)
+               feature_rx_copy = 0;
+       err = xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+                          "feature-rx-flip", "%u", &feature_rx_flip);
+       if (err != 1)
+               feature_rx_flip = 1;
+
+       /*
+        * Copy packets on receive path if:
+        *  (a) This was requested by user, and the backend supports it; or
+        *  (b) Flipping was requested, but this is unsupported by the backend.
+        */
+       np->copying_receiver = ((MODPARM_rx_copy && feature_rx_copy) ||
+                               (MODPARM_rx_flip && !feature_rx_flip));
+
+       err = talk_to_backend(np->xbdev, np);
+       if (err)
+               return err;
 
        xennet_set_features(dev);
+
+       IPRINTK("device %s has %sing receive path.\n",
+               dev->name, np->copying_receiver ? "copy" : "flipp");
 
        spin_lock_irq(&np->tx_lock);
        spin_lock(&np->rx_lock);
@@ -1708,6 +1707,8 @@ static void network_connect(struct net_d
 
        spin_unlock(&np->rx_lock);
        spin_unlock_irq(&np->tx_lock);
+
+       return 0;
 }
 
 static void netif_uninit(struct net_device *dev)
@@ -1873,8 +1874,7 @@ static void network_set_multicast_list(s
 {
 }
 
-static struct net_device * __devinit
-create_netdev(int handle, int copying_receiver, struct xenbus_device *dev)
+static struct net_device * __devinit create_netdev(struct xenbus_device *dev)
 {
        int i, err = 0;
        struct net_device *netdev = NULL;
@@ -1888,9 +1888,7 @@ create_netdev(int handle, int copying_re
        }
 
        np                   = netdev_priv(netdev);
-       np->handle           = handle;
        np->xbdev            = dev;
-       np->copying_receiver = copying_receiver;
 
        netif_carrier_off(netdev);
 
@@ -2021,10 +2019,12 @@ static int open_netdev(struct netfront_i
 
        err = xennet_sysfs_addif(info->netdev);
        if (err) {
-               /* This can be non-fatal: it only means no tuning parameters */
+               unregister_netdev(info->netdev);
                printk(KERN_WARNING "%s: add sysfs failed err=%d\n",
                       __FUNCTION__, err);
-       }
+               return err;
+       }
+
        return 0;
 }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Fri Oct 13 
11:00:32 2006 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Tue Oct 17 
16:44:57 2006 -0400
@@ -34,6 +34,10 @@
 
 static struct proc_dir_entry *privcmd_intf;
 static struct proc_dir_entry *capabilities_intf;
+
+#ifndef HAVE_ARCH_PRIVCMD_MMAP
+static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
+#endif
 
 static int privcmd_ioctl(struct inode *inode, struct file *file,
                         unsigned int cmd, unsigned long data)
@@ -122,11 +126,9 @@ static int privcmd_ioctl(struct inode *i
 
                vma = find_vma(mm, msg.va);
                rc = -EINVAL;
-               if (!vma || (msg.va != vma->vm_start) || vma->vm_private_data)
+               if (!vma || (msg.va != vma->vm_start) ||
+                   !privcmd_enforce_singleshot_mapping(vma))
                        goto mmap_out;
-
-               /* Mapping is a one-shot operation per vma. */
-               vma->vm_private_data = (void *)1;
 
                va = vma->vm_start;
 
@@ -137,7 +139,7 @@ static int privcmd_ioctl(struct inode *i
 
                        /* Do not allow range to wrap the address space. */
                        rc = -EINVAL;
-                       if ((msg.npages > (INT_MAX >> PAGE_SHIFT)) ||
+                       if ((msg.npages > (LONG_MAX >> PAGE_SHIFT)) ||
                            ((unsigned long)(msg.npages << PAGE_SHIFT) >= -va))
                                goto mmap_out;
 
@@ -181,7 +183,7 @@ static int privcmd_ioctl(struct inode *i
                if (copy_from_user(&m, udata, sizeof(m)))
                        return -EFAULT;
 
-               if ((m.num <= 0) || (m.num > (INT_MAX >> PAGE_SHIFT)))
+               if ((m.num <= 0) || (m.num > (LONG_MAX >> PAGE_SHIFT)))
                        return -EINVAL;
 
                down_read(&mm->mmap_sem);
@@ -189,14 +191,12 @@ static int privcmd_ioctl(struct inode *i
                vma = find_vma(mm, m.addr);
                if (!vma ||
                    (m.addr != vma->vm_start) ||
-                   ((m.addr + (m.num<<PAGE_SHIFT)) != vma->vm_end) ||
-                   vma->vm_private_data) {
+                   ((m.addr + ((unsigned long)m.num<<PAGE_SHIFT)) !=
+                    vma->vm_end) ||
+                   !privcmd_enforce_singleshot_mapping(vma)) {
                        up_read(&mm->mmap_sem);
                        return -EINVAL;
                }
-
-               /* Mapping is a one-shot operation per vma. */
-               vma->vm_private_data = (void *)1;
 
                p = m.arr;
                addr = m.addr;
@@ -251,6 +251,11 @@ static int privcmd_mmap(struct file * fi
 
        return 0;
 }
+
+static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
+{
+       return (xchg(&vma->vm_private_data, (void *)1) == NULL);
+}
 #endif
 
 static struct file_operations privcmd_file_ops = {
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Fri Oct 13 
11:00:32 2006 -0400
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Tue Oct 17 
16:44:57 2006 -0400
@@ -138,6 +138,7 @@ int direct_remap_pfn_range(struct vm_are
                           pgprot_t prot,
                           domid_t  domid);
 struct file;
+int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
 int privcmd_mmap(struct file * file, struct vm_area_struct * vma);
 #define HAVE_ARCH_PRIVCMD_MMAP
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/Makefile
--- a/tools/Makefile    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/Makefile    Tue Oct 17 16:44:57 2006 -0400
@@ -60,7 +60,7 @@ check_clean:
        $(MAKE) -C check clean
 
 .PHONY: ioemu ioemuinstall ioemuclean
-ifdef CONFIG_IOEMU
+ifeq ($(CONFIG_IOEMU),y)
 export IOEMU_DIR ?= ioemu
 ioemu ioemuinstall:
        [ -f $(IOEMU_DIR)/config-host.mak ] || \
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/Rules.mk
--- a/tools/Rules.mk    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/Rules.mk    Tue Oct 17 16:44:57 2006 -0400
@@ -4,8 +4,6 @@ all:
 all:
 
 include $(XEN_ROOT)/Config.mk
-
-CONFIG_$(shell uname -s) := y
 
 XEN_XC             = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
@@ -25,9 +23,9 @@ CFLAGS += -D__XEN_TOOLS__
 %.o: %.cc
        $(CC) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
 
-OS = $(shell uname -s)
+.PHONY: mk-symlinks mk-symlinks-xen mk-symlinks-$(XEN_OS)
 
-.PHONY: mk-symlinks mk-symlinks-xen mk-symlinks-$(OS)
+mk-symlinks-SunOS:
 
 mk-symlinks-Linux: LINUX_ROOT=$(XEN_ROOT)/linux-2.6-xen-sparse
 mk-symlinks-Linux:
@@ -44,4 +42,4 @@ mk-symlinks-xen:
        mkdir -p xen/io
        ( cd xen/io && ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
 
-mk-symlinks: mk-symlinks-xen mk-symlinks-$(OS)
+mk-symlinks: mk-symlinks-xen mk-symlinks-$(XEN_OS)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/blktap/drivers/Makefile     Tue Oct 17 16:44:57 2006 -0400
@@ -3,11 +3,9 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 INCLUDES += -I.. -I../lib
 
-INSTALL      = install
-INSTALL_PROG = $(INSTALL) -m0755
 IBIN         = blktapctrl tapdisk
 QCOW_UTIL    = img2qcow qcow2raw qcow-create
-INSTALL_DIR  = /usr/sbin
+INST_DIR  = /usr/sbin
 LIBAIO_DIR   = ../../libaio/src
 
 CFLAGS   += -Werror
@@ -58,7 +56,7 @@ img2qcow qcow2raw qcow-create: %: $(BLK-
        $(CC) $(CFLAGS) -o $* $(BLK-OBJS) $*.c $(AIOLIBS)  $(LIBS)
 
 install: all
-       $(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(DESTDIR)$(INSTALL_DIR)
+       $(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(DESTDIR)$(INST_DIR)
 
 clean:
        rm -rf *.o *~ $(DEPS) xen TAGS $(IBIN) $(LIB) $(QCOW_UTIL)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/blktap/lib/Makefile
--- a/tools/blktap/lib/Makefile Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/blktap/lib/Makefile Tue Oct 17 16:44:57 2006 -0400
@@ -6,10 +6,6 @@ SONAME   = libblktap.so.$(MAJOR)
 SONAME   = libblktap.so.$(MAJOR)
 
 BLKTAP_INSTALL_DIR = /usr/sbin
-
-INSTALL            = install
-INSTALL_PROG       = $(INSTALL) -m0755
-INSTALL_DIR        = $(INSTALL) -d -m0755
 
 INCLUDES += -I. -I.. -I $(XEN_LIBXC) -I $(XEN_XENSTORE)
 
@@ -56,8 +52,8 @@ clean:
        rm -rf *.a *.so* *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS
 
 libblktap.a: $(OBJS) 
-       $(CC) $(CFLAGS) -Wl,-soname -Wl,$(SONAME) -shared         \
-             -L$(XEN_XENSTORE) -l xenstore                       \
+       $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_CFLAGS) \
+             -L$(XEN_XENSTORE) -l xenstore                                \
              -o libblktap.so.$(MAJOR).$(MINOR) $^ $(LIBS)
        ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR)
        ln -sf libblktap.so.$(MAJOR) libblktap.so
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/check/chk
--- a/tools/check/chk   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/check/chk   Tue Oct 17 16:44:57 2006 -0400
@@ -13,6 +13,8 @@ function usage {
 }
 
 export PATH=${PATH}:/sbin:/usr/sbin
+
+[ `uname -s` = SunOS ] && exit 0
 
 case $1 in
     build)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/console/Makefile
--- a/tools/console/Makefile    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/console/Makefile    Tue Oct 17 16:44:57 2006 -0400
@@ -4,10 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 DAEMON_INSTALL_DIR = /usr/sbin
 CLIENT_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin
-
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 CFLAGS  += -Werror -g
 
@@ -26,11 +22,11 @@ clean:
 
 xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
        $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
-              -lxenctrl -lxenstore
+              $(SOCKET_LIBS) -lxenctrl -lxenstore
 
 xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
        $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
-             -lxenctrl -lxenstore
+             $(SOCKET_LIBS) -lxenctrl -lxenstore
 
 .PHONY: install
 install: $(BIN)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/console/daemon/io.c Tue Oct 17 16:44:57 2006 -0400
@@ -147,7 +147,7 @@ static int domain_create_tty(struct doma
        int master;
        bool success;
 
-       if ((master = getpt()) == -1 ||
+       if ((master = open("/dev/ptmx",O_RDWR|O_NOCTTY)) == -1 ||
            grantpt(master) == -1 || unlockpt(master) == -1) {
                dolog(LOG_ERR, "Failed to create tty for domain-%d",
                      dom->domid);
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/console/daemon/utils.c
--- a/tools/console/daemon/utils.c      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/console/daemon/utils.c      Tue Oct 17 16:44:57 2006 -0400
@@ -95,7 +95,7 @@ void daemonize(const char *pidfile)
                exit(1);
        }
 
-       len = sprintf(buf, "%d\n", getpid());
+       len = sprintf(buf, "%ld\n", (long)getpid());
        if (write(fd, buf, len) < 0)
                exit(1);
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 
tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c
--- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c     
Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c     
Tue Oct 17 16:44:57 2006 -0400
@@ -36,8 +36,6 @@
 #include <unistd.h>
 #include <errno.h>
 #include <xenctrl.h>
-#include <thread_db.h>
-#include <xc_ptrace.h>
 
 #define TRACE_ENTER /* printf("enter %s\n", __FUNCTION__) */
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/examples/Makefile
--- a/tools/examples/Makefile   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/examples/Makefile   Tue Oct 17 16:44:57 2006 -0400
@@ -1,10 +1,5 @@ XEN_ROOT = ../../
 XEN_ROOT = ../../
 include $(XEN_ROOT)/tools/Rules.mk
-
-INSTALL                = install
-INSTALL_DIR    = $(INSTALL) -d -m0755
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DATA   = $(INSTALL) -m0644
 
 # Init scripts.
 XEND_INITD = init.d/xend
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/firmware/Makefile
--- a/tools/firmware/Makefile   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/firmware/Makefile   Tue Oct 17 16:44:57 2006 -0400
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 # hvmloader is a 32-bit protected mode binary.
 # It belongs in /usr/lib, not /usr/lib64.
 TARGET      := hvmloader/hvmloader
-INSTALL_DIR := $(DESTDIR)/usr/lib/xen/boot
+INST_DIR := $(DESTDIR)/usr/lib/xen/boot
 
 SUBDIRS :=
 SUBDIRS += rombios
@@ -29,8 +29,8 @@ all:
 
 .PHONY: install
 install: all
-       [ -d $(INSTALL_DIR) ] || install -d -m0755 $(INSTALL_DIR)
-       [ ! -e $(TARGET) ] || install -m0644 $(TARGET) $(INSTALL_DIR)
+       [ -d $(INST_DIR) ] || $(INSTALL_DIR) $(INST_DIR)
+       [ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(INST_DIR)
 
 .PHONY: clean
 clean: 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/firmware/acpi/Makefile
--- a/tools/firmware/acpi/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/firmware/acpi/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -53,7 +53,7 @@ iasl:
        wget $(IASL_URL)
        tar xzf $(IASL_VER).tar.gz
        make -C $(IASL_VER)/compiler
-       install $(IASL_VER)/compiler/iasl /usr/bin/iasl
+       $(INSTALL_PROG) $(IASL_VER)/compiler/iasl /usr/bin/iasl
 
 $(ACPI_GEN):$(C_SRC) $(H_SRC) acpi_dsdt.c
        $(HOSTCC) -o $(ACPI_GEN) $(HOSTCFLAGS) $(shell ls *.c)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/firmware/acpi/acpi_dsdt.asl
--- a/tools/firmware/acpi/acpi_dsdt.asl Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/firmware/acpi/acpi_dsdt.asl Tue Oct 17 16:44:57 2006 -0400
@@ -115,20 +115,15 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
                         0x0000,
                         0xF300)
 
-                /* reserve what device model consumed for PCI VGA device       
 */
+                /* reserve memory for pci devices */
 
                     DWordMemory (ResourceConsumer, PosDecode, MinFixed, 
MaxFixed, Cacheable, ReadWrite,
                         0x00000000,
                         0xF0000000,
-                        0xF1FFFFFF,
+                        0xF4FFFFFF,
                         0x00000000,
-                        0x02000000)
-                    DWordMemory (ResourceConsumer, PosDecode, MinFixed, 
MaxFixed, Cacheable, ReadWrite,
-                        0x00000000,
-                        0xF2000000,
-                        0xF2000FFF,
-                        0x00000000,
-                        0x00001000)
+                        0x05000000)
+
                 })
                 Return (PRT0)
             }
@@ -299,38 +294,43 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
                Return (PRTP)  
                } // end _PRT
 
-        Name(PRTP, Package(){
-                        Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0}, // Slot 
1, INTA
-                        Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0}, // Slot 
1, INTB
-                        Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0}, // Slot 
1, INTC
-                        Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0}, // Slot 
1, INTD
-
-                        Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0}, // Slot 
2, INTB
-                        Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0}, // Slot 
2, INTC
-                        Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0}, // Slot 
2, INTD
-                        Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0}, // Slot 
2, INTA
+        Name(PRTP, Package() {
+                        // Slot 1, INTA - INTD
+                        Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0},
+                        Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0},
+                        Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0},
+                        Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0},
+
+                        // Slot 2, INTA - INTD
+                        Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
+                        Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
+                        Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0},
+                        Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0},
                         
-                        Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0}, // Slot 
3, INTC
-                        Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0}, // Slot 
3, INTD
-                        Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0}, // Slot 
3, INTA
-                        Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0}, // Slot 
3, INTB
+                        // Slot 3, INTA - INTD
+                        Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0},
+                        Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0},
+                        Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0},
+                        Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0},
                         
-                        Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0}, // Slot 
2, INTD
-                        Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0}, // Slot 
2, INTA
-                        Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0}, // Slot 
2, INTB
-                        Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0}, // Slot 
2, INTC
+                        // Slot 4, INTA - INTD
+                        Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0},
+                        Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0},
+                        Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0},
+                        Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0},
                         
+                        // Slot 5, INTA - INTD
+                        Package(){0x0004ffff, 0, \_SB.PCI0.LNKA, 0},
+                        Package(){0x0004ffff, 1, \_SB.PCI0.LNKB, 0},
+                        Package(){0x0004ffff, 2, \_SB.PCI0.LNKC, 0},
+                        Package(){0x0004ffff, 3, \_SB.PCI0.LNKD, 0},
                         }
             )
         Name(PRTA, Package(){
-                        Package(){0x0001ffff, 0, 0, 5}, // Device 1, INTA
-
+                        Package(){0x0001ffff, 0, 0, 5},  // Device 1, INTA
                         Package(){0x0002ffff, 0, 0, 7},  // Device 2, INTA
-                       
                         Package(){0x0003ffff, 0, 0, 10}, // Device 3, INTA
-
-                        Package(){0x0004ffff, 0, 0, 11},  // Device 4, INTA    
                            
-                        
+                        Package(){0x0004ffff, 0, 0, 11}, // Device 4, INTA
                         }
             )
             
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/firmware/acpi/acpi_dsdt.c
--- a/tools/firmware/acpi/acpi_dsdt.c   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/firmware/acpi/acpi_dsdt.c   Tue Oct 17 16:44:57 2006 -0400
@@ -1,19 +1,19 @@
 /*
  * 
  * Intel ACPI Component Architecture
- * ASL Optimizing Compiler / AML Disassembler version 20050513 [Jun  8 2005]
+ * ASL Optimizing Compiler / AML Disassembler version 20050513 [Oct 12 2006]
  * Copyright (C) 2000 - 2005 Intel Corporation
  * Supports ACPI Specification Revision 3.0
  * 
- * Compilation of "acpi_dsdt.asl" - Mon Aug 14 18:15:09 2006
+ * Compilation of "acpi_dsdt.asl" - Thu Oct 12 14:08:49 2006
  * 
  * C source code output
  *
  */
 unsigned char AmlCode[] = 
 {
-    0x44,0x53,0x44,0x54,0xBA,0x08,0x00,0x00,  /* 00000000    "DSDT...." */
-    0x01,0x1D,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
+    0x44,0x53,0x44,0x54,0xDA,0x08,0x00,0x00,  /* 00000000    "DSDT...." */
+    0x01,0x26,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    ".&INTEL." */
     0x69,0x6E,0x74,0x2D,0x78,0x65,0x6E,0x00,  /* 00000010    "int-xen." */
     0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
     0x13,0x05,0x05,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
@@ -34,7 +34,7 @@ unsigned char AmlCode[] =
     0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00,  /* 00000098    "........" */
     0x00,0x08,0x50,0x49,0x43,0x44,0x00,0x14,  /* 000000A0    "..PICD.." */
     0x0C,0x5F,0x50,0x49,0x43,0x01,0x70,0x68,  /* 000000A8    "._PIC.ph" */
-    0x50,0x49,0x43,0x44,0x10,0x45,0x80,0x5F,  /* 000000B0    "PICD.E._" */
+    0x50,0x49,0x43,0x44,0x10,0x45,0x82,0x5F,  /* 000000B0    "PICD.E._" */
     0x53,0x42,0x5F,0x5B,0x82,0x49,0x04,0x4D,  /* 000000B8    "SB_[.I.M" */
     0x45,0x4D,0x30,0x08,0x5F,0x48,0x49,0x44,  /* 000000C0    "EM0._HID" */
     0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43,  /* 000000C8    ".A...._C" */
@@ -45,7 +45,7 @@ unsigned char AmlCode[] =
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000F0    "........" */
     0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,  /* 000000F8    "........" */
     0x00,0x00,0x00,0x00,0x79,0x00,0x5B,0x82,  /* 00000100    "....y.[." */
-    0x42,0x7B,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B{PCI0._" */
+    0x42,0x7D,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B}PCI0._" */
     0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,  /* 00000110    "HID.A..." */
     0x08,0x5F,0x55,0x49,0x44,0x00,0x08,0x5F,  /* 00000118    "._UID.._" */
     0x41,0x44,0x52,0x00,0x08,0x5F,0x42,0x42,  /* 00000120    "ADR.._BB" */
@@ -55,9 +55,9 @@ unsigned char AmlCode[] =
     0x33,0x03,0x49,0x52,0x51,0x35,0x05,0x49,  /* 00000140    "3.IRQ5.I" */
     0x52,0x51,0x37,0x07,0x49,0x52,0x51,0x39,  /* 00000148    "RQ7.IRQ9" */
     0x09,0x49,0x52,0x51,0x41,0x0A,0x49,0x52,  /* 00000150    ".IRQA.IR" */
-    0x51,0x42,0x0B,0x14,0x44,0x08,0x5F,0x43,  /* 00000158    "QB..D._C" */
+    0x51,0x42,0x0B,0x14,0x4A,0x06,0x5F,0x43,  /* 00000158    "QB..J._C" */
     0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30,  /* 00000160    "RS..PRT0" */
-    0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,  /* 00000168    ".B..n..." */
+    0x11,0x48,0x05,0x0A,0x54,0x88,0x0D,0x00,  /* 00000168    ".H..T..." */
     0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,  /* 00000170    "........" */
     0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8,  /* 00000178    ".....G.." */
     0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,  /* 00000180    "........" */
@@ -66,231 +66,235 @@ unsigned char AmlCode[] =
     0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,  /* 00000198    "........" */
     0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00,  /* 000001A0    "........" */
     0x00,0x0D,0x03,0x00,0x00,0x00,0x00,0x00,  /* 000001A8    "........" */
-    0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF1,0x00,  /* 000001B0    "........" */
-    0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x87,  /* 000001B8    "........" */
-    0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00,  /* 000001C0    "........" */
-    0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,  /* 000001C8    "........" */
-    0xF2,0x00,0x00,0x00,0x00,0x00,0x10,0x00,  /* 000001D0    "........" */
-    0x00,0x79,0x00,0xA4,0x50,0x52,0x54,0x30,  /* 000001D8    ".y..PRT0" */
-    0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A,  /* 000001E0    ".BUFA..." */
-    0x06,0x23,0xF8,0xDC,0x18,0x79,0x00,0x08,  /* 000001E8    ".#...y.." */
-    0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06,  /* 000001F0    "BUFB...." */
-    0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42,  /* 000001F8    "#...y..B" */
-    0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56,  /* 00000200    "UFB.IRQV" */
-    0x08,0x42,0x55,0x46,0x43,0x11,0x07,0x0A,  /* 00000208    ".BUFC..." */
-    0x04,0x05,0x07,0x0A,0x0B,0x8C,0x42,0x55,  /* 00000210    "......BU" */
-    0x46,0x43,0x01,0x50,0x49,0x51,0x41,0x8C,  /* 00000218    "FC.PIQA." */
-    0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51,  /* 00000220    "BUFC.PIQ" */
-    0x42,0x8C,0x42,0x55,0x46,0x43,0x01,0x50,  /* 00000228    "B.BUFC.P" */
-    0x49,0x51,0x43,0x8C,0x42,0x55,0x46,0x43,  /* 00000230    "IQC.BUFC" */
-    0x01,0x50,0x49,0x51,0x44,0x5B,0x82,0x48,  /* 00000238    ".PIQD[.H" */
-    0x08,0x4C,0x4E,0x4B,0x41,0x08,0x5F,0x48,  /* 00000240    ".LNKA._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 00000248    "ID.A...." */
-    0x5F,0x55,0x49,0x44,0x01,0x14,0x1C,0x5F,  /* 00000250    "_UID..._" */
-    0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52,  /* 00000258    "STA.{PIR" */
-    0x41,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,  /* 00000260    "A..`...`" */
-    0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,  /* 00000268    "........" */
-    0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,  /* 00000270    "...._PRS" */
-    0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11,  /* 00000278    "..BUFA.." */
-    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49,  /* 00000280    "_DIS.}PI" */
-    0x52,0x41,0x0A,0x80,0x50,0x49,0x52,0x41,  /* 00000288    "RA..PIRA" */
-    0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,  /* 00000290    ".._CRS.{" */
-    0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,0x79,  /* 00000298    "PIRB..`y" */
-    0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42,  /* 000002A0    ".`IRQV.B" */
-    0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,  /* 000002A8    "UFB.._SR" */
-    0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51,  /* 000002B0    "S..h.IRQ" */
-    0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76,  /* 000002B8    "1.IRQ1`v" */
-    0x60,0x70,0x60,0x50,0x49,0x52,0x41,0x5B,  /* 000002C0    "`p`PIRA[" */
-    0x82,0x49,0x08,0x4C,0x4E,0x4B,0x42,0x08,  /* 000002C8    ".I.LNKB." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 000002D0    "_HID.A.." */
-    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,  /* 000002D8    ".._UID.." */
-    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 000002E0    ".._STA.{" */
-    0x50,0x49,0x52,0x42,0x0A,0x80,0x60,0xA0,  /* 000002E8    "PIRB..`." */
-    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 000002F0    "..`....." */
-    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 000002F8    "......._" */
-    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 00000300    "PRS..BUF" */
-    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000308    "A.._DIS." */
-    0x7D,0x50,0x49,0x52,0x42,0x0A,0x80,0x50,  /* 00000310    "}PIRB..P" */
-    0x49,0x52,0x42,0x14,0x1A,0x5F,0x43,0x52,  /* 00000318    "IRB.._CR" */
-    0x53,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,  /* 00000320    "S.{PIRB." */
-    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 00000328    ".`y.`IRQ" */
-    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 00000330    "V.BUFB.." */
-    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 00000338    "_SRS..h." */
-    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 00000340    "IRQ1.IRQ" */
-    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 00000348    "1`v`p`PI" */
-    0x52,0x42,0x5B,0x82,0x49,0x08,0x4C,0x4E,  /* 00000350    "RB[.I.LN" */
-    0x4B,0x43,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000358    "KC._HID." */
-    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 00000360    "A...._UI" */
-    0x44,0x0A,0x03,0x14,0x1C,0x5F,0x53,0x54,  /* 00000368    "D...._ST" */
-    0x41,0x00,0x7B,0x50,0x49,0x52,0x43,0x0A,  /* 00000370    "A.{PIRC." */
-    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 00000378    ".`...`.." */
-    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 00000380    "........" */
-    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 00000388    ".._PRS.." */
-    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 00000390    "BUFA.._D" */
-    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x43,  /* 00000398    "IS.}PIRC" */
-    0x0A,0x80,0x50,0x49,0x52,0x43,0x14,0x1A,  /* 000003A0    "..PIRC.." */
-    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 000003A8    "_CRS.{PI" */
-    0x52,0x43,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 000003B0    "RC..`y.`" */
-    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 000003B8    "IRQV.BUF" */
-    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 000003C0    "B.._SRS." */
-    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 000003C8    ".h.IRQ1." */
-    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 000003D0    "IRQ1`v`p" */
-    0x60,0x50,0x49,0x52,0x43,0x5B,0x82,0x49,  /* 000003D8    "`PIRC[.I" */
-    0x08,0x4C,0x4E,0x4B,0x44,0x08,0x5F,0x48,  /* 000003E0    ".LNKD._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 000003E8    "ID.A...." */
-    0x5F,0x55,0x49,0x44,0x0A,0x04,0x14,0x1C,  /* 000003F0    "_UID...." */
-    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 000003F8    "_STA.{PI" */
-    0x52,0x44,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 00000400    "RD..`..." */
-    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 00000408    "`......." */
-    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 00000410    "....._PR" */
-    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 00000418    "S..BUFA." */
-    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000420    "._DIS.}P" */
-    0x49,0x52,0x44,0x0A,0x80,0x50,0x49,0x52,  /* 00000428    "IRD..PIR" */
-    0x44,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000430    "D.._CRS." */
-    0x7B,0x50,0x49,0x52,0x44,0x0A,0x0F,0x60,  /* 00000438    "{PIRD..`" */
-    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000440    "y.`IRQV." */
-    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000448    "BUFB.._S" */
-    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000450    "RS..h.IR" */
-    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000458    "Q1.IRQ1`" */
-    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x44,  /* 00000460    "v`p`PIRD" */
-    0x14,0x16,0x5F,0x50,0x52,0x54,0x00,0xA0,  /* 00000468    ".._PRT.." */
-    0x0A,0x50,0x49,0x43,0x44,0xA4,0x50,0x52,  /* 00000470    ".PICD.PR" */
-    0x54,0x41,0xA4,0x50,0x52,0x54,0x50,0x08,  /* 00000478    "TA.PRTP." */
-    0x50,0x52,0x54,0x50,0x12,0x43,0x0E,0x10,  /* 00000480    "PRTP.C.." */
-    0x12,0x0B,0x04,0x0B,0xFF,0xFF,0x00,0x4C,  /* 00000488    ".......L" */
-    0x4E,0x4B,0x41,0x00,0x12,0x0B,0x04,0x0B,  /* 00000490    "NKA....." */
-    0xFF,0xFF,0x01,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000498    "...LNKB." */
-    0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x02,  /* 000004A0    "........" */
-    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0C,0x04,  /* 000004A8    "LNKC...." */
-    0x0B,0xFF,0xFF,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000004B0    ".....LNK" */
-    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000004B8    "D......." */
-    0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000004C0    "...LNKB." */
-    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004C8    "........" */
-    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 000004D0    ".LNKC..." */
-    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 000004D8    "........" */
-    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000004E0    "LNKD...." */
-    0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,  /* 000004E8    ".......L" */
-    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 000004F0    "NKA....." */
-    0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,  /* 000004F8    ".....LNK" */
-    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000500    "C......." */
-    0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000508    "...LNKD." */
-    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000510    "........" */
-    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000518    "..LNKA.." */
-    0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,  /* 00000520    "........" */
-    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000528    ".LNKB..." */
-    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,  /* 00000530    ".......L" */
-    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000538    "NKD....." */
-    0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000540    ".....LNK" */
-    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000548    "A......." */
-    0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000550    "....LNKB" */
-    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,  /* 00000558    "........" */
-    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000560    "...LNKC." */
-    0x08,0x50,0x52,0x54,0x41,0x12,0x32,0x04,  /* 00000568    ".PRTA.2." */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000570    "........" */
-    0x00,0x00,0x0A,0x05,0x12,0x0B,0x04,0x0C,  /* 00000578    "........" */
-    0xFF,0xFF,0x02,0x00,0x00,0x00,0x0A,0x07,  /* 00000580    "........" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 00000588    "........" */
-    0x00,0x00,0x0A,0x0A,0x12,0x0B,0x04,0x0C,  /* 00000590    "........" */
-    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x0B,  /* 00000598    "........" */
-    0x5B,0x82,0x48,0x31,0x49,0x53,0x41,0x5F,  /* 000005A0    "[.H1ISA_" */
-    0x08,0x5F,0x41,0x44,0x52,0x00,0x5B,0x80,  /* 000005A8    "._ADR.[." */
-    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 000005B0    "PIRQ..`." */
-    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 000005B8    "...\.[.)" */
-    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 000005C0    "\/._SB_P" */
-    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 000005C8    "CI0ISA_P" */
-    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 000005D0    "IRQ.PIRA" */
-    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 000005D8    ".PIRB.PI" */
-    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 000005E0    "RC.PIRD." */
-    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 000005E8    "[.F.SYSR" */
-    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000005F0    "._HID.A." */
-    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 000005F8    "..._UID." */
-    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000600    ".CRS_.N." */
-    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000608    "..G....." */
-    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000610    "..G."."." */
-    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000618    "..G.0.0." */
-    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000620    "..G.D.D." */
-    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000628    "..G.b.b." */
-    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000630    "..G.e.e." */
-    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000638    "..G.r.r." */
-    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000640    "..G....." */
-    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000648    "..G....." */
-    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000650    "..G....." */
-    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000658    "..G....." */
-    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000660    "..G....." */
-    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000668    "..G....." */
-    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000670    "..G....." */
-    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000678    "..G....." */
-    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 00000680    "..G....." */
-    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 00000688    "..G....." */
-    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 00000690    "..y..._C" */
-    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 00000698    "RS..CRS_" */
-    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 000006A0    "[.+PIC_." */
-    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 000006A8    "_HID.A.." */
-    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 000006B0    "_CRS...." */
-    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 000006B8    "G. . ..." */
-    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 000006C0    "G......." */
-    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 000006C8    ""..y.[.G" */
-    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 000006D0    ".DMA0._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 000006D8    "ID.A...." */
-    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 000006E0    "_CRS.A.." */
-    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 000006E8    "=*..G..." */
-    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 000006F0    "....G..." */
-    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 000006F8    "....G..." */
-    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000700    "....G..." */
-    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000708    "....G..." */
-    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000710    "....G..." */
-    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000718    "... G..." */
-    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000720    "....y.[." */
-    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000728    "%TMR_._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000730    "ID.A...." */
-    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000738    "_CRS...." */
-    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000740    "G.@.@..." */
-    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000748    ""..y.[.%" */
-    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000750    "RTC_._HI" */
-    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000758    "D.A...._" */
-    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000760    "CRS....G" */
-    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000768    ".p.p..."" */
-    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000770    "..y.[."S" */
-    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000778    "PKR._HID" */
-    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 00000780    ".A...._C" */
-    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 00000788    "RS....G." */
-    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 00000790    "a.a...y." */
-    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 00000798    "[.1PS2M." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 000007A0    "_HID.A.." */
-    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 000007A8    ".._CID.A" */
-    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 000007B0    "....._ST" */
-    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 000007B8    "A....._C" */
-    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 000007C0    "RS...."." */
-    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 000007C8    ".y.[.B.P" */
-    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 000007D0    "S2K._HID" */
-    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 000007D8    ".A...._C" */
-    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 000007E0    "ID.A...." */
-    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 000007E8    "._STA..." */
-    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 000007F0    ".._CRS.." */
-    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 000007F8    "..G.`.`." */
-    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000800    "..G.d.d." */
-    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000808    ".."..y.[" */
-    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000810    ".:FDC0._" */
-    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000818    "HID.A..." */
-    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000820    ".._STA.." */
-    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000828    "..._CRS." */
-    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000830    "...G...." */
-    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000838    "...G...." */
-    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000840    "..."@.*." */
-    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000848    ".y.[.5UA" */
-    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000850    "R1._HID." */
-    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000858    "A...._UI" */
-    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000860    "D..._STA" */
-    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000868    "....._CR" */
-    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000870    "S....G.." */
-    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000878    ".....".." */
-    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 00000880    "y.[.6LTP" */
-    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000888    "1._HID.A" */
-    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 00000890    "...._UID" */
-    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000898    "...._STA" */
-    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 000008A0    "....._CR" */
-    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 000008A8    "S....G.x" */
-    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 000008B0    ".x...".." */
+    0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF4,0x00,  /* 000001B0    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x79,  /* 000001B8    ".......y" */
+    0x00,0xA4,0x50,0x52,0x54,0x30,0x08,0x42,  /* 000001C0    "..PRT0.B" */
+    0x55,0x46,0x41,0x11,0x09,0x0A,0x06,0x23,  /* 000001C8    "UFA....#" */
+    0xF8,0xDC,0x18,0x79,0x00,0x08,0x42,0x55,  /* 000001D0    "...y..BU" */
+    0x46,0x42,0x11,0x09,0x0A,0x06,0x23,0x00,  /* 000001D8    "FB....#." */
+    0x00,0x18,0x79,0x00,0x8B,0x42,0x55,0x46,  /* 000001E0    "..y..BUF" */
+    0x42,0x01,0x49,0x52,0x51,0x56,0x08,0x42,  /* 000001E8    "B.IRQV.B" */
+    0x55,0x46,0x43,0x11,0x07,0x0A,0x04,0x05,  /* 000001F0    "UFC....." */
+    0x07,0x0A,0x0B,0x8C,0x42,0x55,0x46,0x43,  /* 000001F8    "....BUFC" */
+    0x01,0x50,0x49,0x51,0x41,0x8C,0x42,0x55,  /* 00000200    ".PIQA.BU" */
+    0x46,0x43,0x01,0x50,0x49,0x51,0x42,0x8C,  /* 00000208    "FC.PIQB." */
+    0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51,  /* 00000210    "BUFC.PIQ" */
+    0x43,0x8C,0x42,0x55,0x46,0x43,0x01,0x50,  /* 00000218    "C.BUFC.P" */
+    0x49,0x51,0x44,0x5B,0x82,0x48,0x08,0x4C,  /* 00000220    "IQD[.H.L" */
+    0x4E,0x4B,0x41,0x08,0x5F,0x48,0x49,0x44,  /* 00000228    "NKA._HID" */
+    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 00000230    ".A...._U" */
+    0x49,0x44,0x01,0x14,0x1C,0x5F,0x53,0x54,  /* 00000238    "ID..._ST" */
+    0x41,0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,  /* 00000240    "A.{PIRA." */
+    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 00000248    ".`...`.." */
+    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 00000250    "........" */
+    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 00000258    ".._PRS.." */
+    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 00000260    "BUFA.._D" */
+    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x41,  /* 00000268    "IS.}PIRA" */
+    0x0A,0x80,0x50,0x49,0x52,0x41,0x14,0x1A,  /* 00000270    "..PIRA.." */
+    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 00000278    "_CRS.{PI" */
+    0x52,0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 00000280    "RB..`y.`" */
+    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 00000288    "IRQV.BUF" */
+    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 00000290    "B.._SRS." */
+    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 00000298    ".h.IRQ1." */
+    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 000002A0    "IRQ1`v`p" */
+    0x60,0x50,0x49,0x52,0x41,0x5B,0x82,0x49,  /* 000002A8    "`PIRA[.I" */
+    0x08,0x4C,0x4E,0x4B,0x42,0x08,0x5F,0x48,  /* 000002B0    ".LNKB._H" */
+    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 000002B8    "ID.A...." */
+    0x5F,0x55,0x49,0x44,0x0A,0x02,0x14,0x1C,  /* 000002C0    "_UID...." */
+    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 000002C8    "_STA.{PI" */
+    0x52,0x42,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 000002D0    "RB..`..." */
+    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 000002D8    "`......." */
+    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 000002E0    "....._PR" */
+    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 000002E8    "S..BUFA." */
+    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 000002F0    "._DIS.}P" */
+    0x49,0x52,0x42,0x0A,0x80,0x50,0x49,0x52,  /* 000002F8    "IRB..PIR" */
+    0x42,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000300    "B.._CRS." */
+    0x7B,0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,  /* 00000308    "{PIRB..`" */
+    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000310    "y.`IRQV." */
+    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000318    "BUFB.._S" */
+    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000320    "RS..h.IR" */
+    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000328    "Q1.IRQ1`" */
+    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x42,  /* 00000330    "v`p`PIRB" */
+    0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x43,  /* 00000338    "[.I.LNKC" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000340    "._HID.A." */
+    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,  /* 00000348    "..._UID." */
+    0x03,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,  /* 00000350    "..._STA." */
+    0x7B,0x50,0x49,0x52,0x43,0x0A,0x80,0x60,  /* 00000358    "{PIRC..`" */
+    0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,  /* 00000360    "...`...." */
+    0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,  /* 00000368    "........" */
+    0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55,  /* 00000370    "_PRS..BU" */
+    0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 00000378    "FA.._DIS" */
+    0x00,0x7D,0x50,0x49,0x52,0x43,0x0A,0x80,  /* 00000380    ".}PIRC.." */
+    0x50,0x49,0x52,0x43,0x14,0x1A,0x5F,0x43,  /* 00000388    "PIRC.._C" */
+    0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x43,  /* 00000390    "RS.{PIRC" */
+    0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52,  /* 00000398    "..`y.`IR" */
+    0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14,  /* 000003A0    "QV.BUFB." */
+    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 000003A8    "._SRS..h" */
+    0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52,  /* 000003B0    ".IRQ1.IR" */
+    0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50,  /* 000003B8    "Q1`v`p`P" */
+    0x49,0x52,0x43,0x5B,0x82,0x49,0x08,0x4C,  /* 000003C0    "IRC[.I.L" */
+    0x4E,0x4B,0x44,0x08,0x5F,0x48,0x49,0x44,  /* 000003C8    "NKD._HID" */
+    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 000003D0    ".A...._U" */
+    0x49,0x44,0x0A,0x04,0x14,0x1C,0x5F,0x53,  /* 000003D8    "ID...._S" */
+    0x54,0x41,0x00,0x7B,0x50,0x49,0x52,0x44,  /* 000003E0    "TA.{PIRD" */
+    0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,  /* 000003E8    "..`...`." */
+    0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,  /* 000003F0    "........" */
+    0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,  /* 000003F8    "..._PRS." */
+    0xA4,0x42,0x55,0x46,0x41,0x14,0x11,0x5F,  /* 00000400    ".BUFA.._" */
+    0x44,0x49,0x53,0x00,0x7D,0x50,0x49,0x52,  /* 00000408    "DIS.}PIR" */
+    0x44,0x0A,0x80,0x50,0x49,0x52,0x44,0x14,  /* 00000410    "D..PIRD." */
+    0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,  /* 00000418    "._CRS.{P" */
+    0x49,0x52,0x44,0x0A,0x0F,0x60,0x79,0x01,  /* 00000420    "IRD..`y." */
+    0x60,0x49,0x52,0x51,0x56,0xA4,0x42,0x55,  /* 00000428    "`IRQV.BU" */
+    0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,  /* 00000430    "FB.._SRS" */
+    0x01,0x8B,0x68,0x01,0x49,0x52,0x51,0x31,  /* 00000438    "..h.IRQ1" */
+    0x82,0x49,0x52,0x51,0x31,0x60,0x76,0x60,  /* 00000440    ".IRQ1`v`" */
+    0x70,0x60,0x50,0x49,0x52,0x44,0x14,0x16,  /* 00000448    "p`PIRD.." */
+    0x5F,0x50,0x52,0x54,0x00,0xA0,0x0A,0x50,  /* 00000450    "_PRT...P" */
+    0x49,0x43,0x44,0xA4,0x50,0x52,0x54,0x41,  /* 00000458    "ICD.PRTA" */
+    0xA4,0x50,0x52,0x54,0x50,0x08,0x50,0x52,  /* 00000460    ".PRTP.PR" */
+    0x54,0x50,0x12,0x4D,0x11,0x14,0x12,0x0B,  /* 00000468    "TP.M...." */
+    0x04,0x0B,0xFF,0xFF,0x00,0x4C,0x4E,0x4B,  /* 00000470    ".....LNK" */
+    0x41,0x00,0x12,0x0B,0x04,0x0B,0xFF,0xFF,  /* 00000478    "A......." */
+    0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0C,  /* 00000480    ".LNKB..." */
+    0x04,0x0B,0xFF,0xFF,0x0A,0x02,0x4C,0x4E,  /* 00000488    "......LN" */
+    0x4B,0x43,0x00,0x12,0x0C,0x04,0x0B,0xFF,  /* 00000490    "KC......" */
+    0xFF,0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000498    "...LNKD." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004A0    "........" */
+    0x00,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 000004A8    ".LNKB..." */
+    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x01,0x4C,  /* 000004B0    ".......L" */
+    0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,  /* 000004B8    "NKC....." */
+    0xFF,0xFF,0x01,0x00,0x0A,0x02,0x4C,0x4E,  /* 000004C0    "......LN" */
+    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000004C8    "KD......" */
+    0xFF,0x01,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000004D0    ".....LNK" */
+    0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000004D8    "A......." */
+    0x02,0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,  /* 000004E0    "...LNKC." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 000004E8    "........" */
+    0x01,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,  /* 000004F0    ".LNKD..." */
+    0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x02,  /* 000004F8    "........" */
+    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 00000500    "LNKA...." */
+    0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03,0x4C,  /* 00000508    ".......L" */
+    0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,  /* 00000510    "NKB....." */
+    0xFF,0xFF,0x03,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000518    ".....LNK" */
+    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000520    "D......." */
+    0x03,0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,  /* 00000528    "...LNKA." */
+    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 00000530    "........" */
+    0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000538    "..LNKB.." */
+    0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,  /* 00000540    "........" */
+    0x03,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,  /* 00000548    ".LNKC..." */
+    0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00,0x4C,  /* 00000550    ".......L" */
+    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000558    "NKA....." */
+    0xFF,0xFF,0x04,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000560    ".....LNK" */
+    0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000568    "B......." */
+    0x04,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,  /* 00000570    "....LNKC" */
+    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x04,  /* 00000578    "........" */
+    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000580    "...LNKD." */
+    0x08,0x50,0x52,0x54,0x41,0x12,0x32,0x04,  /* 00000588    ".PRTA.2." */
+    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000590    "........" */
+    0x00,0x00,0x0A,0x05,0x12,0x0B,0x04,0x0C,  /* 00000598    "........" */
+    0xFF,0xFF,0x02,0x00,0x00,0x00,0x0A,0x07,  /* 000005A0    "........" */
+    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 000005A8    "........" */
+    0x00,0x00,0x0A,0x0A,0x12,0x0B,0x04,0x0C,  /* 000005B0    "........" */
+    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x0B,  /* 000005B8    "........" */
+    0x5B,0x82,0x48,0x31,0x49,0x53,0x41,0x5F,  /* 000005C0    "[.H1ISA_" */
+    0x08,0x5F,0x41,0x44,0x52,0x00,0x5B,0x80,  /* 000005C8    "._ADR.[." */
+    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 000005D0    "PIRQ..`." */
+    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 000005D8    "...\.[.)" */
+    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 000005E0    "\/._SB_P" */
+    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 000005E8    "CI0ISA_P" */
+    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 000005F0    "IRQ.PIRA" */
+    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 000005F8    ".PIRB.PI" */
+    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 00000600    "RC.PIRD." */
+    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 00000608    "[.F.SYSR" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000610    "._HID.A." */
+    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000618    "..._UID." */
+    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000620    ".CRS_.N." */
+    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000628    "..G....." */
+    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000630    "..G."."." */
+    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000638    "..G.0.0." */
+    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000640    "..G.D.D." */
+    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000648    "..G.b.b." */
+    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000650    "..G.e.e." */
+    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000658    "..G.r.r." */
+    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000660    "..G....." */
+    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000668    "..G....." */
+    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000670    "..G....." */
+    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000678    "..G....." */
+    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000680    "..G....." */
+    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000688    "..G....." */
+    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000690    "..G....." */
+    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000698    "..G....." */
+    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 000006A0    "..G....." */
+    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 000006A8    "..G....." */
+    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 000006B0    "..y..._C" */
+    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 000006B8    "RS..CRS_" */
+    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 000006C0    "[.+PIC_." */
+    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 000006C8    "_HID.A.." */
+    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 000006D0    "_CRS...." */
+    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 000006D8    "G. . ..." */
+    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 000006E0    "G......." */
+    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 000006E8    ""..y.[.G" */
+    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 000006F0    ".DMA0._H" */
+    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 000006F8    "ID.A...." */
+    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 00000700    "_CRS.A.." */
+    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 00000708    "=*..G..." */
+    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 00000710    "....G..." */
+    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 00000718    "....G..." */
+    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000720    "....G..." */
+    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000728    "....G..." */
+    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000730    "....G..." */
+    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000738    "... G..." */
+    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000740    "....y.[." */
+    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000748    "%TMR_._H" */
+    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000750    "ID.A...." */
+    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000758    "_CRS...." */
+    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000760    "G.@.@..." */
+    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000768    ""..y.[.%" */
+    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000770    "RTC_._HI" */
+    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000778    "D.A...._" */
+    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000780    "CRS....G" */
+    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000788    ".p.p..."" */
+    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000790    "..y.[."S" */
+    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000798    "PKR._HID" */
+    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 000007A0    ".A...._C" */
+    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 000007A8    "RS....G." */
+    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 000007B0    "a.a...y." */
+    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 000007B8    "[.1PS2M." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 000007C0    "_HID.A.." */
+    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 000007C8    ".._CID.A" */
+    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 000007D0    "....._ST" */
+    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 000007D8    "A....._C" */
+    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 000007E0    "RS...."." */
+    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 000007E8    ".y.[.B.P" */
+    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 000007F0    "S2K._HID" */
+    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 000007F8    ".A...._C" */
+    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 00000800    "ID.A...." */
+    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000808    "._STA..." */
+    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 00000810    ".._CRS.." */
+    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 00000818    "..G.`.`." */
+    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000820    "..G.d.d." */
+    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000828    ".."..y.[" */
+    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000830    ".:FDC0._" */
+    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000838    "HID.A..." */
+    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000840    ".._STA.." */
+    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000848    "..._CRS." */
+    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000850    "...G...." */
+    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000858    "...G...." */
+    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000860    "..."@.*." */
+    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000868    ".y.[.5UA" */
+    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000870    "R1._HID." */
+    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000878    "A...._UI" */
+    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000880    "D..._STA" */
+    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000888    "....._CR" */
+    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000890    "S....G.." */
+    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000898    ".....".." */
+    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 000008A0    "y.[.6LTP" */
+    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 000008A8    "1._HID.A" */
+    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 000008B0    "...._UID" */
+    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 000008B8    "...._STA" */
+    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 000008C0    "....._CR" */
+    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 000008C8    "S....G.x" */
+    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 000008D0    ".x...".." */
     0x79,0x00,
 };
 int DsdtLen=sizeof(AmlCode);
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/firmware/hvmloader/smbios.c Tue Oct 17 16:44:57 2006 -0400
@@ -92,7 +92,6 @@ write_smbios_tables(void *start,
        unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
        char *p, *q;
        char cpu_manufacturer[15];
-       size_t structure_table_length;
 
        get_cpu_manufacturer(cpu_manufacturer, 15);
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/guest-headers/Makefile
--- a/tools/guest-headers/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/guest-headers/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -1,5 +1,6 @@
+XEN_ROOT=../..
+include $(XEN_ROOT)/tools/Rules.mk
 
-XEN_ROOT=../..
 linuxsparsetree = $(XEN_ROOT)/linux-2.6-xen-sparse
 
 .PHONY: all
@@ -8,10 +9,15 @@ all:
 .PHONY: check
 check:
 
-.PHONY: install
-install:
+.PHONY: install install-Linux install-SunOS
+
+install-Linux:
        mkdir -p $(DESTDIR)/usr/include/xen/linux
        install -m0644 $(linuxsparsetree)/include/xen/public/*.h 
$(DESTDIR)/usr/include/xen/linux
 
+install-SunOS:
+
+install: install-$(XEN_OS)
+
 .PHONY: clean
 clean:
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/ioemu/Makefile.target
--- a/tools/ioemu/Makefile.target       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/ioemu/Makefile.target       Tue Oct 17 16:44:57 2006 -0400
@@ -555,10 +555,10 @@ install: all
 install: all 
        mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
 ifneq ($(PROGS),)
-       $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
-endif
-       install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
-       install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
+       $(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)"
+endif
+       $(INSTALL_PROG) $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
+       $(INSTALL_PROG) $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
 
 ifneq ($(wildcard .depend),)
 include .depend
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/ioemu/vl.c  Tue Oct 17 16:44:57 2006 -0400
@@ -2810,7 +2810,7 @@ int parse_host_port(struct sockaddr_in *
     if (buf[0] == '\0') {
         saddr->sin_addr.s_addr = 0;
     } else {
-        if (parse_host(&saddr, buf) == -1)
+        if (parse_host(saddr, buf) == -1)
             return -1;
     }
     port = strtol(p, (char **)&r, 0);
@@ -3028,7 +3028,7 @@ void net_slirp_smb(const char *exported_
     }
 
     /* XXX: better tmp dir construction */
-    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
+    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
     if (mkdir(smb_dir, 0700) < 0) {
         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", 
smb_dir);
         exit(1);
@@ -3995,7 +3995,7 @@ static void create_pidfile(const char *f
                 perror("Opening pidfile");
                 exit(1);
             }
-            fprintf(f, "%d\n", getpid());
+            fprintf(f, "%ld\n", (long)getpid());
             fclose(f);
             pid_filename = qemu_strdup(filename);
             if (!pid_filename) {
@@ -5942,7 +5942,7 @@ int main(int argc, char **argv)
     memset(&vnclisten_addr.sin_addr, 0, sizeof(vnclisten_addr.sin_addr));
     
     /* init debug */
-    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
+    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%ld.log", 
(long)getpid());
     cpu_set_log_filename(qemu_dm_logfilename);
     cpu_set_log(0);
     
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -1,14 +1,8 @@
-
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DATA   = $(INSTALL) -m0644
-INSTALL_DIR    = $(INSTALL) -d -m0755
+XEN_ROOT = ../..
+include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 3.0
 MINOR    = 0
-
-XEN_ROOT = ../..
-include $(XEN_ROOT)/tools/Rules.mk
 
 CTRL_SRCS-y       :=
 CTRL_SRCS-y       += xc_core.c
@@ -21,8 +15,10 @@ CTRL_SRCS-y       += xc_sedf.c
 CTRL_SRCS-y       += xc_sedf.c
 CTRL_SRCS-y       += xc_csched.c
 CTRL_SRCS-y       += xc_tbuf.c
-CTRL_SRCS-$(CONFIG_X86) += xc_ptrace.c xc_ptrace_core.c xc_pagetab.c
+CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
+CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
+CTRL_SRCS-$(CONFIG_X86_Linux) += xc_ptrace.c xc_ptrace_core.c
 
 GUEST_SRCS-y :=
 GUEST_SRCS-y += xc_load_bin.c
@@ -123,7 +119,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(
        ln -sf $< $@
 
 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) 
-shared -o $@ $^
+       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxenctrl.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
 
 # libxenguest
 
@@ -136,7 +132,7 @@ libxenguest.so.$(MAJOR): libxenguest.so.
        ln -sf $< $@
 
 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
-       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) 
-shared -o $@ $^ -lz -lxenctrl
+       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz 
-lxenctrl
 
 -include $(DEPS)
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c  Tue Oct 17 16:44:57 2006 -0400
@@ -44,11 +44,11 @@ read_page(int xc_handle, int io_fd, uint
     mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                PROT_READ|PROT_WRITE, pfn);
     if (mem == NULL) {
-            ERR("cannot map page");
+            ERROR("cannot map page");
            return -1;
     }
     if (!read_exact(io_fd, mem, PAGE_SIZE)) {
-            ERR("Error when reading from state file (5)");
+            ERROR("Error when reading from state file (5)");
             return -1;
     }
     munmap(mem, PAGE_SIZE);
@@ -85,17 +85,17 @@ xc_linux_restore(int xc_handle, int io_f
 
 
     if (!read_exact(io_fd, &ver, sizeof(unsigned long))) {
-       ERR("Error when reading version");
+       ERROR("Error when reading version");
        goto out;
     }
     if (ver != 1) {
-       ERR("version of save doesn't match");
+       ERROR("version of save doesn't match");
        goto out;
     }
 
     if (mlock(&ctxt, sizeof(ctxt))) {
         /* needed for build domctl, but might as well do early */
-        ERR("Unable to mlock ctxt");
+        ERROR("Unable to mlock ctxt");
         return 1;
     }
 
@@ -103,7 +103,7 @@ xc_linux_restore(int xc_handle, int io_f
     domctl.cmd = XEN_DOMCTL_getdomaininfo;
     domctl.domain = (domid_t)dom;
     if (xc_domctl(xc_handle, &domctl) < 0) {
-        ERR("Could not get information on new domain");
+        ERROR("Could not get information on new domain");
         goto out;
     }
     shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
@@ -115,7 +115,7 @@ xc_linux_restore(int xc_handle, int io_f
 
     if (xc_domain_memory_increase_reservation(xc_handle, dom, max_pfn,
                                               0, 0, NULL) != 0) {
-        ERR("Failed to increase reservation by %ld KB", PFN_TO_KB(max_pfn));
+        ERROR("Failed to increase reservation by %ld KB", PFN_TO_KB(max_pfn));
         errno = ENOMEM;
         goto out;
     }
@@ -123,7 +123,7 @@ xc_linux_restore(int xc_handle, int io_f
     DPRINTF("Increased domain reservation by %ld KB\n", PFN_TO_KB(max_pfn));
 
     if (!read_exact(io_fd, &domctl.u.arch_setup, sizeof(domctl.u.arch_setup))) 
{
-        ERR("read: domain setup");
+        ERROR("read: domain setup");
         goto out;
     }
 
@@ -141,13 +141,13 @@ xc_linux_restore(int xc_handle, int io_f
     /* Get pages.  */
     page_array = malloc(max_pfn * sizeof(unsigned long));
     if (page_array == NULL ) {
-        ERR("Could not allocate memory");
+        ERROR("Could not allocate memory");
         goto out;
     }
 
     if (xc_ia64_get_pfn_list(xc_handle, dom, page_array,
                              0, max_pfn) != max_pfn) {
-        ERR("Could not get the page frame list");
+        ERROR("Could not get the page frame list");
         goto out;
     }
 
@@ -155,7 +155,7 @@ xc_linux_restore(int xc_handle, int io_f
 
     while (1) {
         if (!read_exact(io_fd, &mfn, sizeof(unsigned long))) {
-            ERR("Error when reading batch size");
+            ERROR("Error when reading batch size");
             goto out;
         }
        if (mfn == INVALID_MFN)
@@ -178,18 +178,18 @@ xc_linux_restore(int xc_handle, int io_f
         int rc;
 
         if (!read_exact(io_fd, &count, sizeof(count))) {
-            ERR("Error when reading pfn count");
+            ERROR("Error when reading pfn count");
             goto out;
         }
 
         pfntab = malloc(sizeof(unsigned long) * count);
         if (!pfntab) {
-            ERR("Out of memory");
+            ERROR("Out of memory");
             goto out;
         }
 
         if (!read_exact(io_fd, pfntab, sizeof(unsigned long)*count)) {
-            ERR("Error when reading pfntab");
+            ERROR("Error when reading pfntab");
             goto out;
         }
 
@@ -211,7 +211,7 @@ xc_linux_restore(int xc_handle, int io_f
             rc = xc_memory_op(xc_handle, XENMEM_decrease_reservation,
                               &reservation);
             if (rc != 1) {
-                ERR("Could not decrease reservation : %d", rc);
+                ERROR("Could not decrease reservation : %d", rc);
                 goto out;
             }
         }
@@ -221,7 +221,7 @@ xc_linux_restore(int xc_handle, int io_f
 
 
     if (!read_exact(io_fd, &ctxt, sizeof(ctxt))) {
-        ERR("Error when reading ctxt");
+        ERROR("Error when reading ctxt");
         goto out;
     }
 
@@ -231,7 +231,7 @@ xc_linux_restore(int xc_handle, int io_f
     domctl.u.vcpucontext.vcpu   = 0;
     set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
     if (xc_domctl(xc_handle, &domctl) != 0) {
-           ERR("Couldn't set vcpu context");
+           ERROR("Couldn't set vcpu context");
            goto out;
     }
 
@@ -242,19 +242,19 @@ xc_linux_restore(int xc_handle, int io_f
     domctl.u.vcpucontext.vcpu   = 0;
     set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
     if (xc_domctl(xc_handle, &domctl) != 0) {
-           ERR("Couldn't set vcpu context");
+           ERROR("Couldn't set vcpu context");
            goto out;
     }
 
     /* Just a check.  */
     if (xc_vcpu_getcontext(xc_handle, dom, 0 /* XXX */, &ctxt)) {
-        ERR("Could not get vcpu context");
+        ERROR("Could not get vcpu context");
        goto out;
     }
 
     /* Then get privreg page.  */
     if (read_page(xc_handle, io_fd, dom, ctxt.privregs_pfn) < 0) {
-           ERR("Could not read vcpu privregs");
+           ERROR("Could not read vcpu privregs");
            goto out;
     }
 
@@ -262,11 +262,11 @@ xc_linux_restore(int xc_handle, int io_f
     shared_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                        PROT_READ|PROT_WRITE, 
shared_info_frame);
     if (shared_info == NULL) {
-            ERR("cannot map page");
+            ERROR("cannot map page");
            goto out;
     }
     if (!read_exact(io_fd, shared_info, PAGE_SIZE)) {
-            ERR("Error when reading shared_info page");
+            ERROR("Error when reading shared_info page");
            goto out;
     }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c     Tue Oct 17 16:44:57 2006 -0400
@@ -97,14 +97,14 @@ suspend_and_state(int (*suspend)(int), i
     int i = 0;
 
     if (!(*suspend)(dom)) {
-        ERR("Suspend request failed");
+        ERROR("Suspend request failed");
         return -1;
     }
 
 retry:
 
     if (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) {
-        ERR("Could not get domain info");
+        ERROR("Could not get domain info");
         return -1;
     }
 
@@ -115,7 +115,7 @@ retry:
         // try unpausing domain, wait, and retest
         xc_domain_unpause(xc_handle, dom);
 
-        ERR("Domain was paused. Wait and re-test.");
+        ERROR("Domain was paused. Wait and re-test.");
         usleep(10000);  // 10ms
 
         goto retry;
@@ -123,12 +123,12 @@ retry:
 
 
     if(++i < 100) {
-        ERR("Retry suspend domain.");
+        ERROR("Retry suspend domain.");
         usleep(10000);  // 10ms
         goto retry;
     }
 
-    ERR("Unable to suspend domain.");
+    ERROR("Unable to suspend domain.");
 
     return -1;
 }
@@ -191,7 +191,7 @@ xc_linux_save(int xc_handle, int io_fd, 
     //initialize_mbit_rate();
 
     if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
-        ERR("Could not get domain info");
+        ERROR("Could not get domain info");
         return 1;
     }
 
@@ -200,7 +200,7 @@ xc_linux_save(int xc_handle, int io_fd, 
 #if 0
     /* cheesy sanity check */
     if ((info.max_memkb >> (PAGE_SHIFT - 10)) > max_mfn) {
-        ERR("Invalid state record -- pfn count out of range: %lu",
+        ERROR("Invalid state record -- pfn count out of range: %lu",
             (info.max_memkb >> (PAGE_SHIFT - 10)));
         goto out;
      }
@@ -210,7 +210,7 @@ xc_linux_save(int xc_handle, int io_fd, 
     live_shinfo = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                        PROT_READ, shared_info_frame);
     if (!live_shinfo) {
-        ERR("Couldn't map live_shinfo");
+        ERROR("Couldn't map live_shinfo");
         goto out;
     }
 
@@ -218,13 +218,13 @@ xc_linux_save(int xc_handle, int io_fd, 
 
     page_array = malloc(max_pfn * sizeof(unsigned long));
     if (page_array == NULL) {
-        ERR("Could not allocate memory");
+        ERROR("Could not allocate memory");
         goto out;
     }
 
     /* This is expected by xm restore.  */
     if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
-        ERR("write: max_pfn");
+        ERROR("write: max_pfn");
         goto out;
     }
 
@@ -237,7 +237,7 @@ xc_linux_save(int xc_handle, int io_fd, 
         unsigned long version = 1;
 
         if (!write_exact(io_fd, &version, sizeof(unsigned long))) {
-            ERR("write: version");
+            ERROR("write: version");
             goto out;
         }
     }
@@ -246,12 +246,12 @@ xc_linux_save(int xc_handle, int io_fd, 
     domctl.domain = (domid_t)dom;
     domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query;
     if (xc_domctl(xc_handle, &domctl) < 0) {
-        ERR("Could not get domain setup");
+        ERROR("Could not get domain setup");
         goto out;
     }
     if (!write_exact(io_fd, &domctl.u.arch_setup,
                      sizeof(domctl.u.arch_setup))) {
-        ERR("write: domain setup");
+        ERROR("write: domain setup");
         goto out;
     }
 
@@ -261,7 +261,7 @@ xc_linux_save(int xc_handle, int io_fd, 
         if (xc_ia64_shadow_control(xc_handle, dom,
                                    XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
                                    NULL, 0, NULL ) < 0) {
-            ERR("Couldn't enable shadow mode");
+            ERROR("Couldn't enable shadow mode");
             goto out;
         }
 
@@ -272,7 +272,7 @@ xc_linux_save(int xc_handle, int io_fd, 
         to_skip = malloc(bitmap_size);
 
         if (!to_send || !to_skip) {
-            ERR("Couldn't allocate bitmap array");
+            ERROR("Couldn't allocate bitmap array");
             goto out;
         }
 
@@ -280,11 +280,11 @@ xc_linux_save(int xc_handle, int io_fd, 
         memset(to_send, 0xff, bitmap_size);
 
         if (mlock(to_send, bitmap_size)) {
-            ERR("Unable to mlock to_send");
+            ERROR("Unable to mlock to_send");
             goto out;
         }
         if (mlock(to_skip, bitmap_size)) {
-            ERR("Unable to mlock to_skip");
+            ERROR("Unable to mlock to_skip");
             goto out;
         }
         
@@ -296,7 +296,7 @@ xc_linux_save(int xc_handle, int io_fd, 
         last_iter = 1;
 
         if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info)) {
-            ERR("Domain appears not to have suspended");
+            ERROR("Domain appears not to have suspended");
             goto out;
         }
 
@@ -315,7 +315,7 @@ xc_linux_save(int xc_handle, int io_fd, 
         /* Get the pfn list, as it may change.  */
         if (xc_ia64_get_pfn_list(xc_handle, dom, page_array,
                                  0, max_pfn) != max_pfn) {
-            ERR("Could not get the page frame list");
+            ERROR("Could not get the page frame list");
             goto out;
         }
 
@@ -326,7 +326,7 @@ xc_linux_save(int xc_handle, int io_fd, 
             if (xc_ia64_shadow_control(xc_handle, dom,
                                        XEN_DOMCTL_SHADOW_OP_PEEK,
                                        to_skip, max_pfn, NULL) != max_pfn) {
-                ERR("Error peeking shadow bitmap");
+                ERROR("Error peeking shadow bitmap");
                 goto out;
             }
         }
@@ -358,12 +358,12 @@ xc_linux_save(int xc_handle, int io_fd, 
             }
 
             if (!write_exact(io_fd, &N, sizeof(N))) {
-                ERR("write: max_pfn");
+                ERROR("write: max_pfn");
                 goto out;
             }
 
             if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
-                ERR("Error when writing to state file (5)");
+                ERROR("Error when writing to state file (5)");
                 goto out;
             }
             munmap(mem, PAGE_SIZE);
@@ -385,7 +385,7 @@ xc_linux_save(int xc_handle, int io_fd, 
                 last_iter = 1;
 
                 if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info)) {
-                    ERR("Domain appears not to have suspended");
+                    ERROR("Domain appears not to have suspended");
                     goto out;
                 }
             }
@@ -394,7 +394,7 @@ xc_linux_save(int xc_handle, int io_fd, 
             if (xc_ia64_shadow_control(xc_handle, dom,
                                        XEN_DOMCTL_SHADOW_OP_CLEAN,
                                        to_send, max_pfn, NULL ) != max_pfn) {
-                ERR("Error flushing shadow PT");
+                ERROR("Error flushing shadow PT");
                 goto out;
             }
 
@@ -411,7 +411,7 @@ xc_linux_save(int xc_handle, int io_fd, 
     {
         unsigned long pfn = INVALID_MFN;
         if (!write_exact(io_fd, &pfn, sizeof(pfn))) {
-            ERR("Error when writing to state file (6)");
+            ERROR("Error when writing to state file (6)");
             goto out;
         }
     }
@@ -427,7 +427,7 @@ xc_linux_save(int xc_handle, int io_fd, 
         }
 
         if (!write_exact(io_fd, &j, sizeof(unsigned int))) {
-            ERR("Error when writing to state file (6a)");
+            ERROR("Error when writing to state file (6a)");
             goto out;
         }
 
@@ -439,7 +439,7 @@ xc_linux_save(int xc_handle, int io_fd, 
             i++;
             if (j == 1024 || i == max_pfn) {
                 if (!write_exact(io_fd, &pfntab, sizeof(unsigned long)*j)) {
-                    ERR("Error when writing to state file (6b)");
+                    ERROR("Error when writing to state file (6b)");
                     goto out;
                 }
                 j = 0;
@@ -449,29 +449,29 @@ xc_linux_save(int xc_handle, int io_fd, 
     }
 
     if (xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt)) {
-        ERR("Could not get vcpu context");
+        ERROR("Could not get vcpu context");
         goto out;
     }
 
     if (!write_exact(io_fd, &ctxt, sizeof(ctxt))) {
-        ERR("Error when writing to state file (1)");
+        ERROR("Error when writing to state file (1)");
         goto out;
     }
 
     mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                PROT_READ|PROT_WRITE, ctxt.privregs_pfn);
     if (mem == NULL) {
-        ERR("cannot map privreg page");
+        ERROR("cannot map privreg page");
         goto out;
     }
     if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
-        ERR("Error when writing privreg to state file (5)");
+        ERROR("Error when writing privreg to state file (5)");
         goto out;
     }
     munmap(mem, PAGE_SIZE);    
 
     if (!write_exact(io_fd, live_shinfo, PAGE_SIZE)) {
-        ERR("Error when writing to state file (1)");
+        ERROR("Error when writing to state file (1)");
         goto out;
     }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xc_linux_restore.c    Tue Oct 17 16:44:57 2006 -0400
@@ -79,7 +79,7 @@ int uncanonicalize_pagetable(unsigned lo
 
             if(pfn >= max_pfn) {
                 /* This "page table page" is probably not one; bail. */
-                ERR("Frame number in type %lu page table is out of range: "
+                ERROR("Frame number in type %lu page table is out of range: "
                     "i=%d pfn=0x%lx max_pfn=%lu",
                     type >> 28, i, pfn, max_pfn);
                 return 0;
@@ -158,24 +158,24 @@ int xc_linux_restore(int xc_handle, int 
 
     if(!get_platform_info(xc_handle, dom,
                           &max_mfn, &hvirt_start, &pt_levels)) {
-        ERR("Unable to get platform info.");
+        ERROR("Unable to get platform info.");
         return 1;
     }
 
     if (mlock(&ctxt, sizeof(ctxt))) {
         /* needed for build domctl, but might as well do early */
-        ERR("Unable to mlock ctxt");
+        ERROR("Unable to mlock ctxt");
         return 1;
     }
 
     if (!(p2m_frame_list = malloc(P2M_FL_SIZE))) {
-        ERR("Couldn't allocate p2m_frame_list array");
+        ERROR("Couldn't allocate p2m_frame_list array");
         goto out;
     }
 
     /* Read first entry of P2M list, or extended-info signature (~0UL). */
     if (!read_exact(io_fd, p2m_frame_list, sizeof(long))) {
-        ERR("read extended-info signature failed");
+        ERROR("read extended-info signature failed");
         goto out;
     }
 
@@ -184,7 +184,7 @@ int xc_linux_restore(int xc_handle, int 
 
         /* Next 4 bytes: total size of following extended info. */
         if (!read_exact(io_fd, &tot_bytes, sizeof(tot_bytes))) {
-            ERR("read extended-info size failed");
+            ERROR("read extended-info size failed");
             goto out;
         }
 
@@ -195,7 +195,7 @@ int xc_linux_restore(int xc_handle, int 
             /* 4-character chunk signature + 4-byte remaining chunk size. */
             if (!read_exact(io_fd, chunk_sig, sizeof(chunk_sig)) ||
                 !read_exact(io_fd, &chunk_bytes, sizeof(chunk_bytes))) {
-                ERR("read extended-info chunk signature failed");
+                ERROR("read extended-info chunk signature failed");
                 goto out;
             }
             tot_bytes -= 8;
@@ -203,7 +203,7 @@ int xc_linux_restore(int xc_handle, int 
             /* VCPU context structure? */
             if (!strncmp(chunk_sig, "vcpu", 4)) {
                 if (!read_exact(io_fd, &ctxt, sizeof(ctxt))) {
-                    ERR("read extended-info vcpu context failed");
+                    ERROR("read extended-info vcpu context failed");
                     goto out;
                 }
                 tot_bytes   -= sizeof(struct vcpu_guest_context);
@@ -219,7 +219,7 @@ int xc_linux_restore(int xc_handle, int 
                 if ( sz > P2M_FL_SIZE )
                     sz = P2M_FL_SIZE;
                 if (!read_exact(io_fd, p2m_frame_list, sz)) {
-                    ERR("read-and-discard extended-info chunk bytes failed");
+                    ERROR("read-and-discard extended-info chunk bytes failed");
                     goto out;
                 }
                 chunk_bytes -= sz;
@@ -229,14 +229,14 @@ int xc_linux_restore(int xc_handle, int 
 
         /* Now read the real first entry of P2M list. */
         if (!read_exact(io_fd, p2m_frame_list, sizeof(long))) {
-            ERR("read first entry of p2m_frame_list failed");
+            ERROR("read first entry of p2m_frame_list failed");
             goto out;
         }
     }
 
     /* First entry is already read into the p2m array. */
     if (!read_exact(io_fd, &p2m_frame_list[1], P2M_FL_SIZE - sizeof(long))) {
-        ERR("read p2m_frame_list failed");
+        ERROR("read p2m_frame_list failed");
         goto out;
     }
 
@@ -246,13 +246,13 @@ int xc_linux_restore(int xc_handle, int 
     region_mfn = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t));
 
     if ((p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL)) {
-        ERR("memory alloc failed");
+        ERROR("memory alloc failed");
         errno = ENOMEM;
         goto out;
     }
 
     if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
-        ERR("Could not mlock region_mfn");
+        ERROR("Could not mlock region_mfn");
         goto out;
     }
 
@@ -260,7 +260,7 @@ int xc_linux_restore(int xc_handle, int 
     domctl.cmd = XEN_DOMCTL_getdomaininfo;
     domctl.domain = (domid_t)dom;
     if (xc_domctl(xc_handle, &domctl) < 0) {
-        ERR("Could not get information on new domain");
+        ERROR("Could not get information on new domain");
         goto out;
     }
     shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
@@ -272,7 +272,7 @@ int xc_linux_restore(int xc_handle, int 
 
     if(xc_domain_memory_increase_reservation(
            xc_handle, dom, max_pfn, 0, 0, NULL) != 0) {
-        ERR("Failed to increase reservation by %lx KB", PFN_TO_KB(max_pfn));
+        ERROR("Failed to increase reservation by %lx KB", PFN_TO_KB(max_pfn));
         errno = ENOMEM;
         goto out;
     }
@@ -281,12 +281,12 @@ int xc_linux_restore(int xc_handle, int 
 
     /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
     if (xc_get_pfn_list(xc_handle, dom, p2m, max_pfn) != max_pfn) {
-        ERR("Did not read correct number of frame numbers for new dom");
+        ERROR("Did not read correct number of frame numbers for new dom");
         goto out;
     }
 
     if(!(mmu = xc_init_mmu_updates(xc_handle, dom))) {
-        ERR("Could not initialise for MMU updates");
+        ERROR("Could not initialise for MMU updates");
         goto out;
     }
 
@@ -312,7 +312,7 @@ int xc_linux_restore(int xc_handle, int 
         }
 
         if (!read_exact(io_fd, &j, sizeof(int))) {
-            ERR("Error when reading batch size");
+            ERROR("Error when reading batch size");
             goto out;
         }
 
@@ -328,12 +328,12 @@ int xc_linux_restore(int xc_handle, int 
             break;  /* our work here is done */
 
         if (j > MAX_BATCH_SIZE) {
-            ERR("Max batch size exceeded. Giving up.");
+            ERROR("Max batch size exceeded. Giving up.");
             goto out;
         }
 
         if (!read_exact(io_fd, region_pfn_type, j*sizeof(unsigned long))) {
-            ERR("Error when reading region pfn types");
+            ERROR("Error when reading region pfn types");
             goto out;
         }
 
@@ -353,7 +353,7 @@ int xc_linux_restore(int xc_handle, int 
             xc_handle, dom, PROT_WRITE, region_mfn, j);
         if ( region_base == NULL )
         {
-            ERR("map batch failed");
+            ERROR("map batch failed");
             goto out;
         }
 
@@ -371,7 +371,7 @@ int xc_linux_restore(int xc_handle, int 
 
             if ( pfn > max_pfn )
             {
-                ERR("pfn out of range");
+                ERROR("pfn out of range");
                 goto out;
             }
 
@@ -383,7 +383,7 @@ int xc_linux_restore(int xc_handle, int 
             page = verify ? (void *)buf : (region_base + i*PAGE_SIZE);
 
             if (!read_exact(io_fd, page, PAGE_SIZE)) {
-                ERR("Error when reading page (type was %lx)", pagetype);
+                ERROR("Error when reading page (type was %lx)", pagetype);
                 goto out;
             }
 
@@ -422,7 +422,7 @@ int xc_linux_restore(int xc_handle, int 
             }
             else if ( pagetype != XEN_DOMCTL_PFINFO_NOTAB )
             {
-                ERR("Bogus page type %lx page table is out of range: "
+                ERROR("Bogus page type %lx page table is out of range: "
                     "i=%d max_pfn=%lu", pagetype, i, max_pfn);
                 goto out;
 
@@ -455,7 +455,7 @@ int xc_linux_restore(int xc_handle, int 
             if (xc_add_mmu_update(xc_handle, mmu,
                                   (((unsigned long long)mfn) << PAGE_SHIFT)
                                   | MMU_MACHPHYS_UPDATE, pfn)) {
-                ERR("failed machpys update mfn=%lx pfn=%lx", mfn, pfn);
+                ERROR("failed machpys update mfn=%lx pfn=%lx", mfn, pfn);
                 goto out;
             }
         } /* end of 'batch' for loop */
@@ -469,7 +469,7 @@ int xc_linux_restore(int xc_handle, int 
      * reallocations below.
      */
     if (xc_finish_mmu_updates(xc_handle, mmu)) {
-        ERR("Error doing finish_mmu_updates()");
+        ERROR("Error doing finish_mmu_updates()");
         goto out;
     }
 
@@ -512,7 +512,7 @@ int xc_linux_restore(int xc_handle, int 
                 munmap(l3tab, PAGE_SIZE);
 
                 if (!(new_mfn=xc_make_page_below_4G(xc_handle, dom, p2m[i]))) {
-                    ERR("Couldn't get a page below 4GB :-(");
+                    ERROR("Couldn't get a page below 4GB :-(");
                     goto out;
                 }
 
@@ -521,7 +521,7 @@ int xc_linux_restore(int xc_handle, int 
                                       (((unsigned long long)new_mfn)
                                        << PAGE_SHIFT) |
                                       MMU_MACHPHYS_UPDATE, i)) {
-                    ERR("Couldn't m2p on PAE root pgdir");
+                    ERROR("Couldn't m2p on PAE root pgdir");
                     goto out;
                 }
 
@@ -554,14 +554,14 @@ int xc_linux_restore(int xc_handle, int 
                 if (!(region_base = xc_map_foreign_batch(
                           xc_handle, dom, PROT_READ | PROT_WRITE,
                           region_mfn, j))) {
-                    ERR("map batch failed");
+                    ERROR("map batch failed");
                     goto out;
                 }
 
                 for(k = 0; k < j; k++) {
                     if(!uncanonicalize_pagetable(XEN_DOMCTL_PFINFO_L1TAB,
                                                  region_base + k*PAGE_SIZE)) {
-                        ERR("failed uncanonicalize pt!");
+                        ERROR("failed uncanonicalize pt!");
                         goto out;
                     }
                 }
@@ -572,7 +572,7 @@ int xc_linux_restore(int xc_handle, int 
         }
 
         if (xc_finish_mmu_updates(xc_handle, mmu)) {
-            ERR("Error doing finish_mmu_updates()");
+            ERROR("Error doing finish_mmu_updates()");
             goto out;
         }
     }
@@ -615,7 +615,7 @@ int xc_linux_restore(int xc_handle, int 
         /* Batch full? Then flush. */
         if (nr_pins == MAX_PIN_BATCH) {
             if (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) {
-                ERR("Failed to pin batch of %d page tables", nr_pins);
+                ERROR("Failed to pin batch of %d page tables", nr_pins);
                 goto out;
             }
             nr_pins = 0;
@@ -624,7 +624,7 @@ int xc_linux_restore(int xc_handle, int 
 
     /* Flush final partial batch. */
     if ((nr_pins != 0) && (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0)) {
-        ERR("Failed to pin batch of %d page tables", nr_pins);
+        ERROR("Failed to pin batch of %d page tables", nr_pins);
         goto out;
     }
 
@@ -638,17 +638,17 @@ int xc_linux_restore(int xc_handle, int 
         int rc;
 
         if (!read_exact(io_fd, &count, sizeof(count))) {
-            ERR("Error when reading pfn count");
+            ERROR("Error when reading pfn count");
             goto out;
         }
 
         if(!(pfntab = malloc(sizeof(unsigned long) * count))) {
-            ERR("Out of memory");
+            ERROR("Out of memory");
             goto out;
         }
 
         if (!read_exact(io_fd, pfntab, sizeof(unsigned long)*count)) {
-            ERR("Error when reading pfntab");
+            ERROR("Error when reading pfntab");
             goto out;
         }
 
@@ -675,7 +675,7 @@ int xc_linux_restore(int xc_handle, int 
 
             if ((rc = xc_memory_op(xc_handle, XENMEM_decrease_reservation,
                                    &reservation)) != count) {
-                ERR("Could not decrease reservation : %d", rc);
+                ERROR("Could not decrease reservation : %d", rc);
                 goto out;
             } else
                 DPRINTF("Decreased reservation by %d pages\n", count);
@@ -684,14 +684,14 @@ int xc_linux_restore(int xc_handle, int 
 
     if (!read_exact(io_fd, &ctxt, sizeof(ctxt)) ||
         !read_exact(io_fd, shared_info_page, PAGE_SIZE)) {
-        ERR("Error when reading ctxt or shared info page");
+        ERROR("Error when reading ctxt or shared info page");
         goto out;
     }
 
     /* Uncanonicalise the suspend-record frame number and poke resume rec. */
     pfn = ctxt.user_regs.edx;
     if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
-        ERR("Suspend record frame number is bad");
+        ERROR("Suspend record frame number is bad");
         goto out;
     }
     ctxt.user_regs.edx = mfn = p2m[pfn];
@@ -709,14 +709,14 @@ int xc_linux_restore(int xc_handle, int 
 
     /* Uncanonicalise each GDT frame number. */
     if (ctxt.gdt_ents > 8192) {
-        ERR("GDT entry count out of range");
+        ERROR("GDT entry count out of range");
         goto out;
     }
 
     for (i = 0; i < ctxt.gdt_ents; i += 512) {
         pfn = ctxt.gdt_frames[i];
         if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
-            ERR("GDT frame number is bad");
+            ERROR("GDT frame number is bad");
             goto out;
         }
         ctxt.gdt_frames[i] = p2m[pfn];
@@ -726,14 +726,14 @@ int xc_linux_restore(int xc_handle, int 
     pfn = xen_cr3_to_pfn(ctxt.ctrlreg[3]);
 
     if (pfn >= max_pfn) {
-        ERR("PT base is bad: pfn=%lu max_pfn=%lu type=%08lx",
+        ERROR("PT base is bad: pfn=%lu max_pfn=%lu type=%08lx",
             pfn, max_pfn, pfn_type[pfn]);
         goto out;
     }
 
     if ( (pfn_type[pfn] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) !=
          ((unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT) ) {
-        ERR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
+        ERROR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
             pfn, max_pfn, pfn_type[pfn],
             (unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT);
         goto out;
@@ -757,7 +757,7 @@ int xc_linux_restore(int xc_handle, int 
     for (i = 0; i < P2M_FL_ENTRIES; i++) {
         pfn = p2m_frame_list[i];
         if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
-            ERR("PFN-to-MFN frame number is bad");
+            ERROR("PFN-to-MFN frame number is bad");
             goto out;
         }
 
@@ -767,7 +767,7 @@ int xc_linux_restore(int xc_handle, int 
     /* Copy the P2M we've constructed to the 'live' P2M */
     if (!(live_p2m = xc_map_foreign_batch(xc_handle, dom, PROT_WRITE,
                                           p2m_frame_list, P2M_FL_ENTRIES))) {
-        ERR("Couldn't map p2m table");
+        ERROR("Couldn't map p2m table");
         goto out;
     }
 
@@ -803,7 +803,7 @@ int xc_linux_restore(int xc_handle, int 
         (ctxt.ldt_ents > 8192) ||
         (ctxt.ldt_base > hvirt_start) ||
         ((ctxt.ldt_base + ctxt.ldt_ents*8) > hvirt_start)) {
-        ERR("Bad LDT base or size");
+        ERROR("Bad LDT base or size");
         goto out;
     }
 
@@ -816,7 +816,7 @@ int xc_linux_restore(int xc_handle, int 
     rc = xc_domctl(xc_handle, &domctl);
 
     if (rc != 0) {
-        ERR("Couldn't build the domain");
+        ERROR("Couldn't build the domain");
         goto out;
     }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xc_linux_save.c       Tue Oct 17 16:44:57 2006 -0400
@@ -363,19 +363,19 @@ static int suspend_and_state(int (*suspe
     int i = 0;
 
     if (!(*suspend)(dom)) {
-        ERR("Suspend request failed");
+        ERROR("Suspend request failed");
         return -1;
     }
 
  retry:
 
     if (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) {
-        ERR("Could not get domain info");
+        ERROR("Could not get domain info");
         return -1;
     }
 
     if ( xc_vcpu_getcontext(xc_handle, dom, 0 /* XXX */, ctxt))
-        ERR("Could not get vcpu context");
+        ERROR("Could not get vcpu context");
 
 
     if (info->shutdown && info->shutdown_reason == SHUTDOWN_suspend)
@@ -385,7 +385,7 @@ static int suspend_and_state(int (*suspe
         // try unpausing domain, wait, and retest
         xc_domain_unpause( xc_handle, dom );
 
-        ERR("Domain was paused. Wait and re-test.");
+        ERROR("Domain was paused. Wait and re-test.");
         usleep(10000);  // 10ms
 
         goto retry;
@@ -393,12 +393,12 @@ static int suspend_and_state(int (*suspe
 
 
     if( ++i < 100 ) {
-        ERR("Retry suspend domain.");
+        ERROR("Retry suspend domain.");
         usleep(10000);  // 10ms
         goto retry;
     }
 
-    ERR("Unable to suspend domain.");
+    ERROR("Unable to suspend domain.");
 
     return -1;
 }
@@ -516,25 +516,25 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
 
     xmml.max_extents = m2p_chunks;
     if (!(extent_start = malloc(m2p_chunks * sizeof(xen_pfn_t)))) {
-        ERR("failed to allocate space for m2p mfns");
+        ERROR("failed to allocate space for m2p mfns");
         return NULL;
     }
     set_xen_guest_handle(xmml.extent_start, extent_start);
 
     if (xc_memory_op(xc_handle, XENMEM_machphys_mfn_list, &xmml) ||
         (xmml.nr_extents != m2p_chunks)) {
-        ERR("xc_get_m2p_mfns");
+        ERROR("xc_get_m2p_mfns");
         return NULL;
     }
 
     if ((m2p = mmap(NULL, m2p_size, prot,
                     MAP_SHARED, xc_handle, 0)) == MAP_FAILED) {
-        ERR("failed to mmap m2p");
+        ERROR("failed to mmap m2p");
         return NULL;
     }
 
     if (!(entries = malloc(m2p_chunks * sizeof(privcmd_mmap_entry_t)))) {
-        ERR("failed to allocate space for mmap entries");
+        ERROR("failed to allocate space for mmap entries");
         return NULL;
     }
 
@@ -546,7 +546,7 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
 
     if ((rc = xc_map_foreign_ranges(xc_handle, DOMID_XEN,
         entries, m2p_chunks)) < 0) {
-        ERR("xc_mmap_foreign_ranges failed (rc = %d)", rc);
+        ERROR("xc_mmap_foreign_ranges failed (rc = %d)", rc);
         return NULL;
     }
 
@@ -619,23 +619,23 @@ int xc_linux_save(int xc_handle, int io_
 
     if(!get_platform_info(xc_handle, dom,
                           &max_mfn, &hvirt_start, &pt_levels)) {
-        ERR("Unable to get platform info.");
+        ERROR("Unable to get platform info.");
         return 1;
     }
 
     if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
-        ERR("Could not get domain info");
+        ERROR("Could not get domain info");
         return 1;
     }
 
     if (mlock(&ctxt, sizeof(ctxt))) {
-        ERR("Unable to mlock ctxt");
+        ERROR("Unable to mlock ctxt");
         return 1;
     }
 
     /* Only have to worry about vcpu 0 even for SMP */
     if (xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt)) {
-        ERR("Could not get vcpu context");
+        ERROR("Could not get vcpu context");
         goto out;
     }
     shared_info_frame = info.shared_info_frame;
@@ -643,13 +643,13 @@ int xc_linux_save(int xc_handle, int io_
     /* A cheesy test to see whether the domain contains valid state. */
     if (ctxt.ctrlreg[3] == 0)
     {
-        ERR("Domain is not in a valid Linux guest OS state");
+        ERROR("Domain is not in a valid Linux guest OS state");
         goto out;
     }
 
    /* cheesy sanity check */
     if ((info.max_memkb >> (PAGE_SHIFT - 10)) > max_mfn) {
-        ERR("Invalid state record -- pfn count out of range: %lu",
+        ERROR("Invalid state record -- pfn count out of range: %lu",
             (info.max_memkb >> (PAGE_SHIFT - 10)));
         goto out;
      }
@@ -657,7 +657,7 @@ int xc_linux_save(int xc_handle, int io_
     /* Map the shared info frame */
     if(!(live_shinfo = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                             PROT_READ, shared_info_frame))) {
-        ERR("Couldn't map live_shinfo");
+        ERROR("Couldn't map live_shinfo");
         goto out;
     }
 
@@ -668,7 +668,7 @@ int xc_linux_save(int xc_handle, int io_
                              live_shinfo->arch.pfn_to_mfn_frame_list_list);
 
     if (!live_p2m_frame_list_list) {
-        ERR("Couldn't map p2m_frame_list_list (errno %d)", errno);
+        ERROR("Couldn't map p2m_frame_list_list (errno %d)", errno);
         goto out;
     }
 
@@ -678,7 +678,7 @@ int xc_linux_save(int xc_handle, int io_
                              P2M_FLL_ENTRIES);
 
     if (!live_p2m_frame_list) {
-        ERR("Couldn't map p2m_frame_list");
+        ERROR("Couldn't map p2m_frame_list");
         goto out;
     }
 
@@ -692,20 +692,20 @@ int xc_linux_save(int xc_handle, int io_
                                     P2M_FL_ENTRIES);
 
     if (!live_p2m) {
-        ERR("Couldn't map p2m table");
+        ERROR("Couldn't map p2m table");
         goto out;
     }
 
     /* Setup the mfn_to_pfn table mapping */
     if(!(live_m2p = xc_map_m2p(xc_handle, max_mfn, PROT_READ))) {
-        ERR("Failed to map live M2P table");
+        ERROR("Failed to map live M2P table");
         goto out;
     }
 
 
     /* Get a local copy of the live_P2M_frame_list */
     if(!(p2m_frame_list = malloc(P2M_FL_SIZE))) {
-        ERR("Couldn't allocate p2m_frame_list array");
+        ERROR("Couldn't allocate p2m_frame_list array");
         goto out;
     }
     memcpy(p2m_frame_list, live_p2m_frame_list, P2M_FL_SIZE);
@@ -713,8 +713,8 @@ int xc_linux_save(int xc_handle, int io_
     /* Canonicalise the pfn-to-mfn table frame-number list. */
     for (i = 0; i < max_pfn; i += fpp) {
         if (!translate_mfn_to_pfn(&p2m_frame_list[i/fpp])) {
-            ERR("Frame# in pfn-to-mfn frame list is not in pseudophys");
-            ERR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp,
+            ERROR("Frame# in pfn-to-mfn frame list is not in pseudophys");
+            ERROR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp,
                 (uint64_t)p2m_frame_list[i/fpp]);
             goto out;
         }
@@ -726,7 +726,7 @@ int xc_linux_save(int xc_handle, int io_
         if (xc_shadow_control(xc_handle, dom,
                               XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
                               NULL, 0, NULL, 0, NULL) < 0) {
-            ERR("Couldn't enable shadow mode");
+            ERROR("Couldn't enable shadow mode");
             goto out;
         }
 
@@ -740,7 +740,7 @@ int xc_linux_save(int xc_handle, int io_
         last_iter = 1;
 
         if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info, &ctxt)) {
-            ERR("Domain appears not to have suspended");
+            ERROR("Domain appears not to have suspended");
             goto out;
         }
 
@@ -761,20 +761,20 @@ int xc_linux_save(int xc_handle, int io_
     to_skip = malloc(BITMAP_SIZE);
 
     if (!to_send || !to_fix || !to_skip) {
-        ERR("Couldn't allocate to_send array");
+        ERROR("Couldn't allocate to_send array");
         goto out;
     }
 
     memset(to_send, 0xff, BITMAP_SIZE);
 
     if (mlock(to_send, BITMAP_SIZE)) {
-        ERR("Unable to mlock to_send");
+        ERROR("Unable to mlock to_send");
         return 1;
     }
 
     /* (to fix is local only) */
     if (mlock(to_skip, BITMAP_SIZE)) {
-        ERR("Unable to mlock to_skip");
+        ERROR("Unable to mlock to_skip");
         return 1;
     }
 
@@ -785,13 +785,13 @@ int xc_linux_save(int xc_handle, int io_
     pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
 
     if ((pfn_type == NULL) || (pfn_batch == NULL)) {
-        ERR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
+        ERROR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
         errno = ENOMEM;
         goto out;
     }
 
     if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
-        ERR("Unable to mlock");
+        ERROR("Unable to mlock");
         goto out;
     }
 
@@ -817,7 +817,7 @@ int xc_linux_save(int xc_handle, int io_
     /* Start writing out the saved-domain record. */
 
     if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
-        ERR("write: max_pfn");
+        ERROR("write: max_pfn");
         goto out;
     }
 
@@ -837,13 +837,13 @@ int xc_linux_save(int xc_handle, int io_
             !write_exact(io_fd, &chunk_sig, 4) ||
             !write_exact(io_fd, &chunk_sz,  sizeof(chunk_sz)) ||
             !write_exact(io_fd, &ctxt,      sizeof(ctxt))) {
-            ERR("write: extended info");
+            ERROR("write: extended info");
             goto out;
         }
     }
 
     if (!write_exact(io_fd, p2m_frame_list, P2M_FL_SIZE)) {
-        ERR("write: p2m_frame_list");
+        ERROR("write: p2m_frame_list");
         goto out;
     }
 
@@ -877,7 +877,7 @@ int xc_linux_save(int xc_handle, int io_
             if (!last_iter && xc_shadow_control(
                     xc_handle, dom, XEN_DOMCTL_SHADOW_OP_PEEK,
                     to_skip, max_pfn, NULL, 0, NULL) != max_pfn) {
-                ERR("Error peeking shadow bitmap");
+                ERROR("Error peeking shadow bitmap");
                 goto out;
             }
 
@@ -942,12 +942,12 @@ int xc_linux_save(int xc_handle, int io_
 
             if ((region_base = xc_map_foreign_batch(
                      xc_handle, dom, PROT_READ, pfn_type, batch)) == 0) {
-                ERR("map batch failed");
+                ERROR("map batch failed");
                 goto out;
             }
 
             if (xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type)) {
-                ERR("get_pfn_type_batch failed");
+                ERROR("get_pfn_type_batch failed");
                 goto out;
             }
 
@@ -978,12 +978,12 @@ int xc_linux_save(int xc_handle, int io_
             }
 
             if(!write_exact(io_fd, &batch, sizeof(unsigned int))) {
-                ERR("Error when writing to state file (2)");
+                ERROR("Error when writing to state file (2)");
                 goto out;
             }
 
             if(!write_exact(io_fd, pfn_type, sizeof(unsigned long)*j)) {
-                ERR("Error when writing to state file (3)");
+                ERROR("Error when writing to state file (3)");
                 goto out;
             }
 
@@ -1013,7 +1013,7 @@ int xc_linux_save(int xc_handle, int io_
                         goto out; 
 
                     if (ratewrite(io_fd, page, PAGE_SIZE) != PAGE_SIZE) {
-                        ERR("Error when writing to state file (4)");
+                        ERROR("Error when writing to state file (4)");
                         goto out;
                     }
 
@@ -1021,7 +1021,7 @@ int xc_linux_save(int xc_handle, int io_
 
                     /* We have a normal page: just write it directly. */
                     if (ratewrite(io_fd, spage, PAGE_SIZE) != PAGE_SIZE) {
-                        ERR("Error when writing to state file (5)");
+                        ERROR("Error when writing to state file (5)");
                         goto out;
                     }
                 }
@@ -1056,7 +1056,7 @@ int xc_linux_save(int xc_handle, int io_
 
             /* send "-1" to put receiver into debug mode */
             if(!write_exact(io_fd, &minusone, sizeof(int))) {
-                ERR("Error when writing to state file (6)");
+                ERROR("Error when writing to state file (6)");
                 goto out;
             }
 
@@ -1079,7 +1079,7 @@ int xc_linux_save(int xc_handle, int io_
 
                 if (suspend_and_state(suspend, xc_handle, io_fd, dom, &info,
                                       &ctxt)) {
-                    ERR("Domain appears not to have suspended");
+                    ERROR("Domain appears not to have suspended");
                     goto out;
                 }
 
@@ -1092,7 +1092,7 @@ int xc_linux_save(int xc_handle, int io_
             if (xc_shadow_control(xc_handle, dom, 
                                   XEN_DOMCTL_SHADOW_OP_CLEAN, to_send, 
                                   max_pfn, NULL, 0, &stats) != max_pfn) {
-                ERR("Error flushing shadow PT");
+                ERROR("Error flushing shadow PT");
                 goto out;
             }
 
@@ -1110,7 +1110,7 @@ int xc_linux_save(int xc_handle, int io_
     /* Zero terminate */
     i = 0;
     if (!write_exact(io_fd, &i, sizeof(int))) {
-        ERR("Error when writing to state file (6)");
+        ERROR("Error when writing to state file (6)");
         goto out;
     }
 
@@ -1125,7 +1125,7 @@ int xc_linux_save(int xc_handle, int io_
         }
 
         if(!write_exact(io_fd, &j, sizeof(unsigned int))) {
-            ERR("Error when writing to state file (6a)");
+            ERROR("Error when writing to state file (6a)");
             goto out;
         }
 
@@ -1137,7 +1137,7 @@ int xc_linux_save(int xc_handle, int io_
             i++;
             if (j == 1024 || i == max_pfn) {
                 if(!write_exact(io_fd, &pfntab, sizeof(unsigned long)*j)) {
-                    ERR("Error when writing to state file (6b)");
+                    ERROR("Error when writing to state file (6b)");
                     goto out;
                 }
                 j = 0;
@@ -1148,21 +1148,21 @@ int xc_linux_save(int xc_handle, int io_
 
     /* Canonicalise the suspend-record frame number. */
     if ( !translate_mfn_to_pfn(&ctxt.user_regs.edx) ){
-        ERR("Suspend record is not in range of pseudophys map");
+        ERROR("Suspend record is not in range of pseudophys map");
         goto out;
     }
 
     /* Canonicalise each GDT frame number. */
     for ( i = 0; i < ctxt.gdt_ents; i += 512 ) {
         if ( !translate_mfn_to_pfn(&ctxt.gdt_frames[i]) ) {
-            ERR("GDT frame is not in range of pseudophys map");
+            ERROR("GDT frame is not in range of pseudophys map");
             goto out;
         }
     }
 
     /* Canonicalise the page table base pointer. */
     if ( !MFN_IS_IN_PSEUDOPHYS_MAP(xen_cr3_to_pfn(ctxt.ctrlreg[3])) ) {
-        ERR("PT base is not in range of pseudophys map");
+        ERROR("PT base is not in range of pseudophys map");
         goto out;
     }
     ctxt.ctrlreg[3] = 
@@ -1170,7 +1170,7 @@ int xc_linux_save(int xc_handle, int io_
 
     if (!write_exact(io_fd, &ctxt, sizeof(ctxt)) ||
         !write_exact(io_fd, live_shinfo, PAGE_SIZE)) {
-        ERR("Error when writing to state file (1)");
+        ERROR("Error when writing to state file (1)");
         goto out;
     }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xc_private.h  Tue Oct 17 16:44:57 2006 -0400
@@ -30,9 +30,10 @@
 #define DECLARE_SYSCTL struct xen_sysctl sysctl
 #endif
 
-#ifndef PAGE_SHIFT
+#undef PAGE_SHIFT
+#undef PAGE_SIZE
+#undef PAGE_MASK
 #define PAGE_SHIFT              XC_PAGE_SHIFT
-#endif
 #ifndef PAGE_SIZE
 #define PAGE_SIZE               (1UL << PAGE_SHIFT)
 #endif
@@ -59,11 +60,6 @@
 #else
 #define PPRINTF(_f, _a...)
 #endif
-
-#define ERR(_f, _a...) do {                     \
-    DPRINTF(_f ": %d\n" , ## _a, errno);        \
-    fflush(stderr); }                           \
-while (0)
 
 #define ERROR(_m, _a...)                        \
 do {                                            \
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xc_ptrace.c   Tue Oct 17 16:44:57 2006 -0400
@@ -1,5 +1,3 @@
-#define XC_PTRACE_PRIVATE
-
 #include <sys/ptrace.h>
 #include <sys/wait.h>
 #include <time.h>
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_ptrace.h
--- a/tools/libxc/xc_ptrace.h   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xc_ptrace.h   Tue Oct 17 16:44:57 2006 -0400
@@ -1,9 +1,6 @@
 #ifndef XC_PTRACE_
 #define XC_PTRACE_
 
-#include <thread_db.h>
-
-#ifdef XC_PTRACE_PRIVATE
 #define X86_CR0_PE              0x00000001 /* Enable Protected Mode    (RW) */
 #define X86_CR0_PG              0x80000000 /* Paging                   (RW) */
 #define BSD_PAGE_MASK (PAGE_SIZE-1)
@@ -160,25 +157,4 @@ struct gdb_regs {
 }
 #endif
 
-#endif
-
-typedef void (*thr_ev_handler_t)(long);
-
-void xc_register_event_handler(
-    thr_ev_handler_t h,
-    td_event_e e);
-
-long xc_ptrace(
-    int xc_handle,
-    enum __ptrace_request request,
-    uint32_t  domid,
-    long addr,
-    long data);
-
-int xc_waitdomain(
-    int xc_handle,
-    int domain,
-    int *status,
-    int options);
-
 #endif /* XC_PTRACE */
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_ptrace_core.c
--- a/tools/libxc/xc_ptrace_core.c      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xc_ptrace_core.c      Tue Oct 17 16:44:57 2006 -0400
@@ -1,5 +1,3 @@
-#define XC_PTRACE_PRIVATE
-
 #include <sys/ptrace.h>
 #include <sys/wait.h>
 #include "xc_private.h"
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xenctrl.h     Tue Oct 17 16:44:57 2006 -0400
@@ -16,7 +16,6 @@
 
 #include <stddef.h>
 #include <stdint.h>
-#include <sys/ptrace.h>
 #include <xen/xen.h>
 #include <xen/domctl.h>
 #include <xen/sysctl.h>
@@ -105,6 +104,11 @@ int xc_find_device_number(const char *na
  * DOMAIN DEBUGGING FUNCTIONS
  */
 
+#ifdef __linux__
+
+#include <sys/ptrace.h>
+#include <thread_db.h>
+
 typedef struct xc_core_header {
     unsigned int xch_magic;
     unsigned int xch_nr_vcpus;
@@ -116,24 +120,39 @@ typedef struct xc_core_header {
 
 #define XC_CORE_MAGIC 0xF00FEBED
 
-long xc_ptrace_core(
-    int xc_handle,
-    enum __ptrace_request request,
-    uint32_t domid,
-    long addr,
-    long data,
-    vcpu_guest_context_t *ctxt);
 void * map_domain_va_core(
     unsigned long domfd,
     int cpu,
     void *guest_va,
     vcpu_guest_context_t *ctxt);
+
 int xc_waitdomain_core(
     int xc_handle,
     int domain,
     int *status,
     int options,
     vcpu_guest_context_t *ctxt);
+
+typedef void (*thr_ev_handler_t)(long);
+
+void xc_register_event_handler(
+    thr_ev_handler_t h,
+    td_event_e e);
+
+long xc_ptrace(
+    int xc_handle,
+    enum __ptrace_request request,
+    uint32_t  domid,
+    long addr,
+    long data);
+
+int xc_waitdomain(
+    int xc_handle,
+    int domain,
+    int *status,
+    int options);
+
+#endif /* __linux__ */
 
 /*
  * DOMAIN MANAGEMENT FUNCTIONS
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xg_private.c  Tue Oct 17 16:44:57 2006 -0400
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <zlib.h>
+#include <strings.h>
 
 #include "xg_private.h"
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/libxc/xg_private.h  Tue Oct 17 16:44:57 2006 -0400
@@ -79,10 +79,6 @@ unsigned long csum_page (void * page);
 #define L4_PAGETABLE_ENTRIES    512
 #endif
 
-#define PAGE_SHIFT              XC_PAGE_SHIFT
-#define PAGE_SIZE               (1UL << PAGE_SHIFT)
-#define PAGE_MASK               (~(PAGE_SIZE-1))
-
 typedef uint32_t l1_pgentry_32_t;
 typedef uint32_t l2_pgentry_32_t;
 typedef uint64_t l1_pgentry_64_t;
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/Makefile
--- a/tools/misc/Makefile       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/misc/Makefile       Tue Oct 17 16:44:57 2006 -0400
@@ -1,7 +1,3 @@ INSTALL         = install
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
-
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
@@ -24,9 +20,6 @@ all: build
 .PHONY: build
 build: $(TARGETS)
        $(MAKE) -C miniterm
-ifeq ($(CONFIG_MBOOTPACK),y)
-       $(MAKE) -C mbootpack
-endif
        $(MAKE) -C lomount
 
 .PHONY: install
@@ -38,14 +31,11 @@ install: build
        $(MAKE) -C lomount install
 #       No sense in installing miniterm on the Xen box.
 #      $(MAKE) -C miniterm install
-#       Likewise mbootpack
-#      $(MAKE) -C mbootpack install
 
 .PHONY: clean
 clean:
        $(RM) *.o $(TARGETS) *~
        $(MAKE) -C miniterm clean
-       $(MAKE) -C mbootpack clean
        $(MAKE) -C lomount clean
 
 %.o: %.c $(HDRS) Makefile
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/lomount/Makefile
--- a/tools/misc/lomount/Makefile       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/misc/lomount/Makefile       Tue Oct 17 16:44:57 2006 -0400
@@ -1,8 +1,3 @@ INSTALL         = install
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
-INSTALL_DATA   = $(INSTALL) -m0644
-
 XEN_ROOT=../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/miniterm/Makefile
--- a/tools/misc/miniterm/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/misc/miniterm/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -1,9 +1,5 @@ XEN_ROOT:=../../..
 XEN_ROOT:=../../..
 include $(XEN_ROOT)/tools/Rules.mk
-
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
 
 TARGET = miniterm
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/xend
--- a/tools/misc/xend   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/misc/xend   Tue Oct 17 16:44:57 2006 -0400
@@ -19,6 +19,9 @@
 
    The daemon should reconnect to device control interfaces
    and recover its state when restarted.
+
+   On Solaris, the daemons are SMF managed, and you should not attempt
+   to start xend by hand.
 """
 import os
 import os.path
@@ -108,9 +111,10 @@ def main():
     if not sys.argv[1:]:
         print 'usage: %s {start|stop|restart}' % sys.argv[0]
     elif sys.argv[1] == 'start':
-        start_xenstored()
-        start_consoled()
-       start_blktapctrl()
+        if os.uname()[0] != "SunOS":
+            start_xenstored()
+            start_consoled()
+            start_blktapctrl()
         return daemon.start()
     elif sys.argv[1] == 'trace_start':
         start_xenstored()
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/python/xen/util/auxbin.py
--- a/tools/python/xen/util/auxbin.py   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/python/xen/util/auxbin.py   Tue Oct 17 16:44:57 2006 -0400
@@ -21,7 +21,7 @@ LIB_BIN_SUFFIX = "xen/bin"
 LIB_BIN_SUFFIX = "xen/bin"
 
 ## The architectures on which the LIB_64 directory is used.  This
-# deliberately excludes ia64 and ppc64.
+# deliberately excludes ia64 and ppc64, and Solaris.
 LIB_64_ARCHS = [ 'x86_64', 's390x', 'sparc64']
 
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/python/xen/xend/XendRoot.py
--- a/tools/python/xen/xend/XendRoot.py Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/python/xen/xend/XendRoot.py Tue Oct 17 16:44:57 2006 -0400
@@ -30,6 +30,7 @@ import string
 import string
 import sys
 
+import osdep
 import XendLogging
 from XendError import XendError
 
@@ -46,10 +47,10 @@ class XendRoot:
     config_var     = "XEND_CONFIG"
 
     """Where network control scripts live."""
-    network_script_dir = "/etc/xen/scripts"
+    network_script_dir = osdep.scripts_dir
 
     """Where block control scripts live."""
-    block_script_dir = "/etc/xen/scripts"
+    block_script_dir = osdep.scripts_dir
 
     """Default path to the log file. """
     logfile_default = "/var/log/xen/xend.log"
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/python/xen/xend/arch.py
--- a/tools/python/xen/xend/arch.py     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/python/xen/xend/arch.py     Tue Oct 17 16:44:57 2006 -0400
@@ -25,6 +25,7 @@ _types = {
     "i586": "x86",
     "i686": "x86",
     "x86_64": "x86",
+    "i86pc": "x86",
     "ia64": "ia64",
     "ppc": "powerpc",
     "ppc64": "powerpc",
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/python/xen/xend/image.py    Tue Oct 17 16:44:57 2006 -0400
@@ -320,6 +320,11 @@ class HVMImageHandler(ImageHandler):
                 if v:
                     ret.append("-%s" % a)
                     ret.append("%s" % v)
+
+            if a in ['fda', 'fdb' ]:
+                if v:
+                    if not os.path.isfile(v):
+                        raise VmError("Floppy file %s does not exist." % v)
             log.debug("args: %s, val: %s" % (a,v))
 
         # Handle disk/network related options
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/python/xen/xend/server/SrvDaemon.py Tue Oct 17 16:44:57 2006 -0400
@@ -17,6 +17,7 @@ import xen.lowlevel.xc
 import xen.lowlevel.xc
 
 from xen.xend.XendLogging import log
+from xen.xend import osdep
 
 import relocate
 import SrvServer
@@ -168,8 +169,14 @@ class Daemon:
             # ready to receive requests.  All subsequent restarts we don't
             # want this behaviour, or the pipe will eventually fill up, so
             # we just pass None into run in subsequent cases (by clearing w
-            # in the parent of the first fork).
+            # in the parent of the first fork).  On some operating systems,
+            # restart is managed externally, so we won't fork, and just exit.
             while True:
+
+                if not osdep.xend_autorestart:
+                    self.run(os.fdopen(w, 'w'))
+                    break
+
                 pid = self.fork_pid()
                 if pid:
                     if w is not None:
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vnet/doc/Makefile
--- a/tools/vnet/doc/Makefile   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vnet/doc/Makefile   Tue Oct 17 16:44:57 2006 -0400
@@ -1,11 +1,10 @@
 #!/usr/bin/make -f
 # -*- mode: Makefile; -*-
+XEN_ROOT        = ../../..
+include $(XEN_ROOT)/tools/Rules.mk
 
 VERSION = 1.0
 HEADER  = Vnet
-
-INSTALL                = install
-INSTALL_DIR    = $(INSTALL) -d -m0755
 
 PS2PDF         := ps2pdf
 DVIPS          := dvips
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vnet/examples/Makefile
--- a/tools/vnet/examples/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vnet/examples/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -1,9 +1,7 @@
 # -*- mode: Makefile; -*-
 #============================================================================
-
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
+XEN_ROOT        = ../../..
+include $(XEN_ROOT)/tools/Rules.mk
 
 XEN_SCRIPT_DIR  = $(DESTDIR)/etc/xen/scripts
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vnet/libxutil/Makefile
--- a/tools/vnet/libxutil/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vnet/libxutil/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -2,11 +2,6 @@ export VNET_ROOT = $(shell cd .. && pwd)
 export VNET_ROOT = $(shell cd .. && pwd)
 include $(VNET_ROOT)/Make.env
 endif
-
-INSTALL                = install
-INSTALL_DATA   = $(INSTALL) -m0644
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
 
 include $(XEN_ROOT)/tools/Rules.mk
 
@@ -60,7 +55,7 @@ libxutil.so.$(MAJOR): libxutil.so.$(MAJO
        ln -sf $^ $@
 
 libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-       $(CC) $(CFLAGS) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
+       $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxutil.so.$(MAJOR) 
$(SHLIB_CFLAGS) -o $@ $^
 
 libxutil.a: $(LIB_OBJS)
        $(AR) rc $@ $^
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vnet/scripts/Makefile
--- a/tools/vnet/scripts/Makefile       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vnet/scripts/Makefile       Tue Oct 17 16:44:57 2006 -0400
@@ -1,9 +1,7 @@
 # -*- mode: Makefile; -*-
 #============================================================================
-
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
+XEN_ROOT        = ../../..
+include $(XEN_ROOT)/tools/Rules.mk
 
 SBIN_DIR        = $(DESTDIR)/usr/sbin
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vnet/vnetd/Makefile
--- a/tools/vnet/vnetd/Makefile Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vnet/vnetd/Makefile Tue Oct 17 16:44:57 2006 -0400
@@ -110,7 +110,7 @@ vnetd: $(VNETD_OBJ)
 .PHONY: install
 install: vnetd
        mkdir -p $(DESTDIR)$(VNETD_INSTALL_DIR)
-       install -m 0755 vnetd $(DESTDIR)$(VNETD_INSTALL_DIR)
+       $(INSTALL_PROG) vnetd $(DESTDIR)$(VNETD_INSTALL_DIR)
 
 .PHONY: clean
 clean:
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vtpm/Rules.mk
--- a/tools/vtpm/Rules.mk       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vtpm/Rules.mk       Tue Oct 17 16:44:57 2006 -0400
@@ -4,11 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 #
 # Tool definitions
 #
-
-# Installation program and options
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 # Xen tools installation directory
 TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/vtpm_manager/Rules.mk
--- a/tools/vtpm_manager/Rules.mk       Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/vtpm_manager/Rules.mk       Tue Oct 17 16:44:57 2006 -0400
@@ -4,11 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 #
 # Tool definitions
 #
-
-# Installation program and options
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 # Xen tools installation directory
 TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xcutils/Makefile
--- a/tools/xcutils/Makefile    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xcutils/Makefile    Tue Oct 17 16:44:57 2006 -0400
@@ -7,10 +7,6 @@
 #
 # Copyright (C) 2005 by Christian Limpach
 #
-
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
 
 XEN_ROOT       = ../..
 include $(XEN_ROOT)/tools/Rules.mk
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xcutils/readnotes.c
--- a/tools/xcutils/readnotes.c Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xcutils/readnotes.c Tue Oct 17 16:44:57 2006 -0400
@@ -56,7 +56,8 @@ static void print_numeric_note(const cha
                       prefix, *(uint64_t *)ELFNOTE_DESC(note));
                break;
        default:
-               printf("%s: unknown data size %#x\n", prefix, note->n_descsz);
+               printf("%s: unknown data size %#lx\n", prefix,
+                      (unsigned long)note->n_descsz);
                break;
        }
 }
@@ -301,7 +302,8 @@ int main(int argc, char **argv)
                                print_string_note("FEATURES", note);
                                break;
                        default:
-                               printf("unknown note type %#x\n", note->n_type);
+                               printf("unknown note type %#lx\n",
+                                      (unsigned long)note->n_type);
                                break;
                        }
                }
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenmon/Makefile
--- a/tools/xenmon/Makefile     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenmon/Makefile     Tue Oct 17 16:44:57 2006 -0400
@@ -10,15 +10,10 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
-INSTALL_DATA    = $(INSTALL) -m0644
+XEN_ROOT=../..
+include $(XEN_ROOT)/tools/Rules.mk
 
 sbindir=/usr/sbin
-
-XEN_ROOT=../..
-include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror -g
 CFLAGS  += -I $(XEN_XC)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstat/libxenstat/Makefile Tue Oct 17 16:44:57 2006 -0400
@@ -16,10 +16,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 include $(XEN_ROOT)/tools/Rules.mk
 LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
 
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755 -D
-INSTALL_DATA    = $(INSTALL) -m0644 -D
-
 prefix=/usr
 includedir=$(prefix)/include
 libdir=$(prefix)/lib
@@ -34,7 +30,7 @@ SHLIB=src/libxenstat.so.$(MAJOR).$(MINOR
 SHLIB=src/libxenstat.so.$(MAJOR).$(MINOR)
 SHLIB_LINKS=src/libxenstat.so.$(MAJOR) src/libxenstat.so
 OBJECTS=src/xenstat.o
-SONAME_FLAGS=-Wl,-soname -Wl,libxenstat.so.$(MAJOR)
+SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
 
 WARN_FLAGS=-Wall -Werror
 
@@ -49,7 +45,7 @@ all: $(LIB)
        $(RANLIB) $@
 
 $(SHLIB): $(OBJECTS)
-       $(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) -shared -o $@ $(OBJECTS) \
+       $(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_CFLAGS) -o $@ 
$(OBJECTS) \
                -lxenstore -lxenctrl
 
 src/xenstat.o: src/xenstat.c src/xenstat.h
@@ -101,7 +97,7 @@ PYTHON_FLAGS=-I/usr/include/python$(PYTH
        swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
 
 $(PYLIB): $(PYSRC)
-       $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) -shared -lxenstat -o $@ $<
+       $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_CFLAGS) -lxenstat -o 
$@ $<
 
 python-bindings: $(PYLIB) $(PYMOD)
 
@@ -122,7 +118,7 @@ PERL_FLAGS=`perl -MConfig -e 'print "$$C
        swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
 
 $(PERLLIB): $(PERLSRC)
-       $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) -shared -lxenstat -o $@ $<
+       $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_CFLAGS) -lxenstat -o 
$@ $<
 
 .PHONY: perl-bindings
 perl-bindings: $(PERLLIB) $(PERLMOD)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstat/xentop/Makefile
--- a/tools/xenstat/xentop/Makefile     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstat/xentop/Makefile     Tue Oct 17 16:44:57 2006 -0400
@@ -18,10 +18,6 @@ all install xentop:
 all install xentop:
 else
 
-INSTALL         = install
-INSTALL_PROG    = $(INSTALL) -m0755 -D
-INSTALL_DATA    = $(INSTALL) -m0644 -D
-
 prefix=/usr
 mandir=$(prefix)/share/man
 man1dir=$(mandir)/man1
@@ -29,7 +25,7 @@ sbindir=$(prefix)/sbin
 
 CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT)
 LDFLAGS += -L$(XEN_LIBXENSTAT)
-LDLIBS += -lxenstat -lncurses
+LDLIBS += -lxenstat $(CURSES_LIBS) $(SOCKET_LIBS)
 
 .PHONY: all
 all: xentop
@@ -37,6 +33,7 @@ all: xentop
 .PHONY: install
 install: xentop xentop.1
        $(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
+       $(INSTALL_DIR) $(DESTDIR)$(man1dir)
        $(INSTALL_DATA) xentop.1 $(DESTDIR)$(man1dir)/xentop.1
 
 endif
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstat/xentop/xentop.c     Tue Oct 17 16:44:57 2006 -0400
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #include <string.h>
 #include <sys/time.h>
 #include <time.h>
@@ -186,6 +187,8 @@ int prompt_val_len = 0;
 int prompt_val_len = 0;
 void (*prompt_complete_func)(char *);
 
+static WINDOW *cwin;
+
 /*
  * Function definitions
  */
@@ -222,7 +225,7 @@ static void version(void)
 /* Clean up any open resources */
 static void cleanup(void)
 {
-       if(!isendwin())
+       if(cwin != NULL && !isendwin())
                endwin();
        if(prev_node != NULL)
                xenstat_free_node(prev_node);
@@ -235,7 +238,7 @@ static void cleanup(void)
 /* Display the given message and gracefully exit */
 static void fail(const char *str)
 {
-       if(!isendwin())
+       if(cwin != NULL && !isendwin())
                endwin();
        fprintf(stderr, str);
        exit(1);
@@ -266,7 +269,7 @@ static void print(const char *fmt, ...)
        if (!batch) {
                if((current_row() < lines()-1)) {
                        va_start(args, fmt);
-                       vw_printw(stdscr, fmt, args);
+                       vwprintw(stdscr, (char *)fmt, args);
                        va_end(args);
                }
        } else {
@@ -280,7 +283,7 @@ static void attr_addstr(int attr, const 
 static void attr_addstr(int attr, const char *str)
 {
        attron(attr);
-       addstr(str);
+       addstr((char *)str);
        attroff(attr);
 }
 
@@ -1028,14 +1031,16 @@ int main(int argc, char **argv)
 
        if (!batch) {
                /* Begin curses stuff */
-               initscr();
+               cwin = initscr();
                start_color();
                cbreak();
                noecho();
                nonl();
                keypad(stdscr, TRUE);
                halfdelay(5);
+#ifndef __sun__
                use_default_colors();
+#endif
                init_pair(1, -1, COLOR_YELLOW);
 
                do {
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/Makefile   Tue Oct 17 16:44:57 2006 -0400
@@ -4,11 +4,6 @@ XEN_LIBXC          = $(XEN_ROOT)/tools/l
 
 MAJOR = 3.0
 MINOR = 0
-
-INSTALL         = install
-INSTALL_DATA   = $(INSTALL) -m0644
-INSTALL_PROG    = $(INSTALL) -m0755
-INSTALL_DIR     = $(INSTALL) -d -m0755
 
 PROFILE=#-pg
 BASECFLAGS=-Wall -g -Werror
@@ -32,9 +27,10 @@ CLIENTS_OBJS := $(patsubst xenstore-%,xe
 
 XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o 
xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_Linux = xenstored_linux.o
+XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o
+XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o
 
-XENSTORED_OBJS += $(XENSTORED_$(OS))
+XENSTORED_OBJS += $(XENSTORED_OBJS_y)
 
 .PHONY: all
 all: libxenstore.so libxenstore.a xenstored $(CLIENTS) xs_tdb_dump 
xenstore-control xenstore-ls
@@ -46,19 +42,19 @@ testcode: xs_test xenstored_test xs_rand
 testcode: xs_test xenstored_test xs_random
 
 xenstored: $(XENSTORED_OBJS)
-       $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
+       $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl $(SOCKET_LIBS) -o $@
 
 $(CLIENTS): xenstore-%: xenstore_%.o libxenstore.so
-       $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
+       $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore $(SOCKET_LIBS) -o $@
 
 $(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
        $(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
 
 xenstore-control: xenstore_control.o libxenstore.so
-       $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
+       $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore $(SOCKET_LIBS) -o $@
 
 xenstore-ls: xsls.o libxenstore.so
-       $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
+       $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore $(SOCKET_LIBS) -o $@
 
 xenstored_test: xenstored_core_test.o xenstored_watch_test.o 
xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o 
fake_libxc.o utils.o tdb.o
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
@@ -95,7 +91,7 @@ libxenstore.so.$(MAJOR): libxenstore.so.
        ln -sf $< $@
 
 libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
-       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so.$(MAJOR) 
-shared -o $@ $^ -lpthread
+       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxenstore.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ -lpthread
 
 libxenstore.a: xs.o xs_lib.o
        $(AR) rcs libxenstore.a $^
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xenstore_client.c  Tue Oct 17 16:44:57 2006 -0400
@@ -267,12 +267,13 @@ main(int argc, char **argv)
 main(int argc, char **argv)
 {
     struct xs_handle *xsh;
-    xs_transaction_t xth;
+    xs_transaction_t xth = XBT_NULL;
     int ret = 0, socket = 0;
     int prefix = 0;
     int tidy = 0;
     int upto = 0;
     int recurse = 0;
+    int transaction;
 
     while (1) {
        int c, index = 0;
@@ -339,18 +340,28 @@ main(int argc, char **argv)
     }
 #endif
 
+#if defined(CLIENT_read)
+    transaction = (argc - optind) > 1;
+#elif defined(CLIENT_write)
+    transaction = (argc - optind) > 2;
+#else
+    transaction = 1;
+#endif
+
     xsh = socket ? xs_daemon_open() : xs_domain_open();
     if (xsh == NULL)
        err(1, socket ? "xs_daemon_open" : "xs_domain_open");
 
   again:
-    xth = xs_transaction_start(xsh);
-    if (xth == XBT_NULL)
-       errx(1, "couldn't start transaction");
+    if (transaction) {
+       xth = xs_transaction_start(xsh);
+       if (xth == XBT_NULL)
+           errx(1, "couldn't start transaction");
+    }
 
     ret = perform(optind, argc, argv, xsh, xth, prefix, tidy, upto, recurse);
 
-    if (!xs_transaction_end(xsh, xth, ret)) {
+    if (transaction && !xs_transaction_end(xsh, xth, ret)) {
        if (ret == 0 && errno == EAGAIN) {
            output_pos = 0;
            goto again;
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xenstored_core.c   Tue Oct 17 16:44:57 2006 -0400
@@ -1688,7 +1688,7 @@ static void write_pidfile(const char *pi
        if (lockf(fd, F_TLOCK, 0) == -1)
                exit(0);
 
-       len = sprintf(buf, "%d\n", getpid());
+       len = sprintf(buf, "%ld\n", (long)getpid());
        if (write(fd, buf, len) != len)
                barf_perror("Writing pid file %s", pidfile);
 }
@@ -1901,7 +1901,7 @@ int main(int argc, char *argv[])
        restore_existing_connections();
 
        if (outputpid) {
-               printf("%i\n", getpid());
+               printf("%ld\n", (long)getpid());
                fflush(stdout);
        }
 
@@ -1923,6 +1923,9 @@ int main(int argc, char *argv[])
 
        /* Get ready to listen to the tools. */
        max = initialize_set(&inset, &outset, *sock, *ro_sock);
+
+       /* Tell the kernel we're up and running. */
+       xenbus_notify_running();
 
        /* Main loop. */
        /* FIXME: Rewrite so noone can starve. */
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xenstored_core.h   Tue Oct 17 16:44:57 2006 -0400
@@ -172,6 +172,9 @@ void *xenbus_map(void);
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
 
+/* Tell the kernel xenstored is running. */
+void xenbus_notify_running(void);
+
 #endif /* _XENSTORED_CORE_H */
 
 /*
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xenstored_linux.c
--- a/tools/xenstore/xenstored_linux.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xenstored_linux.c  Tue Oct 17 16:44:57 2006 -0400
@@ -67,3 +67,7 @@ void *xenbus_map(void)
 
        return addr;
 }
+
+void xenbus_notify_running(void)
+{
+}
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xenstored_transaction.c
--- a/tools/xenstore/xenstored_transaction.c    Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xenstored_transaction.c    Tue Oct 17 16:44:57 2006 -0400
@@ -133,7 +133,7 @@ void do_transaction_start(struct connect
                return;
        }
 
-       if (conn->transaction_started > quota_max_transaction) {
+       if (conn->id && conn->transaction_started > quota_max_transaction) {
                send_error(conn, ENOSPC);
                return;
        }
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xs_lib.c
--- a/tools/xenstore/xs_lib.c   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xs_lib.c   Tue Oct 17 16:44:57 2006 -0400
@@ -76,7 +76,14 @@ const char *xs_domain_dev(void)
 const char *xs_domain_dev(void)
 {
        char *s = getenv("XENSTORED_PATH");
-       return (s ? s : "/proc/xen/xenbus");
+       if (s)
+               return s;
+
+#ifdef __linux__
+       return "/proc/xen/xenbus";
+#else
+       return "/dev/xen/xenbus";
+#endif
 }
 
 /* Simple routines for writing to sockets, etc. */
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xsls.c
--- a/tools/xenstore/xsls.c     Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xenstore/xsls.c     Tue Oct 17 16:44:57 2006 -0400
@@ -6,6 +6,7 @@
 #include <getopt.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#include <termios.h>
 
 static int max_width = 80;
 static int desired_width = 60;
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xentrace/Makefile
--- a/tools/xentrace/Makefile   Fri Oct 13 11:00:32 2006 -0400
+++ b/tools/xentrace/Makefile   Tue Oct 17 16:44:57 2006 -0400
@@ -1,8 +1,3 @@ INSTALL         = install
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
-INSTALL_DATA   = $(INSTALL) -m0644
-
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/Makefile
--- a/xen/Makefile      Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/Makefile      Tue Oct 17 16:44:57 2006 -0400
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 3
 export XEN_SUBVERSION    = 0
-export XEN_EXTRAVERSION ?= -unstable
+export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/Rules.mk
--- a/xen/Rules.mk      Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/Rules.mk      Tue Oct 17 16:44:57 2006 -0400
@@ -24,9 +24,11 @@ override COMPILE_SUBARCH := $(XEN_COMPIL
 override COMPILE_SUBARCH := $(XEN_COMPILE_ARCH)
 override TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
 override COMPILE_ARCH    := $(shell echo $(XEN_COMPILE_ARCH) | \
-                              sed -e 's/\(x86\|powerpc\).*/\1/')
+                              sed -e 's/x86.*/x86/' \
+                                  -e 's/powerpc.*/powerpc/')
 override TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
-                              sed -e 's/\(x86\|powerpc\).*/\1/')
+                              sed -e 's/x86.*/x86/' \
+                                  -e 's/powerpc.*/powerpc/')
 
 TARGET := $(BASEDIR)/xen
 
@@ -34,10 +36,6 @@ HDRS += $(wildcard $(BASEDIR)/include/pu
 HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
 HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
 HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
-
-INSTALL      := install
-INSTALL_DATA := $(INSTALL) -m0644
-INSTALL_DIR  := $(INSTALL) -d -m0755
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/domain_build.c       Tue Oct 17 16:44:57 2006 -0400
@@ -401,11 +401,11 @@ int construct_dom0(struct domain *d,
            _p(dsi.v_start), _p(v_end));
     printk(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
 
-    if ( (v_end - dsi.v_start) > (nr_pages * PAGE_SIZE) )
+    if ( ((v_end - dsi.v_start)>>PAGE_SHIFT) > nr_pages )
     {
         printk("Initial guest OS requires too much space\n"
                "(%luMB is greater than %luMB limit)\n",
-               (v_end-dsi.v_start)>>20, (nr_pages<<PAGE_SHIFT)>>20);
+               (v_end-dsi.v_start)>>20, nr_pages>>(20-PAGE_SHIFT));
         return -ENOMEM;
     }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/hvm/hvm.c    Tue Oct 17 16:44:57 2006 -0400
@@ -653,15 +653,15 @@ int hvm_bringup_ap(int vcpuid, int tramp
     if ( rc != 0 )
     {
         DPRINTK("AP %d bringup failed in boot_vcpu %x.\n", vcpuid, rc);
-        return rc;
+        goto out;
     }
 
     if ( test_and_clear_bit(_VCPUF_down, &d->vcpu[vcpuid]->vcpu_flags) )
         vcpu_wake(d->vcpu[vcpuid]);
     DPRINTK("AP %d bringup suceeded.\n", vcpuid);
 
+ out:
     xfree(ctxt);
-
     return rc;
 }
 
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/hvm/i8259.c
--- a/xen/arch/x86/hvm/i8259.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/hvm/i8259.c  Tue Oct 17 16:44:57 2006 -0400
@@ -498,19 +498,19 @@ void pic_init(struct hvm_virpic *s, void
 
 static int intercept_pic_io(ioreq_t *p)
 {
-    struct hvm_virpic  *pic;
-    struct vcpu *v = current;
+    struct hvm_virpic *pic;
     uint32_t data;
     unsigned long flags;
-    
-    if ( p->size != 1 || p->count != 1) {
+
+    if ( p->size != 1 || p->count != 1 ) {
         printk("PIC_IO wrong access size %d!\n", (int)p->size);
         return 1;
     }
-    pic = &v->domain->arch.hvm_domain.vpic;
-    if ( p->dir == 0 ) {
-        if (p->pdata_valid) 
-            (void)hvm_copy_from_guest_virt(
+
+    pic = &current->domain->arch.hvm_domain.vpic;
+    if ( p->dir == IOREQ_WRITE ) {
+        if ( p->pdata_valid )
+            (void)hvm_copy_from_guest_phys(
                 &data, (unsigned long)p->u.pdata, p->size);
         else
             data = p->u.data;
@@ -524,10 +524,10 @@ static int intercept_pic_io(ioreq_t *p)
         data = pic_ioport_read(
             (void*)&pic->pics[p->addr>>7], (uint32_t) p->addr);
         spin_unlock_irqrestore(&pic->lock, flags);
-        if (p->pdata_valid) 
-            (void)hvm_copy_to_guest_virt(
+        if ( p->pdata_valid )
+            (void)hvm_copy_to_guest_phys(
                 (unsigned long)p->u.pdata, &data, p->size);
-        else 
+        else
             p->u.data = (u64)data;
     }
     return 1;
@@ -535,42 +535,41 @@ static int intercept_pic_io(ioreq_t *p)
 
 static int intercept_elcr_io(ioreq_t *p)
 {
-    struct hvm_virpic  *s;
-    struct vcpu *v = current;
+    struct hvm_virpic *s;
     uint32_t data;
     unsigned long flags;
-    
+
     if ( p->size != 1 || p->count != 1 ) {
         printk("PIC_IO wrong access size %d!\n", (int)p->size);
         return 1;
     }
 
-    s = &v->domain->arch.hvm_domain.vpic;
-    if ( p->dir == 0 ) {
-        if (p->pdata_valid) 
-            (void)hvm_copy_from_guest_virt(
+    s = &current->domain->arch.hvm_domain.vpic;
+    if ( p->dir == IOREQ_WRITE ) {
+        if ( p->pdata_valid )
+            (void)hvm_copy_from_guest_phys(
                 &data, (unsigned long)p->u.pdata, p->size);
         else
             data = p->u.data;
         spin_lock_irqsave(&s->lock, flags);
         elcr_ioport_write((void*)&s->pics[p->addr&1],
                 (uint32_t) p->addr, (uint32_t)( data & 0xff));
-        get_sp(current->domain)->sp_global.pic_elcr = 
+        get_sp(current->domain)->sp_global.pic_elcr =
             s->pics[0].elcr | ((u16)s->pics[1].elcr << 8);
         spin_unlock_irqrestore(&s->lock, flags);
     }
     else {
         data = (u64) elcr_ioport_read(
                 (void*)&s->pics[p->addr&1], (uint32_t) p->addr);
-        if (p->pdata_valid) 
-            (void)hvm_copy_to_guest_virt(
+        if ( p->pdata_valid )
+            (void)hvm_copy_to_guest_phys(
                 (unsigned long)p->u.pdata, &data, p->size);
-        else 
+        else
             p->u.data = (u64)data;
-
     }
     return 1;
 }
+
 void register_pic_io_hook (void)
 {
     register_portio_handler(0x20, 2, intercept_pic_io);
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/hvm/platform.c
--- a/xen/arch/x86/hvm/platform.c       Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/hvm/platform.c       Tue Oct 17 16:44:57 2006 -0400
@@ -730,13 +730,13 @@ void send_pio_req(struct cpu_user_regs *
     vcpu_iodata_t *vio;
     ioreq_t *p;
 
-    if (size == 0 || count == 0) {
+    if ( size == 0 || count == 0 ) {
         printf("null pio request? port %lx, count %lx, size %d, value %lx, dir 
%d, pvalid %d.\n",
                port, count, size, value, dir, pvalid);
     }
 
     vio = get_vio(v->domain, v->vcpu_id);
-    if (vio == NULL) {
+    if ( vio == NULL ) {
         printk("bad shared page: %lx\n", (unsigned long) vio);
         domain_crash_synchronous();
     }
@@ -745,6 +745,7 @@ void send_pio_req(struct cpu_user_regs *
     if ( p->state != STATE_INVALID )
         printk("WARNING: send pio with something already pending (%d)?\n",
                p->state);
+
     p->dir = dir;
     p->pdata_valid = pvalid;
 
@@ -752,19 +753,20 @@ void send_pio_req(struct cpu_user_regs *
     p->size = size;
     p->addr = port;
     p->count = count;
-    p->df = regs->eflags & EF_DF ? 1 : 0;
+    p->df = regs->eflags & X86_EFLAGS_DF ? 1 : 0;
 
     p->io_count++;
 
-    if (pvalid) {
-        if (hvm_paging_enabled(current))
-            p->u.data = shadow_gva_to_gpa(current, value);
+    if ( pvalid )   /* get physical address of data */
+    {
+        if ( hvm_paging_enabled(current) )
+            p->u.pdata = (void *)shadow_gva_to_gpa(current, value);
         else
-            p->u.pdata = (void *) value; /* guest VA == guest PA */
-    } else
+            p->u.pdata = (void *)value; /* guest VA == guest PA */
+    } else if ( dir == IOREQ_WRITE )
         p->u.data = value;
 
-    if (hvm_portio_intercept(p)) {
+    if ( hvm_portio_intercept(p) ) {
         p->state = STATE_IORESP_READY;
         hvm_io_assist(v);
         return;
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/hvm/svm/svm.c        Tue Oct 17 16:44:57 2006 -0400
@@ -840,7 +840,15 @@ int start_svm(void)
     
     if (!(test_bit(X86_FEATURE_SVME, &boot_cpu_data.x86_capability)))
         return 0;
-    
+
+    /* check whether SVM feature is disabled in BIOS */
+    rdmsr(MSR_K8_VM_CR, eax, edx);
+    if ( eax & K8_VMCR_SVME_DISABLE )
+    {
+        printk("AMD SVM Extension is disabled in BIOS.\n");
+        return 0;
+    }
+
     if (!(hsa[cpu] = alloc_host_save_area()))
         return 0;
     
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/i387.c
--- a/xen/arch/x86/i387.c       Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/i387.c       Tue Oct 17 16:44:57 2006 -0400
@@ -14,6 +14,7 @@
 #include <asm/processor.h>
 #include <asm/hvm/support.h>
 #include <asm/i387.h>
+#include <asm/asm_defns.h>
 
 void init_fpu(void)
 {
@@ -41,11 +42,11 @@ void save_init_fpu(struct vcpu *v)
 #else /* __x86_64__ */
         /*
          * The only way to force fxsaveq on a wide range of gas versions. On 
-         * older versions the rex64 prefix works only if we force an 
addressing 
-         * mode that doesn't require extended registers.
+         * older versions the rex64 prefix works only if we force an
+         * addressing mode that doesn't require extended registers.
          */
         __asm__ __volatile__ (
-            "rex64/fxsave (%1)"
+            REX64_PREFIX "fxsave (%1)"
             : "=m" (*fpu_ctxt) : "cdaSDb" (fpu_ctxt) );
 #endif
 
@@ -95,7 +96,7 @@ void restore_fpu(struct vcpu *v)
             "1: fxrstor %0            \n"
 #else /* __x86_64__ */
             /* See above for why the operands/constraints are this way. */
-            "1: rex64/fxrstor (%2)    \n"
+            "1: " REX64_PREFIX "fxrstor (%2)\n"
 #endif
             ".section .fixup,\"ax\"   \n"
             "2: push %%"__OP"ax       \n"
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/mm/shadow/common.c   Tue Oct 17 16:44:57 2006 -0400
@@ -2681,7 +2681,7 @@ int shadow_test_enable(struct domain *d)
     if ( shadow_mode_enabled(d) )
     {
         SHADOW_ERROR("Don't support enabling test mode"
-                      "on already shadowed doms\n");
+                      " on already shadowed doms\n");
         ret = -EINVAL;
         goto out;
     }
@@ -2754,7 +2754,7 @@ static int shadow_log_dirty_enable(struc
     if ( shadow_mode_enabled(d) )
     {
         SHADOW_ERROR("Don't (yet) support enabling log-dirty"
-                      "on already shadowed doms\n");
+                      " on already shadowed doms\n");
         ret = -EINVAL;
         goto out;
     }
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c    Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/mm/shadow/multi.c    Tue Oct 17 16:44:57 2006 -0400
@@ -1375,80 +1375,6 @@ static int shadow_set_l1e(struct vcpu *v
 
 
 /**************************************************************************/
-/* These functions take a vcpu and a virtual address, and return a pointer
- * to the appropriate level N entry from the shadow tables.  
- * If the necessary tables are not present in the shadow, they return NULL. */
-
-/* N.B. The use of GUEST_PAGING_LEVELS here is correct.  If the shadow has
- * more levels than the guest, the upper levels are always fixed and do not 
- * reflect any information from the guest, so we do not use these functions 
- * to access them. */
-
-#if GUEST_PAGING_LEVELS >= 4
-static shadow_l4e_t *
-shadow_get_l4e(struct vcpu *v, unsigned long va)
-{
-    /* Reading the top level table is always valid. */
-    return sh_linear_l4_table(v) + shadow_l4_linear_offset(va);
-}
-#endif /* GUEST_PAGING_LEVELS >= 4 */
-
-
-#if GUEST_PAGING_LEVELS >= 3
-static shadow_l3e_t *
-shadow_get_l3e(struct vcpu *v, unsigned long va)
-{
-#if GUEST_PAGING_LEVELS >= 4 /* 64bit... */
-    /* Get the l4 */
-    shadow_l4e_t *sl4e = shadow_get_l4e(v, va);
-    ASSERT(sl4e != NULL);
-    if ( !(shadow_l4e_get_flags(*sl4e) & _PAGE_PRESENT) )
-        return NULL;
-    ASSERT(valid_mfn(shadow_l4e_get_mfn(*sl4e)));
-    /* l4 was present; OK to get the l3 */
-    return sh_linear_l3_table(v) + shadow_l3_linear_offset(va);
-#else /* PAE... */
-    /* Top level is always mapped */
-    ASSERT(v->arch.shadow_vtable);
-    return ((shadow_l3e_t *)v->arch.shadow_vtable) + 
shadow_l3_linear_offset(va);
-#endif 
-}
-#endif /* GUEST_PAGING_LEVELS >= 3 */
-
-
-static shadow_l2e_t *
-shadow_get_l2e(struct vcpu *v, unsigned long va)
-{
-#if GUEST_PAGING_LEVELS >= 3  /* 64bit/PAE... */
-    /* Get the l3 */
-    shadow_l3e_t *sl3e = shadow_get_l3e(v, va);
-    if ( sl3e == NULL || !(shadow_l3e_get_flags(*sl3e) & _PAGE_PRESENT) )
-        return NULL;
-    ASSERT(valid_mfn(shadow_l3e_get_mfn(*sl3e)));
-    /* l3 was present; OK to get the l2 */
-#endif
-    return sh_linear_l2_table(v) + shadow_l2_linear_offset(va);
-}
-
-
-#if 0 // avoid the compiler warning for now...
-
-static shadow_l1e_t *
-shadow_get_l1e(struct vcpu *v, unsigned long va)
-{
-    /* Get the l2 */
-    shadow_l2e_t *sl2e = shadow_get_l2e(v, va);
-    if ( sl2e == NULL || !(shadow_l2e_get_flags(*sl2e) & _PAGE_PRESENT) )
-        return NULL;
-    ASSERT(valid_mfn(shadow_l2e_get_mfn(*sl2e)));
-    /* l2 was present; OK to get the l1 */
-    return sh_linear_l1_table(v) + shadow_l1_linear_offset(va);
-}
-
-#endif
-
-
-/**************************************************************************/
 /* Macros to walk pagetables.  These take the shadow of a pagetable and 
  * walk every "interesting" entry.  That is, they don't touch Xen mappings, 
  * and for 32-bit l2s shadowed onto PAE or 64-bit, they only touch every 
@@ -2050,6 +1976,12 @@ sh_make_monitor_table(struct vcpu *v)
  * they are needed.  The "demand" argument is non-zero when handling
  * a demand fault (so we know what to do about accessed bits &c).
  * If the necessary tables are not present in the guest, they return NULL. */
+
+/* N.B. The use of GUEST_PAGING_LEVELS here is correct.  If the shadow has
+ * more levels than the guest, the upper levels are always fixed and do not 
+ * reflect any information from the guest, so we do not use these functions 
+ * to access them. */
+
 #if GUEST_PAGING_LEVELS >= 4
 static shadow_l4e_t * shadow_get_and_create_l4e(struct vcpu *v, 
                                                 walk_t *gw, 
@@ -3223,26 +3155,62 @@ sh_invlpg(struct vcpu *v, unsigned long 
  * instruction should be issued on the hardware, or 0 if it's safe not
  * to do so. */
 {
-    shadow_l2e_t *ptr_sl2e = shadow_get_l2e(v, va);
-
-    // XXX -- might be a good thing to prefetch the va into the shadow
-
-    // no need to flush anything if there's no SL2...
-    //
-    if ( !ptr_sl2e )
+    shadow_l2e_t sl2e;
+    
+    perfc_incrc(shadow_invlpg);
+
+    /* First check that we can safely read the shadow l2e.  SMP/PAE linux can
+     * run as high as 6% of invlpg calls where we haven't shadowed the l2 
+     * yet. */
+#if SHADOW_PAGING_LEVELS == 4
+    {
+        shadow_l3e_t sl3e;
+        if ( !(shadow_l4e_get_flags(
+                   sh_linear_l4_table(v)[shadow_l4_linear_offset(va)])
+               & _PAGE_PRESENT) )
+            return 0;
+        /* This must still be a copy-from-user because we don't have the
+         * shadow lock, and the higher-level shadows might disappear
+         * under our feet. */
+        if ( __copy_from_user(&sl3e, (sh_linear_l3_table(v) 
+                                      + shadow_l3_linear_offset(va)),
+                              sizeof (sl3e)) != 0 )
+        {
+            perfc_incrc(shadow_invlpg_fault);
+            return 0;
+        }
+        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
+            return 0;
+    }
+#elif SHADOW_PAGING_LEVELS == 3
+    if ( !(shadow_l3e_get_flags(
+          ((shadow_l3e_t *)v->arch.shadow_vtable)[shadow_l3_linear_offset(va)])
+           & _PAGE_PRESENT) )
+        // no need to flush anything if there's no SL2...
         return 0;
+#endif
+
+    /* This must still be a copy-from-user because we don't have the shadow
+     * lock, and the higher-level shadows might disappear under our feet. */
+    if ( __copy_from_user(&sl2e, 
+                          sh_linear_l2_table(v) + shadow_l2_linear_offset(va),
+                          sizeof (sl2e)) != 0 )
+    {
+        perfc_incrc(shadow_invlpg_fault);
+        return 0;
+    }
 
     // If there's nothing shadowed for this particular sl2e, then
     // there is no need to do an invlpg, either...
     //
-    if ( !(shadow_l2e_get_flags(*ptr_sl2e) & _PAGE_PRESENT) )
+    if ( !(shadow_l2e_get_flags(sl2e) & _PAGE_PRESENT) )
         return 0;
 
     // Check to see if the SL2 is a splintered superpage...
     // If so, then we'll need to flush the entire TLB (because that's
     // easier than invalidating all of the individual 4K pages).
     //
-    if ( (mfn_to_page(shadow_l2e_get_mfn(*ptr_sl2e))->count_info &
+    if ( (mfn_to_page(shadow_l2e_get_mfn(sl2e))->count_info &
           PGC_SH_type_mask) == PGC_SH_fl1_shadow )
     {
         local_flush_tlb();
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/arch/x86/oprofile/xenoprof.c
--- a/xen/arch/x86/oprofile/xenoprof.c  Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/arch/x86/oprofile/xenoprof.c  Tue Oct 17 16:44:57 2006 -0400
@@ -12,6 +12,9 @@
 
 /* Limit amount of pages used for shared buffer (per domain) */
 #define MAX_OPROF_SHARED_PAGES 32
+
+/* Lock protecting the following global state */
+static spinlock_t xenoprof_lock = SPIN_LOCK_UNLOCKED;
 
 struct domain *active_domains[MAX_OPROF_DOMAINS];
 int active_ready[MAX_OPROF_DOMAINS];
@@ -122,6 +125,7 @@ int alloc_xenoprof_struct(struct domain 
 {
     struct vcpu *v;
     int nvcpu, npages, bufsize, max_bufsize;
+    unsigned max_max_samples;
     int i;
 
     d->xenoprof = xmalloc(struct xenoprof);
@@ -139,17 +143,15 @@ int alloc_xenoprof_struct(struct domain 
     for_each_vcpu ( d, v )
         nvcpu++;
 
-    /* reduce buffer size if necessary to limit pages allocated */
+    /* reduce max_samples if necessary to limit pages allocated */
+    max_bufsize = (MAX_OPROF_SHARED_PAGES * PAGE_SIZE) / nvcpu;
+    max_max_samples = ( (max_bufsize - sizeof(struct xenoprof_buf)) /
+                        sizeof(struct event_log) ) + 1;
+    if ( (unsigned)max_samples > max_max_samples )
+        max_samples = max_max_samples;
+
     bufsize = sizeof(struct xenoprof_buf) +
         (max_samples - 1) * sizeof(struct event_log);
-    max_bufsize = (MAX_OPROF_SHARED_PAGES * PAGE_SIZE) / nvcpu;
-    if ( bufsize > max_bufsize )
-    {
-        bufsize = max_bufsize;
-        max_samples = ( (max_bufsize - sizeof(struct xenoprof_buf)) /
-                        sizeof(struct event_log) ) + 1;
-    }
-
     npages = (nvcpu * bufsize - 1) / PAGE_SIZE + 1;
     
     d->xenoprof->rawbuf = alloc_xenoprof_buf(is_passive ? dom0 : d, npages);
@@ -515,6 +517,8 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         return -EPERM;
     }
 
+    spin_lock(&xenoprof_lock);
+    
     switch ( op )
     {
     case XENOPROF_init:
@@ -540,23 +544,31 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
     case XENOPROF_set_active:
     {
         domid_t domid;
-        if ( xenoprof_state != XENOPROF_IDLE )
-            return -EPERM;
-        if ( copy_from_guest(&domid, arg, 1) )
-            return -EFAULT;
+        if ( xenoprof_state != XENOPROF_IDLE ) {
+            ret = -EPERM;
+            break;
+        }
+        if ( copy_from_guest(&domid, arg, 1) ) {
+            ret = -EFAULT;
+            break;
+        }
         ret = add_active_list(domid);
         break;
     }
     case XENOPROF_set_passive:
     {
-        if ( xenoprof_state != XENOPROF_IDLE )
-            return -EPERM;
+        if ( xenoprof_state != XENOPROF_IDLE ) {
+            ret = -EPERM;
+            break;
+        }
         ret = add_passive_list(arg);
         break;
     }
     case XENOPROF_reserve_counters:
-        if ( xenoprof_state != XENOPROF_IDLE )
-            return -EPERM;
+        if ( xenoprof_state != XENOPROF_IDLE ) {
+            ret = -EPERM;
+            break;
+        }
         ret = nmi_reserve_counters();
         if ( !ret )
             xenoprof_state = XENOPROF_COUNTERS_RESERVED;
@@ -565,16 +577,20 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
     case XENOPROF_counter:
     {
         struct xenoprof_counter counter;
-        if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED )
-            return -EPERM;
-        if ( adomains == 0 )
-            return -EPERM;
-
-        if ( copy_from_guest(&counter, arg, 1) )
-            return -EFAULT;
-
-        if ( counter.ind > OP_MAX_COUNTER )
-            return -E2BIG;
+        if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED || adomains == 0) {
+            ret = -EPERM;
+            break;
+        }
+
+        if ( copy_from_guest(&counter, arg, 1) ) {
+            ret = -EFAULT;
+            break;
+        }
+
+        if ( counter.ind > OP_MAX_COUNTER ) {
+            ret = -E2BIG;
+            break;
+        }
 
         counter_config[counter.ind].count     = (unsigned long) counter.count;
         counter_config[counter.ind].enabled   = (unsigned long) 
counter.enabled;
@@ -588,8 +604,10 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
     }
 
     case XENOPROF_setup_events:
-        if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED )
-            return -EPERM;
+        if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED ) {
+            ret = -EPERM;
+            break;
+        }
         ret = nmi_setup_events();
         if ( !ret )
             xenoprof_state = XENOPROF_READY;
@@ -622,16 +640,20 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         break;
 
     case XENOPROF_stop:
-        if ( xenoprof_state != XENOPROF_PROFILING )
-            return -EPERM;
+        if ( xenoprof_state != XENOPROF_PROFILING ) {
+            ret = -EPERM;
+            break;
+        }
         nmi_stop();
         xenoprof_state = XENOPROF_READY;
         break;
 
     case XENOPROF_disable_virq:
         if ( (xenoprof_state == XENOPROF_PROFILING) && 
-             (is_active(current->domain)) )
-            return -EPERM;
+             (is_active(current->domain)) ) {
+            ret = -EPERM;
+            break;
+        }
         ret = reset_active(current->domain);
         break;
 
@@ -663,6 +685,8 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         ret = -EINVAL;
     }
 
+    spin_unlock(&xenoprof_lock);
+
     if ( ret < 0 )
         printk("xenoprof: operation %d failed for dom %d (status : %d)\n",
                op, current->domain->domain_id, ret);
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/include/acpi/platform/acenv.h
--- a/xen/include/acpi/platform/acenv.h Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/include/acpi/platform/acenv.h Tue Oct 17 16:44:57 2006 -0400
@@ -119,7 +119,7 @@
 
 /*! [Begin] no source code translation */
 
-#if defined(__linux__)
+#if 1 /*defined(__linux__)*/ /* XEN: suitable for all supported build OSes */
 #include "aclinux.h"
 
 #elif defined(_AED_EFI)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/include/asm-x86/msr.h
--- a/xen/include/asm-x86/msr.h Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/include/asm-x86/msr.h Tue Oct 17 16:44:57 2006 -0400
@@ -302,8 +302,14 @@ static inline void wrmsrl(unsigned int m
 
 #define MSR_K8_TOP_MEM1                        0xC001001A
 #define MSR_K8_TOP_MEM2                        0xC001001D
+#define MSR_K8_SYSCFG                  0xC0010010
+#define MSR_K8_HWCR                    0xC0010015
+#define MSR_K8_VM_CR                   0xC0010114
 #define MSR_K8_VM_HSAVE_PA             0xC0010117
-#define MSR_K8_SYSCFG                  0xC0000010      
+
+/* MSR_K8_VM_CR bits: */
+#define _K8_VMCR_SVME_DISABLE          4
+#define K8_VMCR_SVME_DISABLE           (1 << _K8_VMCR_SVME_DISABLE)
 
 /* Centaur-Hauls/IDT defined MSRs. */
 #define MSR_IDT_FCR1                   0x107
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/include/asm-x86/perfc_defn.h
--- a/xen/include/asm-x86/perfc_defn.h  Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/include/asm-x86/perfc_defn.h  Tue Oct 17 16:44:57 2006 -0400
@@ -81,8 +81,8 @@ PERFCOUNTER_CPU(shadow_unshadow_bf,    "
 PERFCOUNTER_CPU(shadow_unshadow_bf,    "shadow unshadow brute-force")
 PERFCOUNTER_CPU(shadow_get_page_fail,  "shadow_get_page_from_l1e failed")
 PERFCOUNTER_CPU(shadow_guest_walk,     "shadow walks guest tables")
-PERFCOUNTER_CPU(shadow_walk_cache_hit, "shadow walk-cache hits")
-PERFCOUNTER_CPU(shadow_walk_cache_miss, "shadow walk-cache misses")
+PERFCOUNTER_CPU(shadow_invlpg,         "shadow emulates invlpg")
+PERFCOUNTER_CPU(shadow_invlpg_fault,   "shadow invlpg faults")
 
 
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/include/asm-x86/x86_64/asm_defns.h
--- a/xen/include/asm-x86/x86_64/asm_defns.h    Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/include/asm-x86/x86_64/asm_defns.h    Tue Oct 17 16:44:57 2006 -0400
@@ -60,6 +60,12 @@
 #define safe_swapgs                             \
         "mfence; swapgs;"
 
+#ifdef __sun__
+#define REX64_PREFIX "rex64\\"
+#else
+#define REX64_PREFIX "rex64/"
+#endif
+
 #define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
 #define XBUILD_SMP_INTERRUPT(x,v)               \
 asmlinkage void x(void);                        \
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h      Fri Oct 13 11:00:32 2006 -0400
+++ b/xen/include/public/io/ring.h      Tue Oct 17 16:44:57 2006 -0400
@@ -152,7 +152,7 @@ typedef struct __name##_back_ring __name
     ((_r)->nr_ents)
 
 /* Number of free requests (for use on front side only). */
-#define RING_FREE_REQUESTS(_r)                                         \
+#define RING_FREE_REQUESTS(_r)                                          \
     (RING_SIZE(_r) - ((_r)->req_prod_pvt - (_r)->rsp_cons))
 
 /* Test if there is an empty slot available on the front ring.
@@ -165,13 +165,21 @@ typedef struct __name##_back_ring __name
 #define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \
     ((_r)->sring->rsp_prod - (_r)->rsp_cons)
 
+#ifdef __GNUC__
+#define RING_HAS_UNCONSUMED_REQUESTS(_r) ({                             \
+    unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;          \
+    unsigned int rsp = RING_SIZE(_r) -                                  \
+        ((_r)->req_cons - (_r)->rsp_prod_pvt);                          \
+    req < rsp ? req : rsp;                                              \
+})
+#else
+/* Same as above, but without the nice GCC ({ ... }) syntax. */
 #define RING_HAS_UNCONSUMED_REQUESTS(_r)                                \
-    ({                                                                 \
-       unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;      \
-       unsigned int rsp = RING_SIZE(_r) -                              \
-                          ((_r)->req_cons - (_r)->rsp_prod_pvt);       \
-       req < rsp ? req : rsp;                                          \
-    })
+    ((((_r)->sring->req_prod - (_r)->req_cons) <                        \
+      (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ?        \
+     ((_r)->sring->req_prod - (_r)->req_cons) :                         \
+     (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt)))
+#endif
 
 /* Direct access to individual ring elements, by index. */
 #define RING_GET_REQUEST(_r, _idx)                                      \
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 config/Linux.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/config/Linux.mk   Tue Oct 17 16:44:57 2006 -0400
@@ -0,0 +1,41 @@
+# -*- mode: Makefile; -*-
+
+AS         = $(CROSS_COMPILE)as
+LD         = $(CROSS_COMPILE)ld
+CC         = $(CROSS_COMPILE)gcc
+CPP        = $(CROSS_COMPILE)gcc -E
+AR         = $(CROSS_COMPILE)ar
+RANLIB     = $(CROSS_COMPILE)ranlib
+NM         = $(CROSS_COMPILE)nm
+STRIP      = $(CROSS_COMPILE)strip
+OBJCOPY    = $(CROSS_COMPILE)objcopy
+OBJDUMP    = $(CROSS_COMPILE)objdump
+
+GREP       = grep
+
+INSTALL      = install
+INSTALL_DIR  = $(INSTALL) -d -m0755
+INSTALL_DATA = $(INSTALL) -m0644
+INSTALL_PROG = $(INSTALL) -m0755
+
+LIB64DIR = lib64
+
+SOCKET_LIBS =
+CURSES_LIBS = -lncurses
+SONAME_LDFLAG = -soname
+SHLIB_CFLAGS = -shared
+
+ifneq ($(debug),y)
+# Optimisation flags are overridable
+CFLAGS ?= -O2 -fomit-frame-pointer
+else
+# Less than -O1 produces bad code and large stack frames
+CFLAGS ?= -O1 -fno-omit-frame-pointer
+endif
+
+# You may use wildcards, e.g. KERNELS=*2.6*
+KERNELS ?= linux-2.6-xen
+
+XKERNELS := $(foreach kernel, $(KERNELS), \
+              $(patsubst buildconfigs/mk.%,%, \
+                $(wildcard buildconfigs/mk.$(kernel))) )
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 config/SunOS.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/config/SunOS.mk   Tue Oct 17 16:44:57 2006 -0400
@@ -0,0 +1,37 @@
+# -*- mode: Makefile; -*-
+
+AS         = $(CROSS_COMPILE)gas
+LD         = $(CROSS_COMPILE)gld
+CC         = $(CROSS_COMPILE)gcc
+CPP        = $(CROSS_COMPILE)gcc -E
+AR         = $(CROSS_COMPILE)gar
+RANLIB     = $(CROSS_COMPILE)granlib
+NM         = $(CROSS_COMPILE)gnm
+STRIP      = $(CROSS_COMPILE)gstrip
+OBJCOPY    = $(CROSS_COMPILE)gobjcopy
+OBJDUMP    = $(CROSS_COMPILE)gobjdump
+
+GREP       = ggrep
+SHELL      = bash
+
+INSTALL      = ginstall
+INSTALL_DIR  = $(INSTALL) -d -m0755
+INSTALL_DATA = $(INSTALL) -m0644
+INSTALL_PROG = $(INSTALL) -m0755
+
+LIB64DIR = lib/amd64
+
+SOCKET_LIBS = -lsocket
+CURSES_LIBS = -lcurses
+SONAME_LDFLAG = -h
+SHLIB_CFLAGS = -static-libgcc -shared
+
+ifneq ($(debug),y)
+# Optimisation flags are overridable
+CFLAGS ?= -O2 -fno-omit-frame-pointer
+else
+# Less than -O1 produces bad code and large stack frames
+CFLAGS ?= -O1 -fno-omit-frame-pointer
+endif
+
+CFLAGS += -Wa,--divide
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/libxc/xc_solaris.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_solaris.c  Tue Oct 17 16:44:57 2006 -0400
@@ -0,0 +1,235 @@
+/******************************************************************************
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License.
+ */
+
+#include "xc_private.h"
+
+#include <xen/memory.h>
+#include <xen/sys/evtchn.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+int xc_interface_open(void)
+{
+    int flags, saved_errno;
+    int fd = open("/dev/xen/privcmd", O_RDWR);
+
+    if ( fd == -1 )
+    {
+        PERROR("Could not obtain handle on privileged command interface");
+        return -1;
+    }
+
+    /* Although we return the file handle as the 'xc handle' the API
+       does not specify / guarentee that this integer is in fact
+       a file handle. Thus we must take responsiblity to ensure
+       it doesn't propagate (ie leak) outside the process */
+    if ( (flags = fcntl(fd, F_GETFD)) < 0 )
+    {
+        PERROR("Could not get file handle flags");
+        goto error;
+    }
+    flags |= FD_CLOEXEC;
+    if ( fcntl(fd, F_SETFD, flags) < 0 )
+    {
+        PERROR("Could not set file handle flags");
+        goto error;
+    }
+
+    return fd;
+
+ error:
+    saved_errno = errno;
+    close(fd);
+    errno = saved_errno;
+    return -1;
+}
+
+int xc_interface_close(int xc_handle)
+{
+    return close(xc_handle);
+}
+
+void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
+                           xen_pfn_t *arr, int num)
+{
+    privcmd_mmapbatch_t ioctlx;
+    void *addr;
+    addr = mmap(NULL, num*PAGE_SIZE, prot, MAP_SHARED, xc_handle, 0);
+    if ( addr == MAP_FAILED )
+        return NULL;
+
+    ioctlx.num=num;
+    ioctlx.dom=dom;
+    ioctlx.addr=(unsigned long)addr;
+    ioctlx.arr=arr;
+    if ( ioctl(xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx) < 0 )
+    {
+        int saved_errno = errno;
+        perror("XXXXXXXX");
+        (void)munmap(addr, num*PAGE_SIZE);
+        errno = saved_errno;
+        return NULL;
+    }
+    return addr;
+
+}
+
+void *xc_map_foreign_range(int xc_handle, uint32_t dom,
+                           int size, int prot,
+                           unsigned long mfn)
+{
+    privcmd_mmap_t ioctlx;
+    privcmd_mmap_entry_t entry;
+    void *addr;
+    addr = mmap(NULL, size, prot, MAP_SHARED, xc_handle, 0);
+    if ( addr == MAP_FAILED )
+        return NULL;
+
+    ioctlx.num=1;
+    ioctlx.dom=dom;
+    ioctlx.entry=&entry;
+    entry.va=(unsigned long) addr;
+    entry.mfn=mfn;
+    entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
+    if ( ioctl(xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )
+    {
+        int saved_errno = errno;
+        (void)munmap(addr, size);
+        errno = saved_errno;
+        return NULL;
+    }
+    return addr;
+}
+
+int xc_map_foreign_ranges(int xc_handle, uint32_t dom,
+                          privcmd_mmap_entry_t *entries, int nr)
+{
+    privcmd_mmap_t ioctlx;
+
+    ioctlx.num   = nr;
+    ioctlx.dom   = dom;
+    ioctlx.entry = entries;
+
+    return ioctl(xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx);
+}
+
+static int do_privcmd(int xc_handle, unsigned int cmd, unsigned long data)
+{
+    return ioctl(xc_handle, cmd, data);
+}
+
+int do_xen_hypercall(int xc_handle, privcmd_hypercall_t *hypercall)
+{
+    return do_privcmd(xc_handle,
+                      IOCTL_PRIVCMD_HYPERCALL,
+                      (unsigned long)hypercall);
+}
+
+int xc_evtchn_open(void)
+{
+    int fd;
+
+    if ( (fd = open("/dev/xen/evtchn", O_RDWR)) == -1 )
+    {
+        PERROR("Could not open event channel interface");
+        return -1;
+    }
+
+    return fd;
+}
+
+int xc_evtchn_close(int xce_handle)
+{
+    return close(xce_handle);
+}
+
+int xc_evtchn_fd(int xce_handle)
+{
+    return xce_handle;
+}
+
+int xc_evtchn_notify(int xce_handle, evtchn_port_t port)
+{
+    struct ioctl_evtchn_notify notify;
+
+    notify.port = port;
+
+    return ioctl(xce_handle, IOCTL_EVTCHN_NOTIFY, &notify);
+}
+
+evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
+    evtchn_port_t remote_port)
+{
+    struct ioctl_evtchn_bind_interdomain bind;
+
+    bind.remote_domain = domid;
+    bind.remote_port = remote_port;
+
+    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
+}
+
+int xc_evtchn_unbind(int xce_handle, evtchn_port_t port)
+{
+    struct ioctl_evtchn_unbind unbind;
+
+    unbind.port = port;
+
+    return ioctl(xce_handle, IOCTL_EVTCHN_UNBIND, &unbind);
+}
+
+evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq)
+{
+    struct ioctl_evtchn_bind_virq bind;
+
+    bind.virq = virq;
+
+    return ioctl(xce_handle, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+}
+
+static int dorw(int fd, char *data, size_t size, int do_write)
+{
+    size_t offset = 0;
+    ssize_t len;
+
+    while ( offset < size )
+    {
+        if (do_write)
+            len = write(fd, data + offset, size - offset);
+        else
+            len = read(fd, data + offset, size - offset);
+
+        if ( len == -1 )
+        {
+             if ( errno == EINTR )
+                 continue;
+             return -1;
+        }
+
+        offset += len;
+    }
+
+    return 0;
+}
+
+evtchn_port_t xc_evtchn_pending(int xce_handle)
+{
+    evtchn_port_t port;
+
+    if ( dorw(xce_handle, (char *)&port, sizeof(port), 0) == -1 )
+        return -1;
+
+    return port;
+}
+
+int xc_evtchn_unmask(int xce_handle, evtchn_port_t port)
+{
+    return dorw(xce_handle, (char *)&port, sizeof(port), 1);
+}
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/python/xen/xend/osdep.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/xend/osdep.py    Tue Oct 17 16:44:57 2006 -0400
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+import os
+
+_scripts_dir = {
+    "Linux": "/etc/xen/scripts",
+    "SunOS": "/usr/lib/xen/scripts",
+}
+
+_xend_autorestart = {
+    "Linux": True,
+    "SunOS": False,
+}
+
+def _get(var, default=None):
+    return var.get(os.uname()[0], default)
+
+scripts_dir = _get(_scripts_dir, "/etc/xen/scripts")
+xend_autorestart = _get(_xend_autorestart)
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/xenstore/xenstored_solaris.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenstore/xenstored_solaris.c        Tue Oct 17 16:44:57 2006 -0400
@@ -0,0 +1,66 @@
+/******************************************************************************
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (C) 2005 Rusty Russell IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License.
+ */
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <xen/sys/xenbus.h>
+
+#include "xenstored_core.h"
+
+evtchn_port_t xenbus_evtchn(void)
+{
+       int fd;
+       evtchn_port_t port; 
+
+       fd = open("/dev/xen/xenbus", O_RDONLY); 
+       if (fd == -1)
+               return -1;
+
+       port = ioctl(fd, IOCTL_XENBUS_XENSTORE_EVTCHN);
+
+       close(fd); 
+       return port;
+}
+
+void *xenbus_map(void)
+{
+       int fd;
+       void *addr;
+
+       fd = open("/dev/xen/xenbus", O_RDWR);
+       if (fd == -1)
+               return NULL;
+
+       addr = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE,
+               MAP_SHARED, fd, 0);
+
+       if (addr == MAP_FAILED)
+               addr = NULL;
+
+       close(fd);
+
+       return addr;
+}
+
+void xenbus_notify_running(void)
+{
+       int fd;
+
+       fd = open("/dev/xen/xenbus", O_RDONLY);
+
+       (void) ioctl(fd, IOCTL_XENBUS_NOTIFY_UP);
+
+       close(fd);
+}
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/GPL
--- a/tools/misc/mbootpack/GPL  Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/Makefile
--- a/tools/misc/mbootpack/Makefile     Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#
-#  Makefile for mbootpack
-#
-INSTALL                = install
-INSTALL_PROG   = $(INSTALL) -m0755
-INSTALL_DIR    = $(INSTALL) -d -m0755
-
-XEN_ROOT=../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: mbootpack
-
-.PHONY: install
-install: build
-       $(INSTALL_PROG) mbootpack $(DESTDIR)/usr/bin
-
-#  Tools etc.
-RM     := rm -f
-INCS   := -I. -I-
-DEFS   := 
-
-#  What object files need building for the program
-OBJS   := mbootpack.o buildimage.o
-
-# Get gcc to generate the dependencies for us.
-DEPFLAGS = -Wp,-MD,.$(@F).d
-DEPS     = .*.d
-
-mbootpack: $(OBJS)
-       $(HOSTCC) $(HOSTCFLAGS) -o $@ $(filter-out %.a, $^)
-
-.PHONY: clean
-clean:
-       $(RM) mbootpack *.o $(DEPS) bootsect setup bzimage_header.c bin2c
-
-bootsect: bootsect.S
-       $(CC) -m32 $(INCS) $(DEFS) -D__MB_ASM -c bootsect.S -o bootsect.o
-       $(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary bootsect.o -o $@
-
-setup: setup.S
-       $(CC) -m32 $(INCS) $(DEFS) -D__MB_ASM -c setup.S -o setup.o
-       $(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary setup.o -o $@
-
-bin2c: bin2c.o 
-       $(HOSTCC) $(HOSTCFLAGS) -o $@ $^ 
-
-bzimage_header.c: bootsect setup bin2c
-       ./bin2c -n 8 -b1 -a bzimage_bootsect bootsect > bzimage_header.c
-       ./bin2c -n 8 -b1 -a bzimage_setup setup >> bzimage_header.c
-
-buildimage.c: bzimage_header.c
-       @
-
-%.o: %.c
-       $(HOSTCC) $(DEPFLAGS) $(HOSTCFLAGS) $(INCS) $(DEFS) -c $< -o $@
-
-.PRECIOUS: $(OBJS) $(OBJS:.o=.c) $(DEPS)
-.SUFFIXES: 
-
--include $(DEPS)
-
-#
-#  EOF
-#
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/README
--- a/tools/misc/mbootpack/README       Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-
-mbootpack
----------
-
-This is a utility to take a multiboot kernel and modules and repackage
-them in a form that a standard linux bootloader will be able to load them.
-It statically allocates memory addresses based on a 'standard' PC memory 
-layout, and then saves the image of the loaded system, along with an 
-almost-standard linux bzImage header which takes care of the start-of-day 
-requirements of a multiboot kernel (setting up 32-bit protected mode, etc.)
-
-Example invocation, to package a xen VMM and xenlinux guest and initrd:
-
-   mbootpack -o bzImage -m ./xenlinux -m ./initrd.img ./xen-image
-
-You can now boot the 'bzImage' file using your favourite linux bootloader.
-
-The kernel command line will be provided at boot time by the bootloader
-(you can specify a kernel command-line using the '-c' flag, but it will
-be overridden at boot time unledd the bootloder provides an entirely
-empty command line).  If you wan to override the command line for the
-first module (i.e. domain 0 kernel in Xen) at boot time, append ' -- '
-and the module commadn line to the bootloader command line, e.g.:
-
-  boot: bzImage com1=9600,8n1 console=com1 dom0_mem=49152 -- root=/dev/sda3 ro 
console=ttyS0,9600n8 
-
-Everything before the '--' is passed to the kernel (xen) as its command
-line; everything after is passed to the first module (xenlinux).
-
-This is ALPHA code: there are execution paths which have *not* been
-tested, though it works for loading the Xen hypervisor using GrUB, LILO
-or SYSLINUX.  Bug reports and patches are very welcome.
-
-Possible features for future versions (all look possible, if there's any 
-demand for them):
-
-    - support for kernels that load below 1MB
-    - zImage-style compressed images
-    - sane error messgaes for insane load addresses
-    - support for the MULTIBOOT_VIDEO_MODE bit
-    - proper support for passing E820h memory-maps from bzImage
-
-
-Tim Deegan <tjd21@xxxxxxxxxxxx>, March 2005
-
-
-
-License and attributions
-------------------------
-
-The bzImage header block was originally taken from the Linux kernel.
-http://www.kernel.org/
-
-Some parts of the Multiboot loader code are based on GNU GRUB.
-mb_info.h and mb_header.h are taken from GNU GRUB.
-http://www.gnu.org/software/grub/
-
-Bin2C was written by Nicolas Doualot; I tidied it a bit for a clean compile.
-http://slubman.celeonet.fr/program.php?style=Default&project=bin2c
-
-All other code is copyright (C) 2003-2005  Tim Deegan (tjd21@xxxxxxxxxxxx)
-
-mbootpack is distributed under the GNU General Public License: see "GPL"
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/bin2c.c
--- a/tools/misc/mbootpack/bin2c.c      Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/***************************************************************************************
-   Project informations:
-      Project:    bin2c
-      Version:    1.00
-      Plateforme: PC
-      Copyright:  DNDD.INC
-      Date:       28/03/2004
-
-   File informations:
-      Name:       bin2c.c
-      Description:Convert any file to a C array
-
-   Author informations:
-      Author:     DOUALOT Nicolas
-      E-Mail:     slubman@xxxxxxxxxxx
-      site:       http://membres.lycos.fr/slubman/gp32
-***************************************************************************************/
-
-
-#include <stdio.h>                             /*perror */
-#include <sys/mman.h>                  /*PROT_READ,MAP_xxx */
-#include <fcntl.h>                             /*O_RDONLY */
-#include <sys/stat.h>                  /*stat */
-#include <stdlib.h>                            /*atoi */
-#include <string.h>                            /*strcmp */
-#include <ctype.h>                             /*toupper */
-
-#define VERSION "1.10"
-
-
-static void help(void)
-{
-       fprintf(stdout, "\nbin2c v"VERSION"\n");
-       fprintf(stdout, "Slubman DevSoft (c)2003-2004 slubman.dndd@xxxxxxxxxxx 
\n\n");
-
-       fprintf(stdout, "Usage: bin2c [flags] <infile>\n\n");
-
-       //fprintf(stdout, "\t-quiet      :\tdon't output standard messages\n");
-       //fprintf(stdout, "\t-slash      :\tappend backslash at end of line\n");
-       fprintf(stdout, "\t-n <count>  :\tnumber of items per line\n");
-       fprintf(stdout, "\t-b1         :\tgenerate unsigned char array\n");
-       fprintf(stdout, "\t-b2         :\tgenerate unsigned short  array\n");
-       fprintf(stdout, "\t-b4         :\tgenerate unsigned long array\n");
-       fprintf(stdout, "\t-a <name>   :\tgenerate an array with given name\n");
-       fprintf(stdout, "\t-ss <nr>    :\tskip number of bytes at begin of 
inputfile\n");
-       fprintf(stdout, "\t-se <nr>    :\tskip number of bytes at end of 
inputfile\n");
-       fprintf(stdout, "\t-lb <nr>    :\tinsert an additionally linebreak 
every nr line\n");
-       fprintf(stdout, "\t-h          :\tproduce an header\n");
-       fprintf(stdout, "\tinfile      :\tname of infile\n");
-       fprintf(stdout, "\toutfile     :\tname of outfile (use \"-\" for 
stdout)\n\n");
-
-       fprintf(stdout, " \tconverts binary file to C array data\n");
-}
-
-static void UnknownFlag(char *flag)
-{
-       fprintf(stderr, "Error: unknown flag %s\n", flag);
-       help();
-       exit(EXIT_FAILURE);
-}
-
-static void WriteHeader(FILE * outFile, char *oFileName, char *iFileName)
-{
-       // File Header
-       fprintf(outFile, 
"/***************************************************************************************\n");
-       fprintf(outFile, "*   File Name:\n");
-       fprintf(outFile, "*      Name:       %s\n", oFileName);
-       fprintf(outFile, "*      From:       %s\n", iFileName);
-       fprintf(outFile, "*      Created by :bin2c v"VERSION"\n*\n");
-       fprintf(outFile, "*   bin2c v"VERSION":\n");
-       fprintf(outFile, "*      Author:     DOUALOT Nicolas\n");
-       fprintf(outFile, "*      E-Mail:     slubman.dndd@xxxxxxxxxxx\n");
-       fprintf(outFile, "*      site:       
http://www.slubman.linux-fan.com/\n";);
-       fprintf(outFile, 
"***************************************************************************************/\n\n");
-}
-
-int main(int argc, char *argv[])
-{
-       FILE *inFile = stdin, *outFile = stdout;
-       int a, i, nbLine = 0;
-       unsigned char *memory;
-       struct stat st;
-
-       // Options
-       char arrayName[255] = "array";  // Array name
-       char *iFileName = NULL;         // File to convert
-       char *oFileName = NULL;         // File to write
-       int bpd = 1;                            // Array item length
-       int lb = 0;                                     // Array blank line 
each lb line(s)
-       int nbCol = 15;                                 // Nuber of items per 
line
-       int SkeepStart = 0;                     // Number of byte to skip at 
file begining
-       int SkeepEnd = 0;                       // Number of byte to skip at 
file end
-       int header = 0;                         // Produce an header
-
-       // Is there the good number of arguments
-       if (argc < 2)
-       {
-               help();
-               return 0;
-       }
-
-       // On récupère les arguments (Ready for more options)
-       for (a = 1; a < argc; a++)
-       {
-               // An option
-               if (argv[a][0] == '-')
-               {
-                       // Wich flag is it ?
-                       switch (argv[a][1])
-                       {
-                                       // Writting on stdout
-                               case 0:
-                                       printf("%s\n", argv[a]);
-                                       outFile = stdout;
-                                       break;
-
-                                       // ArrayName flag
-                               case 'a':
-                                       strcpy(arrayName, argv[++a]);
-                                       break;
-
-                                       // Data type
-                               case 'b':
-                                       switch (argv[a][2])
-                                       {
-                                               case '1':
-                                                       bpd = 1;
-                                                       break;
-
-                                               case '2':
-                                                       bpd = 2;
-                                                       break;
-
-                                               case '4':
-                                                       bpd = 4;
-                                                       break;
-
-                                               default:
-                                                       UnknownFlag(argv[a]);
-                                       }
-                                       break;
-
-                                       // Produce an header
-                               case 'h':
-                                       header = 1;
-                                       break;
-
-                                       // New line each n line
-                               case 'l':
-                                       switch (argv[a][2])
-                                       {
-                                               case 'b':
-                                                       lb = atoi(argv[++a]);
-                                                       break;
-
-                                               default:
-                                                       UnknownFlag(argv[a]);
-                                       }
-
-                                       // Number of bit per line
-                               case 'n':
-                                       nbCol = atoi(argv[++a]);
-                                       break;
-
-                                       // Skip bytes
-                               case 's':
-                                       switch (argv[a][2])
-                                       {
-                                                       // Beginig of file
-                                               case 's':
-                                                       SkeepStart = 
atoi(argv[++a]);
-                                                       break;
-
-                                                       // End of file
-                                               case 'e':
-                                                       SkeepEnd = 
atoi(argv[++a]);
-                                                       break;
-
-                                                       // Flag inconnu
-                                               default:
-                                                       UnknownFlag(argv[a]);
-                                       }
-
-                                       // Flag inconnu
-                               default:
-                                       UnknownFlag(argv[a]);
-                       }
-               }
-               // A filename
-               else
-               {
-                       if (iFileName == NULL)
-                       {
-                               iFileName = argv[a];
-                               if ((inFile = fopen(iFileName, "rb")) == NULL)
-                               {
-                                       fprintf(stderr, "Error: can't open 
%s\n", iFileName);
-                                       exit(EXIT_FAILURE);
-                               }
-                       }
-                       else
-                       {
-                               if (oFileName == NULL)
-                               {
-                                       oFileName = argv[a];
-                                       if ((outFile = fopen(oFileName, "wb")) 
== NULL)
-                                       {
-                                               fprintf(stderr, "Error: can't 
open %s\n", oFileName);
-                                               exit(EXIT_FAILURE);
-                                       }
-                               }
-                               else
-                               {
-                                       fprintf(stderr, "Error: Too many 
filesnames given!\n");
-                                       help();
-                                       exit(EXIT_FAILURE);
-                               }
-                       }
-               }
-       }
-
-       if (!iFileName)
-               exit(EXIT_FAILURE);
-
-       // Get file informations
-       if (stat(iFileName, &st) != 0)
-       {
-               fprintf(stderr, "Error: when scanning file %s\n", argv[1]);
-               exit(EXIT_FAILURE);
-       }
-
-       // Allocating memory
-       if (!(memory = malloc(st.st_size + 3)))
-       {
-               memset(memory, 0, st.st_size + 3);
-               fprintf(stderr, "Error: not enought memory\n");
-               exit(EXIT_FAILURE);
-       }
-
-       // Reading the file
-       if (fread(memory, 1, st.st_size, inFile) != (size_t)st.st_size)
-       {
-               fprintf(stderr, "Error: when reading file %s\n", argv[1]);
-               fclose(inFile);
-               exit(EXIT_FAILURE);
-       }
-       fclose(inFile);
-
-       // Must produce an header
-       if (header)
-       {
-               unsigned int i;
-               char hFileName[256], *def = NULL;
-               FILE *hFile = stdout;
-
-               if (oFileName)
-               {
-                       strcpy(hFileName, oFileName);
-                       hFileName[strlen(hFileName) - 1] = 'h';
-                       hFile = fopen(hFileName, "wt");
-               }
-
-               WriteHeader(hFile, hFileName, iFileName);
-
-               // Replace all '.' by '_'
-               for (i = 0; i < strlen(hFileName); i++)
-                       if (hFileName[i] == '.')
-                               hFileName[i] = '_';
-                       else
-                               hFileName[i] = toupper(hFileName[i]);
-
-               // the #ifdef at the begining
-               def = strrchr(hFileName, '/');
-               def = def ? def + 1 : hFileName;
-               fprintf(hFile, "#ifndef __%s__\n#define __%s__\n\n", def, def);
-
-               // Define array size
-               fprintf(hFile, "#define _%s_size_ %u\n\n", arrayName, (unsigned 
int) (st.st_size - SkeepStart - SkeepEnd) / bpd);
-
-               // Begin the array
-               fprintf(hFile, "extern unsigned ");
-               fprintf(hFile, "%s ", bpd == 1 ? "char" : bpd == 2 ? "short" : 
"long");
-               fprintf(hFile, "%s[", arrayName);
-               fprintf(hFile, "%u];\n\n", (unsigned int) (st.st_size - 
SkeepStart - SkeepEnd) / bpd);
-
-               // the #endif at the end
-               fprintf(hFile, "#endif\n\n");
-
-               if (oFileName)
-                       fclose(hFile);
-       }
-
-       WriteHeader(outFile, oFileName, iFileName);
-
-       // Define array size
-       if (!header)
-               fprintf(outFile, "#define _%s_size_ %u\n\n", arrayName, 
(unsigned int) (st.st_size - SkeepStart - SkeepEnd) / bpd);
-
-       // Begin the array
-       fprintf(outFile, "unsigned ");
-       fprintf(outFile, "%s ", bpd == 1 ? "char" : bpd == 2 ? "short" : 
"long");
-       fprintf(outFile, "%s[", arrayName);
-       fprintf(outFile, "%u] = {\n\t", (unsigned int) (st.st_size - SkeepStart 
- SkeepEnd) / bpd);
-
-       // Writing file elements
-       for (i = 0; i < (st.st_size - SkeepEnd - SkeepStart) / bpd; /*i+=bpd */ 
i++)
-       {
-               // We write an item of bpd byte(s)
-               switch (bpd)
-               {
-                       case 1:
-                               fprintf(outFile, "0x%02x", *(unsigned char *) 
&memory[SkeepStart + i]);
-                               break;
-
-                       case 2:
-                               fprintf(outFile, "0x%04x", *(unsigned short *) 
&memory[SkeepStart + i]);
-                               break;
-
-                       case 4:
-                               fprintf(outFile, "0x%08lx", *(unsigned long *) 
&memory[SkeepStart + i]);
-                               break;
-               }
-
-               // Must put a coma ?
-               if (i != st.st_size - 1)
-                       fprintf(outFile, ",");
-
-               // End of a line ?
-               if (i && !((i + 1) % nbCol))
-               {
-                       // -lb option
-                       if (lb && !((++nbLine) % lb))
-                               fprintf(outFile, "\n");
-                       fprintf(outFile, "\n\t");
-               }
-               // Add a space
-               else
-                       fprintf(outFile, " ");
-       }
-
-       // The last line as nbCol elements
-       if (((st.st_size - SkeepStart - SkeepEnd) / bpd) % nbCol)
-               fprintf(outFile, "\n");
-
-       // Close the array
-       fprintf(outFile, "};\n");
-
-       // CLose the output file
-       if (outFile != stdout)
-               fclose(outFile);
-
-       // Free allocated memory
-       free(memory);
-
-       exit(EXIT_SUCCESS);
-}
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/bootsect.S
--- a/tools/misc/mbootpack/bootsect.S   Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- *  bootsect.S
- *
- *  This is bootsect.S from the linux 2.6.9 sources,
- *  with minor changes for mbootpack.
- *
- *  
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * $Id: bootsect.S,v 1.2 2005/03/23 10:39:11 tjd21 Exp $
- *
- */
-       
-#include "mbootpack.h"
-               
-/*
- *     bootsect.S              Copyright (C) 1991, 1992 Linus Torvalds
- *
- *     modified by Drew Eckhardt
- *     modified by Bruce Evans (bde)
- *     modified by Chris Noe (May 1999) (as86 -> gas)
- *     gutted by H. Peter Anvin (Jan 2003)
- *
- * BIG FAT NOTE: We're in real mode using 64k segments.  Therefore segment
- * addresses must be multiplied by 16 to obtain their respective linear
- * addresses. To avoid confusion, linear addresses are written using leading
- * hex while segment addresses are written as segment:offset.
- *
- */
- 
-/* #include <asm/boot.h> */
-/* Definitions we should have got from there */        
-#define DEF_INITSEG     0x9000
-#define DEF_SYSSEG      0x1000
-#define DEF_SETUPSEG    0x9020
-#define DEF_SYSSIZE     0x7F00
-#define NORMAL_VGA      0xffff
-#define EXTENDED_VGA    0xfffe
-#define ASK_VGA         0xfffd
-
-
-/* SETUPSECTS  = 4 */                  /* default nr of setup-sectors */
-BOOTSEG                = 0x07C0                /* original address of 
boot-sector */
-INITSEG                = DEF_INITSEG           /* we move boot here - out of 
the way */
-SETUPSEG       = DEF_SETUPSEG          /* setup starts here */
-SYSSEG         = DEF_SYSSEG            /* system loaded at 0x10000 (65536) */
-SYSSIZE                = DEF_SYSSIZE           /* system size: # of 16-byte 
clicks */
-                                       /* to be loaded */
-ROOT_DEV       = 0                     /* ROOT_DEV is now written by "build" */
-SWAP_DEV       = 0                     /* SWAP_DEV is now written by "build" */
-
-#ifndef SVGA_MODE
-/* #define SVGA_MODE ASK_VGA */
-#define SVGA_MODE NORMAL_VGA
-#endif
-
-#ifndef RAMDISK
-#define RAMDISK 0
-#endif
-
-#ifndef ROOT_RDONLY
-#define ROOT_RDONLY 1
-#endif
-
-.code16
-.text
-
-.global _start
-_start:
-
-       # Normalize the start address
-       jmpl    $BOOTSEG, $start2
-
-start2:
-       movw    %cs, %ax
-       movw    %ax, %ds
-       movw    %ax, %es
-       movw    %ax, %ss
-       movw    $0x7c00, %sp
-       sti
-       cld
-
-       movw    $bugger_off_msg, %si
-
-msg_loop:
-       lodsb
-       andb    %al, %al
-       jz      die
-       movb    $0xe, %ah
-       movw    $7, %bx
-       int     $0x10
-       jmp     msg_loop
-
-die:
-       # Allow the user to press a key, then reboot
-       xorw    %ax, %ax
-       int     $0x16
-       int     $0x19
-
-       # int 0x19 should never return.  In case it does anyway,
-       # invoke the BIOS reset code...
-       ljmp    $0xf000,$0xfff0
-
-
-bugger_off_msg:
-       .ascii  "Direct booting from floppy is no longer supported.\r\n"
-       .ascii  "Please use a boot loader program instead.\r\n"
-       .ascii  "\n"
-       .ascii  "Remove disk and press any key to reboot . . .\r\n"
-       .byte   0
-       
-
-       # Kernel attributes; used by setupbegtext
-
-       .org 497
-setup_sects:   .byte SETUPSECTS
-root_flags:    .word ROOT_RDONLY
-syssize:       .word SYSSIZE
-swap_dev:      .word SWAP_DEV
-ram_size:      .word RAMDISK
-vid_mode:      .word SVGA_MODE
-root_dev:      .word ROOT_DEV
-boot_flag:     .word 0xAA55
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/buildimage.c
--- a/tools/misc/mbootpack/buildimage.c Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
- *  buildimage.c
- *
- *  Takes the memory image of a loaded kernel and modules and repackages 
- *  it as a linux bzImage
- *
- *  Copyright (C) 2003-2004  Tim Deegan (tjd21@xxxxxxxxxxxx)
- * 
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * $Id: buildimage.c,v 1.2 2005/03/23 10:39:19 tjd21 Exp $
- *
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <getopt.h>
-#include <elf.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <asm/page.h>
-
-#include "mbootpack.h"
-#include "mb_header.h"
-
-
-/*  We will build an image that a bzImage-capable bootloader will load like 
- *  this:
- * 
- *  ==============   (0)
- *  (BIOS memory)
- *  --------------
- *  (Bootloader)
- *  --------------
- *  bzImage startup code
- *  MBI, command-lines, module info
- *  ==============   (0xa0000)
- *  (memory hole)
- *  ==============   (0x100000)
- *  Kernel and modules
- *  ==============
- * 
- *  The bzImage startup code is mostly taken straight from the linux kernel
- *  (see bootsect.S, startup.S).  It does the usual unpleasant start-of-day
- *  tasks to get to 32-bit protected mode, then sets registers appropriately 
- *  and jumps to the kernel's entry address.
- *  
- *  It also does some relocation to make sure the MBI is where we expect it, 
- *  and parses the linux command line.
- */
-
-#define BZ_SETUP_OFFSET    (512 * (1 + SETUPSECTS)) 
-#define BZ_ENTRY_OFFSET    0x30
-#define BZ_MBI_OFFSET      0x34
-/* These *MUST* fit the offsets of entry_address and mbi_address in setup.S */
-
-/* Bring in the bzImage boot sector and setup code */
-#include "bzimage_header.c"
-
-#define _p(x) ((void *)(unsigned long)(x))
-
-address_t place_mbi(long int size) 
-/* Find space at the top of *low* memory for the MBI and associated red tape */
-{
-    address_t start;
-    start = 0xa000 - size;
-    if (start < 0x9000 + sizeof(bzimage_bootsect) + sizeof(bzimage_setup)) {
-        printf("Fatal: command-lines too long: need %ld, have %ld bytes\n",
-               size, 
-               0x1000L - (sizeof(bzimage_bootsect) + sizeof(bzimage_setup)));
-        exit(1);
-    }
-    if (!quiet) {
-        printf("Placed MBI and strings (%p+%p)\n", 
-               _p(start), _p(size));
-    }
-    return start;
-}
-
-void make_bzImage(section_t *sections, 
-                  address_t entry, 
-                  address_t mbi,
-                  FILE *fp)
-/* Rework this list of sections into a bzImage and write it out to fp */
-{
-    int i;
-    size_t offset;
-    section_t *s;
-
-    /* Patch the kernel and mbi addresses into the setup code */
-    *(address_t *)(bzimage_setup + BZ_ENTRY_OFFSET) = eswap(entry);
-    *(address_t *)(bzimage_setup + BZ_MBI_OFFSET) = eswap(mbi);
-    if (!quiet) printf("Kernel entry is %p, MBI is %p.\n",_p(entry), _p(mbi));
-
-    /* Write out header and trampoline */
-    if (fseek(fp, 0, SEEK_SET) < 0) {
-        printf("Fatal: error seeking in output file: %s\n", 
-               strerror(errno));
-        exit(1);
-    }
-    if (fwrite(bzimage_bootsect, sizeof(bzimage_bootsect), 1, fp) != 1) {
-        printf("Fatal: error writing to output file: %s\n", 
-               strerror(errno));
-        exit(1);
-    }
-    if (fwrite(bzimage_setup, sizeof(bzimage_setup), 1, fp) != 1) {
-        printf("Fatal: error writing to output file: %s\n", 
-               strerror(errno));
-        exit(1);
-    }
-
-    if (!quiet) printf("Wrote bzImage header: %ld + %ld bytes.\n", 
-                       (long)sizeof(bzimage_bootsect),
-                       (long)sizeof(bzimage_setup));
-
-    /* Sorted list of sections below 1MB: write them out */
-    for (s = sections, i = 0; s; s = s->next) {
-        if (s->start >= HIGHMEM_START) continue;
-        offset = (s->start - 0x9000);
-        if (fseek(fp, offset, SEEK_SET) < 0) {
-            printf("Fatal: error seeking in output file: %s\n", 
-                   strerror(errno));
-            exit(1);
-        }
-        if (fwrite(s->buffer, s->size, 1, fp) != 1) {
-            printf("Fatal: error writing to output file: %s\n", 
-                   strerror(errno));
-            exit(1);
-        }
-        i++;
-    }
-
-    if (!quiet) printf("Wrote %i low-memory sections.\n", i);
-
-    /* Sorted list of sections higher than 1MB: write them out */
-    for (s = sections, i = 0; s; s = s->next) {
-        if (s->start < HIGHMEM_START) continue;
-        offset = (s->start - HIGHMEM_START) + BZ_SETUP_OFFSET;
-        if (fseek(fp, offset, SEEK_SET) < 0) {
-            printf("Fatal: error seeking in output file: %s\n", 
-                   strerror(errno));
-            exit(1);
-        }
-        if (fwrite(s->buffer, s->size, 1, fp) != 1) {
-            printf("Fatal: error writing to output file: %s\n", 
-                   strerror(errno));
-            exit(1);
-        }
-        i++;
-    }
-    
-    if (!quiet) printf("Wrote %i high-memory sections.\n", i);
-}
-
-
-/*
- *  EOF(buildimage.c)
- */
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/mb_header.h
--- a/tools/misc/mbootpack/mb_header.h  Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2000   Free Software Foundation, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *  MultiBoot Header description
- */
-
-struct multiboot_header
-{
-  /* Must be MULTIBOOT_MAGIC - see below.  */
-  unsigned magic;
-  
-  /* Feature flags - see below.  */
-  unsigned flags;
-  
-  /*
-   * Checksum
-   *
-   * The above fields plus this one must equal 0 mod 2^32.
-   */
-  unsigned checksum;
-  
-  /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set.  */
-  unsigned header_addr;
-  unsigned load_addr;
-  unsigned load_end_addr;
-  unsigned bss_end_addr;
-  unsigned entry_addr;
-
-  /* These are only valid if MULTIBOOT_VIDEO_MODE is set.  */
-  unsigned mode_type;
-  unsigned width;
-  unsigned height;
-  unsigned depth;
-};
-
-/*
- * The entire multiboot_header must be contained
- * within the first MULTIBOOT_SEARCH bytes of the kernel image.
- */
-#define MULTIBOOT_SEARCH               8192
-#define MULTIBOOT_FOUND(addr, len) \
-  (! ((addr) & 0x3) \
-   && (len) >= 12 \
-   && *((int *) (addr)) == MULTIBOOT_MAGIC \
-   && ! (*((unsigned *) (addr)) + *((unsigned *) (addr + 4)) \
-        + *((unsigned *) (addr + 8))) \
-   && (! (MULTIBOOT_AOUT_KLUDGE & *((int *) (addr + 4))) || (len) >= 32) \
-   && (! (MULTIBOOT_VIDEO_MODE & *((int *) (addr + 4))) || (len) >= 48))
-
-/* Magic value identifying the multiboot_header.  */
-#define MULTIBOOT_MAGIC                        0x1BADB002
-
-/*
- * Features flags for 'flags'.
- * If a boot loader sees a flag in MULTIBOOT_MUSTKNOW set
- * and it doesn't understand it, it must fail.
- */
-#define MULTIBOOT_MUSTKNOW             0x0000FFFF
-
-/* currently unsupported flags...  this is a kind of version number.  */
-#define MULTIBOOT_UNSUPPORTED          0x0000FFF8
-
-/* Align all boot modules on i386 page (4KB) boundaries.  */
-#define MULTIBOOT_PAGE_ALIGN           0x00000001
-
-/* Must pass memory information to OS.  */
-#define MULTIBOOT_MEMORY_INFO          0x00000002
-
-/* Must pass video information to OS.  */
-#define MULTIBOOT_VIDEO_MODE           0x00000004
-
-/* This flag indicates the use of the address fields in the header.  */
-#define MULTIBOOT_AOUT_KLUDGE          0x00010000
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/mb_info.h
--- a/tools/misc/mbootpack/mb_info.h    Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2000  Free Software Foundation, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- *  The structure type "mod_list" is used by the "multiboot_info" structure.
- */
-
-struct mod_list
-{
-  /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
-  unsigned long mod_start;
-  unsigned long mod_end;
-  
-  /* Module command line */
-  unsigned long cmdline;
-  
-  /* padding to take it to 16 bytes (must be zero) */
-  unsigned long pad;
-};
-
-
-/*
- *  INT-15, AX=E820 style "AddressRangeDescriptor"
- *  ...with a "size" parameter on the front which is the structure size - 4,
- *  pointing to the next one, up until the full buffer length of the memory
- *  map has been reached.
- */
-
-struct AddrRangeDesc
-{
-  unsigned long size;
-  unsigned long long BaseAddr;
-  unsigned long long Length;
-  unsigned long Type;
-  
-  /* unspecified optional padding... */
-};
-
-/* usable memory "Type", all others are reserved.  */
-#define MB_ARD_MEMORY          1
-
-
-/* Drive Info structure.  */
-struct drive_info
-{
-  /* The size of this structure.  */
-  unsigned long size;
-
-  /* The BIOS drive number.  */
-  unsigned char drive_number;
-
-  /* The access mode (see below).  */
-  unsigned char drive_mode;
-
-  /* The BIOS geometry.  */
-  unsigned short drive_cylinders;
-  unsigned char drive_heads;
-  unsigned char drive_sectors;
-
-  /* The array of I/O ports used for the drive.  */
-  unsigned short drive_ports[0];
-};
-
-/* Drive Mode.  */
-#define MB_DI_CHS_MODE         0
-#define MB_DI_LBA_MODE         1
-
-
-/* APM BIOS info.  */
-struct apm_info
-{
-  unsigned short version;
-  unsigned short cseg;
-  unsigned long offset;
-  unsigned short cseg_16;
-  unsigned short dseg_16;
-  unsigned short cseg_len;
-  unsigned short cseg_16_len;
-  unsigned short dseg_16_len;
-};
-
-
-/*
- *  MultiBoot Info description
- *
- *  This is the struct passed to the boot image.  This is done by placing
- *  its address in the EAX register.
- */
-
-struct multiboot_info
-{
-  /* MultiBoot info version number */
-  unsigned long flags;
-  
-  /* Available memory from BIOS */
-  unsigned long mem_lower;
-  unsigned long mem_upper;
-  
-  /* "root" partition */
-  unsigned long boot_device;
-  
-  /* Kernel command line */
-  unsigned long cmdline;
-  
-  /* Boot-Module list */
-  unsigned long mods_count;
-  unsigned long mods_addr;
-  
-  union
-  {
-    struct
-    {
-      /* (a.out) Kernel symbol table info */
-      unsigned long tabsize;
-      unsigned long strsize;
-      unsigned long addr;
-      unsigned long pad;
-    }
-    a;
-    
-    struct
-    {
-      /* (ELF) Kernel section header table */
-      unsigned long num;
-      unsigned long size;
-      unsigned long addr;
-      unsigned long shndx;
-    }
-    e;
-  }
-  syms;
-  
-  /* Memory Mapping buffer */
-  unsigned long mmap_length;
-  unsigned long mmap_addr;
-  
-  /* Drive Info buffer */
-  unsigned long drives_length;
-  unsigned long drives_addr;
-  
-  /* ROM configuration table */
-  unsigned long config_table;
-  
-  /* Boot Loader Name */
-  unsigned long boot_loader_name;
-
-  /* APM table */
-  unsigned long apm_table;
-
-  /* Video */
-  unsigned long vbe_control_info;
-  unsigned long vbe_mode_info;
-  unsigned short vbe_mode;
-  unsigned short vbe_interface_seg;
-  unsigned short vbe_interface_off;
-  unsigned short vbe_interface_len;
-};
-
-/*
- *  Flags to be set in the 'flags' parameter above
- */
-
-/* is there basic lower/upper memory information? */
-#define MB_INFO_MEMORY                 0x00000001
-/* is there a boot device set? */
-#define MB_INFO_BOOTDEV                        0x00000002
-/* is the command-line defined? */
-#define MB_INFO_CMDLINE                        0x00000004
-/* are there modules to do something with? */
-#define MB_INFO_MODS                   0x00000008
-
-/* These next two are mutually exclusive */
-
-/* is there a symbol table loaded? */
-#define MB_INFO_AOUT_SYMS              0x00000010
-/* is there an ELF section header table? */
-#define MB_INFO_ELF_SHDR               0x00000020
-
-/* is there a full memory map? */
-#define MB_INFO_MEM_MAP                        0x00000040
-
-/* Is there drive info?  */
-#define MB_INFO_DRIVE_INFO             0x00000080
-
-/* Is there a config table?  */
-#define MB_INFO_CONFIG_TABLE           0x00000100
-
-/* Is there a boot loader name?  */
-#define MB_INFO_BOOT_LOADER_NAME       0x00000200
-
-/* Is there a APM table?  */
-#define MB_INFO_APM_TABLE              0x00000400
-
-/* Is there video information?  */
-#define MB_INFO_VIDEO_INFO             0x00000800
-
-/*
- *  The following value must be present in the EAX register.
- */
-
-#define MULTIBOOT_VALID                        0x2BADB002
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/mbootpack.c
--- a/tools/misc/mbootpack/mbootpack.c  Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,704 +0,0 @@
-/*
- *  mbootpack.c
- *
- *  Takes a multiboot image, command-line and modules, and repackages
- *  them as if they were a linux kernel.   Only supports a subset of 
- *  the multiboot info page options (enough to boot the Xen hypervisor).
- *
- *  Copyright (C) 2003-2004  Tim Deegan (tjd21@xxxxxxxxxxxx)
- * 
- *  Parts based on GNU GRUB, Copyright (C) 2000  Free Software Foundation, Inc
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * $Id: mbootpack.c,v 1.3 2005/03/23 10:38:36 tjd21 Exp tjd21 $
- *
- */
-
-#define _GNU_SOURCE
-#include "mbootpack.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <getopt.h>
-#include <elf.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <asm/page.h>
-
-/* From GNU GRUB */
-#include "mb_header.h"
-#include "mb_info.h"
-
-
-/*
- *  The plan: Marshal up the multiboot modules and strings as if we 
- *  were loading them into memory on a fresh ix86 PC.  Attach 
- *  a linux bzImage header to the front, which sets up the machine
- *  appropriately and then jumps to the kernel entry address.
- * 
- *  The memory map will be made up roughly like so:
- *
- *  =============
- *  multiboot information (mbi) struct
- *  -------
- *  kernel command line
- *  -------
- *  bootloader name
- *  -------
- *  module command lines
- *  -------
- *  module information structs
- *  =============
- *   (memory hole)
- *  =============
- *  kernel
- *  -------------
- *  module 1
- *  -------------
- *  module 2
- *  -------------
- *      .
- *      .
- *      .
- *
- *  ==============
- * 
- * 
- *  For allocation of memory we assume that the target machine has 'low'
- *  memory from 0 to 640K and 'high' memory starting at 1M.  We allocate
- *  the kernel first, wherever it wants to be.  After that, sections
- *  are added at the next available aligned address, always in the order
- *  given above, and skipping the memory hole at 640K.  Allocated sections 
- *  are stored in a linked list of buffers.
- * 
- *  Re-packaging as a bzImage file happens in buildimage.c
- *  
- */
-
-/* Version */
-static const char version_string[] = "mbootpack " MBOOTPACK_VERSION_STRING;
-
-/* Flags */
-int quiet = 0;
-
-/* How much of the start of a kernel we read looking for headers.  
- * Must be >= MULTIBOOT_SEARCH */
-#define HEADERBUF_SIZE MULTIBOOT_SEARCH
-
-
-/* Linked list of loaded sections, and a pointer to the next 
- * available space (i.e. just above the highest allocation so far). */
-static section_t *sections = NULL;
-static section_t *last_section = NULL;
-static address_t next_free_space = 0; 
-
-static void usage(void)
-/* If we don't understand the command-line options */ 
-{
-    printf(
-"Usage: mbpack [OPTIONS] kernel-image\n\n"
-"  -h --help                       Print this text.\n"
-"  -q --quiet                      Only output errors and warnings.\n"
-"  -o --output=filename            Output to filename (default \"bzImage\").\n"
-"  -M --multiboot-output           Produce a multiboot kernel, not a bzImage\n"
-"                                  (sets default output file to 
\"mbImage\").\n"
-"  -c --command-line=STRING        Set the kernel command line 
(DEPRECATED!).\n"
-"  -m --module=\"MOD arg1 arg2...\"  Load module MOD with arguments 
\"arg1...\"\n"
-"                                  (can be used multiple times).\n"
-"\n");
-    exit(1);
-}
-
-#define _p(x) ((void *)(unsigned long)(x))
-
-static void place_kernel_section(address_t start, long int size)
-/* Place the kernel in memory, checking for the memory hole. */
-{
-    if (start >= MEM_HOLE_END) {
-        /* Above the memory hole: easy */
-        next_free_space = MAX(next_free_space, start + size);
-        if (!quiet) {
-            printf("Placed kernel section (%p+%p)\n",
-                   _p(start), _p(size));
-        }
-        return;
-    }
-    
-    if (start >= MEM_HOLE_START) {
-        /* In the memory hole.  Not so good */
-        printf("Fatal: kernel load address (%p) is in the memory hole.\n",
-               _p(start));
-        exit(1);
-    }
-    
-    if (start + size > MEM_HOLE_START) {
-        /* Too big for low memory */
-        printf("Fatal: kernel (%p+%p) runs into the memory hole.\n",
-               _p(start), _p(size));
-        exit(1);
-    }  
-    
-    /* Kernel loads below the memory hole */
-    next_free_space = MAX(next_free_space, start + size);
-
-    if (!quiet) {
-        printf("Placed kernel section (%p+%p)\n", _p(start), _p(size));
-    }
-}
-
-
-static address_t place_section(long int size, int align)
-/* Find the next available place for this section.  
- * "align" must be a power of 2 */
-{
-    address_t start;
-    assert(next_free_space != 0);
-    assert(((~align + 1) & align) == align);
-
-    start = ROUNDUP_P2(next_free_space, align);
-
-    /* Check that we don't hit the memory hole */
-    if (start < MEM_HOLE_END && (start + size) > MEM_HOLE_START) 
-        start = ROUNDUP_P2(MEM_HOLE_END, align);
-
-    next_free_space = start + size;
-
-    if (!quiet) {
-        printf("Placed section (%p+%p), align=%p\n", 
-               _p(start), _p(size), _p(align));
-    }
-    return start;
-}
-
-
-static address_t load_kernel(const char *filename)
-/* Load an elf32/multiboot kernel from this file 
- * Returns the entry address for the kernel. */
-{
-    unsigned int i;
-    address_t start;
-    size_t len;
-    long int size, loadsize;
-    FILE *fp;    
-    char *buffer;
-    section_t *sec, *s;
-    Elf32_Ehdr *ehdr;
-    Elf32_Phdr *phdr;
-    struct multiboot_header *mbh;
-    struct stat sb;
-
-    static char headerbuf[HEADERBUF_SIZE];
-
-    /* Stat and open the file */
-    if (stat(filename, &sb) != 0) {
-        printf("Fatal: cannot stat %s: %s\n", filename, strerror(errno));
-        exit(1);
-    }
-    if ((fp = fopen(filename, "r")) == NULL) {
-        printf("Fatal: cannot open %s: %s\n", filename, strerror(errno));
-        exit(1);
-    }
-    
-    /* Load the first 8k of the file */
-    if (fseek(fp, 0, SEEK_SET) < 0) {
-        printf("Fatal: seek error in %s: %s\n", filename, strerror(errno));
-        exit(1);
-    }
-    if ((len = fread(headerbuf, 1, HEADERBUF_SIZE, fp))
-        < HEADERBUF_SIZE)
-    {
-        if (feof(fp))   /* Short file */
-        {
-            if (len < 12) {
-                printf("Fatal: %s is too short to be a multiboot file.", 
-                       filename);
-                exit(1);
-            }
-        } else {
-            printf("Fatal: read error in %s: %s\n", filename, strerror(errno));
-            exit(1);
-        }
-    }
-
-    /* Sanity-check: is this file compressed? */
-    if ((headerbuf[0] == '\037' && 
-         (headerbuf[1] == '\235' /* .Z */ ||
-          headerbuf[1] == '\213' /* .gz */)) ||
-        (headerbuf[0] == 'B' && headerbuf[1] == 'Z') /* .bz[2] */) {
-        printf("Warning: %s looks like a compressed file.\n"
-               "         You should uncompress it first!\n", filename);
-    }
-    
-    /* Now look for a multiboot header */
-    for (i = 0; i <= MIN(len - 12, MULTIBOOT_SEARCH - 12); i += 4)
-    {
-        mbh = (struct multiboot_header *)(headerbuf + i);
-        if (eswap(mbh->magic) != MULTIBOOT_MAGIC 
-            || ((eswap(mbh->magic)+eswap(mbh->flags)+eswap(mbh->checksum)) 
-                               & 0xffffffff))
-        {
-            /* Not a multiboot header */
-            continue;
-        }
-        if (eswap(mbh->flags) & MULTIBOOT_UNSUPPORTED) {
-            /* Requires options we don't support */
-            printf("Fatal: found a multiboot header, but it "
-                    "requires multiboot options that I\n"
-                    "don't understand.  Sorry.\n");
-            exit(1);
-        } 
-        if (eswap(mbh->flags) & MULTIBOOT_VIDEO_MODE) { 
-            /* Asked for screen mode information */
-            /* XXX carry on regardless */
-            printf("Warning: found a multiboot header which asks "
-                   "for screen mode information.\n"
-                   "         This kernel will NOT be given valid"
-                   "screen mode information at boot time.\n");
-        }
-        /* This kernel will do: place and load it */
-
-        if (eswap(mbh->flags) & MULTIBOOT_AOUT_KLUDGE) {
-
-            /* Load using the offsets in the multiboot header */
-            if(!quiet) 
-                printf("Loading %s using multiboot header.\n", filename);
-
-            /* How much is there? */
-            start = eswap(mbh->load_addr);            
-            if (eswap(mbh->load_end_addr) != 0) 
-                loadsize = eswap(mbh->load_end_addr) - eswap(mbh->load_addr);
-            else 
-                loadsize = sb.st_size;
-            
-            /* How much memory will it take up? */ 
-            if (eswap(mbh->bss_end_addr) != 0)
-                size = eswap(mbh->bss_end_addr) - eswap(mbh->load_addr);
-            else
-                size = loadsize;
-            
-            if (loadsize > size) {
-                printf("Fatal: can't load %ld bytes of kernel into %ld bytes "
-                       "of memory.\n", loadsize, size);
-                exit(1);
-            }
-
-            /* Does it fit where it wants to be? */
-            place_kernel_section(start, size);            
-            
-            /* Load the kernel */
-            if ((buffer = malloc(size)) == NULL) {
-                printf("Fatal: malloc() for kernel load failed: %s\n",
-                       strerror(errno));
-                exit(1);
-            }
-            if ((fread(buffer, loadsize, 1, fp)) != 1) { 
-                printf("Fatal: cannot read %s: %s\n", 
-                       filename, strerror(errno));
-                exit(1);
-            }
-            fclose(fp);
-            
-            /* Clear the kernel BSS */
-            memset(buffer + loadsize, 0, size - loadsize);
-
-            /* Start off the linked list of sections */
-            if ((sec = (section_t *)malloc(sizeof (section_t))) == NULL) {
-                printf("Fatal: malloc() for section_t failed: %s\n",
-                       strerror(errno));
-                exit(1);
-            }
-            sec->buffer = buffer;
-            sec->start = start;
-            sec->size = size;
-            sec->next = NULL;
-            sec->prev = NULL;
-            sections = sec;
-            last_section = sec;
-            
-            /* Done. */
-            if (!quiet) printf("Loaded kernel from %s\n", filename);
-            return eswap(mbh->entry_addr);
-            
-        } else {
-
-            /* Now look for an ELF32 header */    
-            ehdr = (Elf32_Ehdr *)headerbuf;
-            if (*(unsigned long *)ehdr != eswap(0x464c457f)
-                || ehdr->e_ident[EI_DATA] != ELFDATA2LSB
-                || ehdr->e_ident[EI_CLASS] != ELFCLASS32
-                || eswap(ehdr->e_machine) != EM_386)
-            {
-                printf("Fatal: kernel has neither ELF32/x86 nor multiboot load"
-                       " headers.\n");
-                exit(1);
-            }
-            if (eswap(ehdr->e_phoff) + eswap(ehdr->e_phnum)*sizeof(*phdr) 
-                               > HEADERBUF_SIZE) {
-                /* Don't expect this will happen with sane kernels */
-                printf("Fatal: too much ELF for me.  Try increasing "
-                       "HEADERBUF_SIZE in mbootpack.\n");
-                exit(1);
-            }
-            if (eswap(ehdr->e_phoff) + eswap(ehdr->e_phnum)*sizeof (*phdr) 
-                               > len) {
-                printf("Fatal: malformed ELF header overruns EOF.\n");
-                exit(1);
-            }
-            if (eswap(ehdr->e_phnum) <= 0) {
-                printf("Fatal: ELF kernel has no program headers.\n");
-                exit(1);
-            }
-
-            if(!quiet) 
-                printf("Loading %s using ELF header.\n", filename);
-
-            if (eswap(ehdr->e_type) != ET_EXEC 
-                || eswap(ehdr->e_version) != EV_CURRENT
-                || eswap(ehdr->e_phentsize) != sizeof (Elf32_Phdr)) {
-                printf("Warning: funny-looking ELF header.\n");
-            }
-            phdr = (Elf32_Phdr *)(headerbuf + eswap(ehdr->e_phoff));
-
-            /* Obey the program headers to load the kernel */
-            for(i = 0; i < eswap(ehdr->e_phnum); i++) {
-
-                start = eswap(phdr[i].p_paddr);
-                size = eswap(phdr[i].p_memsz);
-                if (eswap(phdr[i].p_type) != PT_LOAD) 
-                    loadsize = 0;
-                else 
-                    loadsize = MIN((long int)eswap(phdr[i].p_filesz), size);
-
-                if ((buffer = malloc(size)) == NULL) {
-                    printf("Fatal: malloc() for kernel load failed: %s\n",
-                           strerror(errno));
-                    exit(1);
-                }
-
-                /* Place the section where it wants to be */
-                place_kernel_section(start, size);            
-
-                /* Load section from file */ 
-                if (loadsize > 0) {
-                    if (fseek(fp, eswap(phdr[i].p_offset), SEEK_SET) != 0) {
-                        printf("Fatal: seek failed in %s\n",
-                                strerror(errno));
-                        exit(1);
-                    }
-                    if ((fread(buffer, loadsize, 1, fp)) != 1) { 
-                        printf("Fatal: cannot read %s: %s\n", 
-                               filename, strerror(errno));
-                        exit(1);
-                    }
-                }
-
-                /* Clear the rest of the buffer */
-                memset(buffer + loadsize, 0, size - loadsize);
-
-                /* Add this section to the list (keeping it ordered) */
-                if ((sec = (section_t *)malloc(sizeof (section_t))) == NULL) {
-                    printf("Fatal: malloc() for section_t failed: %s\n",
-                           strerror(errno));
-                    exit(1);
-                }
-                sec->buffer = buffer;
-                sec->start = start;
-                sec->size = size;
-
-                for(s = sections; s; s = s->next) {
-                    if (s->start > start) {
-                        sec->next = s;
-                        if (s->prev == NULL) {
-                            /* sec becomes the new first item */
-                            s->prev = sec;
-                            sections = sec;
-                        } else {
-                            /* sec goes between s->prev and s */
-                            sec->prev = s->prev;
-                            sec->prev->next = sec;
-                            s->prev = sec;
-                        }
-                        break;
-                    }
-                }
-                if (s == NULL) {
-                    /* sec becomes the new last item */
-                    sec->next = NULL;
-                    sec->prev = last_section;
-                    if (last_section) {
-                        last_section->next = sec;
-                    } else {
-                        sections = sec;
-                    }
-                    last_section = sec;
-                }
-            }
-         
-            /* Done! */
-            if (!quiet) printf("Loaded kernel from %s\n", filename);
-            return eswap(ehdr->e_entry);
-        }
-
-    }
-
-    /* This is not a multiboot kernel */
-    printf("Fatal: %s is not a multiboot kernel.\n", filename);
-    exit(1);
-}
-
-
-int main(int argc, char **argv) 
-{
-    char *buffer, *imagename, *command_line, *p;
-    char *mod_filename, *mod_command_line, *mod_clp;
-    char *out_filename;
-    section_t *sec;
-    FILE *fp;
-    struct stat sb;
-    struct multiboot_info *mbi;
-    struct mod_list *modp;
-    address_t start, kernel_entry;
-    long int size, mod_command_line_space, command_line_len;
-    int modules, opt, mbi_reloc_offset;
-
-    static const char short_options[] = "hc:m:o:qM";
-    static const struct option options[] = {
-        { "help",              0, 0, 'h' },
-        { "command-line",      1, 0, 'c' },
-        { "append",            1, 0, 'c' },
-        { "module",            1, 0, 'm' },
-        { "output",            1, 0, 'o' },
-        { "quiet",             0, 0, 'q' },
-        { 0,                   0, 0, 0 },
-    };
-
-    /* Parse the command line */
-    out_filename = NULL;
-    command_line = "";
-    command_line_len = 0;
-    modules = 0;
-    mod_command_line_space = 0;
-    while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1)
-    {
-        switch(opt) {
-        case 'c':
-            command_line = optarg;
-            break;
-        case 'm':
-            modules++;
-            mod_command_line_space += strlen(optarg) + 1;
-            break;
-        case 'o':
-            out_filename = optarg;
-            break;
-        case 'q':
-            quiet = 1;
-            break;
-        case 'h':
-        case '?':
-        default:
-            usage();
-        }
-    }
-    imagename = argv[optind];
-    if (!imagename || strlen(imagename) == 0) usage();
-    command_line_len = strlen(command_line) + strlen(imagename) + 2;
-    /* Leave space to overwritethe command-line at boot time */
-    command_line_len = MAX(command_line_len, CMD_LINE_SPACE); 
-    if (!out_filename) out_filename = "bzImage";
-
-    /* Place and load the kernel */
-    kernel_entry = load_kernel(imagename);
-    assert(sections != NULL);
-    assert(last_section != NULL);
-    assert(next_free_space != 0);
-    
-    /* Next section is all the metadata between kernel and modules */
-    size = ((((sizeof (struct multiboot_info)
-               + command_line_len
-               + strlen(version_string) + 1
-               + mod_command_line_space) 
-              + 3 ) & ~3)
-            + modules * sizeof (struct mod_list));
-    /* Locate this section after the setup sectors, in *low* memory */
-    start = place_mbi(size);
-
-    if ((buffer = malloc(size)) == NULL) {
-        printf("Fatal: malloc() for boot metadata failed: %s\n",
-               strerror(errno));
-        exit(1);
-    }
-
-    if ((sec = (section_t *)malloc(sizeof (section_t))) == NULL) {
-        printf("Fatal: malloc() for section_t failed: %s\n",
-               strerror(errno));
-        exit(1);
-    }
-    sec->buffer = buffer;
-    sec->start = start;
-    sec->size = size;
-    sec->next = NULL;
-    sec->prev = last_section;
-    last_section->next = sec;
-    last_section = sec;
-
-    /* Multiboot info struct */
-    mbi = (struct multiboot_info *)buffer;
-    memset(buffer, 0, sizeof (struct multiboot_info));
-    mbi_reloc_offset = start - (address_t)buffer;
-    
-    /* Command line */
-    p = (char *)(mbi + 1);
-    sprintf(p, "%s %s", imagename, command_line);
-    mbi->cmdline = eswap(((address_t)p) + mbi_reloc_offset);
-    p += command_line_len;
-
-    /* Bootloader ID */
-    sprintf(p, version_string);
-    mbi->boot_loader_name = eswap(((address_t)p) + mbi_reloc_offset);
-    p += strlen(version_string) + 1;
-
-    /* Next is space for the module command lines */
-    mod_clp = p;
-
-    /* Last come the module info structs */
-    modp = (struct mod_list *)
-        ((((address_t)p + mod_command_line_space) + 3) & ~3);
-    mbi->mods_count = eswap(modules);
-    mbi->mods_addr = eswap(((address_t)modp) + mbi_reloc_offset);
-
-    /* Memory information will be added at boot time, by setup.S 
-     * or trampoline.S. */
-    mbi->flags = eswap(MB_INFO_CMDLINE | MB_INFO_BOOT_LOADER_NAME);
-
-
-    /* Load the modules */
-    if (modules) {
-        mbi->flags = eswap(eswap(mbi->flags) | MB_INFO_MODS);
-                
-        /* Go back and parse the module command lines */
-        optind = opterr = 1;
-        while((opt = getopt_long(argc, argv, 
-                                 short_options, options, 0)) != -1)
-        {
-            if (opt != 'm') continue;
-
-            /* Split module filename from command line */
-            mod_command_line = mod_filename = optarg;
-            if ((p = strchr(mod_filename, ' ')) != NULL) {
-                /* See as I discard the 'const' modifier */
-                *p = '\0';
-            }
-
-            /* Find space for it */
-            if (stat(mod_filename, &sb) != 0) {
-                printf("Fatal: cannot stat %s: %s\n",
-                       mod_filename, strerror(errno));
-                exit(1);
-            }
-            size = sb.st_size;
-            start = place_section(size, X86_PAGE_SIZE);
-            /* XXX should be place_section(size, 4) if the MBH hasn't got
-             * XXX MULTIBOOT_PAGE_ALIGN set, but that breaks Xen */
-
-            /* Load it */ 
-            if ((buffer = malloc(sb.st_size)) == NULL) {
-                printf("Fatal: malloc failed for module load: %s\n",
-                       strerror(errno));
-                exit(1);
-            }
-            if ((fp = fopen(mod_filename, "r")) == NULL) {
-                printf("Fatal: cannot open %s: %s\n",
-                       mod_filename, strerror(errno));
-                exit(1);
-            }
-            if ((fread(buffer, sb.st_size, 1, fp)) != 1) { 
-                printf("Fatal: cannot read %s: %s\n",
-                       mod_filename, strerror(errno));
-                exit(1);
-            }
-            fclose(fp);
-            
-            /* Sanity-check: is this file compressed? */
-            if ((buffer[0] == '\037' && 
-                 (buffer[1] == '\235' /* .Z */ ||
-                  buffer[1] == '\213' /* .gz */)) ||
-                (buffer[0] == 'B' && buffer[1] == 'Z') /* .bz[2] */) {
-                printf("Warning: %s looks like a compressed file.\n",
-                       mod_filename);
-            }
-
-            if (!quiet) printf("Loaded module from %s\n", mod_filename);
-
-            /* Restore the command line to its former glory */
-            if (p != NULL) *p = ' ';
-
-            /* Fill in the module info struct */
-            modp->mod_start = eswap(start);
-            modp->mod_end = eswap(start + size);
-            modp->cmdline = eswap((address_t)mod_clp + mbi_reloc_offset);
-            modp->pad = eswap(0);
-            modp++;
-
-            /* Store the module command line */
-            sprintf(mod_clp, "%s", mod_command_line);
-            mod_clp += strlen(mod_clp) + 1;
-
-            /* Add the section to the list */
-            if ((sec = (section_t *)malloc(sizeof (section_t))) == NULL) {
-                printf("Fatal: malloc() for section_t failed: %s\n",
-                       strerror(errno));
-                exit(1);
-            }
-            sec->buffer = buffer;
-            sec->start = start;
-            sec->size = size;
-            sec->next = NULL;
-            sec->prev = last_section;
-            last_section->next = sec;
-            last_section = sec;
-
-        }
-               
-    }
-    
-    /* Everything is placed and loaded.  Now we package it all up 
-     * as a bzImage */
-    if ((fp = fopen(out_filename, "w")) == NULL) {
-        printf("Fatal: cannot open %s: %s\n", out_filename, strerror(errno));
-        exit(1);
-    }
-    make_bzImage(sections, 
-                 kernel_entry, 
-                 ((address_t)mbi) + mbi_reloc_offset,
-                 fp);
-    fclose(fp);
-
-    /* Success! */
-    if(!quiet) printf("Finished.\n");
-    return 0;
-}
-
-/*
- *  EOF (mbootpack.c)
- */
-
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/mbootpack.h
--- a/tools/misc/mbootpack/mbootpack.h  Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- *  mbootpack.h
- *
- *  Common definitions for mbootpack
- * 
- *  Copyright (C) 2003-2004  Tim Deegan (tjd21@xxxxxxxxxxxx)
- * 
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * $Id: mbootpack.h,v 1.2 2005/03/23 10:38:37 tjd21 Exp $
- *
- */
-
-#ifndef __MBOOTPACK__H__
-#define __MBOOTPACK__H__
-
-#ifndef __MB_ASM
-
-#undef NDEBUG
-#include <stdio.h>
-
-#include <endian.h>
-#include <byteswap.h>
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define eswap(x) (x)
-#else 
-#define eswap(x)                                               \
-        ({                                                      \
-               typeof(x) y = (x);                              \
-               switch(sizeof(y))                               \
-               {                                               \
-               case 2: y = __bswap_16(y); break;               \
-               case 4: y = __bswap_32(y); break;               \
-               case 8: y = __bswap_64(y); break;               \
-               }                                               \
-               y;                                              \
-        })     
-#endif                 
-
-/* Flags */
-extern int quiet;
-
-/* Types */
-typedef unsigned long address_t;
-
-typedef struct section_t {
-    char *buffer;
-    address_t start;
-    long int size;
-    struct section_t *prev;
-    struct section_t *next;
-} section_t;
-
-/* buildimage.c */
-extern void make_bzImage(section_t *sections, 
-                         address_t entry, 
-                         address_t mbi, 
-                         FILE *fp);
-
-address_t place_mbi(long int size);
-
-
-/* trampoline.S */
-extern unsigned char mb_trampoline[];
-extern unsigned char mb_trampoline_end[];
-extern volatile address_t mb_mbi_address, mb_entry_address;
-
-/* Macros */
-#define MIN(_x,_y) (((_x)<=(_y))?(_x):(_y))
-#define MAX(_x,_y) (((_x)<=(_y))?(_y):(_x))
-#define ROUNDUP_P2(_x, _a) (((_x)+((_a)-1))&(~((_a)-1)))
-
-#endif
-
-/* x86 memory: such fun */
-#define MEM_HOLE_START  0xa0000
-#define MEM_HOLE_END    0x100000
-#define HIGHMEM_START   MEM_HOLE_END
-#define X86_PAGE_SIZE   0x1000
-
-/* How much command line we'll take from the bootloader. */
-#define CMD_LINE_SPACE  0x300
-
-/* Number of 512-byte sectors to load in low memory (max 7) */
-#define SETUPSECTS     7
-
-
-/* Who are we? */
-#define MBOOTPACK_VERSION_STRING "v0.2 (alpha)"
-
-#endif /* __MBOOTPACK__H__ */
-
-/*
- *  EOF (mbootpack.h)
- */
-
diff -r 3dfeb3e4a03f -r a1fdeb2c6d77 tools/misc/mbootpack/setup.S
--- a/tools/misc/mbootpack/setup.S      Fri Oct 13 11:00:32 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1064 +0,0 @@
-/*
- *  bootsect.S
- *
- *  This is setup.S from the linux 2.6.9 source code,
- *  with heavy cuts and changes for mbootpack
- *  November 2004 Tim Deegan <tjd21@xxxxxxxxxxxx>
- *
- *  
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- *  02111-1307, USA.
- *
- * $Id: setup.S,v 1.4 2005/03/23 10:39:03 tjd21 Exp $
- *
- */
-       
-#include "mbootpack.h"
-               
-/*
- *     setup.S         Copyright (C) 1991, 1992 Linus Torvalds
- *
- * setup.s is responsible for getting the system data from the BIOS,
- * and putting them into the appropriate places in system memory.
- * both setup.s and system has been loaded by the bootblock.
- *
- * This code asks the bios for memory/disk/other parameters, and
- * puts them in a "safe" place: 0x90000-0x901FF, ie where the
- * boot-block used to be. It is then up to the protected mode
- * system to read them from there before the area is overwritten
- * for buffer-blocks.
- *
- * Move PS/2 aux init code to psaux.c
- * (troyer@xxxxxxxxxxxxxxxxxxxxxxxxxxx) 03Oct92
- *
- * some changes and additional features by Christoph Niemann,
- * March 1993/June 1994 (Christoph.Niemann@xxxxxxxxx)
- *
- * add APM BIOS checking by Stephen Rothwell, May 1994
- * (sfr@xxxxxxxxxxxxxxxx)
- *
- * High load stuff, initrd support and position independency
- * by Hans Lermen & Werner Almesberger, February 1996
- * <lermen@xxxxxxxxxxxxxxxxxx>, <almesber@xxxxxxxxxxx>
- *
- * Video handling moved to video.S by Martin Mares, March 1996
- * <mj@xxxxxxxxxxxxxxxxx>
- *
- * Extended memory detection scheme retwiddled by orc@xxxxxxxxxxxxxx (david
- * parsons) to avoid loadlin confusion, July 1997
- *
- * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999.
- * <stiker@xxxxxxxxxxxxx>
- *
- * Fix to work around buggy BIOSes which dont use carry bit correctly
- * and/or report extended memory in CX/DX for e801h memory size detection 
- * call.  As a result the kernel got wrong figures.  The int15/e801h docs
- * from Ralf Brown interrupt list seem to indicate AX/BX should be used
- * anyway.  So to avoid breaking many machines (presumably there was a reason
- * to orginally use CX/DX instead of AX/BX), we do a kludge to see
- * if CX/DX have been changed in the e801 call and if so use AX/BX .
- * Michael Miller, April 2001 <michaelm@xxxxxxxx>
- *
- * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes
- * by Robert Schwebel, December 2001 <robert@xxxxxxxxxxx>
- */
-
-/*
-#include <linux/config.h>
-#include <asm/segment.h>
-#include <linux/version.h>
-#include <linux/compile.h>
-#include <asm/boot.h>
-#include <asm/e820.h>
-#include <asm/page.h>
-*/
-
-/* Definitions that should have come from these includes */
-#define DEF_INITSEG     0x9000
-#define DEF_SYSSEG      0x1000
-#define DEF_SETUPSEG    0x9020
-#define DEF_SYSSIZE     0x7F00
-#define NORMAL_VGA      0xffff
-#define EXTENDED_VGA    0xfffe
-#define ASK_VGA         0xfffd
-#define GDT_ENTRY_BOOT_CS      2
-#define __BOOT_CS              (GDT_ENTRY_BOOT_CS * 8)
-#define GDT_ENTRY_BOOT_DS      (GDT_ENTRY_BOOT_CS + 1)
-#define __BOOT_DS              (GDT_ENTRY_BOOT_DS * 8)
-#define __PAGE_OFFSET           (0xC0000000)
-#define E820MAP 0x2d0           /* our map */
-#define E820MAX 32              /* number of entries in E820MAP */
-#define E820NR  0x1e8           /* # entries in E820MAP */
-#define E820_RAM        1
-#define E820_RESERVED   2
-#define E820_ACPI       3 /* usable as RAM once ACPI tables have been read */
-#define E820_NVS        4
-#define __BIG_KERNEL__
-       
-               
-/* Signature words to ensure LILO loaded us right */
-#define SIG1   0xAA55
-#define SIG2   0x5A5A
-       
-INITSEG  = DEF_INITSEG         # 0x9000, we move boot here, out of the way
-SYSSEG   = DEF_SYSSEG          # 0x1000, system loaded at 0x10000 (65536).
-SETUPSEG = DEF_SETUPSEG                # 0x9020, this is the current segment
-                               # ... and the former contents of CS
-
-DELTA_INITSEG = SETUPSEG - INITSEG     # 0x0020
-
-.code16
-.globl _start, begtext, begdata, begbss, endtext, enddata, endbss
-
-.text
-begtext:
-.data
-begdata:
-.bss
-begbss:
-.text
-
-_start:
-start:
-       jmp     trampoline
-
-# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
-
-               .ascii  "HdrS"          # header signature
-               .word   0x0203          # header version number (>= 0x0105)
-                                       # or else old loadlin-1.5 will fail)
-realmode_swtch:        .word   0, 0            # default_switch, SETUPSEG
-start_sys_seg: .word   SYSSEG
-               .word   kernel_version  # pointing to kernel version string
-                                       # above section of header is compatible
-                                       # with loadlin-1.5 (header v1.5). Don't
-                                       # change it.
-
-type_of_loader:        .byte   0               # = 0, old one (LILO, Loadlin,
-                                       #      Bootlin, SYSLX, bootsect...)
-                                       # See Documentation/i386/boot.txt for
-                                       # assigned ids
-       
-# flags, unused bits must be zero (RFU) bit within loadflags
-loadflags:
-LOADED_HIGH    = 1                     # If set, the kernel is loaded high
-CAN_USE_HEAP   = 0x80                  # If set, the loader also has set
-                                       # heap_end_ptr to tell how much
-                                       # space behind setup.S can be used for
-                                       # heap purposes.
-                                       # Only the loader knows what is free
-#ifndef __BIG_KERNEL__
-               .byte   0
-#else
-               .byte   LOADED_HIGH
-#endif
-
-setup_move_size: .word  0x8000         # size to move, when setup is not
-                                       # loaded at 0x90000. We will move setup 
-                                       # to 0x90000 then just before jumping
-                                       # into the kernel. However, only the
-                                       # loader knows how much data behind
-                                       # us also needs to be loaded.
-
-/* N.B. these next addresses are entirely ignored by this code -- it
- * assumes it was loaded with the 32bit code at 0x100000, and doesn't 
- * touch the ramdisk. */
-code32_start:                          # here loaders can put a different
-                                       # start address for 32-bit code.
-#ifndef __BIG_KERNEL__
-               .long   0x1000          #   0x1000 = default for zImage
-#else
-               .long   0x100000        # 0x100000 = default for big kernel
-#endif
-
-ramdisk_image: .long   0               # address of loaded ramdisk image
-                                       # Here the loader puts the 32-bit
-                                       # address where it loaded the image.
-                                       # This only will be read by the kernel.
-
-ramdisk_size:  .long   0               # its size in bytes
-
-bootsect_kludge:
-               .long   0               # obsolete
-
-heap_end_ptr:  .word   modelist+1024   # (Header version 0x0201 or later)
-                                       # space from here (exclusive) down to
-                                       # end of setup code can be used by setup
-                                       # for local heap purposes.
-
-pad1:          .word   0
-cmd_line_ptr:  .long 0                 # (Header version 0x0202 or later)
-                                       # If nonzero, a 32-bit pointer
-                                       # to the kernel command line.
-                                       # The command line should be
-                                       # located between the start of
-                                       # setup and the end of low
-                                       # memory (0xa0000), or it may
-                                       # get overwritten before it
-                                       # gets read.  If this field is
-                                       # used, there is no longer
-                                       # anything magical about the
-                                       # 0x90000 segment; the setup
-                                       # can be located anywhere in
-                                       # low memory 0x10000 or higher.
-
-ramdisk_max:   .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
-                                       # (Header version 0x0203 or later)
-                                       # The highest safe address for
-                                       # the contents of an initrd
-
-/* Add more known locations: the image builder will overwrite
- * these with the entry point and MBI location for the multiboot kernel.
- * These offsets *must* match the definitions in buildimage.c  */
-
-entry_address: .long 0         # This will be offset 0x30 (0x230 from b'sect)
-mbi_address:   .long 0         # This will be offset 0x34
-
-/* Storage space for the size of memory */
-highmem_size:  .long 0
-               
-trampoline:    call    start_of_setup
-               .space  1024
-# End of setup header #####################################################
-
-start_of_setup:
-# Bootlin depends on this being done early
-       movw    $0x01500, %ax
-       movb    $0x81, %dl
-       int     $0x13
-
-#ifdef SAFE_RESET_DISK_CONTROLLER
-# Reset the disk controller.
-       movw    $0x0000, %ax
-       movb    $0x80, %dl
-       int     $0x13
-#endif
-
-# Set %ds = %cs, we know that SETUPSEG = %cs at this point
-       movw    %cs, %ax                # aka SETUPSEG
-       movw    %ax, %ds
-       
-# Check signature at end of setup      
-       cmpw    $SIG1, setup_sig1
-       jne     bad_sig
-
-       cmpw    $SIG2, setup_sig2
-       jne     bad_sig
-
-       jmp     good_sig1
-
-# Routine to print asciiz string at ds:si
-prtstr:
-       lodsb
-       andb    %al, %al
-       jz      fin
-
-       call    prtchr
-       jmp     prtstr
-
-fin:   ret
-
-# Space printing
-prtsp2:        call    prtspc          # Print double space
-prtspc:        movb    $0x20, %al      # Print single space (note: fall-thru)
-
-# Part of above routine, this one just prints ascii al
-prtchr:        pushw   %ax
-       pushw   %cx
-       movw    $7,%bx
-       movw    $0x01, %cx
-       movb    $0x0e, %ah
-       int     $0x10
-       popw    %cx
-       popw    %ax
-       ret
-
-beep:  movb    $0x07, %al
-       jmp     prtchr
-       
-no_sig_mess: .string   "No setup signature found ..."
-
-good_sig1:
-       jmp     good_sig
-
-# We now have to find the rest of the setup code/data
-bad_sig:
-       movw    %cs, %ax                        # SETUPSEG
-       subw    $DELTA_INITSEG, %ax             # INITSEG
-       movw    %ax, %ds
-       xorb    %bh, %bh
-       movb    (497), %bl                      # get setup sect from bootsect
-       subw    $4, %bx                         # LILO loads 4 sectors of setup
-       shlw    $8, %bx                         # convert to words (1sect=2^8 
words)
-       movw    %bx, %cx
-       shrw    $3, %bx                         # convert to segment
-       addw    $SYSSEG, %bx
-       movw    %bx, %cs:start_sys_seg
-# Move rest of setup code/data to here
-       movw    $2048, %di                      # four sectors loaded by LILO
-       subw    %si, %si
-       pushw   %cs
-       popw    %es
-       movw    $SYSSEG, %ax
-       movw    %ax, %ds
-       rep
-       movsw
-       movw    %cs, %ax                        # aka SETUPSEG
-       movw    %ax, %ds
-       cmpw    $SIG1, setup_sig1
-       jne     no_sig
-
-       cmpw    $SIG2, setup_sig2
-       jne     no_sig
-
-       jmp     good_sig
-
-no_sig:
-       lea     no_sig_mess, %si
-       call    prtstr
-
-no_sig_loop:
-       hlt
-       jmp     no_sig_loop
-
-mb_hello_mess1:
-       .string "mboot"
-       
-good_sig:
-       lea     mb_hello_mess1, %si
-       call    prtstr
-
-       movw    %cs, %ax                        # aka SETUPSEG
-       subw    $DELTA_INITSEG, %ax             # aka INITSEG
-       movw    %ax, %ds
-# Check if an old loader tries to load a big-kernel
-       testb   $LOADED_HIGH, %cs:loadflags     # Do we have a big kernel?
-       jz      loader_ok                       # No, no danger for old loaders.
-
-       cmpb    $0, %cs:type_of_loader          # Do we have a loader that
-                                               # can deal with us?
-       jnz     loader_ok                       # Yes, continue.
-
-       pushw   %cs                             # No, we have an old loader,
-       popw    %ds                             # die. 
-       lea     loader_panic_mess, %si
-       call    prtstr
-
-       jmp     no_sig_loop
-
-loader_panic_mess: .string "Wrong loader, giving up..."
-
-loader_ok:
-       
-# Get memory size (extended mem, kB)
-
-/* We'll be storing this in highmem_size, to be copied to the mbi */
-
-# Try three different memory detection schemes.  First, try
-# e820h, which lets us assemble a memory map, then try e801h,
-# which returns a 32-bit memory size, and finally 88h, which
-# returns 0-64m
-
-       xorl    %edx, %edx
-       xorl    %eax, %eax
-       movl    %eax, (0x1e0)
-       movl    %eax, highmem_size
-       movb    %al, (E820NR)
-       
-# method E820H:
-# the memory map from hell.  e820h returns memory classified into
-# a whole bunch of different types, and allows memory holes and
-# everything.  We scan through this memory map and build a list
-# of the first 32 memory areas, which we return at [E820MAP].
-# This is documented at http://www.acpi.info/, in the ACPI 2.0 specification.
-
-#define SMAP  0x534d4150
-
-meme820:
-       xorl    %ebx, %ebx                      # continuation counter
-       movw    $E820MAP, %di                   # point into the whitelist
-                                               # so we can have the bios
-                                               # directly write into it.
-
-jmpe820:
-       movl    $0x0000e820, %eax               # e820, upper word zeroed
-       movl    $SMAP, %edx                     # ascii 'SMAP'
-       movl    $20, %ecx                       # size of the e820rec
-       pushw   %ds                             # data record.
-       popw    %es
-       int     $0x15                           # make the call
-       jc      bail820                         # fall to e801 if it fails
-
-       cmpl    $SMAP, %eax                     # check the return is `SMAP'
-       jne     bail820                         # fall to e801 if it fails
-
-#      cmpl    $1, 16(%di)                     # is this usable memory?
-#      jne     again820
-
-       # If this is usable memory, we save it by simply advancing %di by
-       # sizeof(e820rec).
-       #
-good820:
-       movb    (E820NR), %al                   # up to 32 entries
-       cmpb    $E820MAX, %al
-       jnl     bail820
-
-       incb    (E820NR)
-       movw    %di, %ax
-       addw    $20, %ax
-       movw    %ax, %di
-again820:
-       cmpl    $0, %ebx                        # check to see if
-       jne     jmpe820                         # %ebx is set to EOF    
-
-/* Multiboot spec says high mem should be the address of the first
- * upper memory hole, minus 1 MB */
-       xorl    %ebx, %ebx
-       xorl    %ecx, %ecx
-       xorl    %edx, %edx
-       movw    $E820MAP, %di                   # Start at the beginning
-calc_highmem_loop:
-       cmpl    $1, 16(%di)                     # is it usable memory?
-       jnz     calc_highmem_next
-       cmpl    $0, 4(%di)                      # is base < 4GB?
-       jnz     calc_highmem_next
-       cmpl    $0x100000, 0(%di)               # is base <= 1MB?
-       jg      calc_highmem_next
-       movl    8(%di), %ecx                    # Calculate base+length
-       shrl    $10, %ecx                       # in kilobytes
-       movl    12(%di), %edx
-       shll    $22, %edx
-       orl     %edx, %ecx
-       movl    0(%di), %edx
-       shrl    $10, %edx
-       addl    %edx, %ecx
-       subl    $1024, %ecx                     # - 1 MB
-       cmpl    %cs:highmem_size, %ecx
-       jl      calc_highmem_next
-       movl    %ecx, %cs:highmem_size
-calc_highmem_next:
-       add     $1, %bl
-       add     $20, %di
-       cmp     %bl, (E820NR)
-       je      calc_highmem_done
-       jmp     calc_highmem_loop
-calc_highmem_done:
-                       
-bail820:
-
-# method E801H:
-# memory size is in 1k chunksizes, to avoid confusing loadlin.
-
-meme801:
-       stc                                     # fix to work around buggy
-       xorw    %cx,%cx                         # BIOSes which dont clear/set
-       xorw    %dx,%dx                         # carry on pass/error of
-                                               # e801h memory size call
-                                               # or merely pass cx,dx though
-                                               # without changing them.
-       movw    $0xe801, %ax
-       int     $0x15
-       jc      mem88
-
-       cmpw    $0x0, %cx                       # Kludge to handle BIOSes
-       jne     e801usecxdx                     # which report their extended
-       cmpw    $0x0, %dx                       # memory in AX/BX rather than
-       jne     e801usecxdx                     # CX/DX.  The spec I have read
-       movw    %ax, %cx                        # seems to indicate AX/BX 
-       movw    %bx, %dx                        # are more reasonable anyway...
-
-e801usecxdx:
-       andl    $0xffff, %edx                   # clear sign extend
-       shll    $6, %edx                        # and go from 64k to 1k chunks
-       andl    $0xffff, %ecx                   # clear sign extend
-       addl    %ecx, %edx
-
-       cmpl    %cs:highmem_size, %edx          # store extended mem size
-       jl      mem88                           # if it's bigger than
-       movl    %edx, %cs:highmem_size          # what we already have
-       
-# Ye Olde Traditional Methode.  Returns the memory size (up to 16mb or
-# 64mb, depending on the bios) in ax.
-mem88:
-       movb    $0x88, %ah
-       int     $0x15
-
-       andl    $0xffff, %eax                   # clear sign extend
-       cmpl    %cs:highmem_size, %eax          # store extended mem size
-       jl      have_memsize                    # if it's bigger than
-       movl    %eax, %cs:highmem_size          # what we already have
-
-have_memsize:
-       
-/* Culled: HDD probes, APM, speedstep */
-
-# Now we want to move to protected mode ...
-       cmpw    $0, %cs:realmode_swtch
-       jz      rmodeswtch_normal
-
-       lcall   *%cs:realmode_swtch
-
-       jmp     rmodeswtch_end
-
-rmodeswtch_normal:
-        pushw  %cs
-       call    default_switch
-
-rmodeswtch_end:
-
-/* Culled: code to take the 32bit entry address from the loader */
-/* Culled: code to relocate non-bzImage kernels */
-       
-       # then we load the segment descriptors
-       movw    %cs, %ax                        # aka SETUPSEG
-       movw    %ax, %ds
-               
-# Check whether we need to be downward compatible with version <=201
-       cmpl    $0, cmd_line_ptr
-       jne     end_move_self           # loader uses version >=202 features
-       cmpb    $0x20, type_of_loader
-       je      end_move_self           # bootsect loader, we know of it
-
-# Boot loader doesnt support boot protocol version 2.02.
-# If we have our code not at 0x90000, we need to move it there now.
-# We also then need to move the params behind it (commandline)
-# Because we would overwrite the code on the current IP, we move
-# it in two steps, jumping high after the first one.
-       movw    %cs, %ax
-       cmpw    $SETUPSEG, %ax
-       je      end_move_self
-
-       cli                                     # make sure we really have
-                                               # interrupts disabled !
-                                               # because after this the stack
-                                               # should not be used
-       subw    $DELTA_INITSEG, %ax             # aka INITSEG
-       movw    %ss, %dx
-       cmpw    %ax, %dx
-       jb      move_self_1
-
-       addw    $INITSEG, %dx
-       subw    %ax, %dx                        # this will go into %ss after
-                                               # the move
-move_self_1:
-       movw    %ax, %ds
-       movw    $INITSEG, %ax                   # real INITSEG
-       movw    %ax, %es
-       movw    %cs:setup_move_size, %cx
-       std                                     # we have to move up, so we use
-                                               # direction down because the
-                                               # areas may overlap
-       movw    %cx, %di
-       decw    %di
-       movw    %di, %si
-       subw    $move_self_here+0x200, %cx
-       rep
-       movsb
-       ljmp    $SETUPSEG, $move_self_here
-
-move_self_here:
-       movw    $move_self_here+0x200, %cx
-       rep
-       movsb
-       movw    $SETUPSEG, %ax
-       movw    %ax, %ds
-       movw    %dx, %ss
-end_move_self:                                 # now we are at the right place
-
-#
-# Enable A20.  This is at the very best an annoying procedure.
-# A20 code ported from SYSLINUX 1.52-1.63 by H. Peter Anvin.
-# AMD Elan bug fix by Robert Schwebel.
-#
-
-#if defined(CONFIG_X86_ELAN)
-       movb $0x02, %al                 # alternate A20 gate
-       outb %al, $0x92                 # this works on SC410/SC520
-a20_elan_wait:
-       call a20_test
-       jz a20_elan_wait
-       jmp a20_done
-#endif
-
-
-A20_TEST_LOOPS         =  32           # Iterations per wait
-A20_ENABLE_LOOPS       = 255           # Total loops to try            
-
-
-#ifndef CONFIG_X86_VOYAGER
-a20_try_loop:
-
-       # First, see if we are on a system with no A20 gate.
-a20_none:
-       call    a20_test
-       jnz     a20_done
-
-       # Next, try the BIOS (INT 0x15, AX=0x2401)
-a20_bios:
-       movw    $0x2401, %ax
-       pushfl                                  # Be paranoid about flags
-       int     $0x15
-       popfl
-
-       call    a20_test
-       jnz     a20_done
-
-       # Try enabling A20 through the keyboard controller
-#endif /* CONFIG_X86_VOYAGER */
-a20_kbc:
-       call    empty_8042
-
-#ifndef CONFIG_X86_VOYAGER
-       call    a20_test                        # Just in case the BIOS worked
-       jnz     a20_done                        # but had a delayed reaction.
-#endif
-
-       movb    $0xD1, %al                      # command write
-       outb    %al, $0x64
-       call    empty_8042
-
-       movb    $0xDF, %al                      # A20 on
-       outb    %al, $0x60
-       call    empty_8042
-
-#ifndef CONFIG_X86_VOYAGER
-       # Wait until a20 really *is* enabled; it can take a fair amount of
-       # time on certain systems; Toshiba Tecras are known to have this
-       # problem.
-a20_kbc_wait:
-       xorw    %cx, %cx
-a20_kbc_wait_loop:
-       call    a20_test
-       jnz     a20_done
-       loop    a20_kbc_wait_loop
-
-       # Final attempt: use "configuration port A"
-a20_fast:
-       inb     $0x92, %al                      # Configuration Port A
-       orb     $0x02, %al                      # "fast A20" version
-       andb    $0xFE, %al                      # don't accidentally reset
-       outb    %al, $0x92
-
-       # Wait for configuration port A to take effect
-a20_fast_wait:
-       xorw    %cx, %cx
-a20_fast_wait_loop:
-       call    a20_test
-       jnz     a20_done
-       loop    a20_fast_wait_loop
-
-       # A20 is still not responding.  Try frobbing it again.
-       # 
-       decb    (a20_tries)
-       jnz     a20_try_loop
-       
-       movw    $a20_err_msg, %si
-       call    prtstr
-
-a20_die:
-       hlt
-       jmp     a20_die
-
-a20_tries:
-       .byte   A20_ENABLE_LOOPS
-
-a20_err_msg:
-       .ascii  "linux: fatal error: A20 gate not responding!"
-       .byte   13, 10, 0
-
-       # If we get here, all is good
-a20_done:
-
-
-#endif /* CONFIG_X86_VOYAGER */
-
-/* Another print, to show protected mode and A20 are OK */
-
-       jmp     mb_hello_mess2_end
-mb_hello_mess2:
-       .string "pack " 
-mb_hello_mess2_end:    
-       lea     mb_hello_mess2, %si
-       call    prtstr
-       
-# set up gdt and idt
-/*     lidt    idt_48                          # load idt with 0,0 */
-/* Multiboot kernels must set up their own IDT:        leave this for now, 
- * so we can print diagnostics */
-       
-       xorl    %eax, %eax                      # Compute gdt_base
-       movw    %ds, %ax                        # (Convert %ds:gdt to a linear 
ptr)
-       shll    $4, %eax
-       addl    $gdt, %eax
-       movl    %eax, (gdt_48+2)
-       lgdt    gdt_48                          # load gdt with whatever is
-                                               # appropriate
-       
-# make sure any possible coprocessor is properly reset..
-       xorw    %ax, %ax
-       outb    %al, $0xf0
-       call    delay
-
-       outb    %al, $0xf1
-       call    delay
-
-       
-# well, that went ok, I hope. Now we mask all interrupts - the rest
-# is done in init_IRQ().
-       movb    $0xFF, %al                      # mask all interrupts for now
-       outb    %al, $0xA1
-       call    delay
-       
-       movb    $0xFB, %al                      # mask all irq's but irq2 which
-       outb    %al, $0x21                      # is cascaded
-
-# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
-# need no steenking BIOS anyway (except for the initial loading :-).
-# The BIOS-routine wants lots of unnecessary data, and it's less
-# "interesting" anyway. This is how REAL programmers do it.
-
-/* Tailor the jump below so the target is the 32bit trampoline code */
-
-       xorl    %eax, %eax                      # Calculate
-       movw    %cs, %ax                        # the linear
-        shll    $4, %eax                       # address of
-        addl    $trampoline32, %eax            # %cs:trampoline32
-       movl    %eax, %cs:code32                # Stick it into the jmpi
-
-       /* Load a 32-bit pointer to the entry address into %ecx */
-       xorl    %ecx, %ecx                      # Calculate
-       movw    %cs, %cx                        # the linear
-        shll    $4, %ecx                       # address of
-        addl    $entry_address, %ecx           # %cs:entry_address
-
-# Well, now's the time to actually move into protected mode.
-
-       lea     mb_ready_mess, %si
-       call    prtstr
-       
-/* May as well load this IDT now */
-       lidt    idt_48
-
-       xorl    %eax, %eax
-       movw    $1, %ax                         # protected mode (PE) bit
-       lmsw    %ax                             # This is it!
-       jmp     flush_instr
-flush_instr:   
-       
-       /* Set up segment registers */
-       movw    $__BOOT_DS, %dx
-       movw    %dx, %ds
-       movw    %dx, %es
-       movw    %dx, %fs
-       movw    %dx, %gs
-       movw    %dx, %ss
-
-       /* Trampoline expects this in %eax */
-       movl    %ecx, %eax
-       
-       /* Jump to the 32-bit trampoline */
-
-# NOTE: For high loaded big kernels we need a
-#      jmpi    0x100000,__BOOT_CS
-#
-#      but we yet haven't reloaded the CS register, so the default size 
-#      of the target offset still is 16 bit.
-#       However, using an operand prefix (0x66), the CPU will properly
-#      take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
-#      Manual, Mixing 16-bit and 32-bit code, page 16-6)
-
-       .byte 0x66, 0xea                        # prefix + jmpi-opcode
-code32:        .long   0x1000                          # will be set to 
trampoline32
-                                               # by code above.
-       .word   __BOOT_CS
-
-# Here's a bunch of information about your current kernel..
-
-kernel_version:         .string "mbootpack changeling bzImage"
-mb_ready_mess: 
-               .ascii MBOOTPACK_VERSION_STRING
-               .ascii "\r\n"
-               .byte 0
-
-# This is the default real mode switch routine.
-# to be called just before protected mode transition
-default_switch:
-       cli                                     # no interrupts allowed !
-       movb    $0x80, %al                      # disable NMI for bootup
-                                               # sequence
-       outb    %al, $0x70
-       lret
-
-
-#ifndef CONFIG_X86_VOYAGER
-# This routine tests whether or not A20 is enabled.  If so, it
-# exits with zf = 0.
-#
-# The memory address used, 0x200, is the int $0x80 vector, which
-# should be safe.
-
-A20_TEST_ADDR = 4*0x80
-
-a20_test:
-       pushw   %cx
-       pushw   %ax
-       xorw    %cx, %cx
-       movw    %cx, %fs                        # Low memory
-       decw    %cx
-       movw    %cx, %gs                        # High memory area
-       movw    $A20_TEST_LOOPS, %cx
-       movw    %fs:(A20_TEST_ADDR), %ax
-       pushw   %ax
-a20_test_wait:
-       incw    %ax
-       movw    %ax, %fs:(A20_TEST_ADDR)
-       call    delay                           # Serialize and make delay 
constant
-       cmpw    %gs:(A20_TEST_ADDR+0x10), %ax
-       loope   a20_test_wait
-
-       popw    %fs:(A20_TEST_ADDR)
-       popw    %ax
-       popw    %cx
-       ret     
-
-#endif /* CONFIG_X86_VOYAGER */
-
-# This routine checks that the keyboard command queue is empty
-# (after emptying the output buffers)
-#
-# Some machines have delusions that the keyboard buffer is always full
-# with no keyboard attached...
-#
-# If there is no keyboard controller, we will usually get 0xff
-# to all the reads.  With each IO taking a microsecond and
-# a timeout of 100,000 iterations, this can take about half a
-# second ("delay" == outb to port 0x80). That should be ok,
-# and should also be plenty of time for a real keyboard controller
-# to empty.
-#
-
-empty_8042:
-       pushl   %ecx
-       movl    $100000, %ecx
-
-empty_8042_loop:
-       decl    %ecx
-       jz      empty_8042_end_loop
-
-       call    delay
-
-       inb     $0x64, %al                      # 8042 status port
-       testb   $1, %al                         # output buffer?
-       jz      no_output
-
-       call    delay
-       inb     $0x60, %al                      # read it
-       jmp     empty_8042_loop
-
-no_output:
-       testb   $2, %al                         # is input buffer full?
-       jnz     empty_8042_loop                 # yes - loop
-empty_8042_end_loop:
-       popl    %ecx
-       ret
-
-# Read the cmos clock. Return the seconds in al
-gettime:
-       pushw   %cx
-       movb    $0x02, %ah
-       int     $0x1a
-       movb    %dh, %al                        # %dh contains the seconds
-       andb    $0x0f, %al
-       movb    %dh, %ah
-       movb    $0x04, %cl
-       shrb    %cl, %ah
-       aad
-       popw    %cx
-       ret
-
-# Delay is needed after doing I/O
-delay:
-       outb    %al,$0x80
-       ret
-
-# Descriptor tables
-#
-# NOTE: The intel manual says gdt should be sixteen bytes aligned for
-# efficiency reasons.  However, there are machines which are known not
-# to boot with misaligned GDTs, so alter this at your peril!  If you alter
-# GDT_ENTRY_BOOT_CS (in asm/segment.h) remember to leave at least two
-# empty GDT entries (one for NULL and one reserved).
-#
-# NOTE:        On some CPUs, the GDT must be 8 byte aligned.  This is
-# true for the Voyager Quad CPU card which will not boot without
-# This directive.  16 byte aligment is recommended by intel.
-#
-
-
-/* The boot-time code segment is set at the jmpi above */
-/* Dont change this without checking everything still matches  */
-
-       .align 16
-gdt:
-       .fill GDT_ENTRY_BOOT_CS,8,0
-
-       .word   0xFFFF                          # 4Gb - (0x100000*0x1000 = 4Gb)
-       .word   0                               # base address = 0
-       .word   0x9A00                          # code read/exec
-       .word   0x00CF                          # granularity = 4096, 386
-                                               #  (+5th nibble of limit)
-
-       .word   0xFFFF                          # 4Gb - (0x100000*0x1000 = 4Gb)
-       .word   0                               # base address = 0
-       .word   0x9200                          # data read/write
-       .word   0x00CF                          # granularity = 4096, 386
-                                               #  (+5th nibble of limit)
-gdt_end:
-       .align  4
-       
-       .word   0                               # alignment byte
-idt_48:
-       .word   0                               # idt limit = 0
-       .word   0, 0                            # idt base = 0L
-
-       .word   0                               # alignment byte
-gdt_48:
-       .word   gdt_end - gdt - 1               # gdt limit
-       .word   0, 0                            # gdt base (filled in later)
-
-# Include video setup & detection code
-
-/* #include "video.S" */
-
-.code32
-trampoline32:
-       /* Here, %eax = 32-bit pointer to entry_address */
-
-       /* Check if the bootloader gave us a (non-empty) command line */
-       movl    -8(%eax), %ebx                  # cmd_line_ptr
-       cmpl    $0, %ebx
-       je      no_cmd_line
-       cmpb    $0, 0(%ebx)
-       je      no_cmd_line
-
-       /* Find the MBI command line */
-       movl    %eax, %ecx                      # &entry_address
-       addl    $(begtext-entry_address), %ecx  # --> start of setup
-       subl    $0x9200, %ecx                   # --> reloc offset
-       movl    %ecx, %esi                      # (copy offset)
-       movl    %ecx, %ebx                      # (copy offset)
-       addl    4(%eax), %ecx                   # --> current addr of MBI
-       addl    16(%ecx), %ebx                  # --> cur. addr of MB cmdline
-
-       /* Overwrite the built-in MBI kernel command line */
-       movl    -8(%eax), %ecx
-       movl    $0, %edi
-
-       /* Give the kernel a 'self' word, that linux doesn't get */
-       movw    $0x202E, 0(%ebx)                        # '. '
-       addl    $0x2, %ebx
-       
-cmd_line_copy: 
-       movb    (%ecx, %edi), %dl
-       movb    %dl, (%ebx, %edi)
-       inc     %edi
-       cmp     $CMD_LINE_SPACE-3, %edi 
-       je      cmd_line_copy_end
-
-       cmpb    $0x0, %dl
-       jne     cmd_line_copy
-cmd_line_copy_end:
-       movb    $0x0, (%ebx, %edi)
-       subl    $0x2, %ebx
-       
-       /* Look for '--' in the kernel command line */
-cmd_line_scan:
-       inc     %ebx
-       cmpb    $0x0, 0(%ebx)
-       je      no_cmd_line
-       cmpl    $0x202D2D20, 0(%ebx)            # ' -- '
-       jne     cmd_line_scan
-
-       /* Found it: terminate kernel's command line */
-       movb    $0x0, 0(%ebx)
-       inc     %ebx
-       /* Relocate address to where it will be moved to */
-       subl    %esi, %ebx
-       
-       /* Is there a module 0? */
-       movl    %esi, %ecx                      # Reloc offset
-       addl    4(%eax), %ecx                   # --> current addr of MBI
-       cmpl    $0x0, 20(%ecx)                  # (check module count)
-       je      no_cmd_line
-       /* Overwrite module 0's command line */
-       movl    %esi, %edx                      # Reloc offset
-       addl    24(%ecx), %edx                  # --> cur. add. of Module 0
-       movl    %ebx, 8(%edx)                   # --> blat mod. 0's cmdline
-no_cmd_line:
-
-
-       /* Relocate the MBI from after the setup code to its proper home
-        * between the MBI pointer and 0xa000 */
-       movl    %eax, %ecx                      # &entry_address
-       addl    $(begtext-entry_address), %ecx  # --> start of setup
-       subl    $0x9200, %ecx                   # --> reloc offset
-       addl    4(%eax), %ecx                   # --> current addr of MBI
-       
-       movl    $0xa000, %ebx                   # End of MBI
-       subl    4(%eax), %ebx                   # --> size of MBI
-       movl    %ebx, %edi
-       
-       movl    4(%eax), %ebx                   # Destination of MBI
-       
-mbi_copy:
-       dec     %edi
-       movb    (%ecx, %edi), %dl
-       movb    %dl, (%ebx, %edi)
-       cmp     $0x0, %edi
-       jne     mbi_copy        
-       
-       /* Copy memory size into MBI structure */
-       movl    4(%eax), %ebx                   # MBI pointer
-       movl    8(%eax), %ecx                   # highmem_size
-       movl    %ecx, 8(%ebx)                   # --> mbi.mem_upper
-       movl    $0x280, %ecx
-       movl    %ecx, 4(%ebx)                   # --> mbi.mem_lower
-       /* Set the MB_INFO_MEMORY bit */
-       orl     $1, 0(%ebx)
-
-       /* Recover the MBI pointer into %ebx */
-       movl    4(%eax), %ebx                   # MBI pointer
-       /* Extract the load address into %ecx */
-       movl    0(%eax), %ecx
-       /* Let the kernel know we're a multiboot loader */
-       movl    $0x2BADB002, %eax
-       /* Jump to the kernel address supplied */
-       jmp     *%ecx
-
-# Setup signature -- must be last
-setup_sig1:    .word   SIG1
-setup_sig2:    .word   SIG2
-
-# After this point, there is some free space which is used by the video mode
-# handling code to store the temporary mode table (not used by the kernel).
-
-modelist:
-
-.text
-endtext:
-.data
-enddata:
-.bss
-endbss:

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] merge with changeset: 12460:317e71a06828, Xen patchbot-xenppc-unstable <=