ia64/xen-unstable

changeset 4608:18d709f72233

bitkeeper revision 1.1159.170.111 (4266fe71ppAIWyNXyP9cTS2-29x3_A)

Merge freefall.cl.cam.ac.uk:/auto/anfs/scratch/font/sd386/xen-2.0-testing.bk
into freefall.cl.cam.ac.uk:/auto/groups/xeno/users/iap10/xeno-clone/xen-2.0-testing.bk
author iap10@freefall.cl.cam.ac.uk
date Thu Apr 21 01:14:25 2005 +0000 (2005-04-21)
parents 0dc3b8b8c298 99aeb036036c
children 9c88ba91d330
files .rootkeys BitKeeper/etc/logging_ok freebsd-5.3-xen-sparse/conf/kern.mk linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig linux-2.6.11-xen-sparse/drivers/xen/console/console.c linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h tools/check/check_iproute tools/libxc/xc_domain.c tools/libxc/xc_io.h tools/libxc/xc_linux_save.c tools/libxutil/file_stream.c tools/libxutil/gzip_stream.c tools/libxutil/iostream.h tools/misc/netfix tools/misc/xend tools/misc/xensv tools/misc/xm tools/xentrace/Makefile tools/xfrd/xen_domain.c xen/Makefile xen/arch/x86/memory.c xen/arch/x86/setup.c xen/arch/x86/smpboot.c xen/common/grant_table.c xen/common/schedule.c xen/drivers/pci/quirks.c xen/include/asm-x86/page.h
line diff
     1.1 --- a/.rootkeys	Tue Apr 05 11:27:50 2005 +0000
     1.2 +++ b/.rootkeys	Thu Apr 21 01:14:25 2005 +0000
     1.3 @@ -46,6 +46,7 @@ 3f815145vGYx1WY79voKkZB9yKwJKQ extras/mi
     1.4  3f815145xlKBAQmal9oces3G_Mvxqw extras/mini-os/traps.c
     1.5  423e7e86yUUeeOvTAmjIahrpk1ksaQ freebsd-5.3-xen-sparse/conf/Makefile.i386-xen
     1.6  423e7e86CSWbA9G8OftmMbfhStuQ6Q freebsd-5.3-xen-sparse/conf/files.i386-xen
     1.7 +42642db9m5qcqIrsHX8QlcBGeKSAmw freebsd-5.3-xen-sparse/conf/kern.mk
     1.8  423e7e86m-vV5fQ_32CjcFMEr77Fyg freebsd-5.3-xen-sparse/conf/ldscript.i386-xen
     1.9  423e7e86Fo2PxRS_37IwkpH-x5t5xQ freebsd-5.3-xen-sparse/conf/options.i386-xen
    1.10  423e7e868Yt0iZuEeccnczyToPPvow freebsd-5.3-xen-sparse/fbsdxensetup
    1.11 @@ -377,6 +378,7 @@ 4124b307vHLUWbfpemVefmaWDcdfag tools/che
    1.12  4124b307jt7T3CHysgl9LijNHSe1tA tools/check/check_brctl
    1.13  4124b307HDX972-zihuZWXB7R8Vd0w tools/check/check_curl_devel
    1.14  4124b307P3bZBkTFm6r-3XTbf0phAA tools/check/check_curl_lib
    1.15 +42642813SYRkwr07qVZ9eCI5QTZANg tools/check/check_iproute
    1.16  4124b307u-FeKvFP9kZnh0rLV0XjGg tools/check/check_logging
    1.17  4124b307tRTjLqzRy60QrUoqN2Fhuw tools/check/check_python
    1.18  4124b307XdznSNCv97lrT3RpOdMM1A tools/check/check_twisted
     2.1 --- a/BitKeeper/etc/logging_ok	Tue Apr 05 11:27:50 2005 +0000
     2.2 +++ b/BitKeeper/etc/logging_ok	Thu Apr 21 01:14:25 2005 +0000
     2.3 @@ -10,6 +10,7 @@ br260@br260.wolfson.cam.ac.uk
     2.4  br260@labyrinth.cl.cam.ac.uk
     2.5  br260@laudney.cl.cam.ac.uk
     2.6  bren@anvil.research
     2.7 +ccoffing@novell.com
     2.8  cl349@arcadians.cl.cam.ac.uk
     2.9  cl349@firebug.cl.cam.ac.uk
    2.10  cl349@freefall.cl.cam.ac.uk
    2.11 @@ -19,6 +20,7 @@ djm@kirby.fc.hp.com
    2.12  doogie@brainfood.com
    2.13  gm281@boulderdash.cl.cam.ac.uk
    2.14  gm281@tetrapod.cl.cam.ac.uk
    2.15 +hollisb@us.ibm.com
    2.16  iap10@freefall.cl.cam.ac.uk
    2.17  iap10@labyrinth.cl.cam.ac.uk
    2.18  iap10@nidd.cl.cam.ac.uk
    2.19 @@ -37,6 +39,7 @@ kaf24@plym.cl.cam.ac.uk
    2.20  kaf24@scramble.cl.cam.ac.uk
    2.21  kaf24@striker.cl.cam.ac.uk
    2.22  kaf24@viper.(none)
    2.23 +katzj@redhat.com
    2.24  laudney@eclipse.(none)
    2.25  lynx@idefix.cl.cam.ac.uk
    2.26  mafetter@fleming.research
    2.27 @@ -54,6 +57,7 @@ rn@wyvis.camb.intel-research.net
    2.28  rn@wyvis.research.intel-research.net
    2.29  rneugeba@wyvis.research
    2.30  rneugeba@wyvis.research.intel-research.net
    2.31 +ryanh@us.ibm.com
    2.32  sd386@font.cl.cam.ac.uk
    2.33  shand@spidean.research.intel-research.net
    2.34  smh22@boulderdash.cl.cam.ac.uk
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/freebsd-5.3-xen-sparse/conf/kern.mk	Thu Apr 21 01:14:25 2005 +0000
     3.3 @@ -0,0 +1,100 @@
     3.4 +# $FreeBSD: src/sys/conf/kern.mk,v 1.42 2004/05/14 13:35:46 cognet Exp $
     3.5 +
     3.6 +#
     3.7 +# Warning flags for compiling the kernel and components of the kernel.
     3.8 +#
     3.9 +# Note that the newly added -Wcast-qual is responsible for generating 
    3.10 +# most of the remaining warnings.  Warnings introduced with -Wall will
    3.11 +# also pop up, but are easier to fix.
    3.12 +.if ${CC} == "icc"
    3.13 +#CWARNFLAGS=	-w2	# use this if you are terribly bored
    3.14 +CWARNFLAGS=
    3.15 +.else
    3.16 +CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
    3.17 +		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
    3.18 +		-fformat-extensions 
    3.19 +.endif
    3.20 +# -std=c99 anonymous unions are non-compliant
    3.21 +#
    3.22 +# The following flags are next up for working on:
    3.23 +#	-W
    3.24 +
    3.25 +#
    3.26 +# On the i386, do not align the stack to 16-byte boundaries.  Otherwise GCC
    3.27 +# 2.95 adds code to the entry and exit point of every function to align the
    3.28 +# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
    3.29 +# per function call.  While the 16-byte alignment may benefit micro benchmarks, 
    3.30 +# it is probably an overall loss as it makes the code bigger (less efficient
    3.31 +# use of code cache tag lines) and uses more stack (less efficient use of data
    3.32 +# cache tag lines)
    3.33 +#
    3.34 +.if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
    3.35 +CFLAGS+=	-mno-align-long-strings -mpreferred-stack-boundary=2
    3.36 +INLINE_LIMIT?=	8000
    3.37 +.endif
    3.38 +
    3.39 +#
    3.40 +# On the alpha, make sure that we don't use floating-point registers and
    3.41 +# allow the use of BWX etc instructions (only needed for low-level i/o).
    3.42 +# Also, reserve register t7 to point at per-cpu global variables.
    3.43 +#
    3.44 +.if ${MACHINE_ARCH} == "alpha"
    3.45 +CFLAGS+=	-mno-fp-regs -ffixed-8 -Wa,-mev6
    3.46 +INLINE_LIMIT?=	15000
    3.47 +.endif
    3.48 +
    3.49 +.if ${MACHINE_ARCH} == "arm"
    3.50 +INLINE_LIMIT?=	8000
    3.51 +.endif
    3.52 +#
    3.53 +# For IA-64, we use r13 for the kernel globals pointer and we only use
    3.54 +# a very small subset of float registers for integer divides.
    3.55 +#
    3.56 +.if ${MACHINE_ARCH} == "ia64"
    3.57 +CFLAGS+=	-ffixed-r13 -mfixed-range=f32-f127 -mno-sdata
    3.58 +INLINE_LIMIT?=	15000
    3.59 +.endif
    3.60 +
    3.61 +#
    3.62 +# For sparc64 we want medlow code model, and we tell gcc to use floating
    3.63 +# point emulation.  This avoids using floating point registers for integer
    3.64 +# operations which it has a tendency to do.
    3.65 +#
    3.66 +.if ${MACHINE_ARCH} == "sparc64"
    3.67 +CFLAGS+=	-mcmodel=medlow -msoft-float
    3.68 +INLINE_LIMIT?=	15000
    3.69 +.endif
    3.70 +
    3.71 +#
    3.72 +# For AMD64, use a medium model for now.  We'll switch to "kernel"
    3.73 +# once pmap is ready.  Be excessively careful to not generate FPU code.
    3.74 +#
    3.75 +.if ${MACHINE_ARCH} == "amd64"
    3.76 +CFLAGS+=	-mcmodel=kernel -mno-red-zone \
    3.77 +		-mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow \
    3.78 +		-msoft-float -fno-asynchronous-unwind-tables
    3.79 +INLINE_LIMIT?=	8000
    3.80 +.endif
    3.81 +
    3.82 +#
    3.83 +# For PowerPC we tell gcc to use floating point emulation.  This avoids using
    3.84 +# floating point registers for integer operations which it has a tendency to do.
    3.85 +#
    3.86 +.if ${MACHINE_ARCH} == "powerpc"
    3.87 +CFLAGS+=	-msoft-float
    3.88 +INLINE_LIMIT?=	15000
    3.89 +.endif
    3.90 +
    3.91 +#
    3.92 +# GCC 3.0 and above like to do certain optimizations based on the
    3.93 +# assumption that the program is linked against libc.  Stop this.
    3.94 +#
    3.95 +.if ${CC} == "icc"
    3.96 +CFLAGS+=	-nolib_inline
    3.97 +.else
    3.98 +CFLAGS+=	-ffreestanding
    3.99 +.endif
   3.100 +
   3.101 +.if ${CC} == "icc"
   3.102 +CFLAGS+=	-restrict
   3.103 +.endif
     4.1 --- a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig	Tue Apr 05 11:27:50 2005 +0000
     4.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig	Thu Apr 21 01:14:25 2005 +0000
     4.3 @@ -1,7 +1,7 @@
     4.4  #
     4.5  # Automatically generated make config: don't edit
     4.6  # Linux kernel version: 2.6.11-xen0
     4.7 -# Fri Mar 11 01:02:42 2005
     4.8 +# Wed Apr 13 23:16:49 2005
     4.9  #
    4.10  CONFIG_XEN=y
    4.11  CONFIG_ARCH_XEN=y
    4.12 @@ -48,6 +48,7 @@ CONFIG_KOBJECT_UEVENT=y
    4.13  # CONFIG_IKCONFIG is not set
    4.14  # CONFIG_EMBEDDED is not set
    4.15  CONFIG_KALLSYMS=y
    4.16 +# CONFIG_KALLSYMS_ALL is not set
    4.17  # CONFIG_KALLSYMS_EXTRA_PASS is not set
    4.18  CONFIG_FUTEX=y
    4.19  CONFIG_EPOLL=y
    4.20 @@ -159,8 +160,15 @@ CONFIG_PCMCIA_PROBE=y
    4.21  #
    4.22  # Kernel hacking
    4.23  #
    4.24 -# CONFIG_DEBUG_KERNEL is not set
    4.25 +CONFIG_DEBUG_KERNEL=y
    4.26  CONFIG_EARLY_PRINTK=y
    4.27 +# CONFIG_DEBUG_STACKOVERFLOW is not set
    4.28 +# CONFIG_DEBUG_STACK_USAGE is not set
    4.29 +# CONFIG_DEBUG_SLAB is not set
    4.30 +CONFIG_MAGIC_SYSRQ=y
    4.31 +# CONFIG_DEBUG_SPINLOCK is not set
    4.32 +# CONFIG_DEBUG_PAGEALLOC is not set
    4.33 +# CONFIG_DEBUG_INFO is not set
    4.34  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    4.35  # CONFIG_FRAME_POINTER is not set
    4.36  # CONFIG_4KSTACKS is not set
    4.37 @@ -186,6 +194,7 @@ CONFIG_BINFMT_ELF=y
    4.38  # CONFIG_STANDALONE is not set
    4.39  CONFIG_PREVENT_FIRMWARE_BUILD=y
    4.40  # CONFIG_FW_LOADER is not set
    4.41 +# CONFIG_DEBUG_DRIVER is not set
    4.42  
    4.43  #
    4.44  # Memory Technology Devices (MTD)
    4.45 @@ -353,8 +362,8 @@ CONFIG_AIC79XX_REG_PRETTY_PRINT=y
    4.46  # CONFIG_SCSI_DPT_I2O is not set
    4.47  # CONFIG_SCSI_ADVANSYS is not set
    4.48  # CONFIG_SCSI_IN2000 is not set
    4.49 -# CONFIG_MEGARAID_NEWGEN is not set
    4.50 -# CONFIG_MEGARAID_LEGACY is not set
    4.51 +CONFIG_MEGARAID_NEWGEN=y
    4.52 +# CONFIG_MEGARAID_MM is not set
    4.53  CONFIG_SCSI_SATA=y
    4.54  # CONFIG_SCSI_SATA_AHCI is not set
    4.55  # CONFIG_SCSI_SATA_SVW is not set
    4.56 @@ -436,7 +445,9 @@ CONFIG_DM_MIRROR=y
    4.57  #
    4.58  # Fusion MPT device support
    4.59  #
    4.60 -# CONFIG_FUSION is not set
    4.61 +CONFIG_FUSION=y
    4.62 +CONFIG_FUSION_MAX_SGE=40
    4.63 +# CONFIG_FUSION_CTL is not set
    4.64  
    4.65  #
    4.66  # IEEE 1394 (FireWire) support
    4.67 @@ -923,7 +934,7 @@ CONFIG_REISERFS_FS=y
    4.68  # CONFIG_ROMFS_FS is not set
    4.69  # CONFIG_QUOTA is not set
    4.70  CONFIG_DNOTIFY=y
    4.71 -# CONFIG_AUTOFS_FS is not set
    4.72 +CONFIG_AUTOFS_FS=y
    4.73  # CONFIG_AUTOFS4_FS is not set
    4.74  
    4.75  #
     5.1 --- a/linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig	Tue Apr 05 11:27:50 2005 +0000
     5.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig	Thu Apr 21 01:14:25 2005 +0000
     5.3 @@ -1,7 +1,7 @@
     5.4  #
     5.5  # Automatically generated make config: don't edit
     5.6  # Linux kernel version: 2.6.11-xenU
     5.7 -# Fri Mar 11 01:20:28 2005
     5.8 +# Wed Apr 13 23:18:37 2005
     5.9  #
    5.10  CONFIG_XEN=y
    5.11  CONFIG_ARCH_XEN=y
    5.12 @@ -45,6 +45,7 @@ CONFIG_KOBJECT_UEVENT=y
    5.13  # CONFIG_IKCONFIG is not set
    5.14  # CONFIG_EMBEDDED is not set
    5.15  CONFIG_KALLSYMS=y
    5.16 +# CONFIG_KALLSYMS_ALL is not set
    5.17  # CONFIG_KALLSYMS_EXTRA_PASS is not set
    5.18  CONFIG_FUTEX=y
    5.19  CONFIG_EPOLL=y
    5.20 @@ -127,8 +128,15 @@ CONFIG_HAVE_DEC_LOCK=y
    5.21  #
    5.22  # Kernel hacking
    5.23  #
    5.24 -# CONFIG_DEBUG_KERNEL is not set
    5.25 +CONFIG_DEBUG_KERNEL=y
    5.26  CONFIG_EARLY_PRINTK=y
    5.27 +# CONFIG_DEBUG_STACKOVERFLOW is not set
    5.28 +# CONFIG_DEBUG_STACK_USAGE is not set
    5.29 +# CONFIG_DEBUG_SLAB is not set
    5.30 +CONFIG_MAGIC_SYSRQ=y
    5.31 +# CONFIG_DEBUG_SPINLOCK is not set
    5.32 +# CONFIG_DEBUG_PAGEALLOC is not set
    5.33 +# CONFIG_DEBUG_INFO is not set
    5.34  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    5.35  # CONFIG_FRAME_POINTER is not set
    5.36  # CONFIG_4KSTACKS is not set
    5.37 @@ -154,6 +162,7 @@ CONFIG_BINFMT_ELF=y
    5.38  CONFIG_STANDALONE=y
    5.39  CONFIG_PREVENT_FIRMWARE_BUILD=y
    5.40  # CONFIG_FW_LOADER is not set
    5.41 +# CONFIG_DEBUG_DRIVER is not set
    5.42  
    5.43  #
    5.44  # Block devices
     6.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c	Tue Apr 05 11:27:50 2005 +0000
     6.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c	Thu Apr 21 01:14:25 2005 +0000
     6.3 @@ -44,6 +44,7 @@
     6.4  #include <linux/slab.h>
     6.5  #include <linux/init.h>
     6.6  #include <linux/console.h>
     6.7 +#include <linux/bootmem.h>
     6.8  #include <asm/io.h>
     6.9  #include <asm/irq.h>
    6.10  #include <asm/uaccess.h>
    6.11 @@ -77,11 +78,21 @@ static int __init xencons_setup(char *st
    6.12  __setup("xencons=", xencons_setup);
    6.13  
    6.14  /* The kernel and user-land drivers share a common transmit buffer. */
    6.15 -#define WBUF_SIZE     4096
    6.16 -#define WBUF_MASK(_i) ((_i)&(WBUF_SIZE-1))
    6.17 -static char wbuf[WBUF_SIZE];
    6.18 +static unsigned int wbuf_size = 4096;
    6.19 +#define WBUF_MASK(_i) ((_i)&(wbuf_size-1))
    6.20 +static char *wbuf;
    6.21  static unsigned int wc, wp; /* write_cons, write_prod */
    6.22  
    6.23 +static int __init xencons_bufsz_setup(char *str)
    6.24 +{
    6.25 +    unsigned int goal;
    6.26 +    goal = simple_strtoul(str, NULL, 0);
    6.27 +    while ( wbuf_size < goal )
    6.28 +        wbuf_size <<= 1;
    6.29 +    return 1;
    6.30 +}
    6.31 +__setup("xencons_bufsz=", xencons_bufsz_setup);
    6.32 +
    6.33  /* This lock protects accesses to the common transmit buffer. */
    6.34  static spinlock_t xencons_lock = SPIN_LOCK_UNLOCKED;
    6.35  
    6.36 @@ -114,7 +125,7 @@ static void kcons_write(
    6.37      
    6.38      for ( i = 0; i < count; i++ )
    6.39      {
    6.40 -        if ( (wp - wc) >= (WBUF_SIZE - 1) )
    6.41 +        if ( (wp - wc) >= (wbuf_size - 1) )
    6.42              break;
    6.43          if ( (wbuf[WBUF_MASK(wp++)] = s[i]) == '\n' )
    6.44              wbuf[WBUF_MASK(wp++)] = '\r';
    6.45 @@ -195,6 +206,8 @@ void xen_console_init(void)
    6.46      else
    6.47          strcpy(kcons_info.name, "tty");
    6.48  
    6.49 +    wbuf = alloc_bootmem(wbuf_size);
    6.50 +
    6.51      register_console(&kcons_info);
    6.52      return __RETCODE;
    6.53  }
    6.54 @@ -246,8 +259,8 @@ void xencons_force_flush(void)
    6.55              continue;
    6.56          if ( sz > sizeof(msg.msg) )
    6.57              sz = sizeof(msg.msg);
    6.58 -        if ( sz > (WBUF_SIZE - WBUF_MASK(wc)) )
    6.59 -            sz = WBUF_SIZE - WBUF_MASK(wc);
    6.60 +        if ( sz > (wbuf_size - WBUF_MASK(wc)) )
    6.61 +            sz = wbuf_size - WBUF_MASK(wc);
    6.62  
    6.63          msg.type    = CMSG_CONSOLE;
    6.64          msg.subtype = CMSG_CONSOLE_DATA;
    6.65 @@ -315,8 +328,8 @@ static void __xencons_tx_flush(void)
    6.66          while ( wc != wp )
    6.67          {
    6.68              sz = wp - wc;
    6.69 -            if ( sz > (WBUF_SIZE - WBUF_MASK(wc)) )
    6.70 -                sz = WBUF_SIZE - WBUF_MASK(wc);
    6.71 +            if ( sz > (wbuf_size - WBUF_MASK(wc)) )
    6.72 +                sz = wbuf_size - WBUF_MASK(wc);
    6.73              kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz);
    6.74              wc += sz;
    6.75              work_done = 1;
    6.76 @@ -344,8 +357,8 @@ static void __xencons_tx_flush(void)
    6.77              sz = wp - wc;
    6.78              if ( sz > sizeof(msg.msg) )
    6.79                  sz = sizeof(msg.msg);
    6.80 -            if ( sz > (WBUF_SIZE - WBUF_MASK(wc)) )
    6.81 -                sz = WBUF_SIZE - WBUF_MASK(wc);
    6.82 +            if ( sz > (wbuf_size - WBUF_MASK(wc)) )
    6.83 +                sz = wbuf_size - WBUF_MASK(wc);
    6.84  
    6.85              msg.type    = CMSG_CONSOLE;
    6.86              msg.subtype = CMSG_CONSOLE_DATA;
    6.87 @@ -409,7 +422,7 @@ static irqreturn_t xencons_priv_interrup
    6.88  
    6.89  static int xencons_write_room(struct tty_struct *tty)
    6.90  {
    6.91 -    return WBUF_SIZE - (wp - wc);
    6.92 +    return wbuf_size - (wp - wc);
    6.93  }
    6.94  
    6.95  static int xencons_chars_in_buffer(struct tty_struct *tty)
    6.96 @@ -468,7 +481,7 @@ static void xencons_flush_buffer(struct 
    6.97  static inline int __xencons_put_char(int ch)
    6.98  {
    6.99      char _ch = (char)ch;
   6.100 -    if ( (wp - wc) == WBUF_SIZE )
   6.101 +    if ( (wp - wc) == wbuf_size )
   6.102          return 0;
   6.103      wbuf[WBUF_MASK(wp++)] = _ch;
   6.104      return 1;
     7.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h	Tue Apr 05 11:27:50 2005 +0000
     7.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h	Thu Apr 21 01:14:25 2005 +0000
     7.3 @@ -81,12 +81,12 @@ static inline void clear_evtchn(int port
     7.4      synch_clear_bit(port, &s->evtchn_pending[0]);
     7.5  }
     7.6  
     7.7 -static inline void notify_via_evtchn(int port)
     7.8 +static inline int notify_via_evtchn(int port)
     7.9  {
    7.10      evtchn_op_t op;
    7.11      op.cmd = EVTCHNOP_send;
    7.12      op.u.send.local_port = port;
    7.13 -    (void)HYPERVISOR_event_channel_op(&op);
    7.14 +    return HYPERVISOR_event_channel_op(&op);
    7.15  }
    7.16  
    7.17  /*
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/check/check_iproute	Thu Apr 21 01:14:25 2005 +0000
     8.3 @@ -0,0 +1,10 @@
     8.4 +#!/bin/bash
     8.5 +# CHECK-INSTALL
     8.6 +
     8.7 +function error {
     8.8 +   echo 'Check for iproute (ip addr) failed.'
     8.9 +   exit 1
    8.10 +}
    8.11 +
    8.12 +ip addr list || error
    8.13 +
     9.1 --- a/tools/libxc/xc_domain.c	Tue Apr 05 11:27:50 2005 +0000
     9.2 +++ b/tools/libxc/xc_domain.c	Thu Apr 21 01:14:25 2005 +0000
     9.3 @@ -132,7 +132,8 @@ int xc_domain_getfullinfo(int xc_handle,
     9.4  
     9.5      rc = do_dom0_op(xc_handle, &op);
     9.6  
     9.7 -    memcpy(info, &op.u.getdomaininfo, sizeof(*info));
     9.8 +    if ( info )
     9.9 +        memcpy(info, &op.u.getdomaininfo, sizeof(*info));
    9.10  
    9.11      if ( ((u16)op.u.getdomaininfo.domain != domid) && rc > 0 )
    9.12          return -ESRCH;
    10.1 --- a/tools/libxc/xc_io.h	Tue Apr 05 11:27:50 2005 +0000
    10.2 +++ b/tools/libxc/xc_io.h	Thu Apr 21 01:14:25 2005 +0000
    10.3 @@ -45,14 +45,14 @@ static inline int xcio_read(XcIOContext 
    10.4      int rc;
    10.5  
    10.6      rc = IOStream_read(ctxt->io, buf, n);
    10.7 -    return (rc == n ? 0 : rc);
    10.8 +    return (rc == n ? 0 : -1);
    10.9  }
   10.10  
   10.11  static inline int xcio_write(XcIOContext *ctxt, void *buf, int n){
   10.12      int rc;
   10.13  
   10.14      rc = IOStream_write(ctxt->io, buf, n);
   10.15 -    return (rc == n ? 0 : rc);
   10.16 +    return (rc == n ? 0 : -1);
   10.17  }
   10.18  
   10.19  static inline int xcio_flush(XcIOContext *ctxt){
    11.1 --- a/tools/libxc/xc_linux_save.c	Tue Apr 05 11:27:50 2005 +0000
    11.2 +++ b/tools/libxc/xc_linux_save.c	Thu Apr 21 01:14:25 2005 +0000
    11.3 @@ -172,7 +172,6 @@ static int xcio_ratewrite(XcIOContext *i
    11.4      struct timeval now;
    11.5      struct timespec delay;
    11.6      long long delta;
    11.7 -    int rc;
    11.8  
    11.9      if (START_MBIT_RATE == 0)
   11.10  	return xcio_write(ioctxt, buf, n);
   11.11 @@ -212,8 +211,7 @@ static int xcio_ratewrite(XcIOContext *i
   11.12  	    }
   11.13  	}
   11.14      }
   11.15 -    rc = IOStream_write(ioctxt->io, buf, n);
   11.16 -    return (rc == n ? 0 : rc);
   11.17 +    return xcio_write(ioctxt, buf, n);
   11.18  }
   11.19  
   11.20  static int print_stats( int xc_handle, u32 domid, 
    12.1 --- a/tools/libxutil/file_stream.c	Tue Apr 05 11:27:50 2005 +0000
    12.2 +++ b/tools/libxutil/file_stream.c	Thu Apr 21 01:14:25 2005 +0000
    12.3 @@ -151,7 +151,12 @@ static int file_error(IOStream *s){
    12.4   * @return result of the close
    12.5   */
    12.6  static int file_close(IOStream *s){
    12.7 -    return fclose(get_file(s));
    12.8 +    int result = 0;
    12.9 +    if (s->data){
   12.10 +        result = fclose(get_file(s));
   12.11 +        s->data = (void*)0;
   12.12 +    }
   12.13 +    return result;
   12.14  }
   12.15  
   12.16  /** Free a file stream.
   12.17 @@ -159,7 +164,7 @@ static int file_close(IOStream *s){
   12.18   * @param s file stream
   12.19   */
   12.20  static void file_free(IOStream *s){
   12.21 -    // Do nothing - fclose does it all?
   12.22 +    file_close(s);
   12.23  }
   12.24  
   12.25  /** Create an IOStream for a stream.
   12.26 @@ -189,7 +194,6 @@ IOStream *file_stream_fopen(const char *
   12.27  	io = file_stream_new(fin);
   12.28  	if(!io){
   12.29  	    fclose(fin);
   12.30 -	    //free(fin); // fclose frees ?
   12.31  	}
   12.32      }
   12.33      return io;
   12.34 @@ -199,13 +203,16 @@ IOStream *file_stream_fopen(const char *
   12.35   *
   12.36   * @param fd file descriptor
   12.37   * @param flags giving the mode to open in (as for fdopen())
   12.38 - * @return new stream for the open file, or 0 if failed
   12.39 + * @return new stream for the open file, or 0 if failed.  Always takes
   12.40 + *         ownership of fd.
   12.41   */
   12.42  IOStream *file_stream_fdopen(int fd, const char *flags){
   12.43      IOStream *io = 0;
   12.44      FILE *fin = fdopen(fd, flags);
   12.45      if(fin){
   12.46 -	io = file_stream_new(fin);
   12.47 +        io = file_stream_new(fin);
   12.48 +        if(!io)
   12.49 +            fclose(fin);
   12.50      }
   12.51      return io;
   12.52  }
    13.1 --- a/tools/libxutil/gzip_stream.c	Tue Apr 05 11:27:50 2005 +0000
    13.2 +++ b/tools/libxutil/gzip_stream.c	Thu Apr 21 01:14:25 2005 +0000
    13.3 @@ -107,7 +107,12 @@ static int gzip_error(IOStream *s){
    13.4   * @return result of the close
    13.5   */
    13.6  static int gzip_close(IOStream *s){
    13.7 -    return gzclose(get_gzfile(s));
    13.8 +    int result = 0;
    13.9 +    if (s->data){
   13.10 +        result = gzclose(get_gzfile(s));
   13.11 +        s->data = (void*)0;
   13.12 +    }
   13.13 +    return result;
   13.14  }
   13.15  
   13.16  /** Free a gzip stream.
   13.17 @@ -115,7 +120,7 @@ static int gzip_close(IOStream *s){
   13.18   * @param s gzip stream
   13.19   */
   13.20  static void gzip_free(IOStream *s){
   13.21 -    // Do nothing - fclose does it all?
   13.22 +    gzip_close(s);
   13.23  }
   13.24  
   13.25  /** Create an IOStream for a gzip stream.
   13.26 @@ -143,11 +148,10 @@ IOStream *gzip_stream_fopen(const char *
   13.27      gzFile *fgz;
   13.28      fgz = gzopen(file, flags);
   13.29      if(fgz){
   13.30 -	io = gzip_stream_new(fgz);
   13.31 -	if(!io){
   13.32 -	    gzclose(fgz);
   13.33 -	    //free(fgz); // gzclose frees ?
   13.34 -	}
   13.35 +        io = gzip_stream_new(fgz);
   13.36 +        if(!io){
   13.37 +            gzclose(fgz);
   13.38 +        }
   13.39      }
   13.40      return io;
   13.41  }
   13.42 @@ -156,14 +160,17 @@ IOStream *gzip_stream_fopen(const char *
   13.43   *
   13.44   * @param fd file descriptor
   13.45   * @param flags giving the mode to open in (as for fdopen())
   13.46 - * @return new stream for the open file, or NULL if failed
   13.47 + * @return new stream for the open file, or NULL if failed.  Always takes
   13.48 + *         ownership of fd.
   13.49   */
   13.50  IOStream *gzip_stream_fdopen(int fd, const char *flags){
   13.51      IOStream *io = NULL;
   13.52      gzFile *fgz;
   13.53      fgz = gzdopen(fd, flags);
   13.54      if(fgz){
   13.55 -	io = gzip_stream_new(fgz);
   13.56 +        io = gzip_stream_new(fgz);
   13.57 +        if(!io)
   13.58 +            gzclose(fgz);
   13.59      }
   13.60      return io;
   13.61  }
    14.1 --- a/tools/libxutil/iostream.h	Tue Apr 05 11:27:50 2005 +0000
    14.2 +++ b/tools/libxutil/iostream.h	Thu Apr 21 01:14:25 2005 +0000
    14.3 @@ -105,8 +105,11 @@ extern int IOStream_vprint(IOStream *io,
    14.4   * @return if ok, number of bytes read, otherwise negative error code
    14.5   */
    14.6  static inline int IOStream_read(IOStream *stream, void *buf, size_t n){
    14.7 -    int result = 0;
    14.8 -    if(stream->closed) goto exit;
    14.9 +    int result;
   14.10 +    if(stream->closed){
   14.11 +        result = IOSTREAM_EOF;
   14.12 +        goto exit;
   14.13 +    }
   14.14      if(!stream->methods || !stream->methods->read){
   14.15          result = -EINVAL;
   14.16          goto exit;
   14.17 @@ -124,11 +127,14 @@ static inline int IOStream_read(IOStream
   14.18   * @param stream input
   14.19   * @param buf where to put input
   14.20   * @param n number of bytes to write
   14.21 - * @return if ok, number of bytes read, otherwise negative error code
   14.22 + * @return if ok, number of bytes written, otherwise negative error code
   14.23   */
   14.24  static inline int IOStream_write(IOStream *stream, const void *buf, size_t n){
   14.25 -    int result = 0;
   14.26 -    if(stream->closed) goto exit;
   14.27 +    int result;
   14.28 +    if(stream->closed){
   14.29 +        result = IOSTREAM_EOF;
   14.30 +        goto exit;
   14.31 +    }
   14.32      if(!stream->methods || !stream->methods->write){
   14.33          result = -EINVAL;
   14.34          goto exit;
   14.35 @@ -179,6 +185,7 @@ static inline int IOStream_close(IOStrea
   14.36      int err = 1;
   14.37      if(stream->methods && stream->methods->close){
   14.38          err = stream->methods->close(stream);
   14.39 +        stream->closed = 1;
   14.40      }
   14.41      return err;
   14.42  }
   14.43 @@ -189,7 +196,7 @@ static inline int IOStream_close(IOStrea
   14.44   * @return 1 if closed, 0 otherwise
   14.45   */
   14.46  static inline int IOStream_is_closed(IOStream *stream){
   14.47 -  return stream->closed;
   14.48 +    return stream->closed;
   14.49  }
   14.50  
   14.51  /** Free the memory used by the stream.
   14.52 @@ -197,11 +204,14 @@ static inline int IOStream_is_closed(IOS
   14.53   * @param stream to free
   14.54   */
   14.55  static inline void IOStream_free(IOStream *stream){
   14.56 -  if(stream->methods && stream->methods->free){
   14.57 -    stream->methods->free(stream);
   14.58 -  }
   14.59 -  *stream = (IOStream){};
   14.60 -  deallocate(stream);
   14.61 +    if(!stream->closed && stream->methods && stream->methods->close){
   14.62 +        stream->methods->close(stream);
   14.63 +    }
   14.64 +    if(stream->methods && stream->methods->free){
   14.65 +        stream->methods->free(stream);
   14.66 +    }
   14.67 +    *stream = (IOStream){};
   14.68 +    deallocate(stream);
   14.69  }
   14.70  
   14.71  
    15.1 --- a/tools/misc/netfix	Tue Apr 05 11:27:50 2005 +0000
    15.2 +++ b/tools/misc/netfix	Thu Apr 21 01:14:25 2005 +0000
    15.3 @@ -9,8 +9,8 @@
    15.4  
    15.5  from getopt import getopt
    15.6  
    15.7 -# Default install path for Xen binary packages.
    15.8 -sys.path = [ '/usr/lib/python' ] + sys.path
    15.9 +# add fallback path for non-native python path installs if needed
   15.10 +sys.path.append('/usr/lib/python')
   15.11  from xen.util.Brctl import *
   15.12  
   15.13  short_options = 'hvqni:b:c'
    16.1 --- a/tools/misc/xend	Tue Apr 05 11:27:50 2005 +0000
    16.2 +++ b/tools/misc/xend	Thu Apr 21 01:14:25 2005 +0000
    16.3 @@ -22,8 +22,8 @@
    16.4  import os
    16.5  import sys
    16.6  
    16.7 -# Default install path for Xen binary packages.
    16.8 -sys.path = [ '/usr/lib/python' ] + sys.path
    16.9 +# add fallback path for non-native python path installs if needed
   16.10 +sys.path.append('/usr/lib/python')
   16.11  from xen.xend.server import SrvDaemon
   16.12  
   16.13  class CheckError(ValueError):
    17.1 --- a/tools/misc/xensv	Tue Apr 05 11:27:50 2005 +0000
    17.2 +++ b/tools/misc/xensv	Thu Apr 21 01:14:25 2005 +0000
    17.3 @@ -22,8 +22,8 @@ import os
    17.4  import sys
    17.5  import re
    17.6  
    17.7 -# Default install path for Xen binary packages.
    17.8 -sys.path = [ '/usr/lib/python' ] + sys.path
    17.9 +# add fallback path for non-native python path installs if needed
   17.10 +sys.path.append('/usr/lib/python')
   17.11  from xen.xend.server.params import XEND_PID_FILE
   17.12  
   17.13  class CheckError(ValueError):
    18.1 --- a/tools/misc/xm	Tue Apr 05 11:27:50 2005 +0000
    18.2 +++ b/tools/misc/xm	Thu Apr 21 01:14:25 2005 +0000
    18.3 @@ -2,8 +2,8 @@
    18.4  #  -*- mode: python; -*-
    18.5  import sys
    18.6  
    18.7 -# Default install path for Xen binary packages.
    18.8 -sys.path = [ '/usr/lib/python' ] + sys.path
    18.9 +# add fallback path for non-native python path installs if needed
   18.10 +sys.path.append('/usr/lib/python')
   18.11  from xen.xm import main
   18.12  
   18.13  main.main(sys.argv)
    19.1 --- a/tools/xentrace/Makefile	Tue Apr 05 11:27:50 2005 +0000
    19.2 +++ b/tools/xentrace/Makefile	Thu Apr 21 01:14:25 2005 +0000
    19.3 @@ -26,13 +26,13 @@ build: $(BIN)
    19.4  
    19.5  install: build
    19.6  	[ -d $(DESTDIR)/usr/bin ] || $(INSTALL_DIR) $(DESTDIR)/usr/bin
    19.7 -	[ -d $(DESTDIR)/usr/man/man1 ] || \
    19.8 -		$(INSTALL_DIR) $(DESTDIR)/usr/man/man1
    19.9 -	[ -d $(DESTDIR)/usr/man/man8 ] || \
   19.10 -		$(INSTALL_DIR) $(DESTDIR)/usr/man/man8
   19.11 +	[ -d $(DESTDIR)/usr/share/man/man1 ] || \
   19.12 +		$(INSTALL_DIR) $(DESTDIR)/usr/share/man/man1
   19.13 +	[ -d $(DESTDIR)/usr/share/man/man8 ] || \
   19.14 +		$(INSTALL_DIR) $(DESTDIR)/usr/share/man/man8
   19.15  	$(INSTALL_PROG) $(BIN) $(SCRIPTS) $(DESTDIR)/usr/bin
   19.16 -	$(INSTALL_DATA) $(MAN1) $(DESTDIR)/usr/man/man1
   19.17 -	$(INSTALL_DATA) $(MAN8) $(DESTDIR)/usr/man/man8
   19.18 +	$(INSTALL_DATA) $(MAN1) $(DESTDIR)/usr/share/man/man1
   19.19 +	$(INSTALL_DATA) $(MAN8) $(DESTDIR)/usr/share/man/man8
   19.20  
   19.21  clean:
   19.22  	$(RM) *.a *.so *.o *.rpm $(BIN)
    20.1 --- a/tools/xfrd/xen_domain.c	Tue Apr 05 11:27:50 2005 +0000
    20.2 +++ b/tools/xfrd/xen_domain.c	Thu Apr 21 01:14:25 2005 +0000
    20.3 @@ -176,7 +176,7 @@ static CURL *curlinit(void){
    20.4  
    20.5  /** Curl debug function.
    20.6   */
    20.7 -int curldebug(CURL *curl, curl_infotype ty, char *buf, size_t buf_n, void *data){
    20.8 +int curldebug(CURL *curl, curl_infotype ty, char *buf, int buf_n, void *data){
    20.9      // printf("%*s\n", buf_n, buf); /* Does not compile correctly on non 32bit platforms */
   20.10      fwrite(data, buf_n, 1, stdout);
   20.11      printf("\n");
    21.1 --- a/xen/Makefile	Tue Apr 05 11:27:50 2005 +0000
    21.2 +++ b/xen/Makefile	Thu Apr 21 01:14:25 2005 +0000
    21.3 @@ -27,7 +27,7 @@ debug:
    21.4  dist: install
    21.5  
    21.6  build: $(TARGET).gz
    21.7 -	
    21.8 +
    21.9  install: $(TARGET).gz
   21.10  	[ -d $(DESTDIR)/boot ] || $(INSTALL_DIR) $(DESTDIR)/boot
   21.11  	$(INSTALL_DATA) $(TARGET).gz $(DESTDIR)/boot
   21.12 @@ -106,15 +106,18 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h
   21.13  .PHONY: default debug install dist clean delete-unfresh-files TAGS tags
   21.14  
   21.15  SUBDIRS = arch/$(TARGET_ARCH) common drivers 
   21.16 +define all_sources
   21.17 +    ( find include/asm-$(TARGET_ARCH) -name SCCS -prune -o -name '*.h' -print; \
   21.18 +      find include -type d -name SCCS -prune -o \( -name "asm-*" -o \
   21.19 +            -name config \) -prune -o -name '*.h' -print; \
   21.20 +      find $(SUBDIRS) -name SCCS -prune -o -name '*.[chS]' -print )
   21.21 +endef
   21.22  TAGS: 
   21.23 -	( find include/asm-$(TARGET_ARCH) -name '*.h'; \
   21.24 -	  find include -type d \( -name "asm-*" -o -name config \) -prune -o \
   21.25 -		-name '*.h' -print; \
   21.26 -	  find $(SUBDIRS) -name '*.[ch]' ) | grep -v /SCCS/ | etags -
   21.27 +	$(all_sources) | etags -
   21.28  tags: 
   21.29 -	( find include/asm-$(TARGET_ARCH) -name '*.h'; \
   21.30 -	  find include -type d \( -name "asm-*" -o -name config \) -prune -o \
   21.31 -		-name '*.h' -print; \
   21.32 -	  find $(SUBDIRS) -name '*.[chS]' ) | grep -v /SCCS/ | xargs ctags
   21.33 +	$(all_sources) | xargs ctags
   21.34 +cscope: 
   21.35 +	$(all_sources) > cscope.files
   21.36 +	cscope -k -b -q
   21.37  MAP:
   21.38  	nm $(TARGET) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
    22.1 --- a/xen/arch/x86/memory.c	Tue Apr 05 11:27:50 2005 +0000
    22.2 +++ b/xen/arch/x86/memory.c	Thu Apr 21 01:14:25 2005 +0000
    22.3 @@ -101,6 +101,7 @@
    22.4  #include <asm/uaccess.h>
    22.5  #include <asm/domain_page.h>
    22.6  #include <asm/ldt.h>
    22.7 +#include <asm/e820.h>
    22.8  
    22.9  #ifdef VERBOSE
   22.10  #define MEM_LOG(_f, _a...)                           \
   22.11 @@ -168,7 +169,8 @@ void __init init_frametable(void)
   22.12  
   22.13  void arch_init_memory(void)
   22.14  {
   22.15 -    unsigned long i;
   22.16 +    unsigned long i, j, pfn, nr_pfns;
   22.17 +    struct pfn_info *page;
   22.18  
   22.19      /*
   22.20       * We are rather picky about the layout of 'struct pfn_info'. The
   22.21 @@ -203,8 +205,8 @@ void arch_init_memory(void)
   22.22  
   22.23      /*
   22.24       * Initialise our DOMID_IO domain.
   22.25 -     * This domain owns no pages but is considered a special case when
   22.26 -     * mapping I/O pages, as the mappings occur at the priv of the caller.
   22.27 +     * This domain owns I/O pages that are within the range of the pfn_info
   22.28 +     * array. Mappings occur at the priv of the caller.
   22.29       */
   22.30      dom_io = alloc_domain_struct();
   22.31      atomic_set(&dom_io->refcnt, 1);
   22.32 @@ -213,11 +215,40 @@ void arch_init_memory(void)
   22.33      /* M2P table is mappable read-only by privileged domains. */
   22.34      for ( i = 0; i < 1024; i++ )
   22.35      {
   22.36 -        frame_table[m2p_start_mfn+i].count_info        = PGC_allocated | 1;
   22.37 -	/* gdt to make sure it's only mapped read-only by non-privileged
   22.38 -	   domains. */
   22.39 -        frame_table[m2p_start_mfn+i].u.inuse.type_info = PGT_gdt_page | 1;
   22.40 -        frame_table[m2p_start_mfn+i].u.inuse.domain    = dom_xen;
   22.41 +	/* Ensure it's mapped read-only by guests (use GDT type). */
   22.42 +        page = &frame_table[m2p_start_mfn+i];
   22.43 +        page->count_info        = PGC_allocated | 1;
   22.44 +        page->u.inuse.type_info = PGT_gdt_page | PGT_validated | 1;
   22.45 +        page->u.inuse.domain    = dom_xen;
   22.46 +    }
   22.47 +
   22.48 +    /* First 1MB of RAM is historically marked as I/O. */
   22.49 +    for ( i = 0; i < 0x100; i++ )
   22.50 +    {
   22.51 +        page = &frame_table[i];
   22.52 +        page->count_info        = PGC_allocated | 1;
   22.53 +        page->u.inuse.type_info = PGT_writable_page | PGT_validated | 1;
   22.54 +        page->u.inuse.domain    = dom_io;
   22.55 +    }
   22.56 + 
   22.57 +    /* Any non-RAM areas in the e820 map are considered to be for I/O. */
   22.58 +    for ( i = 0; i < e820.nr_map; i++ )
   22.59 +    {
   22.60 +        if ( e820.map[i].type == E820_RAM )
   22.61 +            continue;
   22.62 +        pfn = e820.map[i].addr >> PAGE_SHIFT;
   22.63 +        nr_pfns = (e820.map[i].size +
   22.64 +                   (e820.map[i].addr & ~PAGE_MASK) +
   22.65 +                   ~PAGE_MASK) >> PAGE_SHIFT;
   22.66 +        for ( j = 0; j < nr_pfns; j++ )
   22.67 +        {
   22.68 +            if ( !pfn_valid(pfn+j) )
   22.69 +                continue;
   22.70 +            page = &frame_table[pfn+j];
   22.71 +            page->count_info        = PGC_allocated | 1;
   22.72 +            page->u.inuse.type_info = PGT_writable_page | PGT_validated | 1;
   22.73 +            page->u.inuse.domain    = dom_io;
   22.74 +        }
   22.75      }
   22.76  }
   22.77  
   22.78 @@ -298,13 +329,7 @@ static int get_page_from_pagenr(unsigned
   22.79  {
   22.80      struct pfn_info *page = &frame_table[page_nr];
   22.81  
   22.82 -    if ( unlikely(!pfn_is_ram(page_nr)) )
   22.83 -    {
   22.84 -        MEM_LOG("Pfn %08lx is not RAM", page_nr);
   22.85 -        return 0;
   22.86 -    }
   22.87 -
   22.88 -    if ( unlikely(!get_page(page, d)) )
   22.89 +    if ( unlikely(!pfn_valid(page_nr)) || unlikely(!get_page(page, d)) )
   22.90      {
   22.91          MEM_LOG("Could not get page ref for pfn %08lx", page_nr);
   22.92          return 0;
   22.93 @@ -410,20 +435,25 @@ get_page_from_l1e(
   22.94          return 0;
   22.95      }
   22.96  
   22.97 -    if ( unlikely(!pfn_is_ram(pfn)) )
   22.98 +    if ( unlikely(!pfn_valid(pfn)) ||
   22.99 +         unlikely(page->u.inuse.domain == dom_io) )
  22.100      {
  22.101 -        /* Revert to caller privileges if FD == DOMID_IO. */
  22.102 +        /* DOMID_IO reverts to caller for privilege checks. */
  22.103          if ( d == dom_io )
  22.104              d = current;
  22.105  
  22.106 -        if ( IS_PRIV(d) )
  22.107 +        if ( (!IS_PRIV(d)) &&
  22.108 +             (!IS_CAPABLE_PHYSDEV(d) || !domain_iomem_in_pfn(d, pfn)) )
  22.109 +        {
  22.110 +            MEM_LOG("Non-privileged attempt to map I/O space %08lx", pfn);
  22.111 +            return 0;
  22.112 +        }
  22.113 +
  22.114 +        /* No reference counting for out-of-range I/O pages. */
  22.115 +        if ( !pfn_valid(pfn) )
  22.116              return 1;
  22.117  
  22.118 -        if ( IS_CAPABLE_PHYSDEV(d) )
  22.119 -            return domain_iomem_in_pfn(d, pfn);
  22.120 -
  22.121 -        MEM_LOG("Non-privileged attempt to map I/O space %08lx", pfn);
  22.122 -        return 0;
  22.123 +        d = dom_io;
  22.124      }
  22.125  
  22.126      return ((l1v & _PAGE_RW) ?
  22.127 @@ -468,7 +498,7 @@ static void put_page_from_l1e(l1_pgentry
  22.128      struct pfn_info *page = &frame_table[pfn];
  22.129      struct domain   *e;
  22.130  
  22.131 -    if ( !(l1v & _PAGE_PRESENT) || !pfn_is_ram(pfn) )
  22.132 +    if ( !(l1v & _PAGE_PRESENT) || !pfn_valid(pfn) )
  22.133          return;
  22.134  
  22.135      e = page->u.inuse.domain;
  22.136 @@ -1114,7 +1144,7 @@ static int do_extended_command(unsigned 
  22.137          gntref = (grant_ref_t)((val & 0xFF00) | ((ptr >> 2) & 0x00FF));
  22.138          
  22.139          if ( unlikely(IS_XEN_HEAP_FRAME(page)) ||
  22.140 -             unlikely(!pfn_is_ram(pfn)) ||
  22.141 +             unlikely(!pfn_valid(pfn)) ||
  22.142               unlikely((e = find_domain_by_id(domid)) == NULL) )
  22.143          {
  22.144              MEM_LOG("Bad frame (%08lx) or bad domid (%d).\n", pfn, domid);
    23.1 --- a/xen/arch/x86/setup.c	Tue Apr 05 11:27:50 2005 +0000
    23.2 +++ b/xen/arch/x86/setup.c	Thu Apr 21 01:14:25 2005 +0000
    23.3 @@ -22,7 +22,7 @@
    23.4  #include <asm/e820.h>
    23.5  
    23.6  /* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
    23.7 -static unsigned int opt_dom0_mem = 16000;
    23.8 +static unsigned int opt_dom0_mem = 64000;
    23.9  integer_param("dom0_mem", opt_dom0_mem);
   23.10  
   23.11  /*
    24.1 --- a/xen/arch/x86/smpboot.c	Tue Apr 05 11:27:50 2005 +0000
    24.2 +++ b/xen/arch/x86/smpboot.c	Thu Apr 21 01:14:25 2005 +0000
    24.3 @@ -51,8 +51,10 @@
    24.4  
    24.5  #ifdef CONFIG_SMP
    24.6  
    24.7 -/* Setup configured maximum number of CPUs to activate */
    24.8 +/* Cconfigured maximum number of CPUs to activate. We name the parameter 
    24.9 +"maxcpus" rather than max_cpus to be compatible with Linux */
   24.10  static int max_cpus = -1;
   24.11 +integer_param("maxcpus", max_cpus); 
   24.12  
   24.13  /* Total count of live CPUs */
   24.14  int smp_num_cpus = 1;
    25.1 --- a/xen/common/grant_table.c	Tue Apr 05 11:27:50 2005 +0000
    25.2 +++ b/xen/common/grant_table.c	Thu Apr 21 01:14:25 2005 +0000
    25.3 @@ -169,7 +169,7 @@ static void
    25.4  
    25.5          /* rmb(); */ /* not on x86 */
    25.6          frame = sha->frame;
    25.7 -        if ( unlikely(!pfn_is_ram(frame)) || 
    25.8 +        if ( unlikely(!pfn_valid(frame)) || 
    25.9               unlikely(!((flags & GNTMAP_readonly) ? 
   25.10                          get_page(&frame_table[frame], rd) : 
   25.11                          get_page_and_type(&frame_table[frame], rd, 
    26.1 --- a/xen/common/schedule.c	Tue Apr 05 11:27:50 2005 +0000
    26.2 +++ b/xen/common/schedule.c	Thu Apr 21 01:14:25 2005 +0000
    26.3 @@ -385,7 +385,7 @@ static void __enter_scheduler(void)
    26.4      cleanup_writable_pagetable(prev);
    26.5  
    26.6  #if defined(WAKE_HISTO)
    26.7 -    if ( !is_idle_task(next) && next->wokenup ) {
    26.8 +    if ( !is_idle_task(next->domain) && next->wokenup ) {
    26.9          ulong diff = (ulong)(now - next->wokenup);
   26.10          diff /= (ulong)MILLISECS(1);
   26.11          if (diff <= BUCKETS-2)  schedule_data[cpu].hist[diff]++;
   26.12 @@ -394,7 +394,7 @@ static void __enter_scheduler(void)
   26.13      next->wokenup = (s_time_t)0;
   26.14  #elif defined(BLOCKTIME_HISTO)
   26.15      prev->lastdeschd = now;
   26.16 -    if ( !is_idle_task(next) )
   26.17 +    if ( !is_idle_task(next->domain) )
   26.18      {
   26.19          ulong diff = (ulong)((now - next->lastdeschd) / MILLISECS(10));
   26.20          if (diff <= BUCKETS-2)  schedule_data[cpu].hist[diff]++;
    27.1 --- a/xen/drivers/pci/quirks.c	Tue Apr 05 11:27:50 2005 +0000
    27.2 +++ b/xen/drivers/pci/quirks.c	Thu Apr 21 01:14:25 2005 +0000
    27.3 @@ -18,7 +18,6 @@
    27.4  #include <xen/pci.h>
    27.5  #include <xen/init.h>
    27.6  #include <xen/delay.h>
    27.7 -#include <asm/io_apic.h>
    27.8  
    27.9  #undef DEBUG
   27.10  
   27.11 @@ -333,6 +332,8 @@ static void __init quirk_vt82c686_acpi(s
   27.12  
   27.13  #ifdef CONFIG_X86_IO_APIC 
   27.14  
   27.15 +#include <asm/io_apic.h>
   27.16 +
   27.17  /*
   27.18   * VIA 686A/B: If an IO-APIC is active, we need to route all on-chip
   27.19   * devices to the external APIC.
    28.1 --- a/xen/include/asm-x86/page.h	Tue Apr 05 11:27:50 2005 +0000
    28.2 +++ b/xen/include/asm-x86/page.h	Thu Apr 21 01:14:25 2005 +0000
    28.3 @@ -105,14 +105,7 @@ typedef struct { unsigned long pt_lo; } 
    28.4  #define pfn_to_page(_pfn)       (frame_table + (_pfn))
    28.5  #define phys_to_page(kaddr)     (frame_table + ((kaddr) >> PAGE_SHIFT))
    28.6  #define virt_to_page(kaddr)	(frame_table + (__pa(kaddr) >> PAGE_SHIFT))
    28.7 -#define VALID_PAGE(page)	((page - frame_table) < max_mapnr)
    28.8 -
    28.9 -/*
   28.10 - * NB. We don't currently track I/O holes in the physical RAM space.
   28.11 - * For now we guess that I/O devices will be mapped in the first 1MB
   28.12 - * (e.g., VGA buffers) or beyond the end of physical RAM.
   28.13 - */
   28.14 -#define pfn_is_ram(_pfn)        (((_pfn) > 0x100) && ((_pfn) < max_page))
   28.15 +#define pfn_valid(_pfn)         ((_pfn) < max_page)
   28.16  
   28.17  /* High table entries are reserved by the hypervisor. */
   28.18  #define DOMAIN_ENTRIES_PER_L2_PAGETABLE	    \