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

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Oct 2006 12:11:29 +0000
Delivery-date: Thu, 26 Oct 2006 05:19:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 6492b9b2796872caf7a1052fdb9236d7cc01b805
# Parent  d5a46e4cc340dfaf6c638a64ae536d917065e2ba
# Parent  8113c55a6efdc5e3c37c46a684ee8895a0568e65
merge with xen-unstable.hg
---
 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 
----------
 tools/security/example.txt                                            |  376 
---
 tools/security/install.txt                                            |   87 
 .hgignore                                                             |    3 
 .hgtags                                                               |    1 
 Config.mk                                                             |   56 
 Makefile                                                              |    5 
 buildconfigs/Rules.mk                                                 |    3 
 config/Linux.mk                                                       |    8 
 config/OpenBSD.mk                                                     |    1 
 config/StdGNU.mk                                                      |   30 
 config/SunOS.mk                                                       |   35 
 config/ia64.mk                                                        |    2 
 config/powerpc64.mk                                                   |    1 
 config/x86_32.mk                                                      |   10 
 config/x86_64.mk                                                      |   12 
 docs/Makefile                                                         |    5 
 docs/man/xm.pod.1                                                     |    4 
 docs/src/interface.tex                                                |   42 
 linux-2.6-xen-sparse/arch/i386/kernel/fixup.c                         |    3 
 linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c                 |   38 
 linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c                       |   11 
 linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c                      |   82 
 linux-2.6-xen-sparse/drivers/xen/netback/interface.c                  |    2 
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c                    |    6 
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c                  |    7 
 linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c                     |    8 
 patches/linux-2.6.16.29/net-gso-5-rcv-mss.patch                       |   11 
 tools/Makefile                                                        |    2 
 tools/Rules.mk                                                        |    8 
 tools/blktap/drivers/Makefile                                         |    6 
 tools/blktap/lib/Makefile                                             |    8 
 tools/check/check_brctl                                               |   31 
 tools/check/check_iproute                                             |   29 
 tools/check/check_python                                              |   17 
 tools/check/check_zlib_devel                                          |   17 
 tools/check/check_zlib_lib                                            |   17 
 tools/check/chk                                                       |   19 
 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/examples/vtpm-common.sh                                         |    6 
 tools/examples/xend-config.sxp                                        |    4 
 tools/examples/xmexample.hvm                                          |    5 
 tools/examples/xmexample.vti                                          |    5 
 tools/firmware/Makefile                                               |    6 
 tools/firmware/acpi/Makefile                                          |    2 
 tools/firmware/hvmloader/Makefile                                     |   10 
 tools/firmware/vmxassist/Makefile                                     |    9 
 tools/firmware/vmxassist/head.S                                       |    2 
 tools/firmware/vmxassist/trap.S                                       |    2 
 tools/firmware/vmxassist/util.c                                       |   25 
 tools/firmware/vmxassist/util.h                                       |    1 
 tools/firmware/vmxassist/vm86.c                                       |   48 
 tools/guest-headers/Makefile                                          |   12 
 tools/ioemu/Makefile.target                                           |   22 
 tools/ioemu/d3des.c                                                   |  434 
++++
 tools/ioemu/d3des.h                                                   |   51 
 tools/ioemu/hw/ide.c                                                  |    4 
 tools/ioemu/hw/xen_platform.c                                         |    8 
 tools/ioemu/target-i386-dm/rtc-dm.c                                   |  107 +
 tools/ioemu/vl.c                                                      |   14 
 tools/ioemu/vl.h                                                      |    4 
 tools/ioemu/vnc.c                                                     |  112 +
 tools/ioemu/xenstore.c                                                |   51 
 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_hvm_build.c                                            |   35 
 tools/libxc/xc_linux_restore.c                                        |   94 
 tools/libxc/xc_linux_save.c                                           |  104 
 tools/libxc/xc_private.h                                              |    8 
 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/pygrub/Makefile                                                 |    6 
 tools/python/Makefile                                                 |    6 
 tools/python/xen/util/auxbin.py                                       |    2 
 tools/python/xen/util/security.py                                     |   23 
 tools/python/xen/xend/XendDomainInfo.py                               |    2 
 tools/python/xen/xend/XendRoot.py                                     |   11 
 tools/python/xen/xend/arch.py                                         |    1 
 tools/python/xen/xend/image.py                                        |   35 
 tools/python/xen/xend/osdep.py                                        |   36 
 tools/python/xen/xend/server/SrvDaemon.py                             |    9 
 tools/python/xen/xend/server/blkif.py                                 |    3 
 tools/python/xen/xm/addlabel.py                                       |    9 
 tools/python/xen/xm/cfgbootpolicy.py                                  |  134 -
 tools/python/xen/xm/create.py                                         |    5 
 tools/python/xen/xm/getlabel.py                                       |    3 
 tools/python/xen/xm/rmlabel.py                                        |    3 
 tools/security/policy.txt                                             |  163 -
 tools/security/policytools.txt                                        |  148 +
 tools/security/readme.txt                                             |   31 
 tools/security/secpol_tool.c                                          |   14 
 tools/security/secpol_xml2bin.c                                       |   10 
 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                                                |    6 
 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                                               |   26 
 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/xs_lib.c                                               |    9 
 tools/xenstore/xsls.c                                                 |    1 
 tools/xentrace/Makefile                                               |    5 
 tools/xentrace/formats                                                |   29 
 tools/xm-test/README                                                  |   32 
 tools/xm-test/configure.ac                                            |   15 
 tools/xm-test/grouptest/default                                       |    1 
 tools/xm-test/grouptest/security                                      |    1 
 tools/xm-test/lib/XmTestLib/XenDomain.py                              |    5 
 tools/xm-test/lib/XmTestLib/acm.py                                    |   91 
 tools/xm-test/lib/XmTestLib/block_utils.py                            |    2 
 tools/xm-test/runtest.sh                                              |    2 
 tools/xm-test/tests/Makefile.am                                       |    1 
 tools/xm-test/tests/security-acm/01_security-acm_basic.py             |  121 +
 tools/xm-test/tests/security-acm/02_security-acm_dom_start.py         |   64 
 tools/xm-test/tests/security-acm/03_security-acm_dom_conflict.py      |   60 
 tools/xm-test/tests/security-acm/04_security-acm_dom_res.py           |   69 
 tools/xm-test/tests/security-acm/05_security-acm_dom_res_conf.py      |   38 
 tools/xm-test/tests/security-acm/06_security-acm_dom_block_attach.py  |   82 
 tools/xm-test/tests/security-acm/Makefile.am                          |   28 
 tools/xm-test/tests/security-acm/acm_utils.py                         |   15 
 tools/xm-test/tests/security-acm/xm-test-security_policy.xml          |  110 +
 unmodified_drivers/linux-2.6/mkbuildtree                              |   55 
 xen/Makefile                                                          |   10 
 xen/Rules.mk                                                          |   23 
 xen/acm/acm_chinesewall_hooks.c                                       |    2 
 xen/acm/acm_core.c                                                    |  107 -
 xen/acm/acm_simple_type_enforcement_hooks.c                           |    2 
 xen/arch/ia64/Rules.mk                                                |    2 
 xen/arch/ia64/linux-xen/smpboot.c                                     |    3 
 xen/arch/ia64/xen/xenmisc.c                                           |    4 
 xen/arch/powerpc/Makefile                                             |    2 
 xen/arch/powerpc/domain.c                                             |    4 
 xen/arch/x86/Makefile                                                 |    5 
 xen/arch/x86/Rules.mk                                                 |   37 
 xen/arch/x86/boot/mkelf32.c                                           |    5 
 xen/arch/x86/domain.c                                                 |   14 
 xen/arch/x86/domain_build.c                                           |    5 
 xen/arch/x86/hvm/Makefile                                             |    1 
 xen/arch/x86/hvm/hvm.c                                                |   11 
 xen/arch/x86/hvm/i8254.c                                              |   16 
 xen/arch/x86/hvm/i8259.c                                              |   93 
 xen/arch/x86/hvm/intercept.c                                          |  119 -
 xen/arch/x86/hvm/io.c                                                 |   44 
 xen/arch/x86/hvm/platform.c                                           |  843 
+++----
 xen/arch/x86/hvm/rtc.c                                                |  393 
+++
 xen/arch/x86/hvm/svm/intr.c                                           |   38 
 xen/arch/x86/hvm/svm/svm.c                                            |   86 
 xen/arch/x86/hvm/svm/vmcb.c                                           |    9 
 xen/arch/x86/hvm/svm/x86_32/exits.S                                   |    2 
 xen/arch/x86/hvm/svm/x86_64/exits.S                                   |    2 
 xen/arch/x86/hvm/vioapic.c                                            |   53 
 xen/arch/x86/hvm/vlapic.c                                             |    3 
 xen/arch/x86/hvm/vmx/io.c                                             |    2 
 xen/arch/x86/hvm/vmx/vmx.c                                            |  247 +-
 xen/arch/x86/i387.c                                                   |    9 
 xen/arch/x86/io_apic.c                                                |   11 
 xen/arch/x86/irq.c                                                    |    2 
 xen/arch/x86/mm/shadow/common.c                                       |  226 +-
 xen/arch/x86/mm/shadow/multi.c                                        |  872 
++------
 xen/arch/x86/mm/shadow/multi.h                                        |    4 
 xen/arch/x86/mm/shadow/private.h                                      |   75 
 xen/arch/x86/mm/shadow/types.h                                        |  123 -
 xen/arch/x86/oprofile/op_model_athlon.c                               |   28 
 xen/arch/x86/oprofile/op_model_p4.c                                   |   10 
 xen/arch/x86/oprofile/op_model_ppro.c                                 |   10 
 xen/arch/x86/oprofile/xenoprof.c                                      |  127 -
 xen/arch/x86/setup.c                                                  |   45 
 xen/arch/x86/time.c                                                   |    7 
 xen/common/Makefile                                                   |    3 
 xen/common/domain.c                                                   |    2 
 xen/common/grant_table.c                                              |    2 
 xen/common/keyhandler.c                                               |    1 
 xen/common/page_alloc.c                                               |    2 
 xen/common/schedule.c                                                 |    2 
 xen/common/time.c                                                     |   77 
 xen/common/trace.c                                                    |    2 
 xen/common/vsprintf.c                                                 |    2 
 xen/drivers/char/console.c                                            |    4 
 xen/drivers/char/serial.c                                             |    4 
 xen/include/acm/acm_hooks.h                                           |   14 
 xen/include/acpi/platform/acenv.h                                     |    2 
 xen/include/asm-ia64/linux-xen/asm/spinlock.h                         |    8 
 xen/include/asm-powerpc/spinlock.h                                    |   12 
 xen/include/asm-x86/domain.h                                          |   17 
 xen/include/asm-x86/hvm/io.h                                          |   42 
 xen/include/asm-x86/hvm/support.h                                     |    6 
 xen/include/asm-x86/hvm/svm/vmcb.h                                    |    1 
 xen/include/asm-x86/hvm/vcpu.h                                        |    5 
 xen/include/asm-x86/hvm/vpic.h                                        |    2 
 xen/include/asm-x86/hvm/vpit.h                                        |   56 
 xen/include/asm-x86/mm.h                                              |   17 
 xen/include/asm-x86/perfc_defn.h                                      |    2 
 xen/include/asm-x86/shadow.h                                          |    7 
 xen/include/asm-x86/spinlock.h                                        |    8 
 xen/include/asm-x86/x86_64/asm_defns.h                                |    6 
 xen/include/public/io/ring.h                                          |   22 
 xen/include/public/trace.h                                            |   13 
 xen/include/xen/cpumask.h                                             |    8 
 xen/include/xen/domain.h                                              |    2 
 xen/include/xen/lib.h                                                 |    2 
 xen/include/xen/spinlock.h                                            |    8 
 xen/include/xen/stdarg.h                                              |    5 
 xen/include/xen/time.h                                                |   14 
 238 files changed, 5136 insertions(+), 6666 deletions(-)

diff -r d5a46e4cc340 -r 6492b9b27968 .hgignore
--- a/.hgignore Sun Oct 22 14:39:15 2006 -0600
+++ b/.hgignore Sun Oct 22 15:23:52 2006 -0600
@@ -15,8 +15,11 @@
 .*\.rej$
 .*/a\.out$
 .*/cscope\..*$
+^cscope.*$
 ^[^/]*\.bz2$
+^\.config$
 ^TAGS$
+^tags$
 ^dist/.*$
 ^docs/.*\.aux$
 ^docs/.*\.dvi$
diff -r d5a46e4cc340 -r 6492b9b27968 .hgtags
--- a/.hgtags   Sun Oct 22 14:39:15 2006 -0600
+++ b/.hgtags   Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 Config.mk
--- a/Config.mk Sun Oct 22 14:39:15 2006 -0600
+++ b/Config.mk Sun Oct 22 15:23:52 2006 -0600
@@ -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,30 @@ 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))
+# cc-option
+# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
+cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
+              /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
+
+ifneq ($(debug),y)
+CFLAGS += -DNDEBUG
+else
+CFLAGS += -g
+endif
+
+CFLAGS += -std=gnu99
 
 CFLAGS += -Wall -Wstrict-prototypes
 
-HOSTCFLAGS += $(call test-gcc-flag,$(HOSTCC),-Wdeclaration-after-statement)
-CFLAGS     += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement)
+# -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 cc-option,$(HOSTCC),-Wdeclaration-after-statement,)
+CFLAGS     += $(call cc-option,$(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 d5a46e4cc340 -r 6492b9b27968 Makefile
--- a/Makefile  Sun Oct 22 14:39:15 2006 -0600
+++ b/Makefile  Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 buildconfigs/Rules.mk
--- a/buildconfigs/Rules.mk     Sun Oct 22 14:39:15 2006 -0600
+++ b/buildconfigs/Rules.mk     Sun Oct 22 15:23:52 2006 -0600
@@ -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))
diff -r d5a46e4cc340 -r 6492b9b27968 config/ia64.mk
--- a/config/ia64.mk    Sun Oct 22 14:39:15 2006 -0600
+++ b/config/ia64.mk    Sun Oct 22 15:23:52 2006 -0600
@@ -1,4 +1,6 @@ CONFIG_IA64 := y
 CONFIG_IA64 := y
+CONFIG_IA64_$(XEN_OS) := y
+
 CONFIG_IOEMU := y
 CONFIG_XCUTILS := y
 
diff -r d5a46e4cc340 -r 6492b9b27968 config/powerpc64.mk
--- a/config/powerpc64.mk       Sun Oct 22 14:39:15 2006 -0600
+++ b/config/powerpc64.mk       Sun Oct 22 15:23:52 2006 -0600
@@ -1,4 +1,5 @@ CONFIG_POWERPC := y
 CONFIG_POWERPC := y
+CONFIG_POWERPC_$(XEN_OS) := y
 
 CFLAGS += -DELFSIZE=64
 LIBDIR := lib
diff -r d5a46e4cc340 -r 6492b9b27968 config/x86_32.mk
--- a/config/x86_32.mk  Sun Oct 22 14:39:15 2006 -0600
+++ b/config/x86_32.mk  Sun Oct 22 15:23:52 2006 -0600
@@ -1,9 +1,17 @@ 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
 LIBDIR := lib
+
+# Use only if calling $(LD) directly.
+ifeq ($(XEN_OS),OpenBSD)
+LDFLAGS_DIRECT += -melf_i386_obsd
+else
+LDFLAGS_DIRECT += -melf_i386
+endif
diff -r d5a46e4cc340 -r 6492b9b27968 config/x86_64.mk
--- a/config/x86_64.mk  Sun Oct 22 14:39:15 2006 -0600
+++ b/config/x86_64.mk  Sun Oct 22 15:23:52 2006 -0600
@@ -1,9 +1,17 @@ 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
+LIBDIR = $(LIB64DIR)
+
+# Use only if calling $(LD) directly.
+ifeq ($(XEN_OS),OpenBSD)
+LDFLAGS_DIRECT += -melf_x86_64_obsd
+else
+LDFLAGS_DIRECT += -melf_x86_64
+endif
diff -r d5a46e4cc340 -r 6492b9b27968 docs/Makefile
--- a/docs/Makefile     Sun Oct 22 14:39:15 2006 -0600
+++ b/docs/Makefile     Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 docs/man/xm.pod.1
--- a/docs/man/xm.pod.1 Sun Oct 22 14:39:15 2006 -0600
+++ b/docs/man/xm.pod.1 Sun Oct 22 15:23:52 2006 -0600
@@ -810,13 +810,13 @@ Loads the binary representation of the I
 Loads the binary representation of the I<policy> into Xen. The binary
 representation can be created with the B<makepolicy> subcommand.
 
-=item B<cfgbootpolicy> I<policy> [I<kernelversion>]
+=item B<cfgbootpolicy> I<policy> [I<boot title>]
 
 Configures I<policy> as the boot policy for Xen. It copies the binary
 policy representation into the /boot directory and adds a module line
 specifying the binary policy to the /boot/grub/menu.lst file. If your
 boot configuration includes multiple Xen boot titles, then use the
-I<kernelversion> parameter to select the proper title.
+I<boot title> parameter to specify a unique part of the proper title.
 
 =item B<dumppolicy>
 
diff -r d5a46e4cc340 -r 6492b9b27968 docs/src/interface.tex
--- a/docs/src/interface.tex    Sun Oct 22 14:39:15 2006 -0600
+++ b/docs/src/interface.tex    Sun Oct 22 15:23:52 2006 -0600
@@ -955,7 +955,6 @@ A {\bf /vm} entry contains the following
 A {\bf /vm} entry contains the following information:
 
 \begin{description}
-\item[ssidref] ssid reference for domain
 \item[uuid] uuid of the domain (somewhat redundant)
 \item[on\_reboot] the action to take on a domain reboot request (destroy or 
restart)
 \item[on\_poweroff] the action to take on a domain halt request (destroy or 
restart)
@@ -1125,6 +1124,16 @@ This path contains:
       \end{description}
     \end{description}
 
+  \item[security/] access control information for the domain
+    \begin{description}
+    \item[ssidref] security reference identifier used inside the hypervisor
+    \item[access\_control/] security label used by management tools
+      \begin{description}
+       \item[label] security label name
+       \item[policy] security policy name
+      \end{description}
+    \end{description}
+
   \item[store/] per-domain information for the store
     \begin{description}
     \item[port] the event channel used for the store ring queue 
@@ -2168,18 +2177,45 @@ implementing them (in {\tt xen/common/do
 implementing them (in {\tt xen/common/dom0\_ops.c}) and in 
 the user-space tools that use them (mostly in {\tt tools/libxc}). 
 
+\section{Access Control Module Hypercalls}
+\label{s:acmops}
+
 Hypercalls relating to the management of the Access Control Module are
-also restricted to domain 0 access for now:
+also restricted to domain 0 access for now. For more details on any or
+all of these, please see {\tt xen/include/public/acm\_ops.h}.  A
+complete list is given below:
 
 \begin{quote}
 
-\hypercall{acm\_op(struct acm\_op * u\_acm\_op)}
+\hypercall{acm\_op(int cmd, void *args)}
 
 This hypercall can be used to configure the state of the ACM, query
 that state, request access control decisions and dump additional
 information.
 
+\begin{description}
+
+\item [ACMOP\_SETPOLICY:] set the access control policy
+
+\item [ACMOP\_GETPOLICY:] get the current access control policy and
+  status
+
+\item [ACMOP\_DUMPSTATS:] get current access control hook invocation
+  statistics
+
+\item [ACMOP\_GETSSID:] get security access control information for a
+  domain
+
+\item [ACMOP\_GETDECISION:] get access decision based on the currently
+  enforced access control policy
+
+\end{description}
 \end{quote}
+
+Most of the above are best understood by looking at the code
+implementing them (in {\tt xen/common/acm\_ops.c}) and in the
+user-space tools that use them (mostly in {\tt tools/security} and
+{\tt tools/python/xen/lowlevel/acm}).
 
 
 \section{Debugging Hypercalls} 
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/arch/i386/kernel/fixup.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/fixup.c     Sun Oct 22 14:39:15 
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/fixup.c     Sun Oct 22 15:23:52 
2006 -0600
@@ -46,6 +46,9 @@ fastcall void do_fixup_4gb_segment(struc
        if (test_and_set_bit(0, &printed))
                return;
 
+        if (current->tgid == 1) /* Ignore statically linked init */
+                return; 
+            
        HYPERVISOR_vm_assist(
                VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify);
 
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c     Sun Oct 22 
14:39:15 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/microcode-xen.c     Sun Oct 22 
15:23:52 2006 -0600
@@ -50,9 +50,6 @@ MODULE_LICENSE("GPL");
 
 /* no concurrent ->write()s are allowed on /dev/cpu/microcode */
 static DECLARE_MUTEX(microcode_sem);
-
-static void __user *user_buffer;       /* user area microcode data buffer */
-static unsigned int user_buffer_size;  /* it's size */
                                
 static int microcode_open (struct inode *unused1, struct file *unused2)
 {
@@ -60,21 +57,26 @@ static int microcode_open (struct inode 
 }
 
 
-static int do_microcode_update (void)
+static int do_microcode_update (const void __user *ubuf, size_t len)
 {
        int err;
-       dom0_op_t op;
+       void *kbuf;
 
-       err = sys_mlock((unsigned long)user_buffer, user_buffer_size);
-       if (err != 0)
-               return err;
+       kbuf = vmalloc(len);
+       if (!kbuf)
+               return -ENOMEM;
 
-       op.cmd = DOM0_MICROCODE;
-       set_xen_guest_handle(op.u.microcode.data, user_buffer);
-       op.u.microcode.length = user_buffer_size;
-       err = HYPERVISOR_dom0_op(&op);
+       if (copy_from_user(kbuf, ubuf, len) == 0) {
+               dom0_op_t op;
 
-       (void)sys_munlock((unsigned long)user_buffer, user_buffer_size);
+               op.cmd = DOM0_MICROCODE;
+               set_xen_guest_handle(op.u.microcode.data, kbuf);
+               op.u.microcode.length = len;
+               err = HYPERVISOR_dom0_op(&op);
+       } else
+               err = -EFAULT;
+
+       vfree(kbuf);
 
        return err;
 }
@@ -88,17 +90,9 @@ static ssize_t microcode_write (struct f
                return -EINVAL;
        }
 
-       if ((len >> PAGE_SHIFT) > num_physpages) {
-               printk(KERN_ERR "microcode: too much data (max %ld pages)\n", 
num_physpages);
-               return -EINVAL;
-       }
-
        down(&microcode_sem);
 
-       user_buffer = (void __user *) buf;
-       user_buffer_size = (int) len;
-
-       ret = do_microcode_update();
+       ret = do_microcode_update(buf, len);
        if (!ret)
                ret = (ssize_t)len;
 
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Sun Oct 22 14:39:15 
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Sun Oct 22 15:23:52 
2006 -0600
@@ -343,6 +343,7 @@ static void backend_changed(struct xenbu
        case XenbusStateInitialising:
        case XenbusStateInitWait:
        case XenbusStateInitialised:
+       case XenbusStateUnknown:
                break;
 
        case XenbusStateConnected:
@@ -351,13 +352,14 @@ static void backend_changed(struct xenbu
 
        case XenbusStateClosing:
                tpmif_set_connected_state(tp, 0);
+               xenbus_frontend_closed(dev);
                break;
 
-       case XenbusStateUnknown:
        case XenbusStateClosed:
+               tpmif_set_connected_state(tp, 0);
                if (tp->is_suspended == 0)
                        device_unregister(&dev->dev);
-               xenbus_switch_state(dev, XenbusStateClosed);
+               xenbus_frontend_closed(dev);
                break;
        }
 }
@@ -419,9 +421,10 @@ static int tpmfront_suspend(struct xenbu
        mutex_lock(&suspend_lock);
        tp->is_suspended = 1;
 
-       for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {
+       for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 300; ctr++) {
                if ((ctr % 10) == 0)
-                       printk("TPM-FE [INFO]: Waiting for outstanding 
request.\n");
+                       printk("TPM-FE [INFO]: Waiting for outstanding "
+                              "request.\n");
                /*
                 * Wait for a request to be responded to.
                 */
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c  Sun Oct 22 14:39:15 
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c  Sun Oct 22 15:23:52 
2006 -0600
@@ -845,28 +845,29 @@ static void fast_flush_area(pending_req_
                uvaddr = MMAP_VADDR(info->user_vstart, u_idx, i);
 
                khandle = &pending_handle(mmap_idx, k_idx, i);
-               if (BLKTAP_INVALID_HANDLE(khandle)) {
-                       WPRINTK("BLKTAP_INVALID_HANDLE\n");
-                       continue;
-               }
-               gnttab_set_unmap_op(&unmap[invcount], 
-                                   idx_to_kaddr(mmap_idx, k_idx, i), 
-                                   GNTMAP_host_map, khandle->kernel);
-               invcount++;
-
-               if (create_lookup_pte_addr(
-                   info->vma->vm_mm,
-                   MMAP_VADDR(info->user_vstart, u_idx, i), 
-                   &ptep) !=0) {
-                       WPRINTK("Couldn't get a pte addr!\n");
-                       return;
-               }
-
-               gnttab_set_unmap_op(&unmap[invcount], 
-                       ptep, GNTMAP_host_map,
-                       khandle->user);
-               invcount++;
-            
+
+               if (khandle->kernel != 0xFFFF) {
+                       gnttab_set_unmap_op(&unmap[invcount],
+                                           idx_to_kaddr(mmap_idx, k_idx, i),
+                                           GNTMAP_host_map, khandle->kernel);
+                       invcount++;
+               }
+
+               if (khandle->user != 0xFFFF) {
+                       if (create_lookup_pte_addr(
+                               info->vma->vm_mm,
+                               MMAP_VADDR(info->user_vstart, u_idx, i),
+                               &ptep) !=0) {
+                               WPRINTK("Couldn't get a pte addr!\n");
+                               return;
+                       }
+
+                       gnttab_set_unmap_op(&unmap[invcount],
+                                           ptep, GNTMAP_host_map,
+                                           khandle->user);
+                       invcount++;
+               }
+
                BLKTAP_INVALIDATE_HANDLE(khandle);
        }
        ret = HYPERVISOR_grant_table_op(
@@ -1030,7 +1031,7 @@ static int do_block_io_op(blkif_t *blkif
 static int do_block_io_op(blkif_t *blkif)
 {
        blkif_back_ring_t *blk_ring = &blkif->blk_ring;
-       blkif_request_t *req;
+       blkif_request_t req;
        pending_req_t *pending_req;
        RING_IDX rc, rp;
        int more_to_do = 0;
@@ -1082,24 +1083,24 @@ static int do_block_io_op(blkif_t *blkif
                        break;
                }
 
-               req = RING_GET_REQUEST(blk_ring, rc);
+               memcpy(&req, RING_GET_REQUEST(blk_ring, rc), sizeof(req));
                blk_ring->req_cons = ++rc; /* before make_response() */ 
 
-               switch (req->operation) {
+               switch (req.operation) {
                case BLKIF_OP_READ:
                        blkif->st_rd_req++;
-                       dispatch_rw_block_io(blkif, req, pending_req);
+                       dispatch_rw_block_io(blkif, &req, pending_req);
                        break;
 
                case BLKIF_OP_WRITE:
                        blkif->st_wr_req++;
-                       dispatch_rw_block_io(blkif, req, pending_req);
+                       dispatch_rw_block_io(blkif, &req, pending_req);
                        break;
 
                default:
                        WPRINTK("unknown operation [%d]\n",
-                               req->operation);
-                       make_response(blkif, req->id, req->operation,
+                               req.operation);
+                       make_response(blkif, req.id, req.operation,
                                      BLKIF_RSP_ERROR);
                        free_req(pending_req);
                        break;
@@ -1128,9 +1129,10 @@ static void dispatch_rw_block_io(blkif_t
        int usr_idx = GET_NEXT_REQ(info->idx_map);
        uint16_t mmap_idx = pending_req->mem_idx;
 
-       /*Check we have space on user ring - should never fail*/
-       if(usr_idx == INVALID_REQ) goto fail_flush;
-       
+       /* Check we have space on user ring - should never fail. */
+       if (usr_idx == INVALID_REQ)
+               goto fail_response;
+
        /* Check that number of segments is sane. */
        nseg = req->nr_segments;
        if ( unlikely(nseg == 0) || 
@@ -1195,8 +1197,6 @@ static void dispatch_rw_block_io(blkif_t
                                             uvaddr, &ptep);
                if (ret) {
                        WPRINTK("Couldn't get a pte addr!\n");
-                       fast_flush_area(pending_req, pending_idx, usr_idx, 
-                                       blkif->dev_num);
                        goto fail_flush;
                }
 
@@ -1224,19 +1224,25 @@ static void dispatch_rw_block_io(blkif_t
                if (unlikely(map[i].status != 0)) {
                        WPRINTK("invalid kernel buffer -- "
                                "could not remap it\n");
-                       goto fail_flush;
+                       ret |= 1;
+                       map[i].handle = 0xFFFF;
                }
 
                if (unlikely(map[i+1].status != 0)) {
                        WPRINTK("invalid user buffer -- "
                                "could not remap it\n");
-                       goto fail_flush;
+                       ret |= 1;
+                       map[i+1].handle = 0xFFFF;
                }
 
                pending_handle(mmap_idx, pending_idx, i/2).kernel 
                        = map[i].handle;
                pending_handle(mmap_idx, pending_idx, i/2).user   
                        = map[i+1].handle;
+
+               if (ret)
+                       continue;
+
                set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT,
                        FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT));
                offset = (uvaddr - info->vma->vm_start) >> PAGE_SHIFT;
@@ -1244,6 +1250,10 @@ static void dispatch_rw_block_io(blkif_t
                ((struct page **)info->vma->vm_private_data)[offset] =
                        pg;
        }
+
+       if (ret)
+               goto fail_flush;
+
        /* Mark mapped pages as reserved: */
        for (i = 0; i < req->nr_segments; i++) {
                unsigned long kvaddr;
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Sun Oct 22 
14:39:15 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Sun Oct 22 
15:23:52 2006 -0600
@@ -128,7 +128,7 @@ static struct ethtool_ops network_ethtoo
 
 netif_t *netif_alloc(domid_t domid, unsigned int handle)
 {
-       int err = 0, i;
+       int err = 0;
        struct net_device *dev;
        netif_t *netif;
        char name[IFNAMSIZ] = {};
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sun Oct 22 
14:39:15 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sun Oct 22 
15:23:52 2006 -0600
@@ -187,7 +187,7 @@ static struct sk_buff *netbk_copy_skb(st
        if (unlikely(!nskb))
                goto err;
 
-       skb_reserve(nskb, 16);
+       skb_reserve(nskb, 16 + NET_IP_ALIGN);
        headlen = nskb->end - nskb->data;
        if (headlen > skb_headlen(skb))
                headlen = skb_headlen(skb);
@@ -1210,7 +1210,7 @@ static void net_tx_action(unsigned long 
                            ret < MAX_SKB_FRAGS) ?
                        PKT_PROT_LEN : txreq.size;
 
-               skb = alloc_skb(data_len+16, GFP_ATOMIC);
+               skb = alloc_skb(data_len + 16 + NET_IP_ALIGN, GFP_ATOMIC);
                if (unlikely(skb == NULL)) {
                        DPRINTK("Can't allocate a skb in start_xmit.\n");
                        netbk_tx_err(netif, &txreq, i);
@@ -1218,7 +1218,7 @@ static void net_tx_action(unsigned long 
                }
 
                /* Packets passed to netif_rx() must have some headroom. */
-               skb_reserve(skb, 16);
+               skb_reserve(skb, 16 + NET_IP_ALIGN);
 
                if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) {
                        struct netif_extra_info *gso;
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sun Oct 22 
14:39:15 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sun Oct 22 
15:23:52 2006 -0600
@@ -684,7 +684,7 @@ static void network_alloc_rx_buffers(str
                 * necessary here.
                 * 16 bytes added as necessary headroom for netif_receive_skb.
                 */
-               skb = alloc_skb(RX_COPY_THRESHOLD + 16,
+               skb = alloc_skb(RX_COPY_THRESHOLD + 16 + NET_IP_ALIGN,
                                GFP_ATOMIC | __GFP_NOWARN);
                if (unlikely(!skb))
                        goto no_skb;
@@ -702,7 +702,7 @@ no_skb:
                        break;
                }
 
-               skb_reserve(skb, 16); /* mimic dev_alloc_skb() */
+               skb_reserve(skb, 16 + NET_IP_ALIGN); /* mimic dev_alloc_skb() */
                skb_shinfo(skb)->frags[0].page = page;
                skb_shinfo(skb)->nr_frags = 1;
                __skb_queue_tail(&np->rx_batch, skb);
@@ -2129,6 +2129,9 @@ module_init(netif_init);
 
 static void __exit netif_exit(void)
 {
+       if (is_initial_xendomain())
+               return;
+
        unregister_inetaddr_notifier(&notifier_inetdev);
 
        return xenbus_unregister_driver(&netfront);
diff -r d5a46e4cc340 -r 6492b9b27968 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sun Oct 22 14:39:15 
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sun Oct 22 15:23:52 
2006 -0600
@@ -157,10 +157,12 @@ static void frontend_changed(struct xenb
 
        case XenbusStateClosing:
                be->instance = -1;
-               break;
-
-       case XenbusStateUnknown:
+               xenbus_switch_state(dev, XenbusStateClosing);
+               break;
+
+       case XenbusStateUnknown: /* keep it here */
        case XenbusStateClosed:
+               xenbus_switch_state(dev, XenbusStateClosed);
                device_unregister(&be->dev->dev);
                tpmback_remove(dev);
                break;
diff -r d5a46e4cc340 -r 6492b9b27968 tools/Makefile
--- a/tools/Makefile    Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/Makefile    Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/Rules.mk
--- a/tools/Rules.mk    Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/Rules.mk    Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile     Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/blktap/drivers/Makefile     Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/blktap/lib/Makefile
--- a/tools/blktap/lib/Makefile Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/blktap/lib/Makefile Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/check/check_brctl
--- a/tools/check/check_brctl   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/check/check_brctl   Sun Oct 22 15:23:52 2006 -0600
@@ -1,10 +1,27 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-INSTALL
 
-function error {
-   echo
-   echo '  *** Check for the bridge control utils (brctl) FAILED'
-   exit 1
-}
+RC=0
 
-which brctl 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+       # These systems have a bridge builtin
+       TOOL="brconfig"
+       which ${TOOL} 1>/dev/null 2>&1 || RC=1 
+       ;;
+Linux)
+       TOOL="brctl"
+       which ${TOOL} 1>/dev/null 2>&1 || RC=1
+       ;;
+*)
+       TOOL=""
+       echo "Unknown OS" && RC=1
+       ;;
+esac
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for the bridge control utils (${TOOL}) FAILED"
+fi
+
+exit ${RC} 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/check/check_iproute
--- a/tools/check/check_iproute Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/check/check_iproute Sun Oct 22 15:23:52 2006 -0600
@@ -1,11 +1,26 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-INSTALL
 
-function error {
-   echo
-   echo '  *** Check for iproute (ip addr) FAILED'
-   exit 1
-}
+RC=0
 
-ip addr list 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+       TOOL="ifconfig"
+       eval ${TOOL} -a 1>/dev/null 2>&1 || RC=1 
+       ;;
+Linux)
+       TOOL="ip addr"
+       eval ${TOOL} list 1>/dev/null 2>&1 || RC=1 
+       ;;
+*)
+       TOOL=""
+       echo "Unknown OS" && RC=1 
+       ;;
+esac
 
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for iproute (${TOOL}) FAILED"
+fi
+
+exit ${RC} 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/check/check_python
--- a/tools/check/check_python  Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/check/check_python  Sun Oct 22 15:23:52 2006 -0600
@@ -1,10 +1,13 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD CHECK-INSTALL
 
-function error {
-    echo
-    echo "  *** Check for Python version >= 2.2 FAILED"
-    exit 1
-}
+RC=0
 
-python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || error
+python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || RC=1
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for Python version >= 2.2 FAILED"
+fi
+
+exit ${RC} 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/check/check_zlib_devel
--- a/tools/check/check_zlib_devel      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/check/check_zlib_devel      Sun Oct 22 15:23:52 2006 -0600
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD
 
-function error {
-    echo
-    echo "  *** Check for zlib headers FAILED"
-    exit 1
-}
+RC=0
 
 set -e
-[ -e /usr/include/zlib.h ] || error
+test -r /usr/include/zlib.h || RC=1
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for zlib headers FAILED"
+fi 
+
+exit ${RC}
diff -r d5a46e4cc340 -r 6492b9b27968 tools/check/check_zlib_lib
--- a/tools/check/check_zlib_lib        Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/check/check_zlib_lib        Sun Oct 22 15:23:52 2006 -0600
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
 # CHECK-BUILD CHECK-INSTALL
 
-function error {
-    echo
-    echo "  *** Check for zlib library FAILED"
-    exit 1
-}
+RC=0
 
 set -e
-ldconfig -p | grep -q libz.so || error
+ldconfig -v 2>&1 | grep -q libz.so || RC=1
+
+if test ${RC} -ne 0; then
+       echo
+       echo " *** Check for zlib library FAILED"
+fi
+
+exit ${RC} 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/check/chk
--- a/tools/check/chk   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/check/chk   Sun Oct 22 15:23:52 2006 -0600
@@ -1,8 +1,9 @@
-#!/bin/bash
+#!/bin/sh
 
-function usage {
+func_usage ()
+{
     echo "Usage:"
-    echo "\t$0 [build|install|clean]"
+    echo "     $0 [build|install|clean]"
     echo
     echo "Check suitability for Xen build or install."
     echo "Exit with 0 if OK, 1 if not."
@@ -12,7 +13,13 @@ function usage {
     exit 1
 }
 
-export PATH=${PATH}:/sbin:/usr/sbin
+PATH=${PATH}:/sbin:/usr/sbin
+OS=`uname -s`
+export PATH OS
+
+if test "${OS}" = "SunOS"; then
+       exit 0
+fi
 
 case $1 in
     build)
@@ -25,7 +32,7 @@ case $1 in
         exit 0
         ;;
     *)
-        usage
+        func_usage
         ;;
 esac
 
@@ -54,4 +61,4 @@ for f in check_* ; do
     fi
 done
 
-exit $failed
+exit ${failed}
diff -r d5a46e4cc340 -r 6492b9b27968 tools/console/Makefile
--- a/tools/console/Makefile    Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/console/Makefile    Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/console/daemon/io.c Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/console/daemon/utils.c
--- a/tools/console/daemon/utils.c      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/console/daemon/utils.c      Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 
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     
Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c     
Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/examples/Makefile
--- a/tools/examples/Makefile   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/examples/Makefile   Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/examples/vtpm-common.sh
--- a/tools/examples/vtpm-common.sh     Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/examples/vtpm-common.sh     Sun Oct 22 15:23:52 2006 -0600
@@ -226,7 +226,7 @@ function vtpmdb_remove_entry () {
 # Returns 'resume' or 'create'
 function vtpm_get_create_reason () {
        local resume
-       resume=$(xenstore-read $XENBUS_PATH/resume)
+       resume=$(xenstore_read $XENBUS_PATH/resume)
        if [ "$resume" == "True" ]; then
                echo "resume"
        else
@@ -287,6 +287,8 @@ function vtpm_create_instance () {
 #entry is kept in the VTPMDB file.
 function vtpm_remove_instance () {
        local instance reason domname
+       #Stop script execution quietly if path does not exist (anymore)
+       xenstore-exists "$XENBUS_PATH"/domain
        domname=$(xenstore_read "$XENBUS_PATH"/domain)
 
        if [ "$domname" != "" ]; then
@@ -383,7 +385,7 @@ function vtpm_domid_from_name () {
        local id name ids
        ids=$(xenstore-list /local/domain)
        for id in $ids; do
-               name=$(xenstore-read /local/domain/$id/name)
+               name=$(xenstore_read /local/domain/$id/name)
                if [ "$name" == "$1" ]; then
                        echo "$id"
                        return
diff -r d5a46e4cc340 -r 6492b9b27968 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp    Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/examples/xend-config.sxp    Sun Oct 22 15:23:52 2006 -0600
@@ -135,3 +135,7 @@
 # to 127.0.0.1  To restore old 'listen everywhere' behaviour
 # set this to 0.0.0.0
 #(vnc-listen '127.0.0.1')
+
+# The default password for VNC console on HVM domain.
+# Empty string is no authentication.
+(vncpasswd '')
diff -r d5a46e4cc340 -r 6492b9b27968 tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/examples/xmexample.hvm      Sun Oct 22 15:23:52 2006 -0600
@@ -150,6 +150,11 @@ vnc=1
 #vncconsole=0
 
 #----------------------------------------------------------------------------
+# set password for domain's VNC console
+# default is depents on vncpasswd in xend-config.sxp
+vncpasswd=''
+
+#----------------------------------------------------------------------------
 # no graphics, use serial port
 #nographic=0
 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/examples/xmexample.vti
--- a/tools/examples/xmexample.vti      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/examples/xmexample.vti      Sun Oct 22 15:23:52 2006 -0600
@@ -95,6 +95,11 @@ vnc=0
 #vncconsole=0
 
 #----------------------------------------------------------------------------
+# set password for domain's VNC console
+# default is depents on vncpasswd in xend-config.sxp
+vncpasswd=''
+
+#----------------------------------------------------------------------------
 # no graphics, use serial port
 #nographic=0
 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/Makefile
--- a/tools/firmware/Makefile   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/Makefile   Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/firmware/acpi/Makefile
--- a/tools/firmware/acpi/Makefile      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/acpi/Makefile      Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/hvmloader/Makefile Sun Oct 22 15:23:52 2006 -0600
@@ -32,13 +32,13 @@ XENINC   =-I$(XEN_ROOT)/tools/libxc
 XENINC   =-I$(XEN_ROOT)/tools/libxc
 
 # Disable PIE/SSP if GCC supports them. They can break us.
-CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
-CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
-CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
+CFLAGS  += $(call cc-option,$(CC),-nopie,)
+CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector,)
+CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector-all,)
 
 OBJCOPY  = objcopy
 CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
-LDFLAGS  = -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
+LDFLAGS  = -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
 
 SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c
 OBJS = $(patsubst %.c,%.o,$(SRCS))
@@ -48,7 +48,7 @@ all: hvmloader
 
 hvmloader: roms.h $(SRCS)
        $(CC) $(CFLAGS) -c $(SRCS)
-       $(CC) $(LDFLAGS) -o hvmloader.tmp $(OBJS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o hvmloader.tmp $(OBJS)
        $(OBJCOPY) hvmloader.tmp hvmloader
        rm -f hvmloader.tmp
 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/vmxassist/Makefile
--- a/tools/firmware/vmxassist/Makefile Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/vmxassist/Makefile Sun Oct 22 15:23:52 2006 -0600
@@ -32,14 +32,13 @@ XENINC=-I$(XEN_ROOT)/tools/libxc
 XENINC=-I$(XEN_ROOT)/tools/libxc
 
 # Disable PIE/SSP if GCC supports them. They can break us.
-CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
-CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
-CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
+CFLAGS  += $(call cc-option,$(CC),-nopie,)
+CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector,)
+CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector-all,)
 
 CPP      = cpp -P
 OBJCOPY  = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
 CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
-LDFLAGS  = -m elf_i386
 
 OBJECTS = head.o trap.o vm86.o setup.o util.o
 
@@ -48,7 +47,7 @@ all: vmxassist.bin
 
 vmxassist.bin: vmxassist.ld $(OBJECTS)
        $(CPP) $(DEFINES) vmxassist.ld > vmxassist.tmp
-       $(LD) -o vmxassist $(LDFLAGS) -nostdlib --fatal-warnings -N -T 
vmxassist.tmp $(OBJECTS)
+       $(LD) -o vmxassist $(LDFLAGS_DIRECT) -nostdlib --fatal-warnings -N -T 
vmxassist.tmp $(OBJECTS)
        nm -n vmxassist > vmxassist.sym
        $(OBJCOPY) vmxassist vmxassist.tmp
        dd if=vmxassist.tmp of=vmxassist.bin ibs=512 conv=sync
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/vmxassist/head.S
--- a/tools/firmware/vmxassist/head.S   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/vmxassist/head.S   Sun Oct 22 15:23:52 2006 -0600
@@ -59,7 +59,7 @@ _start16:
 
         /* go to protected mode */
         movl    %cr0, %eax
-        orl     $CR0_PE, %eax
+        orl     $(CR0_PE), %eax
         movl    %eax, %cr0
         data32  ljmp $0x08, $1f
 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/vmxassist/trap.S
--- a/tools/firmware/vmxassist/trap.S   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/vmxassist/trap.S   Sun Oct 22 15:23:52 2006 -0600
@@ -106,7 +106,7 @@ common_trap:                                /* common trap 
handler *
        pushl   %es
        pushal
 
-       movl    $DATA_SELECTOR, %eax    /* make sure these are sane */
+       movl    $(DATA_SELECTOR), %eax  /* make sure these are sane */
        movl    %eax, %ds
        movl    %eax, %es
        movl    %eax, %fs
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/vmxassist/util.c
--- a/tools/firmware/vmxassist/util.c   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/vmxassist/util.c   Sun Oct 22 15:23:52 2006 -0600
@@ -29,6 +29,31 @@ static char *printnum(char *, unsigned l
 static char *printnum(char *, unsigned long, int);
 static void _doprint(void (*)(int), char const *, va_list);
 
+void
+cpuid_addr_value(uint64_t addr, uint64_t *value)
+{
+       uint32_t addr_low   = (uint32_t)addr;
+       uint32_t addr_high  = (uint32_t)(addr >> 32);
+       uint32_t value_low, value_high;
+       static unsigned int addr_leaf;
+
+       if (!addr_leaf) {
+               unsigned int eax, ebx, ecx, edx;
+               __asm__ __volatile__(
+                       "cpuid"
+                       : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
+                       : "0" (0x40000000));
+               addr_leaf = eax + 1;
+       }
+
+       __asm__ __volatile__(
+               "cpuid"
+               : "=c" (value_low), "=d" (value_high)
+               : "a" (addr_leaf), "0" (addr_low), "1" (addr_high)
+               : "ebx");
+
+       *value = (uint64_t)value_high << 32 | value_low;
+}
 
 void
 dump_regs(struct regs *regs)
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/vmxassist/util.h
--- a/tools/firmware/vmxassist/util.h   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/vmxassist/util.h   Sun Oct 22 15:23:52 2006 -0600
@@ -31,6 +31,7 @@
 
 struct vmx_assist_context;
 
+extern void cpuid_addr_value(uint64_t addr, uint64_t *value);
 extern void hexdump(unsigned char *, int);
 extern void dump_regs(struct regs *);
 extern void dump_vmx_context(struct vmx_assist_context *);
diff -r d5a46e4cc340 -r 6492b9b27968 tools/firmware/vmxassist/vm86.c
--- a/tools/firmware/vmxassist/vm86.c   Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/firmware/vmxassist/vm86.c   Sun Oct 22 15:23:52 2006 -0600
@@ -56,8 +56,8 @@ static char *rnames[] = { "ax", "cx", "d
 #define PT_ENTRY_PRESENT 0x1
 
 /* We only support access to <=4G physical memory due to 1:1 mapping */
-static unsigned
-guest_linear_to_real(uint32_t base)
+static uint64_t
+guest_linear_to_phys(uint32_t base)
 {
        uint32_t gcr3 = oldctx.cr3;
        uint64_t l2_mfn;
@@ -89,23 +89,32 @@ guest_linear_to_real(uint32_t base)
                l2_mfn = ((uint64_t *)(long)gcr3)[(base >> 30) & 0x3];
                if (!(l2_mfn & PT_ENTRY_PRESENT))
                        panic("l3 entry not present\n");
-               l2_mfn &= 0x3fffff000ULL;
-
-               l1_mfn = ((uint64_t *)(long)l2_mfn)[(base >> 21) & 0x1ff];
+               l2_mfn &= 0xffffff000ULL;
+
+               if (l2_mfn & 0xf00000000ULL) {
+                       printf("l2 page above 4G\n");
+                       cpuid_addr_value(l2_mfn + 8 * ((base >> 21) & 0x1ff), 
&l1_mfn);
+               } else
+                       l1_mfn = ((uint64_t *)(long)l2_mfn)[(base >> 21) & 
0x1ff];
                if (!(l1_mfn & PT_ENTRY_PRESENT))
                        panic("l2 entry not present\n");
 
                if (l1_mfn & PDE_PS) { /* CR4.PSE is ignored in PAE mode */
-                       l0_mfn = l1_mfn & 0x3ffe00000ULL;
+                       l0_mfn = l1_mfn & 0xfffe00000ULL;
                        return l0_mfn + (base & 0x1fffff);
                }
 
-               l1_mfn &= 0x3fffff000ULL;
-
-               l0_mfn = ((uint64_t *)(long)l1_mfn)[(base >> 12) & 0x1ff];
+               l1_mfn &= 0xffffff000ULL;
+
+               if (l1_mfn & 0xf00000000ULL) {
+                       printf("l1 page above 4G\n");
+                       cpuid_addr_value(l1_mfn + 8 * ((base >> 12) & 0x1ff), 
&l0_mfn);
+               } else
+                       l0_mfn = ((uint64_t *)(long)l1_mfn)[(base >> 12) & 
0x1ff];
                if (!(l0_mfn & PT_ENTRY_PRESENT))
                        panic("l1 entry not present\n");
-               l0_mfn &= 0x3fffff000ULL;
+
+               l0_mfn &= 0xffffff000ULL;
 
                return l0_mfn + (base & 0xfff);
        }
@@ -114,6 +123,7 @@ static unsigned
 static unsigned
 address(struct regs *regs, unsigned seg, unsigned off)
 {
+       uint64_t gdt_phys_base;
        unsigned long long entry;
        unsigned seg_base, seg_limit;
        unsigned entry_low, entry_high;
@@ -129,8 +139,13 @@ address(struct regs *regs, unsigned seg,
            (mode == VM86_REAL_TO_PROTECTED && regs->cs == seg))
                return ((seg & 0xFFFF) << 4) + off;
 
-       entry = ((unsigned long long *)
-                 guest_linear_to_real(oldctx.gdtr_base))[seg >> 3];
+       gdt_phys_base = guest_linear_to_phys(oldctx.gdtr_base);
+       if (gdt_phys_base != (uint32_t)gdt_phys_base) {
+               printf("gdt base address above 4G\n");
+               cpuid_addr_value(gdt_phys_base + 8 * (seg >> 3), &entry);
+       } else
+               entry = ((unsigned long long *)(long)gdt_phys_base)[seg >> 3];
+
        entry_high = entry >> 32;
        entry_low = entry & 0xFFFFFFFF;
 
@@ -804,6 +819,7 @@ static int
 static int
 load_seg(unsigned long sel, uint32_t *base, uint32_t *limit, union 
vmcs_arbytes *arbytes)
 {
+       uint64_t gdt_phys_base;
        unsigned long long entry;
 
        /* protected mode: use seg as index into gdt */
@@ -815,8 +831,12 @@ load_seg(unsigned long sel, uint32_t *ba
                return 1;
        }
 
-       entry = ((unsigned long long *)
-                 guest_linear_to_real(oldctx.gdtr_base))[sel >> 3];
+       gdt_phys_base = guest_linear_to_phys(oldctx.gdtr_base);
+       if (gdt_phys_base != (uint32_t)gdt_phys_base) {
+               printf("gdt base address above 4G\n");
+               cpuid_addr_value(gdt_phys_base + 8 * (sel >> 3), &entry);
+       } else
+               entry = ((unsigned long long *)(long)gdt_phys_base)[sel >> 3];
 
        /* Check the P bit first */
        if (!((entry >> (15+32)) & 0x1) && sel != 0)
diff -r d5a46e4cc340 -r 6492b9b27968 tools/guest-headers/Makefile
--- a/tools/guest-headers/Makefile      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/guest-headers/Makefile      Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/ioemu/Makefile.target
--- a/tools/ioemu/Makefile.target       Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/Makefile.target       Sun Oct 22 15:23:52 2006 -0600
@@ -23,7 +23,7 @@ DEFINES+=-I$(SRC_PATH)/linux-user -I$(SR
 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
 CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
-SSE2 := $(call test-gcc-flag,$(CC),-msse2)
+SSE2 := $(call cc-option,$(CC),-msse2,)
 ifeq ($(SSE2),-msse2)
 CFLAGS += -DUSE_SSE2=1 -msse2
 endif
@@ -294,7 +294,11 @@ endif
 endif
 
 # qemu-dm objects
+ifeq ($(ARCH),ia64)
 LIBOBJS=helper2.o exec-dm.o i8259-dm.o
+else
+LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o
+endif
 
 all: $(PROGS)
 
@@ -354,7 +358,11 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 ifeq ($(TARGET_BASE_ARCH), i386)
 # Hardware support
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
+ifeq ($(ARCH),ia64)
 VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
+else
+VL_OBJS+= fdc.o serial.o pc.o
+endif
 VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o
 VL_OBJS+= piix4acpi.o
@@ -398,6 +406,7 @@ VL_OBJS+=sdl.o
 VL_OBJS+=sdl.o
 endif
 VL_OBJS+=vnc.o
+VL_OBJS+=d3des.o
 ifdef CONFIG_COCOA
 VL_OBJS+=cocoa.o
 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
@@ -456,6 +465,9 @@ sdl.o: sdl.c keymaps.c sdl_keysym.h
        $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
 
 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
+       $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+
+d3des.o: d3des.c d3des.h
        $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
@@ -555,10 +567,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 d5a46e4cc340 -r 6492b9b27968 tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/hw/ide.c      Sun Oct 22 15:23:52 2006 -0600
@@ -557,9 +557,9 @@ static void ide_atapi_identify(IDEState 
     padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
     padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */
     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
-    put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */
+    put_le16(p + 49, (1 << 11) | (1 << 9) | (1 << 8)); /* DMA and LBA 
supported */
     put_le16(p + 53, 3); /* words 64-70, 54-58 valid */
-    put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */
+    put_le16(p + 63, 0x07); /* mdma0-2 supported */
     put_le16(p + 64, 1); /* PIO modes */
     put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */
     put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */
diff -r d5a46e4cc340 -r 6492b9b27968 tools/ioemu/hw/xen_platform.c
--- a/tools/ioemu/hw/xen_platform.c     Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/hw/xen_platform.c     Sun Oct 22 15:23:52 2006 -0600
@@ -97,7 +97,8 @@ struct pci_config_header {
     uint8_t  bist; /* Built in self test */
     uint32_t base_address_regs[6];
     uint32_t reserved1;
-    uint32_t reserved2;
+    uint16_t subsystem_vendor_id;
+    uint16_t subsystem_id;
     uint32_t rom_addr;
     uint32_t reserved3;
     uint32_t reserved4;
@@ -126,6 +127,11 @@ void pci_xen_platform_init(PCIBus *bus)
     pch->header_type = 0;
     pch->interrupt_pin = 1;
 
+    /* Microsoft WHQL requires non-zero subsystem IDs. */
+    /* http://www.pcisig.com/reflector/msg02205.html.  */
+    pch->subsystem_vendor_id = pch->vendor_id; /* Duplicate vendor id.  */
+    pch->subsystem_id        = 0x0001;         /* Hardcode sub-id as 1. */
+
     pci_register_io_region(d, 0, 0x100, PCI_ADDRESS_SPACE_IO,
                            platform_ioport_map);
 
diff -r d5a46e4cc340 -r 6492b9b27968 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/vl.c  Sun Oct 22 15:23:52 2006 -0600
@@ -170,6 +170,9 @@ time_t timeoffset = 0;
 
 char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
 extern int domid;
+
+char vncpasswd[64];
+unsigned char challenge[AUTHCHALLENGESIZE];
 
 /***********************************************************/
 /* x86 ISA bus support */
@@ -3028,7 +3031,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 +3998,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) {
@@ -5911,6 +5914,7 @@ int main(int argc, char **argv)
     vncunused = 0;
     kernel_filename = NULL;
     kernel_cmdline = "";
+    *vncpasswd = '\0';
 #ifndef CONFIG_DM
 #ifdef TARGET_PPC
     cdrom_index = 1;
@@ -5942,7 +5946,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);
     
@@ -6559,6 +6563,10 @@ int main(int argc, char **argv)
 
     init_ioports();
 
+    /* read vncpasswd from xenstore */
+    if (0 > xenstore_read_vncpasswd(domid))
+        exit(1);
+
     /* terminal init */
     if (nographic) {
         dumb_display_init(ds);
diff -r d5a46e4cc340 -r 6492b9b27968 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/vl.h  Sun Oct 22 15:23:52 2006 -0600
@@ -1211,6 +1211,7 @@ void xenstore_process_event(void *opaque
 void xenstore_process_event(void *opaque);
 void xenstore_check_new_media_present(int timeout);
 void xenstore_write_vncport(int vnc_display);
+int xenstore_read_vncpasswd(int domid);
 
 /* xen_platform.c */
 void pci_xen_platform_init(PCIBus *bus);
@@ -1222,4 +1223,7 @@ extern char domain_name[];
 
 void destroy_hvm_domain(void);
 
+/* VNC Authentication */
+#define AUTHCHALLENGESIZE 16
+
 #endif /* VL_H */
diff -r d5a46e4cc340 -r 6492b9b27968 tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/vnc.c Sun Oct 22 15:23:52 2006 -0600
@@ -44,6 +44,7 @@
 
 #include "vnc_keysym.h"
 #include "keymaps.c"
+#include "d3des.h"
 
 #define XK_MISCELLANY
 #define XK_LATIN1
@@ -137,6 +138,9 @@ static void vnc_update_client(void *opaq
 static void vnc_update_client(void *opaque);
 static void vnc_client_read(void *opaque);
 static void framebuffer_set_updated(VncState *vs, int x, int y, int w, int h);
+static int make_challenge(char *random, int size);
+static void set_seed(unsigned int *seedp);
+static void get_random(int len, unsigned char *buf);
 
 #if 0
 static inline void vnc_set_bit(uint32_t *d, int k)
@@ -1208,23 +1212,92 @@ static int protocol_client_init(VncState
     return 0;
 }
 
+static int protocol_response(VncState *vs, char *client_response, size_t len)
+{
+    extern char vncpasswd[64];
+    extern unsigned char challenge[AUTHCHALLENGESIZE];
+    unsigned char cryptchallenge[AUTHCHALLENGESIZE];
+    unsigned char key[8];
+    int passwdlen, i, j;
+
+    memcpy(cryptchallenge, challenge, AUTHCHALLENGESIZE);
+
+    /* Calculate the sent challenge */
+    passwdlen = strlen(vncpasswd);
+    for (i=0; i<8; i++)
+       key[i] = i<passwdlen ? vncpasswd[i] : 0;
+    deskey(key, EN0);
+    for (j = 0; j < AUTHCHALLENGESIZE; j += 8)
+       des(cryptchallenge+j, cryptchallenge+j);
+
+    /* Check the actual response */
+    if (memcmp(cryptchallenge, client_response, AUTHCHALLENGESIZE) != 0) {
+       /* password error */
+       vnc_write_u32(vs, 1);
+       vnc_write_u32(vs, 22);
+       vnc_write(vs, "Authentication failure", 22);
+       vnc_flush(vs);
+       fprintf(stderr, "VNC Password error.\n");
+       vnc_client_error(vs);
+       return 0;
+    }
+
+    vnc_write_u32(vs, 0);
+    vnc_flush(vs);
+
+    vnc_read_when(vs, protocol_client_init, 1);
+
+    return 0;
+}
+
 static int protocol_version(VncState *vs, char *version, size_t len)
 {
+    extern char vncpasswd[64];
+    extern unsigned char challenge[AUTHCHALLENGESIZE];
     char local[13];
-    int maj, min;
+    int  support, maj, min;
 
     memcpy(local, version, 12);
     local[12] = 0;
 
+    /* protocol version check */
     if (sscanf(local, "RFB %03d.%03d\n", &maj, &min) != 2) {
+       fprintf(stderr, "Protocol version error.\n");
        vnc_client_error(vs);
        return 0;
     }
 
-    vnc_write_u32(vs, 1); /* None */
-    vnc_flush(vs);
-
-    vnc_read_when(vs, protocol_client_init, 1);
+
+    support = 0;
+    if (maj = 3) {
+       if (min == 3 || min ==4) {
+           support = 1;
+       }
+    }
+
+    if (! support) {
+       fprintf(stderr, "Client uses unsupported protocol version %d.%d.\n",
+               maj, min);
+       vnc_client_error(vs);
+       return 0;
+    }
+
+    if (*vncpasswd == '\0') {
+       /* AuthType is None */
+       vnc_write_u32(vs, 1);
+       vnc_flush(vs);
+       vnc_read_when(vs, protocol_client_init, 1);
+    } else {
+       /* AuthType is VncAuth */
+       vnc_write_u32(vs, 2);
+
+       /* Challenge-Responce authentication */
+       /* Send Challenge */
+       make_challenge(challenge, AUTHCHALLENGESIZE);
+       vnc_write(vs, challenge, AUTHCHALLENGESIZE);
+       vnc_flush(vs);
+       vnc_read_when(vs, protocol_response, AUTHCHALLENGESIZE);
+    }
 
     return 0;
 }
@@ -1342,3 +1415,32 @@ int vnc_start_viewer(int port)
        return pid;
     }
 }
+
+unsigned int seed;
+
+static int make_challenge(char *random, int size)
+{
+ 
+    set_seed(&seed);
+    get_random(size, random);
+
+    return 0;
+}
+
+static void set_seed(unsigned int *seedp)
+{
+    *seedp += (unsigned int)(time(NULL)+getpid()+getpid()*987654+rand());
+    srand(*seedp);
+
+    return;
+}
+
+static void get_random(int len, unsigned char *buf)
+{
+    int i;
+
+    for (i=0; i<len; i++)
+       buf[i] = (int) (256.0*rand()/(RAND_MAX+1.0));
+
+    return;
+}
diff -r d5a46e4cc340 -r 6492b9b27968 tools/ioemu/xenstore.c
--- a/tools/ioemu/xenstore.c    Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/ioemu/xenstore.c    Sun Oct 22 15:23:52 2006 -0600
@@ -213,3 +213,54 @@ void xenstore_write_vncport(int display)
     free(portstr);
     free(buf);
 }
+
+int xenstore_read_vncpasswd(int domid)
+{
+    extern char vncpasswd[64];
+    char *buf = NULL, *path, *uuid = NULL, *passwd = NULL;
+    unsigned int i, len, rc = 0;
+
+    if (xsh == NULL) {
+       return -1;
+    }
+
+    path = xs_get_domain_path(xsh, domid);
+    if (path == NULL) {
+       fprintf(logfile, "xs_get_domain_path() error. domid %d.\n", domid);
+       return -1;
+    }
+
+    pasprintf(&buf, "%s/vm", path);
+    uuid = xs_read(xsh, XBT_NULL, buf, &len);
+    if (uuid == NULL) {
+       fprintf(logfile, "xs_read(): uuid get error. %s.\n", buf);
+       free(path);
+       return -1;
+    }
+
+    pasprintf(&buf, "%s/vncpasswd", uuid);
+    passwd = xs_read(xsh, XBT_NULL, buf, &len);
+    if (passwd == NULL) {
+       fprintf(logfile, "xs_read(): vncpasswd get error. %s.\n", buf);
+       free(uuid);
+       free(path);
+       return rc;
+    }
+
+    for (i=0; i<len && i<63; i++) {
+       vncpasswd[i] = passwd[i];
+       passwd[i] = '\0';
+    }
+    vncpasswd[len] = '\0';
+    pasprintf(&buf, "%s/vncpasswd", uuid);
+    if (xs_write(xsh, XBT_NULL, buf, passwd, len) == 0) {
+       fprintf(logfile, "xs_write() vncpasswd failed.\n");
+       rc = -1;
+    }
+
+    free(passwd);
+    free(uuid);
+    free(path);
+
+    return rc;
+}
diff -r d5a46e4cc340 -r 6492b9b27968 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/libxc/Makefile      Sun Oct 22 15:23:52 2006 -0600
@@ -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 d5a46e4cc340 -r 6492b9b27968 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c  Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c  Sun Oct 22 15:23:52 2006 -0600
@@ -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;
     }
 
@@ -234,7 +234,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;
     }
 
@@ -245,19 +245,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;
     }
 
@@ -265,11 +265,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 d5a46e4cc340 -r 6492b9b27968 tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c     Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c     Sun Oct 22 15:23:52 2006 -0600
@@ -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,12 +449,12 @@ 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;
     }
 
@@ -464,17 +464,17 @@ xc_linux_save(int xc_handle, int io_fd, 
     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 d5a46e4cc340 -r 6492b9b27968 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/libxc/xc_hvm_build.c        Sun Oct 22 15:23:52 2006 -0600
@@ -17,7 +17,6 @@
 #include <xen/hvm/e820.h>
 
 #define HVM_LOADER_ENTR_ADDR  0x00100000
-
 static int
 parseelfimage(
     char *elfbase, unsigned long elfsize, struct domain_setup_info *dsi);
@@ -82,15 +81,16 @@ static void build_e820map(void *e820_pag
     e820entry[nr_map].type = E820_IO;
     nr_map++;
 
+    e820entry[nr_map].addr = 0xEA000;
+    e820entry[nr_map].size = 0x01000;
+    e820entry[nr_map].type = E820_ACPI;
+    nr_map++;
+
     e820entry[nr_map].addr = 0xF0000;
     e820entry[nr_map].size = 0x10000;
     e820entry[nr_map].type = E820_RESERVED;
     nr_map++;
 
-/* ACPI data: 10 pages. */
-#define ACPI_DATA_PAGES     10
-/* ACPI NVS: 3 pages.   */
-#define ACPI_NVS_PAGES      3
 /* buffered io page.    */
 #define BUFFERED_IO_PAGES   1
 /* xenstore page.       */
@@ -102,36 +102,13 @@ static void build_e820map(void *e820_pag
     /* Most of the ram goes here */
     e820entry[nr_map].addr = 0x100000;
     e820entry[nr_map].size = mem_size - 0x100000 - PAGE_SIZE *
-                                                (ACPI_DATA_PAGES +
-                                                 ACPI_NVS_PAGES +
-                                                 BUFFERED_IO_PAGES +
+                                                (BUFFERED_IO_PAGES +
                                                  XENSTORE_PAGES +
                                                  SHARED_IO_PAGES);
     e820entry[nr_map].type = E820_RAM;
     nr_map++;
 
     /* Statically allocated special pages */
-
-    /* For ACPI data */
-    e820entry[nr_map].addr = mem_size - PAGE_SIZE *
-                                        (ACPI_DATA_PAGES +
-                                         ACPI_NVS_PAGES +
-                                         BUFFERED_IO_PAGES +
-                                         XENSTORE_PAGES +
-                                         SHARED_IO_PAGES);
-    e820entry[nr_map].size = PAGE_SIZE * ACPI_DATA_PAGES;
-    e820entry[nr_map].type = E820_ACPI;
-    nr_map++;
-
-    /* For ACPI NVS */
-    e820entry[nr_map].addr = mem_size - PAGE_SIZE *
-                                        (ACPI_NVS_PAGES +
-                                         BUFFERED_IO_PAGES +
-                                         XENSTORE_PAGES +
-                                         SHARED_IO_PAGES);
-    e820entry[nr_map].size = PAGE_SIZE * ACPI_NVS_PAGES;
-    e820entry[nr_map].type = E820_NVS;
-    nr_map++;
 
     /* For buffered IO requests */
     e820entry[nr_map].addr = mem_size - PAGE_SIZE *
diff -r d5a46e4cc340 -r 6492b9b27968 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Sun Oct 22 14:39:15 2006 -0600
+++ b/tools/libxc/xc_linux_restore.c    Sun Oct 22 15:23:52 2006 -0600
@@ -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) !=