[kernel] r7471 - in dists/trunk/linux-2.6/debian/patches: features/all/xen series

Bastian Blank waldi at costa.debian.org
Wed Sep 20 23:39:40 UTC 2006


Author: waldi
Date: Wed Sep 20 23:39:37 2006
New Revision: 7471

Added:
   dists/trunk/linux-2.6/debian/patches/features/all/xen/fedora-36175.patch
      - copied, changed from r7465, /dists/trunk/linux-2.6/debian/patches/features/all/xen/upstream-35844.patch
Removed:
   dists/trunk/linux-2.6/debian/patches/features/all/xen/upstream-35844.patch
Modified:
   dists/trunk/linux-2.6/debian/patches/series/1-extra

Log:
* debian/patches/features/all/xen/fedora-36175.patch: Add.
* debian/patches/series/1-extra: Replace xen patch.


Copied: dists/trunk/linux-2.6/debian/patches/features/all/xen/fedora-36175.patch (from r7465, /dists/trunk/linux-2.6/debian/patches/features/all/xen/upstream-35844.patch)
==============================================================================
--- /dists/trunk/linux-2.6/debian/patches/features/all/xen/upstream-35844.patch	(original)
+++ dists/trunk/linux-2.6/debian/patches/features/all/xen/fedora-36175.patch	Wed Sep 20 23:39:37 2006
@@ -1,6 +1,6 @@
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/boot-xen/Makefile linux-2.6.18-xen/arch/i386/boot-xen/Makefile
 --- linux-2.6.18/arch/i386/boot-xen/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/boot-xen/Makefile	2006-05-26 22:00:00.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/boot-xen/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,21 @@
 +
 +OBJCOPYFLAGS := -g --strip-unneeded
@@ -25,8 +25,16 @@
 +	ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/Kconfig linux-2.6.18-xen/arch/i386/Kconfig
 --- linux-2.6.18/arch/i386/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/Kconfig	2006-09-17 17:44:46.000000000 +0200
-@@ -103,6 +103,15 @@
++++ linux-2.6.18-xen/arch/i386/Kconfig	2006-09-04 16:31:00.000000000 +0200
+@@ -16,6 +16,7 @@
+ 
+ config GENERIC_TIME
+ 	bool
++	depends on !X86_XEN
+ 	default y
+ 
+ config LOCKDEP_SUPPORT
+@@ -103,6 +104,15 @@
  	help
  	  Choose this option if your computer is a standard PC or compatible.
  
@@ -42,7 +50,7 @@
  config X86_ELAN
  	bool "AMD Elan"
  	help
-@@ -213,6 +222,7 @@
+@@ -213,6 +223,7 @@
  
  config HPET_TIMER
  	bool "HPET Timer Support"
@@ -50,7 +58,7 @@
  	help
  	  This enables the use of the HPET for the kernel's internal timer.
  	  HPET is the next generation timer replacing legacy 8254s.
-@@ -263,7 +273,7 @@
+@@ -263,7 +274,7 @@
  
  config X86_UP_APIC
  	bool "Local APIC support on uniprocessors"
@@ -59,7 +67,7 @@
  	help
  	  A local APIC (Advanced Programmable Interrupt Controller) is an
  	  integrated interrupt controller in the CPU. If you have a single-CPU
-@@ -288,12 +298,12 @@
+@@ -288,12 +299,12 @@
  
  config X86_LOCAL_APIC
  	bool
@@ -74,15 +82,8 @@
  	default y
  
  config X86_VISWS_APIC
-@@ -301,9 +311,14 @@
- 	depends on X86_VISWS
- 	default y
+@@ -303,7 +314,7 @@
  
-+config X86_TSC
-+	bool
-+	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODEGX1) && !X86_NUMAQ && !X86_XEN
-+	default y
-+
  config X86_MCE
  	bool "Machine Check Exception"
 -	depends on !X86_VOYAGER
@@ -90,7 +91,7 @@
  	---help---
  	  Machine Check Exception support allows the processor to notify the
  	  kernel if it detects a problem (e.g. overheating, component failure).
-@@ -402,6 +417,7 @@
+@@ -402,6 +413,7 @@
  
  config MICROCODE
  	tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
@@ -98,7 +99,7 @@
  	---help---
  	  If you say Y here and also to "/dev file system support" in the
  	  'File systems' section, you will be able to update the microcode on
-@@ -419,6 +435,7 @@
+@@ -419,6 +431,7 @@
  
  config X86_MSR
  	tristate "/dev/cpu/*/msr - Model-specific register support"
@@ -106,7 +107,7 @@
  	help
  	  This device gives privileged processes access to the x86
  	  Model-Specific Registers (MSRs).  It is a character device with
-@@ -434,6 +451,10 @@
+@@ -434,6 +447,10 @@
  	  with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
  	  /dev/cpu/31/cpuid.
  
@@ -117,7 +118,7 @@
  source "drivers/firmware/Kconfig"
  
  choice
-@@ -607,7 +628,7 @@
+@@ -607,7 +624,7 @@
  
  config HIGHPTE
  	bool "Allocate 3rd-level pagetables from highmem"
@@ -126,7 +127,7 @@
  	help
  	  The VM uses one page table entry for each page of physical memory.
  	  For systems with a lot of RAM, this can be wasteful of precious
-@@ -616,6 +637,7 @@
+@@ -616,6 +633,7 @@
  
  config MATH_EMULATION
  	bool "Math emulation"
@@ -134,7 +135,7 @@
  	---help---
  	  Linux can emulate a math coprocessor (used for floating point
  	  operations) if you don't have one. 486DX and Pentium processors have
-@@ -641,6 +663,8 @@
+@@ -641,6 +659,8 @@
  
  config MTRR
  	bool "MTRR (Memory Type Range Register) support"
@@ -143,7 +144,7 @@
  	---help---
  	  On Intel P6 family processors (Pentium Pro, Pentium II and later)
  	  the Memory Type Range Registers (MTRRs) may be used to control
-@@ -675,7 +699,7 @@
+@@ -675,7 +695,7 @@
  
  config EFI
  	bool "Boot from EFI support"
@@ -152,7 +153,7 @@
  	default n
  	---help---
  	This enables the the kernel to boot on EFI platforms using
-@@ -693,7 +717,7 @@
+@@ -693,7 +713,7 @@
  
  config IRQBALANCE
   	bool "Enable kernel irq balancing"
@@ -161,7 +162,7 @@
  	default y
  	help
   	  The default yes will allow the kernel to do irq load balancing.
-@@ -741,7 +765,7 @@
+@@ -741,7 +761,7 @@
  
  config KEXEC
  	bool "kexec system call (EXPERIMENTAL)"
@@ -170,7 +171,15 @@
  	help
  	  kexec is a system call that implements the ability to shutdown your
  	  current kernel, and to start another kernel.  It is like a reboot
-@@ -810,18 +834,20 @@
+@@ -794,6 +814,7 @@
+ config COMPAT_VDSO
+ 	bool "Compat VDSO support"
+ 	default y
++	depends on !X86_XEN
+ 	help
+ 	  Map the VDSO to the predictable old-style address too.
+ 	---help---
+@@ -810,18 +831,20 @@
  	depends on HIGHMEM
  
  menu "Power management options (ACPI, APM)"
@@ -194,7 +203,7 @@
  	---help---
  	  APM is a BIOS specification for saving power using several different
  	  techniques. This is mostly useful for battery powered laptops with
-@@ -1006,6 +1032,7 @@
+@@ -1006,6 +1029,7 @@
  
  config PCI_GOBIOS
  	bool "BIOS"
@@ -202,7 +211,7 @@
  
  config PCI_GOMMCONFIG
  	bool "MMConfig"
-@@ -1013,6 +1040,13 @@
+@@ -1013,6 +1037,13 @@
  config PCI_GODIRECT
  	bool "Direct"
  
@@ -216,7 +225,7 @@
  config PCI_GOANY
  	bool "Any"
  
-@@ -1020,7 +1054,7 @@
+@@ -1020,7 +1051,7 @@
  
  config PCI_BIOS
  	bool
@@ -225,7 +234,7 @@
  	default y
  
  config PCI_DIRECT
-@@ -1033,6 +1067,18 @@
+@@ -1033,6 +1064,18 @@
  	depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
  	default y
  
@@ -244,7 +253,7 @@
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
-@@ -1043,7 +1089,7 @@
+@@ -1043,7 +1086,7 @@
  
  config ISA
  	bool "ISA support"
@@ -253,7 +262,7 @@
  	help
  	  Find out whether you have ISA slots on your motherboard.  ISA is the
  	  name of a bus system, i.e. the way the CPU talks to the other stuff
-@@ -1070,7 +1116,7 @@
+@@ -1070,7 +1113,7 @@
  source "drivers/eisa/Kconfig"
  
  config MCA
@@ -262,7 +271,7 @@
  	default y if X86_VOYAGER
  	help
  	  MicroChannel Architecture is found in some IBM PS/2 machines and
-@@ -1146,6 +1192,8 @@
+@@ -1146,6 +1189,8 @@
  
  source "crypto/Kconfig"
  
@@ -271,7 +280,7 @@
  source "lib/Kconfig"
  
  #
-@@ -1171,7 +1219,7 @@
+@@ -1171,7 +1216,7 @@
  
  config X86_HT
  	bool
@@ -280,7 +289,7 @@
  	default y
  
  config X86_BIOS_REBOOT
-@@ -1184,6 +1232,16 @@
+@@ -1184,6 +1229,16 @@
  	depends on X86_SMP || (X86_VOYAGER && SMP)
  	default y
  
@@ -299,7 +308,7 @@
  	default y
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/Kconfig.cpu linux-2.6.18-xen/arch/i386/Kconfig.cpu
 --- linux-2.6.18/arch/i386/Kconfig.cpu	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/Kconfig.cpu	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/Kconfig.cpu	2006-09-04 16:31:00.000000000 +0200
 @@ -251,7 +251,7 @@
  
  config X86_F00F_BUG
@@ -309,9 +318,16 @@
  	default y
  
  config X86_WP_WORKS_OK
+@@ -311,5 +311,5 @@
+ 
+ config X86_TSC
+ 	bool
+-	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODEGX1 || MGEODE_LX) && !X86_NUMAQ
++	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODEGX1 || MGEODE_LX) && !X86_NUMAQ && !X86_XEN
+ 	default y
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/Kconfig.debug linux-2.6.18-xen/arch/i386/Kconfig.debug
 --- linux-2.6.18/arch/i386/Kconfig.debug	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/Kconfig.debug	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/Kconfig.debug	2006-09-04 16:31:00.000000000 +0200
 @@ -79,6 +79,7 @@
  config DOUBLEFAULT
  	default y
@@ -322,7 +338,7 @@
            would otherwise cause a system to silently reboot. Disabling this
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/acpi/boot-xen.c linux-2.6.18-xen/arch/i386/kernel/acpi/boot-xen.c
 --- linux-2.6.18/arch/i386/kernel/acpi/boot-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/acpi/boot-xen.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/acpi/boot-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,1168 @@
 +/*
 + *  boot.c - Architecture-Specific Low-Level ACPI Boot Support
@@ -1494,7 +1510,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/acpi/Makefile linux-2.6.18-xen/arch/i386/kernel/acpi/Makefile
 --- linux-2.6.18/arch/i386/kernel/acpi/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/acpi/Makefile	2006-05-26 22:00:00.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/acpi/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -6,3 +6,7 @@
  obj-y				+= cstate.o processor.o
  endif
@@ -1505,23 +1521,34 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/alternative.c linux-2.6.18-xen/arch/i386/kernel/alternative.c
 --- linux-2.6.18/arch/i386/kernel/alternative.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/alternative.c	2006-09-17 17:44:46.000000000 +0200
-@@ -151,7 +151,11 @@
++++ linux-2.6.18-xen/arch/i386/kernel/alternative.c	2006-09-04 16:31:00.000000000 +0200
+@@ -4,7 +4,11 @@
+ #include <asm/alternative.h>
+ #include <asm/sections.h>
+ 
++#ifdef CONFIG_X86_64_XEN
++static int no_replacement    = 1;
++#else
+ static int no_replacement    = 0;
++#endif
+ static int smp_alt_once      = 0;
+ static int debug_alternative = 0;
+ 
+@@ -151,7 +155,11 @@
  #ifdef CONFIG_X86_64
  		/* vsyscall code is not mapped yet. resolve it manually. */
  		if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
--			instr = __va(instr - (u8*)VSYSCALL_START + (u8*)__pa_symbol(&__vsyscall_0));
-+#ifndef CONFIG_XEN
-+			instr = __va(instr - (u8*)VSYSCALL_START + (u8*)(__pa_symbol(&__vsyscall_0)));
-+#else
++#ifdef CONFIG_XEN
 +			instr = __va(instr - (u8*)VSYSCALL_START + (u8*)phys_to_machine(__pa_symbol(&__vsyscall_0)));
++#else
+ 			instr = __va(instr - (u8*)VSYSCALL_START + (u8*)__pa_symbol(&__vsyscall_0));
 +#endif
  			DPRINTK("%s: vsyscall fixup: %p => %p\n",
  				__FUNCTION__, a->instr, instr);
  		}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/apic-xen.c linux-2.6.18-xen/arch/i386/kernel/apic-xen.c
 --- linux-2.6.18/arch/i386/kernel/apic-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/apic-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/apic-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,160 @@
 +/*
 + *	Local APIC handling, local APIC timers
@@ -1685,7 +1712,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/asm-offsets.c linux-2.6.18-xen/arch/i386/kernel/asm-offsets.c
 --- linux-2.6.18/arch/i386/kernel/asm-offsets.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/asm-offsets.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/asm-offsets.c	2006-09-04 16:31:00.000000000 +0200
 @@ -66,9 +66,14 @@
  	OFFSET(pbe_orig_address, pbe, orig_address);
  	OFFSET(pbe_next, pbe, next);
@@ -1704,7 +1731,7 @@
  	DEFINE(VDSO_PRELINK, VDSO_PRELINK);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/cpu/common-xen.c linux-2.6.18-xen/arch/i386/kernel/cpu/common-xen.c
 --- linux-2.6.18/arch/i386/kernel/cpu/common-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/cpu/common-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/cpu/common-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,739 @@
 +#include <linux/init.h>
 +#include <linux/string.h>
@@ -2333,7 +2360,7 @@
 +	}
 +	printk(KERN_INFO "Initializing CPU#%d\n", cpu);
 +
-+	if (cpu_has_vme || cpu_has_de)
++	if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
 +		clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
 +	if (tsc_disable && cpu_has_tsc) {
 +		printk(KERN_NOTICE "Disabling TSC...\n");
@@ -2447,7 +2474,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/cpu/Makefile linux-2.6.18-xen/arch/i386/kernel/cpu/Makefile
 --- linux-2.6.18/arch/i386/kernel/cpu/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/cpu/Makefile	2006-05-26 22:00:00.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/cpu/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -17,3 +17,8 @@
  
  obj-$(CONFIG_MTRR)	+= 	mtrr/
@@ -2459,7 +2486,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/cpu/mtrr/main-xen.c linux-2.6.18-xen/arch/i386/kernel/cpu/mtrr/main-xen.c
 --- linux-2.6.18/arch/i386/kernel/cpu/mtrr/main-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/cpu/mtrr/main-xen.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/cpu/mtrr/main-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,197 @@
 +#include <linux/init.h>
 +#include <linux/proc_fs.h>
@@ -2660,7 +2687,7 @@
 +subsys_initcall(mtrr_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/cpu/mtrr/Makefile linux-2.6.18-xen/arch/i386/kernel/cpu/mtrr/Makefile
 --- linux-2.6.18/arch/i386/kernel/cpu/mtrr/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/cpu/mtrr/Makefile	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/cpu/mtrr/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -3,3 +3,10 @@
  obj-y		+= cyrix.o
  obj-y		+= centaur.o
@@ -2674,13 +2701,13 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/early_printk-xen.c linux-2.6.18-xen/arch/i386/kernel/early_printk-xen.c
 --- linux-2.6.18/arch/i386/kernel/early_printk-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/early_printk-xen.c	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/early_printk-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +#include "../../x86_64/kernel/early_printk-xen.c"
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/entry.S linux-2.6.18-xen/arch/i386/kernel/entry.S
 --- linux-2.6.18/arch/i386/kernel/entry.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/entry.S	2006-09-20 13:58:38.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/entry.S	2006-09-21 01:33:31.000000000 +0200
 @@ -269,7 +269,7 @@
  	CFI_STARTPROC simple
  	CFI_DEF_CFA esp, 0
@@ -2710,8 +2737,8 @@
  	pushl $sysenter_past_esp
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/entry-xen.S linux-2.6.18-xen/arch/i386/kernel/entry-xen.S
 --- linux-2.6.18/arch/i386/kernel/entry-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/entry-xen.S	2006-09-20 13:58:38.000000000 +0200
-@@ -0,0 +1,1201 @@
++++ linux-2.6.18-xen/arch/i386/kernel/entry-xen.S	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,1213 @@
 +/*
 + *  linux/arch/i386/entry.S
 + *
@@ -3073,26 +3100,27 @@
 +	movl EIP(%esp), %edx
 +	movl OLDESP(%esp), %ecx
 +	xorl %ebp,%ebp
-+#ifdef CONFIG_XEN
 +	TRACE_IRQS_ON
++#ifdef CONFIG_XEN
 +	__ENABLE_INTERRUPTS
 +sysexit_scrit:	/**** START OF SYSEXIT CRITICAL REGION ****/
 +	__TEST_PENDING
 +	jnz  14f			# process more events if necessary...
 +	movl ESI(%esp), %esi
 +	sysexit
-+	CFI_ENDPROC
 +14:	__DISABLE_INTERRUPTS
 +sysexit_ecrit:	/**** END OF SYSEXIT CRITICAL REGION ****/
 +	push %esp
++	CFI_ADJUST_CFA_OFFSET 4
 +	call evtchn_do_upcall
 +	add  $4,%esp
++	CFI_ADJUST_CFA_OFFSET -4
 +	jmp  ret_from_intr
 +#else
 +	sti
 +	sysexit
-+	CFI_ENDPROC
 +#endif /* !CONFIG_XEN */
++	CFI_ENDPROC
 +
 +
 +	# system call handler stub
@@ -3134,11 +3162,8 @@
 +	movb CS(%esp), %al
 +	andl $(VM_MASK | (4 << 8) | 3), %eax
 +	cmpl $((4 << 8) | 3), %eax
-+	CFI_REMEMBER_STATE
 +	je ldt_ss			# returning to user-space with LDT SS
 +restore_nocheck:
-+	TRACE_IRQS_IRET
-+restore_nocheck_notrace:
 +#else
 +restore_nocheck:
 +	movl EFLAGS(%esp), %eax
@@ -3149,8 +3174,10 @@
 +	andb evtchn_upcall_mask(%esi),%al
 +	andb $1,%al			# EAX[0] == IRET_EFLAGS.IF & event_mask
 +	jnz restore_all_enable_events	#        != 0 => enable event delivery
-+	TRACE_IRQS_IRET
 +#endif
++	TRACE_IRQS_IRET
++	CFI_REMEMBER_STATE
++restore_nocheck_notrace:
 +	RESTORE_REGS
 +	addl $4, %esp
 +	CFI_ADJUST_CFA_OFFSET -4
@@ -3170,8 +3197,8 @@
 +	.long 1b,iret_exc
 +.previous
 +
-+#ifndef CONFIG_XEN
 +	CFI_RESTORE_STATE
++#ifndef CONFIG_XEN
 +ldt_ss:
 +	larl OLDSS(%esp), %eax
 +	jnz restore_nocheck
@@ -3200,16 +3227,14 @@
 +	.align 4
 +	.long 1b,iret_exc
 +.previous
-+	CFI_ENDPROC
 +#else
 +hypervisor_iret:
 +	andl $~NMI_MASK, EFLAGS(%esp)
 +	RESTORE_REGS
 +	addl $4, %esp
-+	CFI_ADJUST_CFA_OFFSET -4
 +	jmp  hypercall_page + (__HYPERVISOR_iret * 32)
-+	CFI_ENDPROC
 +#endif
++	CFI_ENDPROC
 +
 +	# perform work that needs to be done immediately before resumption
 +	ALIGN
@@ -3338,7 +3363,7 @@
 +.rept NR_IRQS
 +	ALIGN
 + .if vector
-+ 	CFI_ADJUST_CFA_OFFSET -4
++	CFI_ADJUST_CFA_OFFSET -4
 + .endif
 +1:	pushl $~(vector)
 +	CFI_ADJUST_CFA_OFFSET 4
@@ -3364,10 +3389,11 @@
 +
 +#define BUILD_INTERRUPT(name, nr)	\
 +ENTRY(name)				\
++	SAVE_ALL			\
 +	RING0_INT_FRAME;		\
 +	pushl $~(nr);			\
 +	CFI_ADJUST_CFA_OFFSET 4;	\
-+	SAVE_ALL			\
++	SAVE_ALL;			\
 +	TRACE_IRQS_OFF			\
 +	movl %esp,%eax;			\
 +	call smp_/**/name;		\
@@ -3466,15 +3492,16 @@
 +	jb   11f
 +	cmpl $sysexit_ecrit,%eax
 +	ja   11f
++	# interrupted in sysexit critical
 +	addl $0x34,%esp			# Remove cs...ebx from stack frame.
-+	CFI_ADJUST_CFA_OFFSET -52
++	# this popped off new frame to reuse the old one, therefore no 
++	# CFI_ADJUST_CFA_OFFSET here
 +11:	push %esp
 +	CFI_ADJUST_CFA_OFFSET 4
 +	call evtchn_do_upcall
 +	add  $4,%esp
 +	CFI_ADJUST_CFA_OFFSET -4
 +	jmp  ret_from_intr
-+	CFI_ENDPROC
 +
 +        ALIGN
 +restore_all_enable_events:
@@ -3520,7 +3547,10 @@
 +	movl %eax,(%edi)
 +	loop 16b
 +17:	movl %edi,%esp			# final %edi is top of merged stack
++	# this popped off new frame to reuse the old one, therefore no 
++	# CFI_DEF_CFA_OFFSET here
 +	jmp  11b
++	CFI_ENDPROC
 +
 +critical_fixup_table:
 +	.byte 0xff,0xff,0xff		# testb $0xff,(%esi) = __TEST_PENDING
@@ -3550,7 +3580,9 @@
 +# to pop the stack frame we end up in an infinite loop of failsafe callbacks.
 +# We distinguish between categories by maintaining a status value in EAX.
 +ENTRY(failsafe_callback)
++	RING0_INT_FRAME
 +	pushl %eax
++	CFI_ADJUST_CFA_OFFSET 4
 +	movl $1,%eax
 +1:	mov 4(%esp),%ds
 +2:	mov 8(%esp),%es
@@ -3558,11 +3590,16 @@
 +4:	mov 16(%esp),%gs
 +	testl %eax,%eax
 +	popl %eax
++	CFI_ADJUST_CFA_OFFSET -4
 +	jz 5f
 +	addl $16,%esp		# EAX != 0 => Category 2 (Bad IRET)
++	CFI_ADJUST_CFA_OFFSET -16
 +	jmp iret_exc
++	CFI_ADJUST_CFA_OFFSET 16
 +5:	addl $16,%esp		# EAX == 0 => Category 1 (Bad segment)
++	CFI_ADJUST_CFA_OFFSET -16
 +	pushl $0
++	CFI_ADJUST_CFA_OFFSET 4
 +	SAVE_ALL
 +	jmp ret_from_exception
 +.section .fixup,"ax";		\
@@ -3586,6 +3623,7 @@
 +	.long 3b,8b;		\
 +	.long 4b,9b;		\
 +.previous
++	CFI_ENDPROC
 +#endif
 +
 +ENTRY(coprocessor_error)
@@ -3621,7 +3659,6 @@
 +	addl $4, %esp
 +	CFI_ADJUST_CFA_OFFSET -4
 +	jmp ret_from_exception
-+	CFI_ENDPROC
 +device_available_emulate:
 +#endif
 +	preempt_stop
@@ -3745,7 +3782,7 @@
 +	CFI_ADJUST_CFA_OFFSET 4
 +	SAVE_ALL
 +	FIXUP_ESPFIX_STACK		# %eax == %esp
-+	CFI_ADJUST_CFA_OFFSET -20
++	CFI_ADJUST_CFA_OFFSET -20	# the frame has now moved
 +	xorl %edx,%edx			# zero error code
 +	call do_nmi
 +	RESTORE_REGS
@@ -3756,16 +3793,18 @@
 +	.align 4
 +	.long 1b,iret_exc
 +.previous
-+	CFI_ENDPROC
 +#else
 +ENTRY(nmi)
++	RING0_INT_FRAME
 +	pushl %eax
++	CFI_ADJUST_CFA_OFFSET 4
 +	SAVE_ALL
 +	xorl %edx,%edx		# zero error code
 +	movl %esp,%eax		# pt_regs pointer
 +	call do_nmi
 +	orl  $NMI_MASK, EFLAGS(%esp)
 +	jmp restore_all
++	CFI_ENDPROC
 +#endif
 +
 +KPROBE_ENTRY(int3)
@@ -3915,8 +3954,8 @@
 +syscall_table_size=(.-sys_call_table)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/fixup.c linux-2.6.18-xen/arch/i386/kernel/fixup.c
 --- linux-2.6.18/arch/i386/kernel/fixup.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/fixup.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,85 @@
++++ linux-2.6.18-xen/arch/i386/kernel/fixup.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,92 @@
 +/******************************************************************************
 + * fixup.c
 + * 
@@ -3957,6 +3996,7 @@
 +
 +fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
 +{
++#if 0
 +	static unsigned long printed = 0;
 +	char info[100];
 +	int i;
@@ -3993,6 +4033,12 @@
 +	}
 +
 +	printk("Continuing...\n\n");
++#else
++	if (printk_ratelimit())
++		printk(KERN_WARNING
++		       "4gb seg fixup, process %s (pid %d), cs:ip %02x:%08lx\n",
++		       current->comm, current->tgid, regs->xcs, regs->eip);
++#endif
 +}
 +
 +static int __init fixup_init(void)
@@ -4004,11 +4050,12 @@
 +__initcall(fixup_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/head-xen.S linux-2.6.18-xen/arch/i386/kernel/head-xen.S
 --- linux-2.6.18/arch/i386/kernel/head-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/head-xen.S	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,181 @@
++++ linux-2.6.18-xen/arch/i386/kernel/head-xen.S	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,200 @@
 +
 +
 +.text
++#include <linux/elfnote.h>
 +#include <linux/threads.h>
 +#include <linux/linkage.h>
 +#include <asm/segment.h>
@@ -4016,6 +4063,7 @@
 +#include <asm/thread_info.h>
 +#include <asm/asm-offsets.h>
 +#include <xen/interface/arch-x86_32.h>
++#include <xen/interface/elfnote.h>
 +
 +/*
 + * References to members of the new_cpu_data structure.
@@ -4066,8 +4114,7 @@
 +	movl %eax,%gs
 +	cld			# gcc2 wants the direction flag cleared at all times
 +
-+	pushl %eax		# fake return address
-+	jmp start_kernel
++	call start_kernel
 +L6:
 +	jmp L6			# main should never return here, but
 +				# just in case, we know what happens.
@@ -4146,6 +4193,7 @@
 +	.quad 0x0000000000000000	/* 0xf0 - unused */
 +	.quad 0x0000000000000000	/* 0xf8 - GDT entry 31: double-fault TSS */
 +
++#ifdef CONFIG_XEN_COMPAT_030002
 +/*
 + * __xen_guest information
 + */
@@ -4165,12 +4213,8 @@
 +	.ascii	",XEN_VER=xen-3.0"
 +	.ascii	",VIRT_BASE=0x"
 +		utoa __PAGE_OFFSET
-+#ifdef CONFIG_XEN_COMPAT_030002
 +	.ascii	",ELF_PADDR_OFFSET=0x"
 +		utoa __PAGE_OFFSET
-+#else
-+	.ascii	",ELF_PADDR_OFFSET=0x0"
-+#endif /* !CONFIG_XEN_COMPAT_030002 */
 +	.ascii	",VIRT_ENTRY=0x"
 +		utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
 +	.ascii	",HYPERCALL_PAGE=0x"
@@ -4187,9 +4231,30 @@
 +#endif
 +	.ascii	",LOADER=generic"
 +	.byte	0
++#endif /* CONFIG_XEN_COMPAT_030002 */
++
++
++	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz, "linux")	
++	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz, "2.6")
++	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz, "xen-3.0")
++	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .long,  __PAGE_OFFSET)
++#ifdef CONFIG_XEN_COMPAT_030002
++	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .long,  __PAGE_OFFSET)
++#else
++	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .long,  0)
++#endif /* !CONFIG_XEN_COMPAT_030002 */
++	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
++	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
++	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
++#ifdef CONFIG_X86_PAE
++	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
++#else
++	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "no")
++#endif
++	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/init_task-xen.c linux-2.6.18-xen/arch/i386/kernel/init_task-xen.c
 --- linux-2.6.18/arch/i386/kernel/init_task-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/init_task-xen.c	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/init_task-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,51 @@
 +#include <linux/mm.h>
 +#include <linux/module.h>
@@ -4244,8 +4309,8 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/io_apic-xen.c linux-2.6.18-xen/arch/i386/kernel/io_apic-xen.c
 --- linux-2.6.18/arch/i386/kernel/io_apic-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/io_apic-xen.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,2768 @@
++++ linux-2.6.18-xen/arch/i386/kernel/io_apic-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,2771 @@
 +/*
 + *	Intel IO-APIC support for multi-Pentium hosts.
 + *
@@ -4829,8 +4894,8 @@
 +	}
 +
 +	cpus_and(allowed_mask,
-+		cpu_online_map,
-+		balance_irq_affinity[selected_irq]);
++		 cpu_online_map,
++		 balance_irq_affinity[selected_irq]);
 +	target_cpu_mask = cpumask_of_cpu(min_loaded);
 +	cpus_and(tmp, target_cpu_mask, allowed_mask);
 +
@@ -4871,7 +4936,7 @@
 +	
 +	/* push everything to CPU 0 to give us a starting point.  */
 +	for (i = 0 ; i < NR_IRQS ; i++) {
-+		irq_desc[i].pending_mask = cpumask_of_cpu(0);
++		irq_desc[i].pending_mask[i] = cpumask_of_cpu(0);
 +		set_pending_irq(i, cpumask_of_cpu(0));
 +	}
 +
@@ -5459,13 +5524,15 @@
 +{
 +	struct physdev_irq irq_op;
 +	unsigned long flags;
-+	int vector;
 +
 +	BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
 +
-+	if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
-+		return IO_APIC_VECTOR(irq);
++	spin_lock_irqsave(&vector_lock, flags);
 +
++	if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
++		spin_unlock_irqrestore(&vector_lock, flags);
++		return IO_APIC_VECTOR(irq);
++	}
 +	irq_op.irq = irq;
 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
 +		return -ENOSPC;
@@ -5474,6 +5541,8 @@
 +	if (irq != AUTO_ASSIGN)
 +		IO_APIC_VECTOR(irq) = irq_op.vector;
 +
++	spin_unlock_irqrestore(&vector_lock, flags);
++
 +	return irq_op.vector;
 +}
 +
@@ -6559,9 +6628,9 @@
 +	io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
 +	spin_unlock_irqrestore(&ioapic_lock, flags);
 +}
-+
++#endif /* CONFIG_XEN */
 +int timer_uses_ioapic_pin_0;
-+
++#ifdef CONFI_XEN
 +/*
 + * This code may look a bit paranoid, but it's supposed to cooperate with
 + * a wide range of boards and BIOS bugs.  Fortunately only the timer IRQ
@@ -6686,7 +6755,6 @@
 +		"report.  Then try booting with the 'noapic' option");
 +}
 +#else
-+int timer_uses_ioapic_pin_0;
 +#define check_timer() ((void)0)
 +#endif
 +
@@ -7016,8 +7084,8 @@
 +#endif /* CONFIG_ACPI */
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/ioport-xen.c linux-2.6.18-xen/arch/i386/kernel/ioport-xen.c
 --- linux-2.6.18/arch/i386/kernel/ioport-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/ioport-xen.c	2006-08-15 13:03:12.000000000 +0200
-@@ -0,0 +1,122 @@
++++ linux-2.6.18-xen/arch/i386/kernel/ioport-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,121 @@
 +/*
 + *	linux/arch/i386/kernel/ioport.c
 + *
@@ -7099,7 +7167,6 @@
 +
 +		memset(bitmap, 0xff, IO_BITMAP_BYTES);
 +		t->io_bitmap_ptr = bitmap;
-+		set_thread_flag(TIF_IO_BITMAP);
 +
 +		set_iobitmap.bitmap   = (char *)bitmap;
 +		set_iobitmap.nr_ports = IO_BITMAP_BITS;
@@ -7142,7 +7209,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/irq-xen.c linux-2.6.18-xen/arch/i386/kernel/irq-xen.c
 --- linux-2.6.18/arch/i386/kernel/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/irq-xen.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/irq-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,324 @@
 +/*
 + *	linux/arch/i386/kernel/irq.c
@@ -7253,7 +7320,7 @@
 +		 */
 +		irqctx->tinfo.preempt_count =
 +			(irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK) |
-+			(curctx->tinfo.preempt_count & SOFTIRQ_MASK);
++			 (curctx->tinfo.preempt_count & SOFTIRQ_MASK);
 +
 +		asm volatile(
 +			"       xchgl   %%ebx,%%esp      \n"
@@ -7383,7 +7450,7 @@
 +	if (i == 0) {
 +		seq_printf(p, "           ");
 +		for_each_online_cpu(j)
-+			seq_printf(p, "CPU%-8d",j);
++			seq_printf(p, "CPU%-8d       ",j);
 +		seq_putc(p, '\n');
 +	}
 +
@@ -7470,7 +7537,7 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/ldt-xen.c linux-2.6.18-xen/arch/i386/kernel/ldt-xen.c
 --- linux-2.6.18/arch/i386/kernel/ldt-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/ldt-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/ldt-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,270 @@
 +/*
 + * linux/kernel/ldt.c
@@ -7744,7 +7811,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/Makefile linux-2.6.18-xen/arch/i386/kernel/Makefile
 --- linux-2.6.18/arch/i386/kernel/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/Makefile	2006-09-20 13:58:38.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/Makefile	2006-09-21 01:33:31.000000000 +0200
 @@ -44,6 +44,12 @@
  
  obj-$(CONFIG_SCx200)		+= scx200.o
@@ -7767,7 +7834,7 @@
  	$(call if_changed,syscall)
  
  # We also create a special relocatable object that should mirror the symbol
-@@ -77,8 +83,20 @@
+@@ -77,8 +83,19 @@
  
  SYSCFLAGS_vsyscall-syms.o = -r
  $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
@@ -7775,6 +7842,8 @@
 +			$(obj)/vsyscall-sysenter.o $(obj)/$(vsyscall_note) FORCE
  	$(call if_changed,syscall)
  
+ k8-y                      += ../../x86_64/kernel/k8.o
+ 
 +ifdef CONFIG_XEN
 +include $(srctree)/scripts/Makefile.xen
 +
@@ -7786,13 +7855,10 @@
 +obj-y := $(call cherrypickxen, $(obj-y))
 +extra-y := $(call cherrypickxen, $(extra-y))
 +endif
-+
- k8-y                      += ../../x86_64/kernel/k8.o
- 
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/microcode-xen.c linux-2.6.18-xen/arch/i386/kernel/microcode-xen.c
 --- linux-2.6.18/arch/i386/kernel/microcode-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/microcode-xen.c	2006-08-15 13:03:12.000000000 +0200
-@@ -0,0 +1,150 @@
++++ linux-2.6.18-xen/arch/i386/kernel/microcode-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,147 @@
 +/*
 + *	Intel CPU Microcode Update Driver for Linux
 + *
@@ -7837,11 +7903,8 @@
 +MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver");
 +MODULE_AUTHOR("Tigran Aivazian <tigran at veritas.com>");
 +MODULE_LICENSE("GPL");
-+  
-+static int verbose;
-+module_param(verbose, int, 0644);
 +
-+#define MICROCODE_VERSION 	"1.14a-xen"
++#define MICROCODE_VERSION 	"1.14-xen"
 +
 +#define DEFAULT_UCODE_DATASIZE 	(2000) 	  /* 2000 bytes */
 +#define MC_HEADER_SIZE		(sizeof (microcode_header_t))  	  /* 48 bytes */
@@ -7945,7 +8008,7 @@
 +MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/mpparse-xen.c linux-2.6.18-xen/arch/i386/kernel/mpparse-xen.c
 --- linux-2.6.18/arch/i386/kernel/mpparse-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/mpparse-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/mpparse-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,1185 @@
 +/*
 + *	Intel Multiprocessor Specification 1.1 and 1.4
@@ -9134,8 +9197,8 @@
 +#endif /* CONFIG_ACPI */
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/pci-dma-xen.c linux-2.6.18-xen/arch/i386/kernel/pci-dma-xen.c
 --- linux-2.6.18/arch/i386/kernel/pci-dma-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/pci-dma-xen.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,377 @@
++++ linux-2.6.18-xen/arch/i386/kernel/pci-dma-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,379 @@
 +/*
 + * Dynamic DMA mapping support.
 + *
@@ -9184,10 +9247,6 @@
 +/* Set this to 1 if there is a HW IOMMU in the system */
 +int iommu_detected __read_mostly = 0;
 +
-+__init int iommu_setup(char *p)
-+{
-+    return 1;
-+}
 +void __init pci_iommu_alloc(void)
 +{
 +	/*
@@ -9199,6 +9258,7 @@
 +#endif
 +
 +#ifdef CONFIG_CALGARY_IOMMU
++#include <asm/calgary.h>
 +	detect_calgary();
 +#endif
 +
@@ -9206,6 +9266,11 @@
 +	pci_swiotlb_init();
 +#endif
 +}
++
++__init int iommu_setup(char *p)
++{
++    return 1;
++}
 +#endif
 +
 +struct dma_coherent_mem {
@@ -9515,7 +9580,7 @@
 +EXPORT_SYMBOL(dma_sync_single_for_device);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/process-xen.c linux-2.6.18-xen/arch/i386/kernel/process-xen.c
 --- linux-2.6.18/arch/i386/kernel/process-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/process-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/process-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,812 @@
 +/*
 + *  linux/arch/i386/kernel/process.c
@@ -9579,9 +9644,6 @@
 +#include <asm/tlbflush.h>
 +#include <asm/cpu.h>
 +
-+#include <asm/tlbflush.h>
-+#include <asm/cpu.h>
-+
 +asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 +
 +static int hlt_counter;
@@ -9666,6 +9728,7 @@
 +
 +	current_thread_info()->status |= TS_POLLING;
 +
++
 +	/* endless idle loop with no priority at all */
 +	while (1) {
 +		while (!need_resched()) {
@@ -9798,10 +9861,12 @@
 +	if (unlikely(test_thread_flag(TIF_IO_BITMAP))) {
 +		struct task_struct *tsk = current;
 +		struct thread_struct *t = &tsk->thread;
++
 +		struct physdev_set_iobitmap set_iobitmap = { 0 };
 +		HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
 +		kfree(t->io_bitmap_ptr);
 +		t->io_bitmap_ptr = NULL;
++		clear_thread_flag(TIF_IO_BITMAP);
 +	}
 +}
 +
@@ -10104,7 +10169,7 @@
 +	/*
 +	 * Now maybe reload the debug registers
 +	 */
-+	if (test_tsk_thread_flag(next_p, TIF_DEBUG)) {
++	if (unlikely(next->debugreg[7])) {
 +		set_debugreg(next->debugreg[0], 0);
 +		set_debugreg(next->debugreg[1], 1);
 +		set_debugreg(next->debugreg[2], 2);
@@ -10331,7 +10396,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/quirks-xen.c linux-2.6.18-xen/arch/i386/kernel/quirks-xen.c
 --- linux-2.6.18/arch/i386/kernel/quirks-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/quirks-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/quirks-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,47 @@
 +/*
 + * This file contains work-arounds for x86 and x86_64 platform bugs.
@@ -10382,8 +10447,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/setup-xen.c linux-2.6.18-xen/arch/i386/kernel/setup-xen.c
 --- linux-2.6.18/arch/i386/kernel/setup-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/setup-xen.c	2006-09-20 13:58:38.000000000 +0200
-@@ -0,0 +1,1850 @@
++++ linux-2.6.18-xen/arch/i386/kernel/setup-xen.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,1830 @@
 +/*
 + *  linux/arch/i386/kernel/setup.c
 + *
@@ -10429,9 +10494,6 @@
 +#include <linux/init.h>
 +#include <linux/edd.h>
 +#include <linux/nodemask.h>
-+#include <linux/kernel.h>
-+#include <linux/percpu.h>
-+#include <linux/notifier.h>
 +#include <linux/kexec.h>
 +#include <linux/crash_dump.h>
 +#include <linux/dmi.h>
@@ -10452,7 +10514,8 @@
 +#include <xen/interface/physdev.h>
 +#include <xen/interface/memory.h>
 +#include <xen/features.h>
-+#include <setup_arch.h>
++#include <xen/xencons.h>
++#include "setup_arch.h"
 +#include <bios_ebda.h>
 +
 +/* Forward Declaration. */
@@ -10723,8 +10786,6 @@
 +		/* if checksum okay, trust length byte */
 +		if (length && romchecksum(rom, length))
 +			video_rom_resource.end = start + length - 1;
-+
-+		request_resource(&iomem_resource, &video_rom_resource);
 +		break;
 +	}
 +
@@ -10783,7 +10844,7 @@
 +EXPORT_SYMBOL(xen_start_info);
 +
 +void __init add_memory_region(unsigned long long start,
-+			      unsigned long long size, int type)
++                                  unsigned long long size, int type)
 +{
 +	int x;
 +
@@ -11787,10 +11848,8 @@
 +
 +	for (i = 0; i < nr_map; i++) {
 +		struct resource *res;
-+#ifndef CONFIG_RESOURCES_64BIT
 +		if (map[i].addr + map[i].size > 0x100000000ULL)
 +			continue;
-+#endif
 +		res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
 +		switch (map[i].type) {
 +		case E820_RAM:	res->name = "System RAM"; break;
@@ -11811,8 +11870,10 @@
 +			 *  so we try it repeatedly and let the resource manager
 +			 *  test it.
 +			 */
++#ifndef CONFIG_XEN
 +			request_resource(res, code_resource);
 +			request_resource(res, data_resource);
++#endif
 +#ifdef CONFIG_KEXEC
 +			request_resource(res, &crashk_res);
 +#endif
@@ -11991,33 +12052,15 @@
 +		screen_info.orig_video_cols = 80;
 +		screen_info.orig_video_ega_bx = 3;
 +		screen_info.orig_video_points = 16;
++		screen_info.orig_y = screen_info.orig_video_lines - 1;
 +		if (xen_start_info->console.dom0.info_size >=
 +		    sizeof(struct dom0_vga_console_info)) {
 +			const struct dom0_vga_console_info *info =
 +				(struct dom0_vga_console_info *)(
 +					(char *)xen_start_info +
 +					xen_start_info->console.dom0.info_off);
-+			screen_info.orig_video_mode = info->txt_mode;
-+			screen_info.orig_video_isVGA = info->video_type;
-+			screen_info.orig_video_lines = info->video_height;
-+			screen_info.orig_video_cols = info->video_width;
-+			screen_info.orig_video_points = info->txt_points;
-+			screen_info.lfb_width = info->video_width;
-+			screen_info.lfb_height = info->video_height;
-+			screen_info.lfb_depth = info->lfb_depth;
-+			screen_info.lfb_base = info->lfb_base;
-+			screen_info.lfb_size = info->lfb_size;
-+			screen_info.lfb_linelength = info->lfb_linelen;
-+			screen_info.red_size = info->red_size;
-+			screen_info.red_pos = info->red_pos;
-+			screen_info.green_size = info->green_size;
-+			screen_info.green_pos = info->green_pos;
-+			screen_info.blue_size = info->blue_size;
-+			screen_info.blue_pos = info->blue_pos;
-+			screen_info.rsvd_size = info->rsvd_size;
-+			screen_info.rsvd_pos = info->rsvd_pos;
++			dom0_init_screen_info(info);
 +		}
-+		screen_info.orig_y = screen_info.orig_video_lines - 1;
 +		xen_start_info->console.domU.mfn = 0;
 +		xen_start_info->console.domU.evtchn = 0;
 +	} else
@@ -12199,7 +12242,9 @@
 +		extern int console_use_vt;
 +		console_use_vt = 0;
 +	}
++#ifdef CONFIG_X86_TSC
 +	tsc_init();
++#endif
 +}
 +
 +static int
@@ -12236,7 +12281,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/smp-xen.c linux-2.6.18-xen/arch/i386/kernel/smp-xen.c
 --- linux-2.6.18/arch/i386/kernel/smp-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/smp-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/smp-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,624 @@
 +/*
 + *	Intel SMP support routines.
@@ -12864,7 +12909,7 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/swiotlb.c linux-2.6.18-xen/arch/i386/kernel/swiotlb.c
 --- linux-2.6.18/arch/i386/kernel/swiotlb.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/swiotlb.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/swiotlb.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,672 @@
 +/*
 + * Dynamic DMA mapping support.
@@ -13540,7 +13585,7 @@
 +EXPORT_SYMBOL(swiotlb_dma_supported);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/sysenter.c linux-2.6.18-xen/arch/i386/kernel/sysenter.c
 --- linux-2.6.18/arch/i386/kernel/sysenter.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/sysenter.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/sysenter.c	2006-09-04 16:31:00.000000000 +0200
 @@ -23,6 +23,10 @@
  #include <asm/pgtable.h>
  #include <asm/unistd.h>
@@ -13602,8 +13647,8 @@
  		memcpy(syscall_page,
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/time-xen.c linux-2.6.18-xen/arch/i386/kernel/time-xen.c
 --- linux-2.6.18/arch/i386/kernel/time-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/time-xen.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,1118 @@
++++ linux-2.6.18-xen/arch/i386/kernel/time-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,1101 @@
 +/*
 + *  linux/arch/i386/kernel/time.c
 + *
@@ -13694,6 +13739,13 @@
 +struct timezone __sys_tz __section_sys_tz;
 +#endif
 +
++#define USEC_PER_TICK (USEC_PER_SEC / HZ)
++#define NSEC_PER_TICK (NSEC_PER_SEC / HZ)
++#define FSEC_PER_TICK (FSEC_PER_SEC / HZ)
++
++#define NS_SCALE	10 /* 2^10, carefully chosen */
++#define US_SCALE	32 /* 2^32, arbitralrily chosen */
++
 +unsigned int cpu_khz;	/* Detected as we calibrate the TSC */
 +EXPORT_SYMBOL(cpu_khz);
 +
@@ -13702,19 +13754,9 @@
 +DEFINE_SPINLOCK(rtc_lock);
 +EXPORT_SYMBOL(rtc_lock);
 +
-+#if 0
-+#if defined (__i386__)
-+#include <asm/i8253.h>
-+#endif
-+
-+DEFINE_SPINLOCK(i8253_lock);
-+EXPORT_SYMBOL(i8253_lock);
-+
 +extern struct init_timer_opts timer_tsc_init;
 +extern struct timer_opts timer_tsc;
 +#define timer_none timer_tsc
-+struct timer_opts *cur_timer __read_mostly = &timer_tsc;
-+#endif
 +
 +/* These are peridically updated in shared_info, and then copied here. */
 +struct shadow_time_info {
@@ -13773,7 +13815,7 @@
 +}
 +__setup("permitted_clock_jitter=", __permitted_clock_jitter);
 +
-+#if 0
++#ifndef CONFIG_X86
 +int tsc_disable __devinitdata = 0;
 +#endif
 +
@@ -13788,12 +13830,10 @@
 +	} while ((now - bclock) < loops);
 +}
 +
-+#if 0
 +struct timer_opts timer_tsc = {
 +	.name = "tsc",
 +	.delay = delay_tsc,
 +};
-+#endif
 +
 +/*
 + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
@@ -13821,7 +13861,7 @@
 +		"add  %4,%%eax ; "
 +		"adc  %5,%%edx ; "
 +		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
-+		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
++		: "a" ((u32)delta), "1" ((u32)(delta >> US_SCALE)), "2" (mul_frac) );
 +#else
 +	__asm__ (
 +		"mul %%rdx ; shrd $32,%%rdx,%%rax"
@@ -13831,7 +13871,6 @@
 +	return product;
 +}
 +
-+#if 0
 +#if defined (__i386__)
 +int read_current_timer(unsigned long *timer_val)
 +{
@@ -13839,11 +13878,10 @@
 +	return 0;
 +}
 +#endif
-+#endif
 +
 +void init_cpu_khz(void)
 +{
-+	u64 __cpu_khz = 1000000ULL << 32;
++	u64 __cpu_khz = 1000000ULL << US_SCALE;
 +	struct vcpu_time_info *info;
 +	info = &HYPERVISOR_shared_info->vcpu_info[0].time;
 +	do_div(__cpu_khz, info->tsc_to_system_mul);
@@ -13982,7 +14020,6 @@
 + * This version of gettimeofday has microsecond resolution
 + * and better than microsecond precision on fast x86 machines with TSC.
 + */
-+#ifdef __x86_64__
 +void do_gettimeofday(struct timeval *tv)
 +{
 +	unsigned long seq;
@@ -14106,7 +14143,6 @@
 +}
 +
 +EXPORT_SYMBOL(do_settimeofday);
-+#endif
 +
 +static void sync_xen_wallclock(unsigned long dummy);
 +static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0);
@@ -14142,19 +14178,18 @@
 +static int set_rtc_mmss(unsigned long nowtime)
 +{
 +	int retval;
-+
-+	WARN_ON(irqs_disabled());
++	unsigned long flags;
 +
 +	if (independent_wallclock || !is_initial_xendomain())
 +		return 0;
 +
 +	/* gets recalled with irq locally disabled */
-+	spin_lock_irq(&rtc_lock);
++	spin_lock_irqsave(&rtc_lock, flags);
 +	if (efi_enabled)
 +		retval = efi_set_rtc_mmss(nowtime);
 +	else
 +		retval = mach_set_rtc_mmss(nowtime);
-+	spin_unlock_irq(&rtc_lock);
++	spin_unlock_irqrestore(&rtc_lock, flags);
 +
 +	return retval;
 +}
@@ -14185,12 +14220,10 @@
 +}
 +EXPORT_SYMBOL(monotonic_clock);
 +
-+#ifdef __x86_64__
 +unsigned long long sched_clock(void)
 +{
 +	return monotonic_clock();
 +}
-+#endif
 +
 +#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
 +unsigned long profile_pc(struct pt_regs *regs)
@@ -14204,7 +14237,7 @@
 +	   is just accounted to the spinlock function.
 +	   Better would be to write these functions in assembler again
 +	   and check exactly. */
-+	if (!user_mode(regs) && in_lock_functions(pc)) {
++	if (!user_mode_vm(regs) && in_lock_functions(pc)) {
 +		char *v = *(char **)regs->rsp;
 +		if ((v >= _stext && v <= _etext) ||
 +			(v >= _sinittext && v <= _einittext) ||
@@ -14425,7 +14458,6 @@
 +
 +static long clock_cmos_diff, sleep_start;
 +
-+static struct timer_opts *last_timer;
 +static int timer_suspend(struct sys_device *dev, pm_message_t state)
 +{
 +	/*
@@ -14495,10 +14527,6 @@
 +	if ((hpet_enable() >= 0) && hpet_use_timer) {
 +		printk("Using HPET for base-timer\n");
 +	}
-+
-+	cur_timer = select_timer();
-+	printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);
-+
 +	time_init_hook();
 +}
 +#endif
@@ -14546,8 +14574,8 @@
 +
 +#if defined(__x86_64__)
 +	vxtime.mode = VXTIME_TSC;
-+	vxtime.quot = (1000000L << 32) / vxtime_hz;
-+	vxtime.tsc_quot = (1000L << 32) / cpu_khz;
++	vxtime.quot = (1000000L << US_SCALE) / vxtime_hz;
++	vxtime.tsc_quot = (1000L << US_SCALE) / cpu_khz;
 +	sync_core();
 +	rdtscll(vxtime.last_tsc);
 +#endif
@@ -14724,7 +14752,7 @@
 +__initcall(xen_sysctl_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/traps.c linux-2.6.18-xen/arch/i386/kernel/traps.c
 --- linux-2.6.18/arch/i386/kernel/traps.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/traps.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/traps.c	2006-09-04 16:31:00.000000000 +0200
 @@ -642,18 +642,11 @@
  
  static void io_check_error(unsigned char reason, struct pt_regs * regs)
@@ -14747,8 +14775,8 @@
  static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/traps-xen.c linux-2.6.18-xen/arch/i386/kernel/traps-xen.c
 --- linux-2.6.18/arch/i386/kernel/traps-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/traps-xen.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,1186 @@
++++ linux-2.6.18-xen/arch/i386/kernel/traps-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,1184 @@
 +/*
 + *  linux/arch/i386/traps.c
 + *
@@ -14959,9 +14987,8 @@
 +					printk("Full inexact backtrace again:\n");
 +			} else if (call_trace >= 1)
 +				return;
-+			else
-+				printk("Full inexact backtrace again:\n");
 +		} else
++				printk("Full inexact backtrace again:\n");
 +			printk("Inexact backtrace:\n");
 +	}
 +
@@ -15106,7 +15133,6 @@
 +		return;
 +
 +	printk(KERN_EMERG "------------[ cut here ]------------\n");
-+
 +#ifdef CONFIG_DEBUG_BUGVERBOSE
 +	do {
 +		unsigned short line;
@@ -15935,9 +15961,28 @@
 +}
 +__setup("call_trace=", call_trace_setup);
 +#endif
+diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/tsc.c linux-2.6.18-xen/arch/i386/kernel/tsc.c
+--- linux-2.6.18/arch/i386/kernel/tsc.c	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/tsc.c	2006-09-04 16:31:00.000000000 +0200
+@@ -101,6 +101,7 @@
+ 	return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
+ }
+ 
++#ifndef CONFIG_XEN
+ /*
+  * Scheduler clock - returns current time in nanosec units.
+  */
+@@ -124,6 +125,7 @@
+ 	/* return the value in ns */
+ 	return cycles_2_ns(this_offset);
+ }
++#endif
+ 
+ static unsigned long calculate_cpu_khz(void)
+ {
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/vm86.c linux-2.6.18-xen/arch/i386/kernel/vm86.c
 --- linux-2.6.18/arch/i386/kernel/vm86.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/kernel/vm86.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/vm86.c	2006-09-04 16:31:00.000000000 +0200
 @@ -97,7 +97,9 @@
  struct pt_regs * FASTCALL(save_v86_state(struct kernel_vm86_regs * regs));
  struct pt_regs * fastcall save_v86_state(struct kernel_vm86_regs * regs)
@@ -15992,9 +16037,50 @@
  
  	tsk->thread.screen_bitmap = info->screen_bitmap;
  	if (info->flags & VM86_SCREEN_BITMAP)
+diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/vmlinux.lds.S linux-2.6.18-xen/arch/i386/kernel/vmlinux.lds.S
+--- linux-2.6.18/arch/i386/kernel/vmlinux.lds.S	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/vmlinux.lds.S	2006-09-04 16:31:00.000000000 +0200
+@@ -13,6 +13,12 @@
+ OUTPUT_ARCH(i386)
+ ENTRY(phys_startup_32)
+ jiffies = jiffies_64;
++
++PHDRS {
++	text PT_LOAD FLAGS(5);	/* R_E */
++	data PT_LOAD FLAGS(7);	/* RWE */
++	note PT_NOTE FLAGS(4);	/* R__ */
++}
+ SECTIONS
+ {
+   . = __KERNEL_START;
+@@ -26,7 +32,7 @@
+ 	KPROBES_TEXT
+ 	*(.fixup)
+ 	*(.gnu.warning)
+-	} = 0x9090
++	} :text = 0x9090
+ 
+   _etext = .;			/* End of text section */
+ 
+@@ -48,7 +54,7 @@
+   .data : AT(ADDR(.data) - LOAD_OFFSET) {	/* Data */
+ 	*(.data)
+ 	CONSTRUCTORS
+-	}
++	} :data
+ 
+   . = ALIGN(4096);
+   __nosave_begin = .;
+@@ -184,4 +190,6 @@
+   STABS_DEBUG
+ 
+   DWARF_DEBUG
++
++  NOTES
+ }
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/kernel/vsyscall-note-xen.S linux-2.6.18-xen/arch/i386/kernel/vsyscall-note-xen.S
 --- linux-2.6.18/arch/i386/kernel/vsyscall-note-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/kernel/vsyscall-note-xen.S	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/kernel/vsyscall-note-xen.S	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,32 @@
 +/*
 + * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
@@ -16028,9 +16114,29 @@
 +NOTE_KERNELCAP_BEGIN(1, 1)
 +NOTE_KERNELCAP(1, "nosegneg")  /* Change 1 back to 0 when glibc is fixed! */
 +NOTE_KERNELCAP_END
+diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/lib/delay.c linux-2.6.18-xen/arch/i386/lib/delay.c
+--- linux-2.6.18/arch/i386/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/lib/delay.c	2006-09-04 16:31:00.000000000 +0200
+@@ -61,6 +61,7 @@
+ 	delay_fn = delay_tsc;
+ }
+ 
++#ifndef CONFIG_X86_XEN
+ int read_current_timer(unsigned long *timer_val)
+ {
+ 	if (delay_fn == delay_tsc) {
+@@ -69,7 +70,7 @@
+ 	}
+ 	return -1;
+ }
+-
++#endif
+ void __delay(unsigned long loops)
+ {
+ 	delay_fn(loops);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mach-xen/irqflags.c linux-2.6.18-xen/arch/i386/mach-xen/irqflags.c
 --- linux-2.6.18/arch/i386/mach-xen/irqflags.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mach-xen/irqflags.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mach-xen/irqflags.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,99 @@
 +#include <linux/module.h>
 +#include <linux/smp.h>
@@ -16133,7 +16239,7 @@
 +EXPORT_SYMBOL(__raw_local_irq_save);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mach-xen/Makefile linux-2.6.18-xen/arch/i386/mach-xen/Makefile
 --- linux-2.6.18/arch/i386/mach-xen/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mach-xen/Makefile	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mach-xen/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,5 @@
 +#
 +# Makefile for the linux kernel.
@@ -16142,20 +16248,22 @@
 +obj-y				:= setup.o irqflags.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mach-xen/setup.c linux-2.6.18-xen/arch/i386/mach-xen/setup.c
 --- linux-2.6.18/arch/i386/mach-xen/setup.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mach-xen/setup.c	2006-08-15 13:03:12.000000000 +0200
-@@ -0,0 +1,144 @@
++++ linux-2.6.18-xen/arch/i386/mach-xen/setup.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,154 @@
 +/*
 + *	Machine specific setup for generic
 + */
 +
-+#include <linux/module.h>
 +#include <linux/smp.h>
 +#include <linux/init.h>
 +#include <linux/interrupt.h>
++#include <linux/module.h>
 +#include <asm/acpi.h>
 +#include <asm/arch_hooks.h>
 +#include <asm/e820.h>
 +#include <asm/setup.h>
++#include <asm/fixmap.h>
++
 +#include <xen/interface/callback.h>
 +#include <xen/interface/memory.h>
 +
@@ -16187,16 +16295,12 @@
 +late_initcall(print_ipi_mode);
 +
 +/**
-+ * pre_setup_arch_hook - hook called prior to any setup_arch() execution
++ * machine_specific_memory_setup - Hook for machine specific memory setup.
 + *
 + * Description:
-+ *	generally used to activate any machine specific identification
-+ *	routines that may be needed before setup_arch() runs.  On VISWS
-+ *	this is used to get the board revision and type.
++ *	This is included late in kernel/setup.c so that it can make
++ *	use of all of the static functions.
 + **/
-+void __init pre_setup_arch_hook(void)
-+{
-+}
 +
 +char * __init machine_specific_memory_setup(void)
 +{
@@ -16288,9 +16392,21 @@
 +	while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
 +		machine_to_phys_order++;
 +}
++
++/**
++ * pre_setup_arch_hook - hook called prior to any setup_arch() execution
++ *
++ * Description:
++ *	generally used to activate any machine specific identification
++ *	routines that may be needed before setup_arch() runs.  On VISWS
++ *	this is used to get the board revision and type.
++ **/
++void __init pre_setup_arch_hook(void)
++{
++}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/Makefile linux-2.6.18-xen/arch/i386/Makefile
 --- linux-2.6.18/arch/i386/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/Makefile	2006-05-26 22:00:00.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -48,6 +48,11 @@
  
  CFLAGS += $(cflags-y)
@@ -16349,8 +16465,8 @@
 +CLEAN_FILES += vmlinuz vmlinux-stripped
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/fault-xen.c linux-2.6.18-xen/arch/i386/mm/fault-xen.c
 --- linux-2.6.18/arch/i386/mm/fault-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mm/fault-xen.c	2006-08-15 13:03:12.000000000 +0200
-@@ -0,0 +1,771 @@
++++ linux-2.6.18-xen/arch/i386/mm/fault-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,770 @@
 +/*
 + *  linux/arch/i386/mm/fault.c
 + *
@@ -16416,7 +16532,6 @@
 +}
 +#endif
 +
-+
 +/*
 + * Unlock any spinlocks which will prevent us from getting the
 + * message out 
@@ -16464,9 +16579,6 @@
 +	unsigned seg = regs->xcs & 0xffff;
 +	u32 seg_ar, seg_limit, base, *desc;
 +
-+	/* The standard kernel/user address space limit. */
-+	*eip_limit = (seg & 2) ? USER_DS.seg : KERNEL_DS.seg;
-+
 +	/* Unlikely, but must come before segment checks. */
 +	if (unlikely(regs->eflags & VM_MASK)) {
 +		base = seg << 4;
@@ -16474,6 +16586,9 @@
 +		return base + (eip & 0xffff);
 +	}
 +
++	/* The standard kernel/user address space limit. */
++	*eip_limit = (seg & 2) ? USER_DS.seg : KERNEL_DS.seg;
++
 +	/* By far the most common cases. */
 +	if (likely(seg == __USER_CS || seg == GET_KERNEL_CS()))
 +		return eip;
@@ -17124,7 +17239,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/highmem-xen.c linux-2.6.18-xen/arch/i386/mm/highmem-xen.c
 --- linux-2.6.18/arch/i386/mm/highmem-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mm/highmem-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mm/highmem-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,133 @@
 +#include <linux/highmem.h>
 +#include <linux/module.h>
@@ -17261,7 +17376,7 @@
 +EXPORT_SYMBOL(kmap_atomic_to_page);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/hypervisor.c linux-2.6.18-xen/arch/i386/mm/hypervisor.c
 --- linux-2.6.18/arch/i386/mm/hypervisor.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mm/hypervisor.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mm/hypervisor.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,457 @@
 +/******************************************************************************
 + * mm/hypervisor.c
@@ -17722,8 +17837,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/init-xen.c linux-2.6.18-xen/arch/i386/mm/init-xen.c
 --- linux-2.6.18/arch/i386/mm/init-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mm/init-xen.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,850 @@
++++ linux-2.6.18-xen/arch/i386/mm/init-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,851 @@
 +/*
 + *  linux/arch/i386/mm/init.c
 + *
@@ -18450,7 +18565,7 @@
 + */
 +#ifdef CONFIG_MEMORY_HOTPLUG
 +#ifndef CONFIG_NEED_MULTIPLE_NODES
-+int arch_add_memory(int nid, u64 start, u64 size)
++int arch_add_memory(u64 start, u64 size)
 +{
 +	struct pglist_data *pgdata = &contig_page_data;
 +	struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1;
@@ -18536,6 +18651,7 @@
 +	printk("Write protecting the kernel read-only data: %uk\n",
 +			(__end_rodata - __start_rodata) >> 10);
 +
++
 +	/*
 +	 * change_page_attr() requires a global_flush_tlb() call after it.
 +	 * We do this after the printk so that if something went wrong in the
@@ -18576,8 +18692,8 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/ioremap-xen.c linux-2.6.18-xen/arch/i386/mm/ioremap-xen.c
 --- linux-2.6.18/arch/i386/mm/ioremap-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mm/ioremap-xen.c	2006-09-17 17:44:46.000000000 +0200
-@@ -0,0 +1,478 @@
++++ linux-2.6.18-xen/arch/i386/mm/ioremap-xen.c	2006-09-04 16:31:00.000000000 +0200
+@@ -0,0 +1,439 @@
 +/*
 + * arch/i386/mm/ioremap.c
 + *
@@ -18602,15 +18718,6 @@
 +#define ISA_START_ADDRESS	0x0
 +#define ISA_END_ADDRESS		0x100000
 +
-+#if 0 /* not PAE safe */
-+/* These hacky macros avoid phys->machine translations. */
-+#define __direct_pte(x) ((pte_t) { (x) } )
-+#define __direct_mk_pte(page_nr,pgprot) \
-+  __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
-+#define direct_mk_pte_phys(physpage, pgprot) \
-+  __direct_mk_pte((physpage) >> PAGE_SHIFT, pgprot)
-+#endif
-+
 +static int direct_remap_area_pte_fn(pte_t *pte, 
 +				    struct page *pmd_page,
 +				    unsigned long address, 
@@ -18646,17 +18753,16 @@
 +
 +	for (i = 0; i < size; i += PAGE_SIZE) {
 +		if ((v - u) == (PAGE_SIZE / sizeof(mmu_update_t))) {
-+			/* Fill in the PTE pointers. */
++			/* Flush a full batch after filling in the PTE ptrs. */
 +			rc = apply_to_page_range(mm, start_address, 
 +						 address - start_address,
 +						 direct_remap_area_pte_fn, &w);
 +			if (rc)
 +				goto out;
-+			w = u;
 +			rc = -EFAULT;
 +			if (HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0)
 +				goto out;
-+			v = u;
++			v = w = u;
 +			start_address = address;
 +		}
 +
@@ -18672,7 +18778,7 @@
 +	}
 +
 +	if (v != u) {
-+		/* get the ptep's filled in */
++		/* Final batch. */
 +		rc = apply_to_page_range(mm, start_address,
 +					 address - start_address,
 +					 direct_remap_area_pte_fn, &w);
@@ -18759,32 +18865,6 @@
 +
 +EXPORT_SYMBOL(touch_pte_range);
 +
-+void *vm_map_xen_pages (unsigned long maddr, int vm_size, pgprot_t prot)
-+{
-+	int error;
-+       
-+	struct vm_struct *vma;
-+	vma = get_vm_area (vm_size, VM_IOREMAP);
-+      
-+	if (vma == NULL) {
-+		printk ("ioremap.c,vm_map_xen_pages(): "
-+			"Failed to get VMA area\n");
-+		return NULL;
-+	}
-+
-+	error = direct_kernel_remap_pfn_range((unsigned long) vma->addr,
-+					      maddr >> PAGE_SHIFT, vm_size,
-+					      prot, DOMID_SELF );
-+	if (error == 0) {
-+		return vma->addr;
-+	} else {
-+		printk ("ioremap.c,vm_map_xen_pages(): "
-+			"Failed to map xen shared pages into kernel space\n");
-+		return NULL;
-+	}
-+}
-+EXPORT_SYMBOL(vm_map_xen_pages);
-+
 +/*
 + * Does @address reside within a non-highmem page that is local to this virtual
 + * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
@@ -18862,9 +18942,6 @@
 +	area->phys_addr = phys_addr;
 +	addr = (void __iomem *) area->addr;
 +	flags |= _PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
-+#ifdef __x86_64__
-+	flags |= _PAGE_USER;
-+#endif
 +	if (__direct_remap_pfn_range(&init_mm, (unsigned long)addr,
 +				     phys_addr>>PAGE_SHIFT,
 +				     size, __pgprot(flags), domid)) {
@@ -19058,7 +19135,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/Makefile linux-2.6.18-xen/arch/i386/mm/Makefile
 --- linux-2.6.18/arch/i386/mm/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/mm/Makefile	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mm/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -8,3 +8,11 @@
  obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
  obj-$(CONFIG_HIGHMEM) += highmem.o
@@ -19073,7 +19150,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/pageattr.c linux-2.6.18-xen/arch/i386/mm/pageattr.c
 --- linux-2.6.18/arch/i386/mm/pageattr.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/mm/pageattr.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mm/pageattr.c	2006-09-04 16:31:00.000000000 +0200
 @@ -84,7 +84,7 @@
  	unsigned long flags;
  
@@ -19083,45 +19160,9 @@
  		return;
  
  	spin_lock_irqsave(&pgd_lock, flags);
-diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/pgtable.c linux-2.6.18-xen/arch/i386/mm/pgtable.c
---- linux-2.6.18/arch/i386/mm/pgtable.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/mm/pgtable.c	2006-08-15 13:03:12.000000000 +0200
-@@ -12,6 +12,7 @@
- #include <linux/slab.h>
- #include <linux/pagemap.h>
- #include <linux/spinlock.h>
-+#include <linux/module.h>
- 
- #include <asm/system.h>
- #include <asm/pgtable.h>
-@@ -137,6 +138,10 @@
- 	__flush_tlb_one(vaddr);
- }
- 
-+static int nr_fixmaps = 0;
-+unsigned long __FIXADDR_TOP = 0xfffff000;
-+EXPORT_SYMBOL(__FIXADDR_TOP);
-+
- void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
- {
- 	unsigned long address = __fix_to_virt(idx);
-@@ -146,6 +151,13 @@
- 		return;
- 	}
- 	set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
-+	nr_fixmaps++;
-+}
-+
-+void set_fixaddr_top(unsigned long top)
-+{
-+	BUG_ON(nr_fixmaps > 0);
-+	__FIXADDR_TOP = top - PAGE_SIZE;
- }
- 
- pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/mm/pgtable-xen.c linux-2.6.18-xen/arch/i386/mm/pgtable-xen.c
 --- linux-2.6.18/arch/i386/mm/pgtable-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/mm/pgtable-xen.c	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/mm/pgtable-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,699 @@
 +/*
 + *  linux/arch/i386/mm/pgtable.c
@@ -19824,7 +19865,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/oprofile/Makefile linux-2.6.18-xen/arch/i386/oprofile/Makefile
 --- linux-2.6.18/arch/i386/oprofile/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/oprofile/Makefile	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/oprofile/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -6,7 +6,11 @@
  		oprofilefs.o oprofile_stats.o  \
  		timer_int.o )
@@ -19839,8 +19880,8 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/oprofile/xenoprof.c linux-2.6.18-xen/arch/i386/oprofile/xenoprof.c
 --- linux-2.6.18/arch/i386/oprofile/xenoprof.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/oprofile/xenoprof.c	2006-08-15 13:03:12.000000000 +0200
-@@ -0,0 +1,555 @@
++++ linux-2.6.18-xen/arch/i386/oprofile/xenoprof.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,584 @@
 +/**
 + * @file xenoprof.c
 + *
@@ -19869,16 +19910,17 @@
 +#include <xen/evtchn.h>
 +#include "op_counter.h"
 +
++#include <xen/driver_util.h>
 +#include <xen/interface/xen.h>
 +#include <xen/interface/xenoprof.h>
 +#include <../../../drivers/oprofile/cpu_buffer.h>
 +#include <../../../drivers/oprofile/event_buffer.h>
 +
++#define MAX_XENOPROF_SAMPLES 16
++
 +static int xenoprof_start(void);
 +static void xenoprof_stop(void);
 +
-+void * vm_map_xen_pages(unsigned long maddr, int vm_size, pgprot_t prot);
-+
 +static int xenoprof_enabled = 0;
 +static unsigned int num_events = 0;
 +static int is_primary = 0;
@@ -19887,7 +19929,7 @@
 +/* sample buffers shared with Xen */
 +xenoprof_buf_t * xenoprof_buf[MAX_VIRT_CPUS];
 +/* Shared buffer area */
-+char * shared_buffer;
++char * shared_buffer = NULL;
 +/* Number of buffers in shared area (one per VCPU) */
 +int nbuf;
 +/* Mappings of VIRQ_XENOPROF to irq number (per cpu) */
@@ -20044,7 +20086,7 @@
 +{
 +	int i;
 +
-+	for_each_online_cpu(i) {
++	for_each_possible_cpu(i) {
 +		if (ovf_irq[i] >= 0) {
 +			unbind_from_irqhandler(ovf_irq[i], NULL);
 +			ovf_irq[i] = -1;
@@ -20057,7 +20099,7 @@
 +{
 +	int i, result;
 +
-+	for_each_online_cpu(i) {
++	for_each_possible_cpu(i) {
 +		result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
 +						 i,
 +						 xenoprof_ovf_interrupt,
@@ -20077,13 +20119,57 @@
 +}
 +
 +
++static int map_xenoprof_buffer(int max_samples)
++{
++	struct xenoprof_get_buffer get_buffer;
++	struct xenoprof_buf *buf;
++	int npages, ret, i;
++	struct vm_struct *area;
++
++	if ( shared_buffer )
++		return 0;
++
++	get_buffer.max_samples = max_samples;
++
++	if ( (ret = HYPERVISOR_xenoprof_op(XENOPROF_get_buffer, &get_buffer)) )
++		return ret;
++
++	nbuf = get_buffer.nbuf;
++	npages = (get_buffer.bufsize * nbuf - 1) / PAGE_SIZE + 1;
++
++	area = alloc_vm_area(npages * PAGE_SIZE);
++	if (area == NULL)
++		return -ENOMEM;
++
++	if ( (ret = direct_kernel_remap_pfn_range(
++		      (unsigned long)area->addr,
++		      get_buffer.buf_maddr >> PAGE_SHIFT,
++		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE), DOMID_SELF)) ) {
++		vunmap(area->addr);
++		return ret;
++	}
++
++	shared_buffer = area->addr;
++	for (i=0; i< nbuf; i++) {
++		buf = (struct xenoprof_buf*) 
++			&shared_buffer[i * get_buffer.bufsize];
++		BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS);
++		xenoprof_buf[buf->vcpu_id] = buf;
++	}
++
++	return 0;
++}
++
++
 +static int xenoprof_setup(void)
 +{
 +	int ret;
 +	int i;
 +
-+	ret = bind_virq();
-+	if (ret)
++	if ( (ret = map_xenoprof_buffer(MAX_XENOPROF_SAMPLES)) )
++		return ret;
++
++	if ( (ret = bind_virq()) )
 +		return ret;
 +
 +	if (is_primary) {
@@ -20216,9 +20302,9 @@
 +{
 +	int ret;
 +	int i, j;
-+	int vm_size;
 +	int npages;
 +	struct xenoprof_buf *buf;
++	struct vm_struct *area;
 +	pgprot_t prot = __pgprot(_KERNPG_TABLE);
 +
 +	if (!is_primary)
@@ -20234,20 +20320,30 @@
 +	for (i = 0; i < pdoms; i++) {
 +		passive_domains[i].domain_id = p_domains[i];
 +		passive_domains[i].max_samples = 2048;
-+		ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive, &passive_domains[i]);
++		ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive,
++					     &passive_domains[i]);
 +		if (ret)
-+			return ret;
++			goto out;
 +
 +		npages = (passive_domains[i].bufsize * passive_domains[i].nbuf - 1) / PAGE_SIZE + 1;
-+		vm_size = npages * PAGE_SIZE;
 +
-+		p_shared_buffer[i] = (char *)vm_map_xen_pages(passive_domains[i].buf_maddr,
-+							      vm_size, prot);
-+		if (!p_shared_buffer[i]) {
++		area = alloc_vm_area(npages * PAGE_SIZE);
++		if (area == NULL) {
 +			ret = -ENOMEM;
 +			goto out;
 +		}
 +
++		ret = direct_kernel_remap_pfn_range(
++			(unsigned long)area->addr,
++			passive_domains[i].buf_maddr >> PAGE_SHIFT,
++			npages * PAGE_SIZE, prot, DOMID_SELF);
++		if (ret) {
++			vunmap(area->addr);
++			goto out;
++		}
++
++		p_shared_buffer[i] = area->addr;
++
 +		for (j = 0; j < passive_domains[i].nbuf; j++) {
 +			buf = (struct xenoprof_buf *)
 +				&p_shared_buffer[i][j * passive_domains[i].bufsize];
@@ -20316,44 +20412,19 @@
 +int __init oprofile_arch_init(struct oprofile_operations * ops)
 +{
 +	struct xenoprof_init init;
-+	struct xenoprof_buf * buf;
-+	int vm_size;
-+	int npages;
-+	int ret;
-+	int i;
++	int ret, i;
 +
-+	init.max_samples = 16;
 +	ret = HYPERVISOR_xenoprof_op(XENOPROF_init, &init);
 +
 +	if (!ret) {
-+		pgprot_t prot = __pgprot(_KERNPG_TABLE);
-+
 +		num_events = init.num_events;
 +		is_primary = init.is_primary;
-+		nbuf = init.nbuf;
 +
 +		/* just in case - make sure we do not overflow event list 
-+                   (i.e. counter_config list) */
++		   (i.e. counter_config list) */
 +		if (num_events > OP_MAX_COUNTER)
 +			num_events = OP_MAX_COUNTER;
 +
-+		npages = (init.bufsize * nbuf - 1) / PAGE_SIZE + 1;
-+		vm_size = npages * PAGE_SIZE;
-+
-+		shared_buffer = (char *)vm_map_xen_pages(init.buf_maddr,
-+							 vm_size, prot);
-+		if (!shared_buffer) {
-+			ret = -ENOMEM;
-+			goto out;
-+		}
-+
-+		for (i=0; i< nbuf; i++) {
-+			buf = (struct xenoprof_buf*) 
-+				&shared_buffer[i * init.bufsize];
-+			BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS);
-+			xenoprof_buf[buf->vcpu_id] = buf;
-+		}
-+
 +		/*  cpu_type is detected by Xen */
 +		cpu_type[XENOPROF_CPU_TYPE_SIZE-1] = 0;
 +		strncpy(cpu_type, init.cpu_type, XENOPROF_CPU_TYPE_SIZE - 1);
@@ -20368,7 +20439,6 @@
 +
 +		active_defined = 0;
 +	}
-+ out:
 +	printk(KERN_INFO "oprofile_arch_init: ret %d, events %d, "
 +	       "is_primary %d\n", ret, num_events, is_primary);
 +	return ret;
@@ -20398,7 +20468,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/pci/irq-xen.c linux-2.6.18-xen/arch/i386/pci/irq-xen.c
 --- linux-2.6.18/arch/i386/pci/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/pci/irq-xen.c	2006-09-17 17:44:46.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/pci/irq-xen.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,1206 @@
 +/*
 + *	Low-Level PCI Support for PC -- Routing of Interrupts
@@ -21608,7 +21678,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/pci/Makefile linux-2.6.18-xen/arch/i386/pci/Makefile
 --- linux-2.6.18/arch/i386/pci/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/pci/Makefile	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/pci/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -4,6 +4,10 @@
  obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig.o direct.o
  obj-$(CONFIG_PCI_DIRECT)	+= direct.o
@@ -21631,7 +21701,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/pci/pcifront.c linux-2.6.18-xen/arch/i386/pci/pcifront.c
 --- linux-2.6.18/arch/i386/pci/pcifront.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/i386/pci/pcifront.c	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/pci/pcifront.c	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,55 @@
 +/*
 + * PCI Frontend Stub - puts some "dummy" functions in to the Linux x86 PCI core
@@ -21690,7 +21760,7 @@
 +arch_initcall(pcifront_x86_stub_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/i386/power/Makefile linux-2.6.18-xen/arch/i386/power/Makefile
 --- linux-2.6.18/arch/i386/power/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/i386/power/Makefile	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/i386/power/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -1,2 +1,4 @@
 -obj-$(CONFIG_PM)		+= cpu.o
 +obj-$(CONFIG_PM_LEGACY)		+= cpu.o
@@ -21699,13 +21769,22 @@
  obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/dig/setup.c linux-2.6.18-xen/arch/ia64/dig/setup.c
 --- linux-2.6.18/arch/ia64/dig/setup.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/dig/setup.c	2006-09-17 17:44:47.000000000 +0200
-@@ -67,4 +67,38 @@
++++ linux-2.6.18-xen/arch/ia64/dig/setup.c	2006-09-21 01:33:31.000000000 +0200
+@@ -24,6 +24,8 @@
+ #include <asm/machvec.h>
+ #include <asm/system.h>
+ 
++#include <xen/xencons.h>
++
+ void __init
+ dig_setup (char **cmdline_p)
+ {
+@@ -67,4 +69,19 @@
  	screen_info.orig_video_mode = 3;	/* XXX fake */
  	screen_info.orig_video_isVGA = 1;	/* XXX fake */
  	screen_info.orig_video_ega_bx = 3;	/* XXX fake */
 +#ifdef CONFIG_XEN
-+	if (!is_running_on_xen())
++	if (!is_running_on_xen() || !is_initial_xendomain())
 +		return;
 +
 +	if (xen_start_info->console.dom0.info_size >=
@@ -21714,34 +21793,15 @@
 +		        (struct dom0_vga_console_info *)(
 +		                (char *)xen_start_info +
 +		                xen_start_info->console.dom0.info_off);
-+		screen_info.orig_video_mode = info->txt_mode;
-+		screen_info.orig_video_isVGA = info->video_type;
-+		screen_info.orig_video_lines = info->video_height;
-+		screen_info.orig_video_cols = info->video_width;
-+		screen_info.orig_video_points = info->txt_points;
-+		screen_info.lfb_width = info->video_width;
-+		screen_info.lfb_height = info->video_height;
-+		screen_info.lfb_depth = info->lfb_depth;
-+		screen_info.lfb_base = info->lfb_base;
-+		screen_info.lfb_size = info->lfb_size;
-+		screen_info.lfb_linelength = info->lfb_linelen;
-+		screen_info.red_size = info->red_size;
-+		screen_info.red_pos = info->red_pos;
-+		screen_info.green_size = info->green_size;
-+		screen_info.green_pos = info->green_pos;
-+		screen_info.blue_size = info->blue_size;
-+		screen_info.blue_pos = info->blue_pos;
-+		screen_info.rsvd_size = info->rsvd_size;
-+		screen_info.rsvd_pos = info->rsvd_pos;
++		dom0_init_screen_info(info);
 +	}
-+	screen_info.orig_y = screen_info.orig_video_lines - 1;
 +	xen_start_info->console.domU.mfn = 0;
 +	xen_start_info->console.domU.evtchn = 0;
 +#endif
  }
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/hp/sim/Makefile linux-2.6.18-xen/arch/ia64/hp/sim/Makefile
 --- linux-2.6.18/arch/ia64/hp/sim/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/hp/sim/Makefile	2006-05-26 22:00:01.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/hp/sim/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -14,3 +14,5 @@
  obj-$(CONFIG_HP_SIMSERIAL) += simserial.o
  obj-$(CONFIG_HP_SIMSERIAL_CONSOLE) += hpsim_console.o
@@ -21750,7 +21810,7 @@
 +obj-$(CONFIG_XEN) += hpsim_console.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/Kconfig linux-2.6.18-xen/arch/ia64/Kconfig
 --- linux-2.6.18/arch/ia64/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/Kconfig	2006-09-20 13:58:38.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/Kconfig	2006-09-21 01:33:31.000000000 +0200
 @@ -58,6 +58,20 @@
  	bool
  	default y
@@ -21794,7 +21854,7 @@
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
-@@ -528,3 +557,40 @@
+@@ -528,3 +557,34 @@
  source "security/Kconfig"
  
  source "crypto/Kconfig"
@@ -21818,12 +21878,6 @@
 +config XEN_SKBUFF
 +	default y
 +
-+config XEN_NETDEV_BACKEND
-+	default y
-+
-+config XEN_NETDEV_FRONTEND
-+	default y
-+
 +config XEN_DEVMEM
 +	default n
 +
@@ -21837,7 +21891,7 @@
 +source "drivers/xen/Kconfig"
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/asm-offsets.c linux-2.6.18-xen/arch/ia64/kernel/asm-offsets.c
 --- linux-2.6.18/arch/ia64/kernel/asm-offsets.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/asm-offsets.c	2006-08-15 13:03:13.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/asm-offsets.c	2006-09-04 16:31:00.000000000 +0200
 @@ -268,4 +268,29 @@
  	DEFINE(IA64_TIME_SOURCE_MMIO64, TIME_SOURCE_MMIO64);
  	DEFINE(IA64_TIME_SOURCE_MMIO32, TIME_SOURCE_MMIO32);
@@ -21870,7 +21924,7 @@
  }
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/entry.S linux-2.6.18-xen/arch/ia64/kernel/entry.S
 --- linux-2.6.18/arch/ia64/kernel/entry.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/entry.S	2006-09-20 13:58:38.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/entry.S	2006-09-21 01:33:31.000000000 +0200
 @@ -180,7 +180,7 @@
   *	called.  The code starting at .map relies on this.  The rest of the code
   *	doesn't care about the interrupt masking status.
@@ -21992,7 +22046,7 @@
  	br.many b7
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/gate.lds.S linux-2.6.18-xen/arch/ia64/kernel/gate.lds.S
 --- linux-2.6.18/arch/ia64/kernel/gate.lds.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/gate.lds.S	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/gate.lds.S	2006-09-04 16:31:00.000000000 +0200
 @@ -43,6 +43,28 @@
  				    __start_gate_brl_fsys_bubble_down_patchlist = .;
  				    *(.data.patch.brl_fsys_bubble_down)
@@ -22024,16 +22078,15 @@
    .IA_64.unwind			: { *(.IA_64.unwind*) }			:readable :unwind
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/gate.S linux-2.6.18-xen/arch/ia64/kernel/gate.S
 --- linux-2.6.18/arch/ia64/kernel/gate.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/gate.S	2006-09-17 17:44:47.000000000 +0200
-@@ -6,6 +6,7 @@
++++ linux-2.6.18-xen/arch/ia64/kernel/gate.S	2006-09-04 16:31:00.000000000 +0200
+@@ -6,13 +6,15 @@
   * 	David Mosberger-Tang <davidm at hpl.hp.com>
   */
  
-+#include <linux/config.h>
- 
+-
  #include <asm/asmmacro.h>
  #include <asm/errno.h>
-@@ -13,6 +14,9 @@
+ #include <asm/asm-offsets.h>
  #include <asm/sigcontext.h>
  #include <asm/system.h>
  #include <asm/unistd.h>
@@ -22043,7 +22096,7 @@
  
  /*
   * We can't easily refer to symbols inside the kernel.  To avoid full runtime relocation,
-@@ -32,6 +36,52 @@
+@@ -32,6 +34,52 @@
  [1:](pr)brl.cond.sptk 0;				\
  	.xdata4 ".data.patch.brl_fsys_bubble_down", 1b-.
  
@@ -22096,7 +22149,7 @@
  GLOBAL_ENTRY(__kernel_syscall_via_break)
  	.prologue
  	.altrp b6
-@@ -76,7 +126,39 @@
+@@ -76,7 +124,39 @@
  	epc					// B	causes split-issue
  }
  	;;
@@ -22136,7 +22189,7 @@
  	LOAD_FSYSCALL_TABLE(r14)		// X
  	;;
  	mov r16=IA64_KR(CURRENT)		// M2 (12 cyc)
-@@ -84,7 +166,14 @@
+@@ -84,7 +164,14 @@
  	mov r19=NR_syscalls-1			// A
  	;;
  	lfetch [r18]				// M0|1
@@ -22151,7 +22204,7 @@
  	// If r17 is a NaT, p6 will be zero
  	cmp.geu p6,p7=r19,r17			// A    (sysnr > 0 && sysnr < 1024+NR_syscalls)?
  	;;
-@@ -98,9 +187,21 @@
+@@ -98,9 +185,21 @@
  	;;
  	nop.m 0
  (p6)	tbit.z.unc p8,p0=r18,0			// I0 (dual-issues with "mov b7=r18"!)
@@ -22173,7 +22226,7 @@
  (p6)	mov b7=r18				// I0
  (p8)	br.dptk.many b7				// B
  
-@@ -121,9 +222,21 @@
+@@ -121,9 +220,21 @@
  #else
  	BRL_COND_FSYS_BUBBLE_DOWN(p6)
  #endif
@@ -22197,7 +22250,7 @@
  END(__kernel_syscall_via_epc)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/head.S linux-2.6.18-xen/arch/ia64/kernel/head.S
 --- linux-2.6.18/arch/ia64/kernel/head.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/head.S	2006-09-20 13:58:38.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/head.S	2006-09-21 01:33:31.000000000 +0200
 @@ -367,6 +367,12 @@
  	;;
  (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
@@ -22213,7 +22266,7 @@
  .ret0:
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/iosapic.c linux-2.6.18-xen/arch/ia64/kernel/iosapic.c
 --- linux-2.6.18/arch/ia64/kernel/iosapic.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/iosapic.c	2006-08-15 13:03:13.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/iosapic.c	2006-09-04 16:31:00.000000000 +0200
 @@ -159,6 +159,65 @@
  static int iosapic_kmalloc_ok;
  static LIST_HEAD(free_rte_list);
@@ -22302,7 +22355,7 @@
  		 * Disable the compatibility mode interrupts (8259 style),
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/irq_ia64.c linux-2.6.18-xen/arch/ia64/kernel/irq_ia64.c
 --- linux-2.6.18/arch/ia64/kernel/irq_ia64.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/irq_ia64.c	2006-08-15 13:03:13.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/irq_ia64.c	2006-09-04 16:31:00.000000000 +0200
 @@ -30,6 +30,9 @@
  #include <linux/smp_lock.h>
  #include <linux/threads.h>
@@ -22327,7 +22380,7 @@
   again:
  	pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS);
  	vector = IA64_FIRST_DEVICE_VECTOR + pos;
-@@ -240,12 +250,209 @@
+@@ -240,14 +250,215 @@
  };
  #endif
  
@@ -22536,8 +22589,14 @@
 +
  	for (irq = 0; irq < NR_IRQS; ++irq)
  		if (irq_to_vector(irq) == vec) {
++#ifdef CONFIG_XEN
++			if (is_running_on_xen())
++				return xen_register_percpu_irq(vec, action, 1);
++#endif
  			desc = irq_desc + irq;
-@@ -259,6 +466,21 @@
+ 			desc->status |= IRQ_PER_CPU;
+ 			desc->chip = &irq_type_ia64_lsapic;
+@@ -259,6 +470,21 @@
  void __init
  init_IRQ (void)
  {
@@ -22559,7 +22618,7 @@
  	register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
  #ifdef CONFIG_SMP
  	register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
-@@ -276,6 +498,39 @@
+@@ -276,6 +502,39 @@
  	unsigned long ipi_data;
  	unsigned long phys_cpu_id;
  
@@ -22601,7 +22660,7 @@
  #else
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/pal.S linux-2.6.18-xen/arch/ia64/kernel/pal.S
 --- linux-2.6.18/arch/ia64/kernel/pal.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/pal.S	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/pal.S	2006-09-04 16:31:00.000000000 +0200
 @@ -16,6 +16,7 @@
  #include <asm/processor.h>
  
@@ -22630,7 +22689,7 @@
   * Make a PAL call using the stacked registers calling convention.
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/patch.c linux-2.6.18-xen/arch/ia64/kernel/patch.c
 --- linux-2.6.18/arch/ia64/kernel/patch.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/patch.c	2006-08-15 13:03:13.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/patch.c	2006-09-04 16:31:00.000000000 +0200
 @@ -184,6 +184,73 @@
  	ia64_srlz_i();
  }
@@ -22639,7 +22698,7 @@
 +extern char __start_gate_running_on_xen_patchlist[];
 +extern char __end_gate_running_on_xen_patchlist[];
 +
-+void
++void __init
 +patch_running_on_xen(unsigned long start, unsigned long end)
 +{
 +	extern int running_on_xen;
@@ -22656,7 +22715,7 @@
 +	ia64_srlz_i();
 +}
 +
-+static void
++static void __init
 +patch_brl_symaddr(unsigned long start, unsigned long end,
 +                  unsigned long symaddr)
 +{
@@ -22684,7 +22743,7 @@
 +	                  (unsigned long)__end_gate_brl_##name##_patchlist,   \
 +	                  (unsigned long)name)
 +
-+static void
++static void __init
 +patch_brl_in_vdso(void)
 +{
 +	EXTERN_PATCHLIST(xen_rsm_be_i);
@@ -22718,7 +22777,7 @@
  }
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/kernel/setup.c linux-2.6.18-xen/arch/ia64/kernel/setup.c
 --- linux-2.6.18/arch/ia64/kernel/setup.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/kernel/setup.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/kernel/setup.c	2006-09-04 16:31:00.000000000 +0200
 @@ -60,6 +60,10 @@
  #include <asm/system.h>
  #include <asm/unistd.h>
@@ -22730,7 +22789,7 @@
  
  #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
  # error "struct cpuinfo_ia64 too big!"
-@@ -70,6 +74,20 @@
+@@ -70,6 +74,22 @@
  EXPORT_SYMBOL(__per_cpu_offset);
  #endif
  
@@ -22744,14 +22803,88 @@
 +}
 +
 +static struct notifier_block xen_panic_block = {
-+	xen_panic_event, NULL, 0 /* try to go last */
++	.notifier_call	= xen_panic_event,
++	.next		= NULL,
++	.priority	= 0	/* try to go last */
 +};
 +#endif
 +
  extern void ia64_setup_printk_clock(void);
  
  DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
-@@ -242,6 +260,14 @@
+@@ -176,15 +196,33 @@
+ 	return 0;
+ }
+ 
++static int __init
++rsvd_region_cmp(struct rsvd_region *lhs, struct rsvd_region *rhs)
++{
++	if (lhs->start > rhs->start)
++		return 1;
++	if (lhs->start < rhs->start)
++		return -1;
++
++	if (lhs->end > rhs->end)
++		return 1;
++	if (lhs->end < rhs->end)
++		return -1;
++
++	return 0;
++}
++
+ static void __init
+ sort_regions (struct rsvd_region *rsvd_region, int max)
+ {
++	int num = max;
+ 	int j;
+ 
+ 	/* simple bubble sorting */
+ 	while (max--) {
+ 		for (j = 0; j < max; ++j) {
+-			if (rsvd_region[j].start > rsvd_region[j+1].start) {
++			if (rsvd_region_cmp(&rsvd_region[j],
++					    &rsvd_region[j + 1]) > 0) {
+ 				struct rsvd_region tmp;
+ 				tmp = rsvd_region[j];
+ 				rsvd_region[j] = rsvd_region[j + 1];
+@@ -192,6 +230,36 @@
+ 			}
+ 		}
+ 	}
++
++	for (j = 0; j < num - 1; j++) {
++		int k;
++		unsigned long start = rsvd_region[j].start;
++		unsigned long end = rsvd_region[j].end;
++		int collapsed;
++		
++		for (k = j + 1; k < num; k++) {
++			BUG_ON(start > rsvd_region[k].start);
++			if (end < rsvd_region[k].start) {
++				k--;
++				break;
++			}
++			end = max(end, rsvd_region[k].end);
++		}
++		if (k == num)
++			k--;
++		rsvd_region[j].end = end;
++		collapsed = k - j;
++		num -= collapsed;
++		for (k = j + 1; k < num; k++) {
++			rsvd_region[k] = rsvd_region[k + collapsed];
++		}
++	}
++
++	num_rsvd_regions = num;
++	for (j = 0; j < num; j++) {
++		printk("rsvd_region[%d]: [0x%016lx, 0x%06lx)\n",
++		       j, rsvd_region[j].start, rsvd_region[j].end);
++	}
+ }
+ 
+ /*
+@@ -242,6 +310,14 @@
  	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
  	n++;
  
@@ -22766,7 +22899,7 @@
  #ifdef CONFIG_BLK_DEV_INITRD
  	if (ia64_boot_param->initrd_start) {
  		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
-@@ -333,6 +359,16 @@
+@@ -333,6 +409,16 @@
  {
  	int earlycons = 0;
  
@@ -22783,7 +22916,7 @@
  #ifdef CONFIG_SERIAL_SGI_L1_CONSOLE
  	{
  		extern int sn_serial_console_early_setup(void);
-@@ -402,6 +438,14 @@
+@@ -402,6 +488,14 @@
  {
  	unw_init();
  
@@ -22791,14 +22924,14 @@
 +	if (is_running_on_xen()) {
 +		setup_xen_features();
 +		/* Register a call for panic conditions. */
-+		notifier_chain_register(&panic_notifier_list, &xen_panic_block);
++		atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
 +	}
 +#endif
 +
  	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
  
  	*cmdline_p = __va(ia64_boot_param->command_line);
-@@ -478,6 +522,23 @@
+@@ -478,6 +572,23 @@
  			conswitchp = &vga_con;
  # endif
  	}
@@ -22822,15 +22955,17 @@
  #endif
  
  	/* enable IA-64 Machine Check Abort Handling unless disabled */
-@@ -486,6 +547,7 @@
+@@ -486,6 +597,9 @@
  
  	platform_setup(cmdline_p);
  	paging_init();
++#ifdef CONFIG_XEN
 +	contiguous_bitmap_init(max_pfn);
++#endif
  }
  
  /*
-@@ -870,6 +932,15 @@
+@@ -870,6 +984,15 @@
  	/* size of physical stacked register partition plus 8 bytes: */
  	__get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
  	platform_cpu_init();
@@ -22848,7 +22983,7 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/Makefile linux-2.6.18-xen/arch/ia64/Makefile
 --- linux-2.6.18/arch/ia64/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/Makefile	2006-08-15 13:03:12.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -45,6 +45,12 @@
  endif
  
@@ -22891,24 +23026,26 @@
    echo '* compressed	- Build compressed kernel image'
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/mm/ioremap.c linux-2.6.18-xen/arch/ia64/mm/ioremap.c
 --- linux-2.6.18/arch/ia64/mm/ioremap.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/ia64/mm/ioremap.c	2006-09-17 17:44:47.000000000 +0200
-@@ -16,6 +16,7 @@
++++ linux-2.6.18-xen/arch/ia64/mm/ioremap.c	2006-09-04 16:31:00.000000000 +0200
+@@ -16,6 +16,9 @@
  static inline void __iomem *
  __ioremap (unsigned long offset, unsigned long size)
  {
++#ifdef CONFIG_XEN
 +	offset = HYPERVISOR_ioremap(offset, size);
++#endif
  	return (void __iomem *) (__IA64_UNCACHED_OFFSET | offset);
  }
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/drivers/README linux-2.6.18-xen/arch/ia64/xen/drivers/README
 --- linux-2.6.18/arch/ia64/xen/drivers/README	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/drivers/README	2006-05-26 22:00:02.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/drivers/README	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,2 @@
 +This is a temporary location for source/Makefiles that need to be
 +patched/reworked in drivers/xen to work with xenlinux/ia64.
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/hypercall.S linux-2.6.18-xen/arch/ia64/xen/hypercall.S
 --- linux-2.6.18/arch/ia64/xen/hypercall.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/hypercall.S	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/hypercall.S	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,413 @@
 +/*
 + * Support routines for Xen hypercalls
@@ -23325,8 +23462,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/hypervisor.c linux-2.6.18-xen/arch/ia64/xen/hypervisor.c
 --- linux-2.6.18/arch/ia64/xen/hypervisor.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/hypervisor.c	2006-09-17 17:44:47.000000000 +0200
-@@ -0,0 +1,810 @@
++++ linux-2.6.18-xen/arch/ia64/xen/hypervisor.c	2006-09-04 16:31:01.000000000 +0200
+@@ -0,0 +1,833 @@
 +/******************************************************************************
 + * include/asm-ia64/shadow.h
 + *
@@ -23700,6 +23837,8 @@
 +int
 +HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
 +{
++	__u64 va1, va2, pa1, pa2;
++
 +	if (cmd == GNTTABOP_map_grant_ref) {
 +		unsigned int i;
 +		for (i = 0; i < count; i++) {
@@ -23707,8 +23846,29 @@
 +				(struct gnttab_map_grant_ref*)uop + i);
 +		}
 +	}
-+
-+	return ____HYPERVISOR_grant_table_op(cmd, uop, count);
++	va1 = (__u64)uop & PAGE_MASK;
++	pa1 = pa2 = 0;
++	if ((REGION_NUMBER(va1) == 5) &&
++	    ((va1 - KERNEL_START) >= KERNEL_TR_PAGE_SIZE)) {
++		pa1 = ia64_tpa(va1);
++		if (cmd <= GNTTABOP_transfer) {
++			static uint32_t uop_size[GNTTABOP_transfer + 1] = {
++				sizeof(struct gnttab_map_grant_ref),
++				sizeof(struct gnttab_unmap_grant_ref),
++				sizeof(struct gnttab_setup_table),
++				sizeof(struct gnttab_dump_table),
++				sizeof(struct gnttab_transfer),
++			};
++			va2 = (__u64)uop + (uop_size[cmd] * count) - 1;
++			va2 &= PAGE_MASK;
++			if (va1 != va2) {
++				/* maximum size of uop is 2pages */
++				BUG_ON(va2 > va1 + PAGE_SIZE);
++				pa2 = ia64_tpa(va2);
++			}
++		}
++	}
++	return ____HYPERVISOR_grant_table_op(cmd, uop, count, pa1, pa2);
 +}
 +EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
 +
@@ -24139,7 +24299,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/Makefile linux-2.6.18-xen/arch/ia64/xen/Makefile
 --- linux-2.6.18/arch/ia64/xen/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/Makefile	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/Makefile	2006-09-04 16:31:00.000000000 +0200
 @@ -0,0 +1,8 @@
 +#
 +# Makefile for Xen components
@@ -24151,7 +24311,7 @@
 +pci-dma-xen-y := ../../i386/kernel/pci-dma-xen.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/util.c linux-2.6.18-xen/arch/ia64/xen/util.c
 --- linux-2.6.18/arch/ia64/xen/util.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/util.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/util.c	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,115 @@
 +/******************************************************************************
 + * arch/ia64/xen/util.c
@@ -24270,7 +24430,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/xenentry.S linux-2.6.18-xen/arch/ia64/xen/xenentry.S
 --- linux-2.6.18/arch/ia64/xen/xenentry.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/xenentry.S	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/xenentry.S	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,867 @@
 +/*
 + * ia64/xen/entry.S
@@ -25141,7 +25301,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/xenhpski.c linux-2.6.18-xen/arch/ia64/xen/xenhpski.c
 --- linux-2.6.18/arch/ia64/xen/xenhpski.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/xenhpski.c	2006-05-26 22:00:02.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/xenhpski.c	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,19 @@
 +
 +extern unsigned long xen_get_cpuid(int);
@@ -25164,7 +25324,7 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/xenivt.S linux-2.6.18-xen/arch/ia64/xen/xenivt.S
 --- linux-2.6.18/arch/ia64/xen/xenivt.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/xenivt.S	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/xenivt.S	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,2169 @@
 +/*
 + * arch/ia64/xen/ivt.S
@@ -27337,7 +27497,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/xenminstate.h linux-2.6.18-xen/arch/ia64/xen/xenminstate.h
 --- linux-2.6.18/arch/ia64/xen/xenminstate.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/xenminstate.h	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/xenminstate.h	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,368 @@
 +
 +#include <asm/cache.h>
@@ -27709,7 +27869,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/xenpal.S linux-2.6.18-xen/arch/ia64/xen/xenpal.S
 --- linux-2.6.18/arch/ia64/xen/xenpal.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/xenpal.S	2006-08-15 13:03:13.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/xenpal.S	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,76 @@
 +/*
 + * ia64/xen/xenpal.S
@@ -27789,7 +27949,7 @@
 +END(xen_pal_call_static)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/ia64/xen/xensetup.S linux-2.6.18-xen/arch/ia64/xen/xensetup.S
 --- linux-2.6.18/arch/ia64/xen/xensetup.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/ia64/xen/xensetup.S	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/ia64/xen/xensetup.S	2006-09-04 16:31:01.000000000 +0200
 @@ -0,0 +1,54 @@
 +/*
 + * Support routines for Xen
@@ -27847,7 +28007,7 @@
 +END(HYPERVISOR_suspend)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/um/kernel/physmem.c linux-2.6.18-xen/arch/um/kernel/physmem.c
 --- linux-2.6.18/arch/um/kernel/physmem.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/um/kernel/physmem.c	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/um/kernel/physmem.c	2006-09-04 16:31:02.000000000 +0200
 @@ -226,7 +226,7 @@
  EXPORT_SYMBOL(physmem_remove_mapping);
  EXPORT_SYMBOL(physmem_subst_mapping);
@@ -27868,7 +28028,7 @@
  int is_remapped(void *virt)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/ia32/ia32entry-xen.S linux-2.6.18-xen/arch/x86_64/ia32/ia32entry-xen.S
 --- linux-2.6.18/arch/x86_64/ia32/ia32entry-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/ia32/ia32entry-xen.S	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/ia32/ia32entry-xen.S	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,743 @@
 +/*
 + * Compatibility mode system call entry point for x86-64. 
@@ -27965,11 +28125,11 @@
 +	__swapgs 
 +	movq	%gs:pda_kernelstack, %rsp
 +	addq	$(PDA_STACKOFFSET),%rsp
-+	XEN_UNBLOCK_EVENTS(%r11)	
 +	/*
 +	 * No need to follow this irqs on/off section: the syscall
 +	 * disabled irqs, here we enable it straight after entry:
 +	 */
++	XEN_UNBLOCK_EVENTS(%r11)	
 +	__sti
 + 	movl	%ebp,%ebp		/* zero extension */
 +	pushq	$__USER32_DS
@@ -28085,11 +28245,11 @@
 +	movl	%esp,%r8d
 +	CFI_REGISTER	rsp,r8
 +	movq	%gs:pda_kernelstack,%rsp
-+	XEN_UNBLOCK_EVENTS(%r11)	
 +	/*
 +	 * No need to follow this irqs on/off section: the syscall
 +	 * disabled irqs and here we enable it straight after entry:
 +	 */
++	XEN_UNBLOCK_EVENTS(%r11)	
 +	__sti
 +	SAVE_ARGS 8,1,1
 +	movl 	%eax,%eax	/* zero extension */
@@ -28194,11 +28354,11 @@
 +	/*CFI_REL_OFFSET	cs,CS-RIP*/
 +	CFI_REL_OFFSET	rip,RIP-RIP
 +	__swapgs
-+	XEN_UNBLOCK_EVENTS(%r11)
 +	/*
 +	 * No need to follow this irqs on/off section: the syscall
 +	 * disabled irqs and here we enable it straight after entry:
 +	 */
++	XEN_UNBLOCK_EVENTS(%r11)
 +	__sti
 +	movq (%rsp),%rcx
 +	movq 8(%rsp),%r11
@@ -28615,7 +28775,7 @@
 +ia32_syscall_end:		
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/ia32/Makefile linux-2.6.18-xen/arch/x86_64/ia32/Makefile
 --- linux-2.6.18/arch/x86_64/ia32/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/ia32/Makefile	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/ia32/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -27,9 +27,25 @@
  			   -Wl,-soname=linux-gate.so.1 -o $@ \
  			   -Wl,-T,$(filter-out FORCE,$^)
@@ -28646,7 +28806,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/ia32/syscall32_syscall-xen.S linux-2.6.18-xen/arch/x86_64/ia32/syscall32_syscall-xen.S
 --- linux-2.6.18/arch/x86_64/ia32/syscall32_syscall-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/ia32/syscall32_syscall-xen.S	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/ia32/syscall32_syscall-xen.S	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,28 @@
 +/* 32bit VDSOs mapped into user space. */
 +
@@ -28678,7 +28838,7 @@
 +syscall32_sysenter_end:
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/ia32/syscall32-xen.c linux-2.6.18-xen/arch/x86_64/ia32/syscall32-xen.c
 --- linux-2.6.18/arch/x86_64/ia32/syscall32-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/ia32/syscall32-xen.c	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/ia32/syscall32-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,128 @@
 +/* Copyright 2002,2003 Andi Kleen, SuSE Labs */
 +
@@ -28810,7 +28970,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/ia32/vsyscall-int80.S linux-2.6.18-xen/arch/x86_64/ia32/vsyscall-int80.S
 --- linux-2.6.18/arch/x86_64/ia32/vsyscall-int80.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/ia32/vsyscall-int80.S	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/ia32/vsyscall-int80.S	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,58 @@
 +/*
 + * Code for the vsyscall page.  This version uses the old int $0x80 method.
@@ -28872,7 +29032,7 @@
 +#include "vsyscall-sigreturn.S"
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/ia32/vsyscall-sigreturn.S linux-2.6.18-xen/arch/x86_64/ia32/vsyscall-sigreturn.S
 --- linux-2.6.18/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-09-04 16:31:03.000000000 +0200
 @@ -139,5 +139,5 @@
  	.align 4
  .LENDFDE3:
@@ -28882,8 +29042,16 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/Kconfig linux-2.6.18-xen/arch/x86_64/Kconfig
 --- linux-2.6.18/arch/x86_64/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/Kconfig	2006-09-20 13:58:38.000000000 +0200
-@@ -135,6 +135,22 @@
++++ linux-2.6.18-xen/arch/x86_64/Kconfig	2006-09-21 01:33:31.000000000 +0200
+@@ -30,6 +30,7 @@
+ 
+ config STACKTRACE_SUPPORT
+ 	bool
++	depends on !X86_64_XEN
+ 	default y
+ 
+ config SEMAPHORE_SLEEPERS
+@@ -135,6 +136,22 @@
  
  endchoice
  
@@ -28906,7 +29074,7 @@
  #
  # Define implied options from the CPU selection here
  #
-@@ -155,6 +171,7 @@
+@@ -155,6 +172,7 @@
  
  config X86_TSC
  	bool
@@ -28914,7 +29082,7 @@
  	default y
  
  config X86_GOOD_APIC
-@@ -197,7 +214,7 @@
+@@ -197,7 +215,7 @@
  
  config X86_HT
  	bool
@@ -28923,7 +29091,7 @@
  	default y
  
  config MATH_EMULATION
-@@ -211,14 +228,22 @@
+@@ -211,14 +229,22 @@
  
  config X86_IO_APIC
  	bool
@@ -28946,7 +29114,7 @@
  	---help---
  	  On Intel P6 family processors (Pentium Pro, Pentium II and later)
  	  the Memory Type Range Registers (MTRRs) may be used to control
-@@ -259,7 +284,7 @@
+@@ -259,7 +285,7 @@
  
  config SCHED_SMT
  	bool "SMT (Hyperthreading) scheduler support"
@@ -28955,7 +29123,7 @@
  	default n
  	help
  	  SMT scheduler support improves the CPU scheduler's decision making
-@@ -269,7 +294,7 @@
+@@ -269,7 +295,7 @@
  
  config SCHED_MC
  	bool "Multi-core scheduler support"
@@ -28964,7 +29132,7 @@
  	default y
  	help
  	  Multi-core scheduler support improves the CPU scheduler's decision
-@@ -280,7 +305,7 @@
+@@ -280,7 +306,7 @@
  
  config NUMA
         bool "Non Uniform Memory Access (NUMA) Support"
@@ -28973,7 +29141,7 @@
         help
  	 Enable NUMA (Non Uniform Memory Access) support. The kernel 
  	 will try to allocate memory used by a CPU on the local memory 
-@@ -341,7 +366,7 @@
+@@ -341,7 +367,7 @@
  
  config ARCH_SPARSEMEM_ENABLE
  	def_bool y
@@ -28982,7 +29150,7 @@
  
  config ARCH_MEMORY_PROBE
  	def_bool y
-@@ -365,6 +390,7 @@
+@@ -365,6 +391,7 @@
  	int "Maximum number of CPUs (2-256)"
  	range 2 255
  	depends on SMP
@@ -28990,7 +29158,7 @@
  	default "8"
  	help
  	  This allows you to specify the maximum number of CPUs which this
-@@ -387,6 +413,7 @@
+@@ -387,6 +414,7 @@
  
  config HPET_TIMER
  	bool
@@ -28998,7 +29166,7 @@
  	default y
  	help
  	  Use the IA-PC HPET (High Precision Event Timer) to manage
-@@ -407,7 +434,7 @@
+@@ -407,7 +435,7 @@
  	default y
  	select SWIOTLB
  	select AGP
@@ -29007,7 +29175,7 @@
  	help
  	  Support for full DMA access of devices with 32bit memory access only
  	  on systems with more than 3GB. This is usually needed for USB,
-@@ -444,6 +471,7 @@
+@@ -444,6 +472,7 @@
  
  config X86_MCE
  	bool "Machine check support" if EMBEDDED
@@ -29015,7 +29183,7 @@
  	default y
  	help
  	   Include a machine check error handler to report hardware errors.
-@@ -469,7 +497,7 @@
+@@ -469,7 +498,7 @@
  
  config KEXEC
  	bool "kexec system call (EXPERIMENTAL)"
@@ -29024,7 +29192,7 @@
  	help
  	  kexec is a system call that implements the ability to shutdown your
  	  current kernel, and to start another kernel.  It is like a reboot
-@@ -564,8 +592,11 @@
+@@ -564,8 +593,11 @@
  	default y
  
  menu "Power management options"
@@ -29036,7 +29204,7 @@
  
  source "drivers/acpi/Kconfig"
  
-@@ -588,6 +619,21 @@
+@@ -588,6 +620,21 @@
  	bool "Support mmconfig PCI config space access"
  	depends on PCI && ACPI
  
@@ -29058,7 +29226,7 @@
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
-@@ -658,4 +704,6 @@
+@@ -658,4 +705,6 @@
  
  source "crypto/Kconfig"
  
@@ -29067,7 +29235,7 @@
  source "lib/Kconfig"
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/acpi/Makefile linux-2.6.18-xen/arch/x86_64/kernel/acpi/Makefile
 --- linux-2.6.18/arch/x86_64/kernel/acpi/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/kernel/acpi/Makefile	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/acpi/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -7,3 +7,4 @@
  processor-y		:= ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o
  endif
@@ -29075,7 +29243,7 @@
 +boot-$(CONFIG_XEN)		:= ../../../i386/kernel/acpi/boot-xen.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/apic-xen.c linux-2.6.18-xen/arch/x86_64/kernel/apic-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/apic-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/apic-xen.c	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/apic-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,197 @@
 +/*
 + *	Local APIC handling, local APIC timers
@@ -29276,7 +29444,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/asm-offsets.c linux-2.6.18-xen/arch/x86_64/kernel/asm-offsets.c
 --- linux-2.6.18/arch/x86_64/kernel/asm-offsets.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/kernel/asm-offsets.c	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/asm-offsets.c	2006-09-04 16:31:03.000000000 +0200
 @@ -67,8 +67,10 @@
  	DEFINE(pbe_address, offsetof(struct pbe, address));
  	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
@@ -29290,8 +29458,8 @@
  	return 0;
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/e820-xen.c linux-2.6.18-xen/arch/x86_64/kernel/e820-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/e820-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/e820-xen.c	2006-09-20 13:58:38.000000000 +0200
-@@ -0,0 +1,755 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/e820-xen.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,757 @@
 +/* 
 + * Handle the memory map.
 + * The functions here do the job until bootmem takes over.
@@ -29590,8 +29758,10 @@
 +			 *  so we try it repeatedly and let the resource manager
 +			 *  test it.
 +			 */
++#ifndef CONFIG_XEN
 +			request_resource(res, &code_resource);
 +			request_resource(res, &data_resource);
++#endif
 +#ifdef CONFIG_KEXEC
 +			request_resource(res, &crashk_res);
 +#endif
@@ -30049,7 +30219,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/early_printk-xen.c linux-2.6.18-xen/arch/x86_64/kernel/early_printk-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/early_printk-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/early_printk-xen.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/early_printk-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,304 @@
 +
 +#include <linux/console.h>
@@ -30357,8 +30527,8 @@
 +__setup("earlyprintk=", setup_early_printk);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/entry-xen.S linux-2.6.18-xen/arch/x86_64/kernel/entry-xen.S
 --- linux-2.6.18/arch/x86_64/kernel/entry-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/entry-xen.S	2006-09-17 17:44:47.000000000 +0200
-@@ -0,0 +1,1232 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/entry-xen.S	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,1213 @@
 +/*
 + *  linux/arch/x86_64/entry.S
 + *
@@ -30424,6 +30594,7 @@
 +#define retint_kernel retint_restore_args
 +#endif	
 +
++
 +.macro TRACE_IRQS_IRETQ offset=ARGOFFSET
 +#ifdef CONFIG_TRACE_IRQFLAGS
 +	bt   $9,EFLAGS-\offset(%rsp)	/* interrupts off? */
@@ -30635,6 +30806,10 @@
 +	andl %edi,%edx
 +	CFI_REMEMBER_STATE
 +	jnz  sysret_careful 
++	/*
++	 * sysretq will re-enable interrupts:
++	 */
++	TRACE_IRQS_ON
 +        XEN_UNBLOCK_EVENTS(%rsi)                
 +	CFI_REGISTER	rip,rcx
 +	RESTORE_ARGS 0,8,0
@@ -30647,7 +30822,8 @@
 +	CFI_RESTORE_STATE
 +	bt $TIF_NEED_RESCHED,%edx
 +	jnc sysret_signal
-+	XEN_UNBLOCK_EVENTS(%rsi)
++	TRACE_IRQS_ON
++        XEN_UNBLOCK_EVENTS(%rsi)        
 +	pushq %rdi
 +	CFI_ADJUST_CFA_OFFSET 8
 +	call schedule
@@ -30657,6 +30833,7 @@
 +
 +	/* Handle a signal */ 
 +sysret_signal:
++	TRACE_IRQS_ON
 +/*	sti */
 +        XEN_UNBLOCK_EVENTS(%rsi)        
 +	testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
@@ -30721,6 +30898,7 @@
 +	CFI_REL_OFFSET	r10,R10-ARGOFFSET
 +	CFI_REL_OFFSET	r11,R11-ARGOFFSET
 +        XEN_BLOCK_EVENTS(%rsi)
++	TRACE_IRQS_OFF
 +	testb $3,CS-ARGOFFSET(%rsp)
 +        jnz 1f
 +        /* Need to set the proper %ss (not NULL) for ring 3 iretq */
@@ -30743,6 +30921,7 @@
 +int_careful:
 +	bt $TIF_NEED_RESCHED,%edx
 +	jnc  int_very_careful
++	TRACE_IRQS_ON
 +/*	sti */
 +        XEN_UNBLOCK_EVENTS(%rsi)
 +	pushq %rdi
@@ -30751,10 +30930,12 @@
 +	popq %rdi
 +	CFI_ADJUST_CFA_OFFSET -8
 +	XEN_BLOCK_EVENTS(%rsi)
++	TRACE_IRQS_OFF
 +	jmp int_with_check
 +
 +	/* handle signals and tracing -- both require a full stack frame */
 +int_very_careful:
++	TRACE_IRQS_ON
 +/*	sti */
 +        XEN_UNBLOCK_EVENTS(%rsi)
 +	SAVE_REST
@@ -30899,7 +31080,7 @@
 +	andb $1,%al			# EAX[0] == IRET_EFLAGS.IF & event_mask
 +	jnz restore_all_enable_events	#        != 0 => enable event delivery
 +	XEN_PUT_VCPU_INFO(%rsi)
-+		
++	TRACE_IRQS_IRETQ
 +	RESTORE_ARGS 0,8,0
 +	HYPERVISOR_IRET 0
 +	
@@ -30908,6 +31089,7 @@
 +	CFI_RESTORE_STATE
 +	bt    $TIF_NEED_RESCHED,%edx
 +	jnc   retint_signal
++	TRACE_IRQS_ON
 +	XEN_UNBLOCK_EVENTS(%rsi)
 +/*	sti */        
 +	pushq %rdi
@@ -30917,12 +31099,14 @@
 +	CFI_ADJUST_CFA_OFFSET	-8
 +	GET_THREAD_INFO(%rcx)
 +	XEN_BLOCK_EVENTS(%rsi)		
++	TRACE_IRQS_OFF
 +/*	cli */
 +	jmp retint_check
 +	
 +retint_signal:
 +	testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
 +	jz    retint_restore_args
++	TRACE_IRQS_ON
 +        XEN_UNBLOCK_EVENTS(%rsi)
 +	SAVE_REST
 +	movq $-1,ORIG_RAX(%rsp) 			
@@ -30931,6 +31115,7 @@
 +	call do_notify_resume
 +	RESTORE_REST
 +        XEN_BLOCK_EVENTS(%rsi)		
++	TRACE_IRQS_OFF
 +	movl $_TIF_NEED_RESCHED,%edi
 +	GET_THREAD_INFO(%rcx)
 +	jmp retint_check
@@ -30949,7 +31134,9 @@
 +	call preempt_schedule_irq
 +	jmp retint_kernel       /* check again */
 +#endif	
++
 +	CFI_ENDPROC
++END(common_interrupt)
 +	
 +/*
 + * APIC interrupts.
@@ -31074,6 +31261,7 @@
 +	addq	$EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
 +	.endif
 +/*	cli */
++	TRACE_IRQS_OFF
 +	XEN_BLOCK_EVENTS(%rsi)		
 +	.endm
 +#endif
@@ -31131,11 +31319,12 @@
 +	RESTORE_REST
 +/*	cli */
 +	XEN_BLOCK_EVENTS(%rsi)		
++	TRACE_IRQS_OFF
 +	GET_THREAD_INFO(%rcx)	
 +	testb $3,CS-ARGOFFSET(%rsp)
 +	jz retint_kernel
 +	movl  threadinfo_flags(%rcx),%edx
-+	movl  $_TIF_WORK_MASK,%edi	
++	movl  $_TIF_WORK_MASK,%edi
 +	andl  %edi,%edx
 +	jnz   retint_careful
 +	jmp   retint_restore_args
@@ -31166,7 +31355,7 @@
 +	jmp  error_sti
 +#endif        
 +END(error_entry)
-+	
++		
 +ENTRY(hypervisor_callback)
 +	zeroentry do_hypervisor_callback
 +        
@@ -31400,7 +31589,6 @@
 +/*	jmp paranoid_exit */
 +	CFI_ENDPROC
 +END(debug)
-+END(nmi)
 +	.previous .text
 +
 +#if 0
@@ -31409,49 +31597,14 @@
 +	INTR_FRAME
 +	pushq $-1
 +	CFI_ADJUST_CFA_OFFSET 8
-+	paranoidentry do_nmi
-+	/*
-+ 	 * "Paranoid" exit path from exception stack.
-+  	 * Paranoid because this is used by NMIs and cannot take
-+	 * any kernel state for granted.
-+	 * We don't do kernel preemption checks here, because only
-+	 * NMI should be common and it does not enable IRQs and
-+	 * cannot get reschedule ticks.
-+	 */
-+	/* ebx:	no swapgs flag */
-+paranoid_exit:
-+	testl %ebx,%ebx				/* swapgs needed? */
-+	jnz paranoid_restore
-+	testl $3,CS(%rsp)
-+	jnz   paranoid_userspace
-+paranoid_swapgs:	
-+	swapgs
-+paranoid_restore:	
-+	RESTORE_ALL 8
-+	iretq
-+paranoid_userspace:	
-+	GET_THREAD_INFO(%rcx)
-+	movl threadinfo_flags(%rcx),%ebx
-+	andl $_TIF_WORK_MASK,%ebx
-+	jz paranoid_swapgs
-+	movq %rsp,%rdi			/* &pt_regs */
-+	call sync_regs
-+	movq %rax,%rsp			/* switch stack for scheduling */
-+	testl $_TIF_NEED_RESCHED,%ebx
-+	jnz paranoid_schedule
-+	movl %ebx,%edx			/* arg3: thread flags */
-+	sti
-+	xorl %esi,%esi 			/* arg2: oldset */
-+	movq %rsp,%rdi 			/* arg1: &pt_regs */
-+	call do_notify_resume
-+	cli
-+	jmp paranoid_userspace
-+paranoid_schedule:
-+	sti
-+	call schedule
-+	cli
-+	jmp paranoid_userspace
-+	CFI_ENDPROC
++	paranoidentry do_nmi, 0, 0
++#ifdef CONFIG_TRACE_IRQFLAGS
++	paranoidexit 0
++#else
++	jmp paranoid_exit1
++ 	CFI_ENDPROC
++#endif
++END(nmi)
 +	.previous .text
 +#endif        
 +
@@ -31502,7 +31655,6 @@
 +ENTRY(segment_not_present)
 +	errorentry do_segment_not_present
 +END(segment_not_present)
-+
 +	/* runs on exception stack */
 +ENTRY(stack_segment)
 +	XCPT_FRAME
@@ -31539,7 +31691,6 @@
 +END(machine_check)
 +#endif
 +
-+/* Call softirq on interrupt stack. Interrupts are off. */
 +ENTRY(call_softirq)
 +	CFI_STARTPROC
 +	push %rbp
@@ -31593,8 +31744,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/genapic_xen.c linux-2.6.18-xen/arch/x86_64/kernel/genapic_xen.c
 --- linux-2.6.18/arch/x86_64/kernel/genapic_xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/genapic_xen.c	2006-09-17 17:44:47.000000000 +0200
-@@ -0,0 +1,149 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/genapic_xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,176 @@
 +/*
 + * Copyright 2004 James Cleverdon, IBM.
 + * Subject to the GNU Public License, v.2
@@ -31613,8 +31764,14 @@
 +#include <linux/kernel.h>
 +#include <linux/ctype.h>
 +#include <linux/init.h>
++#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 +#include <asm/smp.h>
 +#include <asm/ipi.h>
++#else
++#include <asm/apic.h>
++#include <asm/apicdef.h>
++#include <asm/genapic.h>
++#endif
 +#include <xen/evtchn.h>
 +
 +DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
@@ -31672,24 +31829,6 @@
 +	return;
 +}
 +
-+static void xen_send_IPI_allbutself(int vector)
-+{
-+	/*
-+	 * if there are no other CPUs in the system then
-+	 * we get an APIC send error if we try to broadcast.
-+	 * thus we have to avoid sending IPIs in this case.
-+	 */
-+	Dprintk("%s\n", __FUNCTION__);
-+	if (num_online_cpus() > 1)
-+		xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
-+}
-+
-+static void xen_send_IPI_all(int vector)
-+{
-+	Dprintk("%s\n", __FUNCTION__);
-+	xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
-+}
-+
 +static void xen_send_IPI_mask(cpumask_t cpumask, int vector)
 +{
 +	unsigned long mask = cpus_addr(cpumask)[0];
@@ -31708,12 +31847,48 @@
 +	local_irq_restore(flags);
 +}
 +
++static void xen_send_IPI_allbutself(int vector)
++{
++#ifdef	CONFIG_HOTPLUG_CPU
++	int hotplug = 1;
++#else
++	int hotplug = 0;
++#endif
++	/*
++	 * if there are no other CPUs in the system then
++	 * we get an APIC send error if we try to broadcast.
++	 * thus we have to avoid sending IPIs in this case.
++	 */
++	Dprintk("%s\n", __FUNCTION__);
++	if (hotplug || vector == NMI_VECTOR) {
++		cpumask_t allbutme = cpu_online_map;
++
++		cpu_clear(smp_processor_id(), allbutme);
++
++		if (!cpus_empty(allbutme))
++			xen_send_IPI_mask(allbutme, vector);
++	} else if (num_online_cpus() > 1) {
++		xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
++	}
++}
++
++static void xen_send_IPI_all(int vector)
++{
++	Dprintk("%s\n", __FUNCTION__);
++	if (vector == NMI_VECTOR)
++		xen_send_IPI_mask(cpu_online_map, vector);
++	else
++		xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
++}
++
++#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 +static int xen_apic_id_registered(void)
 +{
 +	/* better be set */
 +	Dprintk("%s\n", __FUNCTION__);
 +	return physid_isset(smp_processor_id(), phys_cpu_present_map);
 +}
++#endif
 +
 +static unsigned int xen_cpu_mask_to_apicid(cpumask_t cpumask)
 +{
@@ -31723,8 +31898,7 @@
 +
 +static unsigned int phys_pkg_id(int index_msb)
 +{
-+	u32 ebx;
-+
++	int ebx;
 +	Dprintk("%s\n", __FUNCTION__);
 +	ebx = cpuid_ebx(1);
 +	return ((ebx >> 24) & 0xFF) >> index_msb;
@@ -31732,11 +31906,15 @@
 +
 +struct genapic apic_xen =  {
 +	.name = "xen",
++#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 +	.int_delivery_mode = dest_LowestPrio,
++#endif
 +	.int_dest_mode = (APIC_DEST_LOGICAL != 0),
 +	.int_delivery_dest = APIC_DEST_LOGICAL | APIC_DM_LOWEST,
 +	.target_cpus = xen_target_cpus,
++#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 +	.apic_id_registered = xen_apic_id_registered,
++#endif
 +	.init_apic_ldr = xen_init_apic_ldr,
 +	.send_IPI_all = xen_send_IPI_all,
 +	.send_IPI_allbutself = xen_send_IPI_allbutself,
@@ -31746,7 +31924,7 @@
 +};
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/genapic-xen.c linux-2.6.18-xen/arch/x86_64/kernel/genapic-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/genapic-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/genapic-xen.c	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/genapic-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,143 @@
 +/*
 + * Copyright 2004 James Cleverdon, IBM.
@@ -31893,8 +32071,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/head64-xen.c linux-2.6.18-xen/arch/x86_64/kernel/head64-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/head64-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/head64-xen.c	2006-08-15 13:03:15.000000000 +0200
-@@ -0,0 +1,162 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/head64-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,161 @@
 +/*
 + *  linux/arch/x86_64/kernel/head64.c -- prepare to run common code
 + *
@@ -32009,7 +32187,6 @@
 +			xen_start_info->nr_pt_frames;
 +	}
 +
-+
 +	machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
 +	machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
 +	if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
@@ -32019,17 +32196,17 @@
 +	while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
 +		machine_to_phys_order++;
 +
-+	/*
-+	 * This must be called really, really early:
-+	 */
-+	lockdep_init();
-+
 +#if 0
 +	for (i = 0; i < 256; i++)
 +		set_intr_gate(i, early_idt_handler);
 +	asm volatile("lidt %0" :: "m" (idt_descr));
 +#endif
 +
++	/*
++	 * This must be called really, really early:
++	 */
++	lockdep_init();
++
 + 	for (i = 0; i < NR_CPUS; i++)
 + 		cpu_pda(i) = &boot_cpu_pda[i];
 +
@@ -32059,8 +32236,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/head-xen.S linux-2.6.18-xen/arch/x86_64/kernel/head-xen.S
 --- linux-2.6.18/arch/x86_64/kernel/head-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/head-xen.S	2006-05-26 22:00:14.000000000 +0200
-@@ -0,0 +1,176 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/head-xen.S	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,191 @@
 +/*
 + *  linux/arch/x86_64/kernel/head.S -- start in 32bit and switch to 64bit
 + *
@@ -32079,12 +32256,15 @@
 +#include <linux/linkage.h>
 +#include <linux/threads.h>
 +#include <linux/init.h>
++#include <linux/elfnote.h>
 +#include <asm/desc.h>
 +#include <asm/segment.h>
 +#include <asm/page.h>
 +#include <asm/msr.h>
 +#include <asm/cache.h>
 +
++#include <xen/interface/elfnote.h>
++
 +	.text
 +	.section .bootstrap.text
 +	.code64
@@ -32202,6 +32382,7 @@
 +ENTRY(empty_zero_page)
 +	.skip PAGE_SIZE
 +
++#ifdef CONFIG_XEN_COMPAT_030002
 +/*
 + * __xen_guest information
 + */
@@ -32221,12 +32402,8 @@
 +	.ascii	",XEN_VER=xen-3.0"
 +	.ascii	",VIRT_BASE=0x"
 +		utoh __START_KERNEL_map
-+#ifdef CONFIG_XEN_COMPAT_030002
 +	.ascii	",ELF_PADDR_OFFSET=0x"
 +		utoh __START_KERNEL_map
-+#else
-+	.ascii	",ELF_PADDR_OFFSET=0x0"
-+#endif /* !CONFIG_XEN_COMPAT_030002 */
 +	.ascii	",VIRT_ENTRY=0x"
 +		utoh (__START_KERNEL_map + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
 +	.ascii	",HYPERCALL_PAGE=0x"
@@ -32237,9 +32414,24 @@
 +	.ascii	         "|supervisor_mode_kernel"
 +	.ascii	",LOADER=generic"
 +	.byte	0
++#endif /* CONFIG_XEN_COMPAT_030002 */
++	
++	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz, "linux")
++	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz, "2.6")
++	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz, "xen-3.0")
++	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .quad,  __START_KERNEL_map)
++#ifdef CONFIG_XEN_COMPAT_030002
++	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .quad,  __START_KERNEL_map)
++#else
++	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .quad,  0)
++#endif /* !CONFIG_XEN_COMPAT_030002 */
++	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
++	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
++	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
++	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/init_task.c linux-2.6.18-xen/arch/x86_64/kernel/init_task.c
 --- linux-2.6.18/arch/x86_64/kernel/init_task.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/kernel/init_task.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/init_task.c	2006-09-04 16:31:03.000000000 +0200
 @@ -37,6 +37,8 @@
  struct task_struct init_task = INIT_TASK(init_task);
  
@@ -32259,8 +32451,8 @@
   * debugging, no special alignment required.
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/io_apic-xen.c linux-2.6.18-xen/arch/x86_64/kernel/io_apic-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/io_apic-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/io_apic-xen.c	2006-08-15 13:03:15.000000000 +0200
-@@ -0,0 +1,2257 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/io_apic-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,2263 @@
 +/*
 + *	Intel IO-APIC support for multi-Pentium hosts.
 + *
@@ -33152,11 +33344,16 @@
 +int assign_irq_vector(int irq)
 +{
 +	struct physdev_irq irq_op;
-+  
++	unsigned long flags;
++
 +  	BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
-+  	if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
-+  		return IO_APIC_VECTOR(irq);
 +
++	spin_lock_irqsave(&vector_lock, flags);
++
++	if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
++		spin_unlock_irqrestore(&vector_lock, flags);
++  		return IO_APIC_VECTOR(irq);
++	}
 +	irq_op.irq = irq;
 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
 +		return -ENOSPC;
@@ -33165,6 +33362,7 @@
 +	if (irq != AUTO_ASSIGN)
 +		IO_APIC_VECTOR(irq) = irq_op.vector;
 +
++	spin_unlock_irqrestore(&vector_lock, flags);
 +	return irq_op.vector;
 +}
 +
@@ -33966,7 +34164,6 @@
 +	.set_affinity = set_ioapic_affinity,
 +#endif
 +	.retrigger	= ioapic_retrigger,
-+	.retrigger	= ioapic_retrigger,
 +};
 +
 +static struct hw_interrupt_type ioapic_level_type __read_mostly = {
@@ -33980,6 +34177,7 @@
 +#ifdef CONFIG_SMP
 +	.set_affinity = set_ioapic_affinity,
 +#endif
++	.retrigger	= ioapic_retrigger,
 +};
 +#endif /* !CONFIG_XEN */
 +
@@ -34520,7 +34718,7 @@
 +#endif /* !CONFIG_XEN */
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/ioport-xen.c linux-2.6.18-xen/arch/x86_64/kernel/ioport-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/ioport-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/ioport-xen.c	2006-07-07 20:51:32.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/ioport-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,99 @@
 +/*
 + *	linux/arch/x86_64/kernel/ioport.c
@@ -34623,7 +34821,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/irqflags-xen.c linux-2.6.18-xen/arch/x86_64/kernel/irqflags-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/irqflags-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/irqflags-xen.c	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/irqflags-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,100 @@
 +#include <linux/module.h>
 +#include <linux/smp.h>
@@ -34727,8 +34925,8 @@
 +EXPORT_SYMBOL(raw_irqs_disabled);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/irq-xen.c linux-2.6.18-xen/arch/x86_64/kernel/irq-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/irq-xen.c	2006-08-15 13:03:15.000000000 +0200
-@@ -0,0 +1,197 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/irq-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,198 @@
 +/*
 + *	linux/arch/x86_64/kernel/irq.c
 + *
@@ -34794,7 +34992,7 @@
 +	if (i == 0) {
 +		seq_printf(p, "           ");
 +		for_each_online_cpu(j)
-+			seq_printf(p, "CPU%-8d",j);
++			seq_printf(p, "CPU%-8d       ",j);
 +		seq_putc(p, '\n');
 +	}
 +
@@ -34857,6 +35055,7 @@
 +
 +	exit_idle();
 +	irq_enter();
++
 +#ifdef CONFIG_DEBUG_STACKOVERFLOW
 +	stack_overflow_check(regs);
 +#endif
@@ -34928,7 +35127,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/ldt-xen.c linux-2.6.18-xen/arch/x86_64/kernel/ldt-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/ldt-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/ldt-xen.c	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/ldt-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,282 @@
 +/*
 + * linux/arch/x86_64/kernel/ldt.c
@@ -35214,7 +35413,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/Makefile linux-2.6.18-xen/arch/x86_64/kernel/Makefile
 --- linux-2.6.18/arch/x86_64/kernel/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/kernel/Makefile	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -21,11 +21,13 @@
  obj-$(CONFIG_X86_CPUID)		+= cpuid.o
  obj-$(CONFIG_SMP)		+= smp.o smpboot.o trampoline.o
@@ -35230,7 +35429,7 @@
  obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
  obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
  obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
-@@ -55,3 +57,19 @@
+@@ -55,3 +57,18 @@
  msr-$(subst m,y,$(CONFIG_X86_MSR))  += ../../i386/kernel/msr.o
  alternative-y			+= ../../i386/kernel/alternative.o
  
@@ -35249,10 +35448,9 @@
 +obj-y := $(call cherrypickxen, $(obj-y))
 +extra-y := $(call cherrypickxen, $(extra-y))
 +endif
-+
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/mpparse-xen.c linux-2.6.18-xen/arch/x86_64/kernel/mpparse-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/mpparse-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/mpparse-xen.c	2006-08-15 13:03:16.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/mpparse-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,1011 @@
 +/*
 + *	Intel Multiprocessor Specification 1.1 and 1.4
@@ -36267,8 +36465,8 @@
 +#endif /*CONFIG_ACPI*/
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/pci-swiotlb-xen.c linux-2.6.18-xen/arch/x86_64/kernel/pci-swiotlb-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/pci-swiotlb-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/pci-swiotlb-xen.c	2006-08-15 13:03:16.000000000 +0200
-@@ -0,0 +1,55 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/pci-swiotlb-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,54 @@
 +/* Glue code to lib/swiotlb.c */
 +
 +#include <linux/pci.h>
@@ -36307,10 +36505,9 @@
 +{
 +#if 0
 +	/* don't initialize swiotlb if iommu=off (no_iommu=1) */
-+	if (!iommu_detected && !no_iommu && end_pfn > MAX_DMA32_PFN)
++	if (!iommu_aperture && !no_iommu &&
++	    (end_pfn > MAX_DMA32_PFN || force_iommu))
 +	       swiotlb = 1;
-+	if (swiotlb_force)
-+		swiotlb = 1;
 +	if (swiotlb) {
 +		printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
 +		swiotlb_init();
@@ -36326,8 +36523,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/process-xen.c linux-2.6.18-xen/arch/x86_64/kernel/process-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/process-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/process-xen.c	2006-08-15 13:03:16.000000000 +0200
-@@ -0,0 +1,793 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/process-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,794 @@
 +/*
 + *  linux/arch/x86-64/kernel/process.c
 + *
@@ -36402,7 +36599,6 @@
 + * Powermanagement idle function, if any..
 + */
 +void (*pm_idle)(void);
-+EXPORT_SYMBOL(pm_idle);
 +static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
 +
 +static ATOMIC_NOTIFIER_HEAD(idle_notifier);
@@ -36585,7 +36781,7 @@
 +{
 +	printk("CPU %d:", smp_processor_id());
 +	__show_regs(regs);
-+	show_trace(NULL, regs, (void *)(regs + 1));
++	show_trace(NULL, regs, &regs->rsp);
 +}
 +
 +/*
@@ -36636,6 +36832,7 @@
 +			current_thread_info()->status |= TS_COMPAT;
 +	}
 +
++
 +	tsk->thread.debugreg0 = 0;
 +	tsk->thread.debugreg1 = 0;
 +	tsk->thread.debugreg2 = 0;
@@ -36792,18 +36989,6 @@
 +	multicall_entry_t _mcl[8], *mcl = _mcl;
 +
 +	/*
-+	 * This is basically '__unlazy_fpu', except that we queue a
-+	 * multicall to indicate FPU task switch, rather than
-+	 * synchronously trapping to Xen.
-+	 */
-+	if (prev_p->thread_info->status & TS_USEDFPU) {
-+		__save_init_fpu(prev_p); /* _not_ save_init_fpu() */
-+		mcl->op      = __HYPERVISOR_fpu_taskswitch;
-+		mcl->args[0] = 1;
-+		mcl++;
-+	}
-+
-+	/*
 +	 * Reload esp0, LDT and the page table pointer:
 +	 */
 +	mcl->op      = __HYPERVISOR_stack_switch;
@@ -36871,11 +37056,24 @@
 +		HYPERVISOR_set_segment_base(SEGBASE_GS_USER, next->gs); 
 +
 +	/* 
-+	 * Switch the PDA.
++	 * Switch the PDA and FPU context.
 +	 */
 +	prev->userrsp = read_pda(oldrsp); 
 +	write_pda(oldrsp, next->userrsp); 
 +	write_pda(pcurrent, next_p); 
++
++	/* This must be here to ensure both math_state_restore() and
++	   kernel_fpu_begin() work consistently. 
++	   And the AMD workaround requires it to be after DS reload. */
++	/*
++	 * This is basically '__unlazy_fpu', except that we queue a
++	 * multicall to indicate FPU task switch, rather than
++	 * synchronously trapping to Xen.
++	 */
++	if (prev_p->thread_info->status & TS_USEDFPU) {
++		__save_init_fpu(prev_p); /* _not_ save_init_fpu() */
++		HYPERVISOR_fpu_taskswitch(1);
++	}
 +	write_pda(kernelstack,
 +		  task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
 +
@@ -37123,7 +37321,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/setup64-xen.c linux-2.6.18-xen/arch/x86_64/kernel/setup64-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/setup64-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/setup64-xen.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/setup64-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,361 @@
 +/* 
 + * X86-64 specific CPU setup.
@@ -37488,8 +37686,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/setup-xen.c linux-2.6.18-xen/arch/x86_64/kernel/setup-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/setup-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/setup-xen.c	2006-09-17 17:44:47.000000000 +0200
-@@ -0,0 +1,1655 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/setup-xen.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,1638 @@
 +/*
 + *  linux/arch/x86-64/kernel/setup.c
 + *
@@ -37563,6 +37761,7 @@
 +#include <asm/hypervisor.h>
 +#include <xen/interface/nmi.h>
 +#include <xen/features.h>
++#include <xen/xencons.h>
 +#define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
 +#define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
 +#include <asm/mach-xen/setup_arch_post.h>
@@ -37570,6 +37769,7 @@
 +
 +extern unsigned long start_pfn;
 +extern struct edid_info edid_info;
++EXPORT_SYMBOL_GPL(edid_info);
 +
 +shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
 +EXPORT_SYMBOL(HYPERVISOR_shared_info);
@@ -37639,7 +37839,6 @@
 +};
 +
 +struct edid_info edid_info;
-+EXPORT_SYMBOL_GPL(edid_info);
 +struct e820map e820;
 +
 +extern int root_mountflags;
@@ -38087,33 +38286,15 @@
 +		screen_info.orig_video_cols = 80;
 +		screen_info.orig_video_ega_bx = 3;
 +		screen_info.orig_video_points = 16;
++		screen_info.orig_y = screen_info.orig_video_lines - 1;
 +		if (xen_start_info->console.dom0.info_size >=
 +		    sizeof(struct dom0_vga_console_info)) {
 +			const struct dom0_vga_console_info *info =
 +				(struct dom0_vga_console_info *)(
 +					(char *)xen_start_info +
 +					xen_start_info->console.dom0.info_off);
-+			screen_info.orig_video_mode = info->txt_mode;
-+			screen_info.orig_video_isVGA = info->video_type;
-+			screen_info.orig_video_lines = info->video_height;
-+			screen_info.orig_video_cols = info->video_width;
-+			screen_info.orig_video_points = info->txt_points;
-+			screen_info.lfb_width = info->video_width;
-+			screen_info.lfb_height = info->video_height;
-+			screen_info.lfb_depth = info->lfb_depth;
-+			screen_info.lfb_base = info->lfb_base;
-+			screen_info.lfb_size = info->lfb_size;
-+			screen_info.lfb_linelength = info->lfb_linelen;
-+			screen_info.red_size = info->red_size;
-+			screen_info.red_pos = info->red_pos;
-+			screen_info.green_size = info->green_size;
-+			screen_info.green_pos = info->green_pos;
-+			screen_info.blue_size = info->blue_size;
-+			screen_info.blue_pos = info->blue_pos;
-+			screen_info.rsvd_size = info->rsvd_size;
-+			screen_info.rsvd_pos = info->rsvd_pos;
++			dom0_init_screen_info(info);
 +		}
-+		screen_info.orig_y = screen_info.orig_video_lines - 1;
 +		xen_start_info->console.domU.mfn = 0;
 +		xen_start_info->console.domU.evtchn = 0;
 +	} else
@@ -38207,8 +38388,7 @@
 +
 +#ifdef CONFIG_XEN
 +	/* reserve physmap, start info and initial page tables */
-+	reserve_bootmem(__pa_symbol(&_end),
-+			(table_start<<PAGE_SHIFT) - __pa_symbol(&_end));
++	reserve_bootmem(__pa_symbol(&_end), (table_start<<PAGE_SHIFT)-__pa_symbol(&_end));
 +#else
 +	/*
 +	 * reserve physical page 0 - it's a special BIOS page on many boxes,
@@ -38295,7 +38475,7 @@
 +
 +		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
 +			/* Make sure we have a large enough P->M table. */
-+			phys_to_machine_mapping = alloc_bootmem(
++			phys_to_machine_mapping = alloc_bootmem_pages(
 +				end_pfn * sizeof(unsigned long));
 +			memset(phys_to_machine_mapping, ~0,
 +			       end_pfn * sizeof(unsigned long));
@@ -38312,7 +38492,7 @@
 +			 * list of frames that make up the p2m table. Used by
 +                         * save/restore.
 +			 */
-+			pfn_to_mfn_frame_list_list = alloc_bootmem(PAGE_SIZE);
++			pfn_to_mfn_frame_list_list = alloc_bootmem_pages(PAGE_SIZE);
 +			HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
 +				virt_to_mfn(pfn_to_mfn_frame_list_list);
 +
@@ -38322,7 +38502,7 @@
 +					k++;
 +					BUG_ON(k>=fpp);
 +					pfn_to_mfn_frame_list[k] =
-+						alloc_bootmem(PAGE_SIZE);
++						alloc_bootmem_pages(PAGE_SIZE);
 +					pfn_to_mfn_frame_list_list[k] =
 +						virt_to_mfn(pfn_to_mfn_frame_list[k]);
 +					j=0;
@@ -38402,9 +38582,10 @@
 +		BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
 +
 +		e820_reserve_resources(machine_e820, memmap.nr_entries);
-+	} else
-+#endif
++	}
++#else
 +	e820_reserve_resources(e820.map, e820.nr_map);
++#endif
 +
 +	request_resource(&iomem_resource, &video_ram_resource);
 +
@@ -38631,7 +38812,7 @@
 +		set_bit(X86_FEATURE_FXSAVE_LEAK, &c->x86_capability);
 +
 +	level = get_model_name(c);
-+	if (!level) {
++	if (!level) { 
 +		switch (c->x86) { 
 +		case 15:
 +			/* Should distinguish Models here, but this is only
@@ -38659,6 +38840,7 @@
 +#ifdef CONFIG_SMP
 +	u32 	eax, ebx, ecx, edx;
 +	int 	index_msb, core_bits;
++	int 	cpu = smp_processor_id();
 +
 +	cpuid(1, &eax, &ebx, &ecx, &edx);
 +
@@ -38697,7 +38879,6 @@
 +		printk(KERN_INFO  "CPU: Physical Processor ID: %d\n", c->phys_proc_id);
 +		printk(KERN_INFO  "CPU: Processor Core ID: %d\n", c->cpu_core_id);
 +	}
-+
 +#endif
 +}
 +
@@ -38980,8 +39161,8 @@
 +		/* Other (Linux-defined) */
 +		"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
 +		"constant_tsc", NULL, NULL,
-+		"up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 +		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		"up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 +		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 +
 +		/* Intel-defined (#2) */
@@ -39147,7 +39328,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/smp-xen.c linux-2.6.18-xen/arch/x86_64/kernel/smp-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/smp-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/smp-xen.c	2006-08-15 13:03:16.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/smp-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,600 @@
 +/*
 + *	Intel SMP support routines.
@@ -39292,10 +39473,10 @@
 +
 +	cpu = smp_processor_id();
 +	/*
-+	 * orig_rax contains the negated interrupt vector.
++	 * orig_rax contains the interrupt vector - 256.
 +	 * Use that to determine where the sender put the data.
 +	 */
-+	sender = ~regs->orig_rax - INVALIDATE_TLB_VECTOR_START;
++	sender = regs->orig_rax + 256 - INVALIDATE_TLB_VECTOR_START;
 +	f = &per_cpu(flush_state, sender);
 +
 +	if (!cpu_isset(cpu, f->flush_cpumask))
@@ -39751,8 +39932,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/traps-xen.c linux-2.6.18-xen/arch/x86_64/kernel/traps-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/traps-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/traps-xen.c	2006-09-17 17:44:47.000000000 +0200
-@@ -0,0 +1,1175 @@
++++ linux-2.6.18-xen/arch/x86_64/kernel/traps-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,1173 @@
 +/*
 + *  linux/arch/x86-64/traps.c
 + *
@@ -39824,7 +40005,6 @@
 +asmlinkage void spurious_interrupt_bug(void);
 +
 +ATOMIC_NOTIFIER_HEAD(die_chain);
-+EXPORT_SYMBOL(die_chain);
 +
 +int register_die_notifier(struct notifier_block *nb)
 +{
@@ -39861,13 +40041,14 @@
 +	preempt_enable_no_resched();
 +}
 +
-+static int kstack_depth_to_print = 12;
++static int kstack_depth_to_print = 10;
 +#ifdef CONFIG_STACK_UNWIND
 +static int call_trace = 1;
 +#else
 +#define call_trace (-1)
 +#endif
 +
++
 +#ifdef CONFIG_KALLSYMS
 +# include <linux/kallsyms.h>
 +void printk_address(unsigned long address)
@@ -39934,7 +40115,7 @@
 +			break;
 +#endif
 +		default:
-+			end = per_cpu(orig_ist, cpu).ist[k];
++			end = per_cpu(orig_tss, cpu).ist[k];
 +			break;
 +		}
 +		/*
@@ -39996,10 +40177,10 @@
 +	int n = 0;
 +
 +	while (unwind(info) == 0 && UNW_PC(info)) {
-+		n++;
-+		printk_address(UNW_PC(info));
 +		if (arch_unw_user_mode(info))
 +			break;
++		n++;
++		printk_address(UNW_PC(info));
 +	}
 +	return n;
 +}
@@ -40051,12 +40232,11 @@
 +		} else
 +			printk("Inexact backtrace:\n");
 +	}
-+
-+	/*
-+	 * Print function call entries within a stack. 'cond' is the
-+	 * "end of stackframe" condition, that the 'stack++'
-+	 * iteration will eventually trigger.
-+	 */
++ 	/*
++ 	 * Print function call entries within a stack. 'cond' is the
++ 	 * "end of stackframe" condition, that the 'stack++'
++ 	 * iteration will eventually trigger.
++ 	 */
 +#define HANDLE_STACK(cond) \
 +	do while (cond) { \
 +		unsigned long addr = *stack++; \
@@ -40158,7 +40338,7 @@
 +		}
 +		if (i && ((i % 4) == 0))
 +			printk("\n");
-+		printk(" %016lx", *stack++);
++		printk(" %016lx ", *stack++);
 +		touch_nmi_watchdog();
 +	}
 +	show_trace(tsk, regs, rsp);
@@ -40251,7 +40431,6 @@
 +{ 
 +	BUG(); 
 +} 
-+EXPORT_SYMBOL(out_of_line_bug);
 +#endif
 +
 +static DEFINE_SPINLOCK(die_lock);
@@ -40922,15 +41101,99 @@
 +		call_trace = 0;
 +	else if (strcmp(s, "newfallback") == 0)
 +		call_trace = 1;
-+	else if (strcmp(s, "new") == 0)
++ 	else if (strcmp(s, "new") == 0)
 +		call_trace = 2;
 +	return 1;
 +}
 +__setup("call_trace=", call_trace_setup);
 +#endif
+diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/vmlinux.lds.S linux-2.6.18-xen/arch/x86_64/kernel/vmlinux.lds.S
+--- linux-2.6.18/arch/x86_64/kernel/vmlinux.lds.S	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/vmlinux.lds.S	2006-09-21 01:33:31.000000000 +0200
+@@ -13,6 +13,12 @@
+ OUTPUT_ARCH(i386:x86-64)
+ ENTRY(phys_startup_64)
+ jiffies_64 = jiffies;
++PHDRS {
++	text PT_LOAD FLAGS(5);	/* R_E */
++	data PT_LOAD FLAGS(7);	/* RWE */
++	user PT_LOAD FLAGS(7);	/* RWE */
++	note PT_NOTE FLAGS(4);	/* R__ */
++}
+ SECTIONS
+ {
+   . = __START_KERNEL;
+@@ -31,7 +37,7 @@
+ 	KPROBES_TEXT
+ 	*(.fixup)
+ 	*(.gnu.warning)
+-	} = 0x9090
++	} :text = 0x9090
+   				/* out-of-line lock text */
+   .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
+ 
+@@ -57,17 +63,10 @@
+   .data : AT(ADDR(.data) - LOAD_OFFSET) {
+ 	*(.data)
+ 	CONSTRUCTORS
+-	}
++	} :data
+ 
+   _edata = .;			/* End of data section */
+ 
+-  __bss_start = .;		/* BSS */
+-  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
+-	*(.bss.page_aligned)	
+-	*(.bss)
+-	}
+-  __bss_stop = .;
+-
+   . = ALIGN(PAGE_SIZE);
+   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
+   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
+@@ -89,7 +88,7 @@
+ #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
+ 
+   . = VSYSCALL_ADDR;
+-  .vsyscall_0 :	 AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
++  .vsyscall_0 :	 AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) } :user
+   __vsyscall_0 = VSYSCALL_VIRT_ADDR;
+ 
+   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
+@@ -132,7 +131,7 @@
+   . = ALIGN(8192);		/* init_task */
+   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
+ 	*(.data.init_task)
+-  }
++  } :data
+ 
+   . = ALIGN(4096);
+   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
+@@ -222,6 +221,14 @@
+   . = ALIGN(4096);
+   __nosave_end = .;
+ 
++  __bss_start = .;		/* BSS */
++  . = ALIGN(4096);
++  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
++	*(.bss.page_aligned)
++	*(.bss)
++	}
++  __bss_stop = .;
++
+   _end = . ;
+ 
+   /* Sections to be discarded */
+@@ -235,4 +242,6 @@
+   STABS_DEBUG
+ 
+   DWARF_DEBUG
++
++  NOTES
+ }
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/vsyscall-xen.c linux-2.6.18-xen/arch/x86_64/kernel/vsyscall-xen.c
 --- linux-2.6.18/arch/x86_64/kernel/vsyscall-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/vsyscall-xen.c	2006-08-15 13:03:16.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/vsyscall-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,239 @@
 +/*
 + *  linux/arch/x86_64/kernel/vsyscall.c
@@ -41173,7 +41436,7 @@
 +__initcall(vsyscall_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/kernel/xen_entry.S linux-2.6.18-xen/arch/x86_64/kernel/xen_entry.S
 --- linux-2.6.18/arch/x86_64/kernel/xen_entry.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/kernel/xen_entry.S	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/kernel/xen_entry.S	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,40 @@
 +/*
 + * Copied from arch/xen/i386/kernel/entry.S
@@ -41217,7 +41480,7 @@
 +	
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/Makefile linux-2.6.18-xen/arch/x86_64/Makefile
 --- linux-2.6.18/arch/x86_64/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/Makefile	2006-08-15 13:03:15.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/Makefile	2006-09-04 16:31:02.000000000 +0200
 @@ -32,6 +32,10 @@
  cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
  cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
@@ -41261,8 +41524,8 @@
  	$(Q)$(MAKE) $(clean)=$(boot)
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/mm/fault-xen.c linux-2.6.18-xen/arch/x86_64/mm/fault-xen.c
 --- linux-2.6.18/arch/x86_64/mm/fault-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/mm/fault-xen.c	2006-08-15 13:03:16.000000000 +0200
-@@ -0,0 +1,725 @@
++++ linux-2.6.18-xen/arch/x86_64/mm/fault-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,723 @@
 +/*
 + *  linux/arch/x86-64/mm/fault.c
 + *
@@ -41771,10 +42034,8 @@
 +	if (!(vma->vm_flags & VM_GROWSDOWN))
 +		goto bad_area;
 +	if (error_code & 4) {
-+		/* Allow userspace just enough access below the stack pointer
-+		 * to let the 'enter' instruction work.
-+		 */
-+		if (address + 65536 + 32 * sizeof(unsigned long) < regs->rsp)
++		// XXX: align red zone size with ABI 
++		if (address + 128 < regs->rsp)
 +			goto bad_area;
 +	}
 +	if (expand_stack(vma, address))
@@ -41990,8 +42251,8 @@
 +__setup("pagefaulttrace", enable_pagefaulttrace);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/mm/init-xen.c linux-2.6.18-xen/arch/x86_64/mm/init-xen.c
 --- linux-2.6.18/arch/x86_64/mm/init-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/mm/init-xen.c	2006-09-17 17:44:47.000000000 +0200
-@@ -0,0 +1,1209 @@
++++ linux-2.6.18-xen/arch/x86_64/mm/init-xen.c	2006-09-04 16:31:03.000000000 +0200
+@@ -0,0 +1,1200 @@
 +/*
 + *  linux/arch/x86_64/mm/init.c
 + *
@@ -42564,7 +42825,7 @@
 +		mk_kernel_pgd(__pa_symbol(level3_kernel_pgt));
 +	level3_kernel_pgt[pud_index(__START_KERNEL_map)] = 
 +		__pud(__pa_symbol(level2_kernel_pgt) |
-+		      _KERNPG_TABLE | _PAGE_USER);
++		      _KERNPG_TABLE);
 +	memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
 +
 +	early_make_page_readonly(init_level4_pgt,
@@ -42613,7 +42874,7 @@
 +			pte_page = alloc_static_page(&phys);
 +			early_make_page_readonly(
 +				pte_page, XENFEAT_writable_page_tables);
-+			set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
++			set_pmd(pmd, __pmd(phys | _KERNPG_TABLE));
 +		} else {
 +			addr = page[pmd_index(va)];
 +			addr_to_page(addr, pte_page);
@@ -42622,7 +42883,7 @@
 +		if (pte_none(*pte)) {
 +			new_pte = pfn_pte(
 +				(va - __START_KERNEL_map) >> PAGE_SHIFT, 
-+				__pgprot(_KERNPG_TABLE | _PAGE_USER));
++				__pgprot(_KERNPG_TABLE));
 +			xen_l1_entry_update(pte, new_pte);
 +		}
 +		va += PAGE_SIZE;
@@ -42657,7 +42918,7 @@
 +
 +	early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n",
 +		end, table_start << PAGE_SHIFT,
-+		(table_start << PAGE_SHIFT) + tables);
++		     (table_end << PAGE_SHIFT) + tables);
 +}
 +
 +/* Setup the direct mapping of the physical memory at PAGE_OFFSET.
@@ -42687,7 +42948,7 @@
 +		pud_t *pud;
 +
 +		if (after_bootmem) {
-+			pud = pud_offset_k(pgd, start & PGDIR_MASK);
++			pud = pud_offset(pgd, start & PGDIR_MASK);
 +			make_page_readonly(pud, XENFEAT_writable_page_tables);
 +			pud_phys = __pa(pud);
 +		} else {
@@ -42871,6 +43132,7 @@
 +/*
 + * Memory hotplug specific functions
 + */
++
 +void online_page(struct page *page)
 +{
 +	ClearPageReserved(page);
@@ -43031,10 +43293,6 @@
 +void free_init_pages(char *what, unsigned long begin, unsigned long end)
 +{
 +#ifdef __DO_LATER__
-+	/*
-+	 * Some pages can be pinned, but some are not. Unpinning such pages 
-+	 * triggers BUG(). 
-+	 */
 +	unsigned long addr;
 +
 +	if (begin >= end)
@@ -43046,13 +43304,6 @@
 +		init_page_count(virt_to_page(addr));
 +		memset((void *)(addr & ~(PAGE_SIZE-1)),
 +			POISON_FREE_INITMEM, PAGE_SIZE);
-+		make_page_writable(
-+			__va(__pa(addr)), XENFEAT_writable_page_tables);
-+		/*
-+		 * Make pages from __PAGE_OFFSET address as well
-+		 */
-+		make_page_writable(
-+			(void *)addr, XENFEAT_writable_page_tables);
 +		free_page(addr);
 +		totalram_pages++;
 +	}
@@ -43061,11 +43312,13 @@
 +
 +void free_initmem(void)
 +{
++#ifdef __DO_LATER__
 +	memset(__initdata_begin, POISON_FREE_INITDATA,
-+		__initdata_end - __initdata_begin);
++	       __initdata_end - __initdata_begin);
 +	free_init_pages("unused kernel memory",
 +			(unsigned long)(&__init_begin),
 +			(unsigned long)(&__init_end));
++#endif
 +}
 +
 +#ifdef CONFIG_DEBUG_RODATA
@@ -43079,7 +43332,6 @@
 +
 +	printk ("Write protecting the kernel read-only data: %luk\n",
 +			(__end_rodata - __start_rodata) >> 10);
-+
 +	/*
 +	 * change_page_attr_addr() requires a global_flush_tlb() call after it.
 +	 * We do this after the printk so that if something went wrong in the
@@ -43203,7 +43455,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/mm/Makefile linux-2.6.18-xen/arch/x86_64/mm/Makefile
 --- linux-2.6.18/arch/x86_64/mm/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/mm/Makefile	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/mm/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -9,3 +9,13 @@
  obj-$(CONFIG_ACPI_NUMA) += srat.o
  
@@ -43220,7 +43472,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/mm/pageattr-xen.c linux-2.6.18-xen/arch/x86_64/mm/pageattr-xen.c
 --- linux-2.6.18/arch/x86_64/mm/pageattr-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/arch/x86_64/mm/pageattr-xen.c	2006-08-15 13:03:16.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/mm/pageattr-xen.c	2006-09-04 16:31:03.000000000 +0200
 @@ -0,0 +1,396 @@
 +/* 
 + * Copyright 2002 Andi Kleen, SuSE Labs. 
@@ -43620,7 +43872,7 @@
 +EXPORT_SYMBOL(global_flush_tlb);
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/oprofile/Makefile linux-2.6.18-xen/arch/x86_64/oprofile/Makefile
 --- linux-2.6.18/arch/x86_64/oprofile/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/oprofile/Makefile	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/oprofile/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -11,9 +11,12 @@
  	oprofilefs.o oprofile_stats.o \
  	timer_int.o )
@@ -43637,7 +43889,7 @@
  oprofile-y = $(DRIVER_OBJS) $(addprefix ../../i386/oprofile/, $(OPROFILE-y))
 diff -urN -x .hg -x .hgtags linux-2.6.18/arch/x86_64/pci/Makefile linux-2.6.18-xen/arch/x86_64/pci/Makefile
 --- linux-2.6.18/arch/x86_64/pci/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/arch/x86_64/pci/Makefile	2006-05-26 22:00:14.000000000 +0200
++++ linux-2.6.18-xen/arch/x86_64/pci/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -15,11 +15,23 @@
  
  obj-$(CONFIG_NUMA)	+= k8-bus.o
@@ -43664,7 +43916,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/acpi/Kconfig linux-2.6.18-xen/drivers/acpi/Kconfig
 --- linux-2.6.18/drivers/acpi/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/acpi/Kconfig	2006-08-15 13:03:16.000000000 +0200
++++ linux-2.6.18-xen/drivers/acpi/Kconfig	2006-09-04 16:31:03.000000000 +0200
 @@ -45,7 +45,7 @@
  
  config ACPI_SLEEP
@@ -43682,9 +43934,21 @@
  	default y
  	help
  	  The Power Management Timer is available on all ACPI-capable,
+diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/hangcheck-timer.c linux-2.6.18-xen/drivers/char/hangcheck-timer.c
+--- linux-2.6.18/drivers/char/hangcheck-timer.c	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/hangcheck-timer.c	2006-09-04 16:31:04.000000000 +0200
+@@ -117,7 +117,7 @@
+ __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks);
+ #endif /* not MODULE */
+ 
+-#if defined(CONFIG_X86_64) || defined(CONFIG_S390)
++#if defined(CONFIG_X86_64) || defined(CONFIG_S390) || defined(CONFIG_X86_XEN)
+ # define HAVE_MONOTONIC
+ # define TIMER_FREQ 1000000000ULL
+ #elif defined(CONFIG_IA64)
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/mem.c linux-2.6.18-xen/drivers/char/mem.c
 --- linux-2.6.18/drivers/char/mem.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/char/mem.c	2006-08-15 13:03:17.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/mem.c	2006-09-04 16:31:04.000000000 +0200
 @@ -101,6 +101,7 @@
  }
  #endif
@@ -43721,16 +43985,17 @@
  	.llseek		= memory_lseek,
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/Kconfig linux-2.6.18-xen/drivers/char/tpm/Kconfig
 --- linux-2.6.18/drivers/char/tpm/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/char/tpm/Kconfig	2006-08-15 13:03:18.000000000 +0200
-@@ -31,6 +31,7 @@
++++ linux-2.6.18-xen/drivers/char/tpm/Kconfig	2006-09-04 16:31:04.000000000 +0200
+@@ -31,7 +31,7 @@
  
  config TCG_NSC
  	tristate "National Semiconductor TPM Interface"
+-	depends on TCG_TPM && PNPACPI
 +	depends on TCG_TPM && PNPACPI && !XEN_UNPRIVILEGED_GUEST
- 	depends on TCG_TPM && PNPACPI
  	---help---
  	  If you have a TPM security chip from National Semicondutor 
-@@ -58,5 +59,13 @@
+ 	  say Yes and it will be accessible from within Linux.  To 
+@@ -58,5 +58,13 @@
  	  Further information on this driver and the supported hardware
  	  can be found at http://www.prosec.rub.de/tpm
  
@@ -43747,7 +44012,7 @@
 +endmenu
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/Makefile linux-2.6.18-xen/drivers/char/tpm/Makefile
 --- linux-2.6.18/drivers/char/tpm/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/char/tpm/Makefile	2006-08-15 13:03:18.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/tpm/Makefile	2006-09-04 16:31:04.000000000 +0200
 @@ -9,3 +9,5 @@
  obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
  obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
@@ -43756,7 +44021,7 @@
 +tpm_xenu-y = tpm_xen.o tpm_vtpm.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/tpm.c linux-2.6.18-xen/drivers/char/tpm/tpm.c
 --- linux-2.6.18/drivers/char/tpm/tpm.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/char/tpm/tpm.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/tpm/tpm.c	2006-09-04 16:31:04.000000000 +0200
 @@ -30,7 +30,9 @@
  
  enum tpm_const {
@@ -43879,84 +44144,38 @@
  EXPORT_SYMBOL_GPL(tpm_read);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/tpm.h linux-2.6.18-xen/drivers/char/tpm/tpm.h
 --- linux-2.6.18/drivers/char/tpm/tpm.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/char/tpm/tpm.h	2006-08-15 13:03:18.000000000 +0200
-@@ -26,6 +26,13 @@
- #include <linux/platform_device.h>
- #include <linux/io.h>
- 
-+#ifdef CONFIG_XEN
-+enum tpm_bufsize {
-+	TPM_MIN_BUFFERSIZE = 2048,
-+	TPM_MAX_BUFFERSIZE = 64 * 1024,
-+};
-+#endif
-+
- enum tpm_timeout {
- 	TPM_TIMEOUT = 5,	/* msecs */
- };
-@@ -61,6 +68,9 @@
++++ linux-2.6.18-xen/drivers/char/tpm/tpm.h	2006-09-21 01:33:31.000000000 +0200
+@@ -61,6 +61,7 @@
  	const u8 req_complete_mask;
  	const u8 req_complete_val;
  	const u8 req_canceled;
-+#ifdef CONFIG_XEN
 +	u32 buffersize;
-+#endif
  	void __iomem *iobase;		/* ioremapped address */
  	unsigned long base;		/* TPM base address */
  
-@@ -94,6 +104,9 @@
+@@ -94,6 +95,7 @@
  	/* Data passed to and from the tpm via the read/write calls */
  	u8 *data_buffer;
  	atomic_t data_pending;
-+#ifdef CONFIG_XEN
 +	atomic_t data_position;
-+#endif
  	struct semaphore buffer_mutex;
  
  	struct timer_list user_read_timer;	/* user needs to claim result */
-@@ -105,6 +118,9 @@
- 	struct dentry **bios_dir;
- 
- 	struct list_head list;
-+#ifdef CONFIG_XEN
-+	void *priv;
-+#endif
- };
- 
- #define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)
-@@ -121,6 +137,29 @@
+@@ -121,6 +123,11 @@
  	outb(value & 0xFF, base+1);
  }
  
-+#ifdef CONFIG_XEN
 +static inline u32 get_chip_buffersize(struct tpm_chip *chip)
 +{
-+	u32 size = chip->vendor.buffersize;
-+	if (size > TPM_MAX_BUFFERSIZE) {
-+		return TPM_MAX_BUFFERSIZE;
-+	} else if (size < TPM_MIN_BUFFERSIZE) {
-+		return TPM_MIN_BUFFERSIZE;
-+	}
-+	return size;
-+}
-+
-+static inline void *chip_get_private(const struct tpm_chip *chip)
-+{
-+	return chip->priv;
-+}
-+
-+static inline void chip_set_private(struct tpm_chip *chip, void *priv)
-+{
-+	chip->priv = priv;
++	return chip->vendor.buffersize;
 +}
-+#endif
 +
  extern void tpm_get_timeouts(struct tpm_chip *);
  extern void tpm_gen_interrupt(struct tpm_chip *);
  extern void tpm_continue_selftest(struct tpm_chip *);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/tpm_vtpm.c linux-2.6.18-xen/drivers/char/tpm/tpm_vtpm.c
 --- linux-2.6.18/drivers/char/tpm/tpm_vtpm.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/char/tpm/tpm_vtpm.c	2006-08-15 13:03:18.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/tpm/tpm_vtpm.c	2006-09-04 16:31:04.000000000 +0200
 @@ -0,0 +1,547 @@
 +/*
 + * Copyright (C) 2006 IBM Corporation
@@ -44507,7 +44726,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/tpm_vtpm.h linux-2.6.18-xen/drivers/char/tpm/tpm_vtpm.h
 --- linux-2.6.18/drivers/char/tpm/tpm_vtpm.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/char/tpm/tpm_vtpm.h	2006-08-15 13:03:18.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/tpm/tpm_vtpm.h	2006-09-04 16:31:04.000000000 +0200
 @@ -0,0 +1,68 @@
 +#ifndef TPM_VTPM_H
 +#define TPM_VTPM_H
@@ -44579,7 +44798,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tpm/tpm_xen.c linux-2.6.18-xen/drivers/char/tpm/tpm_xen.c
 --- linux-2.6.18/drivers/char/tpm/tpm_xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/char/tpm/tpm_xen.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/tpm/tpm_xen.c	2006-09-04 16:31:04.000000000 +0200
 @@ -0,0 +1,756 @@
 +/*
 + * Copyright (c) 2005, IBM Corporation
@@ -45339,7 +45558,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/char/tty_io.c linux-2.6.18-xen/drivers/char/tty_io.c
 --- linux-2.6.18/drivers/char/tty_io.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/char/tty_io.c	2006-09-17 17:44:47.000000000 +0200
++++ linux-2.6.18-xen/drivers/char/tty_io.c	2006-09-04 16:31:04.000000000 +0200
 @@ -130,6 +130,8 @@
     vt.c for deeply disgusting hack reasons */
  DEFINE_MUTEX(tty_mutex);
@@ -45377,7 +45596,7 @@
  }
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/firmware/Kconfig linux-2.6.18-xen/drivers/firmware/Kconfig
 --- linux-2.6.18/drivers/firmware/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/firmware/Kconfig	2006-08-15 13:03:18.000000000 +0200
++++ linux-2.6.18-xen/drivers/firmware/Kconfig	2006-09-04 16:31:04.000000000 +0200
 @@ -7,7 +7,7 @@
  
  config EDD
@@ -45389,7 +45608,7 @@
  	  Services real mode BIOS calls to determine which disk
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/ide/ide-lib.c linux-2.6.18-xen/drivers/ide/ide-lib.c
 --- linux-2.6.18/drivers/ide/ide-lib.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/ide/ide-lib.c	2006-08-15 13:03:19.000000000 +0200
++++ linux-2.6.18-xen/drivers/ide/ide-lib.c	2006-09-04 16:31:04.000000000 +0200
 @@ -408,10 +408,10 @@
  {
  	u64 addr = BLK_BOUNCE_HIGH;	/* dma64_addr_t */
@@ -45407,7 +45626,7 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/Makefile linux-2.6.18-xen/drivers/Makefile
 --- linux-2.6.18/drivers/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/Makefile	2006-08-15 13:03:16.000000000 +0200
++++ linux-2.6.18-xen/drivers/Makefile	2006-09-04 16:31:03.000000000 +0200
 @@ -31,6 +31,7 @@
  obj-$(CONFIG_NUBUS)		+= nubus/
  obj-$(CONFIG_ATM)		+= atm/
@@ -45418,7 +45637,7 @@
  obj-$(CONFIG_SCSI)		+= scsi/
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/buffer_sync.c linux-2.6.18-xen/drivers/oprofile/buffer_sync.c
 --- linux-2.6.18/drivers/oprofile/buffer_sync.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/buffer_sync.c	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/buffer_sync.c	2006-09-04 16:31:08.000000000 +0200
 @@ -6,6 +6,10 @@
   *
   * @author John Levon <levon at movementarian.org>
@@ -45541,7 +45760,7 @@
  		}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/cpu_buffer.c linux-2.6.18-xen/drivers/oprofile/cpu_buffer.c
 --- linux-2.6.18/drivers/oprofile/cpu_buffer.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/cpu_buffer.c	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/cpu_buffer.c	2006-09-04 16:31:08.000000000 +0200
 @@ -6,6 +6,10 @@
   *
   * @author John Levon <levon at movementarian.org>
@@ -45598,12 +45817,13 @@
  {
  	struct task_struct * task;
  
-@@ -180,18 +186,18 @@
+@@ -180,18 +186,20 @@
  		return 0;
  	}
  
 -	is_kernel = !!is_kernel;
--
++	WARN_ON(cpu_mode > CPU_MODE_XEN);
+ 
  	task = current;
  
  	/* notice a switch from user->kernel or vice versa */
@@ -45624,7 +45844,7 @@
  		cpu_buf->last_task = task;
  		add_code(cpu_buf, (unsigned long)task);
  	}
-@@ -275,6 +281,25 @@
+@@ -275,6 +283,25 @@
  	add_sample(cpu_buf, pc, 0);
  }
  
@@ -45652,7 +45872,7 @@
   * the task mortuary progresses
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/cpu_buffer.h linux-2.6.18-xen/drivers/oprofile/cpu_buffer.h
 --- linux-2.6.18/drivers/oprofile/cpu_buffer.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/cpu_buffer.h	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/cpu_buffer.h	2006-09-04 16:31:08.000000000 +0200
 @@ -36,7 +36,7 @@
  	volatile unsigned long tail_pos;
  	unsigned long buffer_size;
@@ -45677,7 +45897,7 @@
  #endif /* OPROFILE_CPU_BUFFER_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/event_buffer.h linux-2.6.18-xen/drivers/oprofile/event_buffer.h
 --- linux-2.6.18/drivers/oprofile/event_buffer.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/event_buffer.h	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/event_buffer.h	2006-09-04 16:31:08.000000000 +0200
 @@ -29,15 +29,20 @@
  #define CPU_SWITCH_CODE 		2
  #define COOKIE_SWITCH_CODE 		3
@@ -45702,7 +45922,7 @@
   
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/oprof.c linux-2.6.18-xen/drivers/oprofile/oprof.c
 --- linux-2.6.18/drivers/oprofile/oprof.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/oprof.c	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/oprof.c	2006-09-04 16:31:08.000000000 +0200
 @@ -5,6 +5,10 @@
   * @remark Read the file COPYING
   *
@@ -45758,7 +45978,7 @@
  	int err;
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/oprof.h linux-2.6.18-xen/drivers/oprofile/oprof.h
 --- linux-2.6.18/drivers/oprofile/oprof.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/oprof.h	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/oprof.h	2006-09-04 16:31:08.000000000 +0200
 @@ -35,5 +35,8 @@
  void oprofile_timer_init(struct oprofile_operations * ops);
  
@@ -45770,7 +45990,7 @@
  #endif /* OPROF_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/oprofile/oprofile_files.c linux-2.6.18-xen/drivers/oprofile/oprofile_files.c
 --- linux-2.6.18/drivers/oprofile/oprofile_files.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/oprofile/oprofile_files.c	2006-08-15 13:03:24.000000000 +0200
++++ linux-2.6.18-xen/drivers/oprofile/oprofile_files.c	2006-09-04 16:31:08.000000000 +0200
 @@ -5,15 +5,21 @@
   * @remark Read the file COPYING
   *
@@ -45794,13 +46014,14 @@
  unsigned long fs_buffer_size = 131072;
  unsigned long fs_cpu_buffer_size = 8192;
  unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
-@@ -117,11 +123,206 @@
+@@ -117,11 +123,208 @@
  static struct file_operations dump_fops = {
  	.write		= dump_write,
  };
 - 
 +
 +#ifdef CONFIG_XEN
++
 +#define TMPBUFSIZE 512
 +
 +static unsigned int adomains = 0;
@@ -45989,7 +46210,8 @@
 +	.read		= pdomain_read,
 +	.write		= pdomain_write,
 +};
-+#endif
++
++#endif /* CONFIG_XEN */
 +
  void oprofile_create_files(struct super_block * sb, struct dentry * root)
  {
@@ -46004,7 +46226,7 @@
  	oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/pci/Kconfig linux-2.6.18-xen/drivers/pci/Kconfig
 --- linux-2.6.18/drivers/pci/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/pci/Kconfig	2006-05-26 22:00:30.000000000 +0200
++++ linux-2.6.18-xen/drivers/pci/Kconfig	2006-09-04 16:31:08.000000000 +0200
 @@ -5,6 +5,7 @@
  	bool "Message Signaled Interrupts (MSI and MSI-X)"
  	depends on PCI
@@ -46015,7 +46237,7 @@
  	   Interrupts).  Message Signaled Interrupts enable a device to
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/serial/Kconfig linux-2.6.18-xen/drivers/serial/Kconfig
 --- linux-2.6.18/drivers/serial/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/drivers/serial/Kconfig	2006-08-15 13:03:26.000000000 +0200
++++ linux-2.6.18-xen/drivers/serial/Kconfig	2006-09-04 16:31:10.000000000 +0200
 @@ -11,6 +11,7 @@
  config SERIAL_8250
  	tristate "8250/16550 and compatible serial support"
@@ -46026,7 +46248,7 @@
  	  This selects whether you want to include the driver for the standard
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/balloon/balloon.c linux-2.6.18-xen/drivers/xen/balloon/balloon.c
 --- linux-2.6.18/drivers/xen/balloon/balloon.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/balloon/balloon.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/balloon/balloon.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,625 @@
 +/******************************************************************************
 + * balloon.c
@@ -46655,14 +46877,14 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/balloon/Makefile linux-2.6.18-xen/drivers/xen/balloon/Makefile
 --- linux-2.6.18/drivers/xen/balloon/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/balloon/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/balloon/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +obj-y += balloon.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkback/blkback.c linux-2.6.18-xen/drivers/xen/blkback/blkback.c
 --- linux-2.6.18/drivers/xen/blkback/blkback.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkback/blkback.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,566 @@
++++ linux-2.6.18-xen/drivers/xen/blkback/blkback.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,567 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/main.c
 + * 
@@ -46705,6 +46927,7 @@
 +#include <linux/list.h>
 +#include <xen/balloon.h>
 +#include <asm/hypervisor.h>
++#include <asm/hypercall.h>
 +#include "common.h"
 +
 +/*
@@ -47231,7 +47454,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkback/common.h linux-2.6.18-xen/drivers/xen/blkback/common.h
 --- linux-2.6.18/drivers/xen/blkback/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkback/common.h	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkback/common.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,133 @@
 +/* 
 + * This program is free software; you can redistribute it and/or
@@ -47368,7 +47591,7 @@
 +#endif /* __BLKIF__BACKEND__COMMON_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkback/interface.c linux-2.6.18-xen/drivers/xen/blkback/interface.c
 --- linux-2.6.18/drivers/xen/blkback/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkback/interface.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkback/interface.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,171 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/interface.c
@@ -47543,14 +47766,14 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkback/Makefile linux-2.6.18-xen/drivers/xen/blkback/Makefile
 --- linux-2.6.18/drivers/xen/blkback/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkback/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkback/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,3 @@
 +obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkbk.o
 +
 +blkbk-y	:= blkback.o xenbus.o interface.o vbd.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkback/vbd.c linux-2.6.18-xen/drivers/xen/blkback/vbd.c
 --- linux-2.6.18/drivers/xen/blkback/vbd.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkback/vbd.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkback/vbd.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,119 @@
 +/******************************************************************************
 + * blkback/vbd.c
@@ -47673,8 +47896,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkback/xenbus.c linux-2.6.18-xen/drivers/xen/blkback/xenbus.c
 --- linux-2.6.18/drivers/xen/blkback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkback/xenbus.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,464 @@
++++ linux-2.6.18-xen/drivers/xen/blkback/xenbus.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,468 @@
 +/*  Xenbus code for blkif backend
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
 +    Copyright (C) 2005 XenSource Ltd
@@ -47978,11 +48201,11 @@
 +	struct backend_info *be = dev->dev.driver_data;
 +	int err;
 +
-+	DPRINTK("");
++	DPRINTK("%s", xenbus_strstate(frontend_state));
 +
 +	switch (frontend_state) {
 +	case XenbusStateInitialising:
-+		if (dev->state == XenbusStateClosing) {
++		if (dev->state == XenbusStateClosed) {
 +			printk("%s: %s: prepare for reconnect\n",
 +			       __FUNCTION__, dev->nodename);
 +			xenbus_switch_state(dev, XenbusStateInitWait);
@@ -48008,8 +48231,12 @@
 +		xenbus_switch_state(dev, XenbusStateClosing);
 +		break;
 +
-+	case XenbusStateUnknown:
 +	case XenbusStateClosed:
++		xenbus_switch_state(dev, XenbusStateClosed);
++		if (xenbus_dev_is_online(dev))
++			break;
++		/* fall through if not online */
++	case XenbusStateUnknown:
 +		device_unregister(&dev->dev);
 +		break;
 +
@@ -48141,7 +48368,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkfront/blkfront.c linux-2.6.18-xen/drivers/xen/blkfront/blkfront.c
 --- linux-2.6.18/drivers/xen/blkfront/blkfront.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkfront/blkfront.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkfront/blkfront.c	2006-09-21 01:33:31.000000000 +0200
 @@ -0,0 +1,842 @@
 +/******************************************************************************
 + * blkfront.c
@@ -48418,7 +48645,7 @@
 +			xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
 +
 +		mutex_lock(&bd->bd_mutex);
-+		if (info->users > 0)
++		if (info->users > 0 && system_state == SYSTEM_RUNNING)
 +			xenbus_dev_error(dev, -EBUSY,
 +					 "Device in use; refusing to close");
 +		else
@@ -48505,7 +48732,7 @@
 +
 +	xlvbd_del(info);
 +
-+	xenbus_switch_state(dev, XenbusStateClosed);
++	xenbus_frontend_closed(dev);
 +}
 +
 +
@@ -48987,7 +49214,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkfront/block.h linux-2.6.18-xen/drivers/xen/blkfront/block.h
 --- linux-2.6.18/drivers/xen/blkfront/block.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkfront/block.h	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkfront/block.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,154 @@
 +/******************************************************************************
 + * block.h
@@ -49145,7 +49372,7 @@
 +#endif /* __XEN_DRIVERS_BLOCK_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkfront/Kconfig linux-2.6.18-xen/drivers/xen/blkfront/Kconfig
 --- linux-2.6.18/drivers/xen/blkfront/Kconfig	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkfront/Kconfig	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkfront/Kconfig	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,6 @@
 +
 +config XENBLOCK
@@ -49155,7 +49382,7 @@
 +	  Block device driver for Xen
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkfront/Makefile linux-2.6.18-xen/drivers/xen/blkfront/Makefile
 --- linux-2.6.18/drivers/xen/blkfront/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkfront/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blkfront/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,5 @@
 +
 +obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	:= xenblk.o
@@ -49164,8 +49391,8 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blkfront/vbd.c linux-2.6.18-xen/drivers/xen/blkfront/vbd.c
 --- linux-2.6.18/drivers/xen/blkfront/vbd.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blkfront/vbd.c	2006-08-15 13:03:28.000000000 +0200
-@@ -0,0 +1,317 @@
++++ linux-2.6.18-xen/drivers/xen/blkfront/vbd.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,318 @@
 +/******************************************************************************
 + * vbd.c
 + * 
@@ -49298,6 +49525,7 @@
 +		return NULL;
 +	}
 +
++/*	devfs_mk_dir(ptr->type->devname);*/
 +	major_info[index] = ptr;
 +	return ptr;
 +}
@@ -49485,8 +49713,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blktap/blktap.c linux-2.6.18-xen/drivers/xen/blktap/blktap.c
 --- linux-2.6.18/drivers/xen/blktap/blktap.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blktap/blktap.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,1442 @@
++++ linux-2.6.18-xen/drivers/xen/blktap/blktap.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,1444 @@
 +/******************************************************************************
 + * drivers/xen/blktap/blktap.c
 + * 
@@ -49602,8 +49830,8 @@
 +} domid_translate_t ;
 +
 +
-+domid_translate_t  translate_domid[MAX_TAP_DEV];
-+tap_blkif_t *tapfds[MAX_TAP_DEV];
++static domid_translate_t  translate_domid[MAX_TAP_DEV];
++static tap_blkif_t *tapfds[MAX_TAP_DEV];
 +
 +static int __init set_blkif_reqs(char *str)
 +{
@@ -50606,7 +50834,7 @@
 +			       "ring does not exist!\n");
 +			print_dbug = 0; /*We only print this message once*/
 +		}
-+		return 1;
++		return 0;
 +	}
 +
 +	info = tapfds[blkif->dev_num];
@@ -50615,7 +50843,7 @@
 +			WPRINTK("Can't get UE info!\n");
 +			print_dbug = 0;
 +		}
-+		return 1;
++		return 0;
 +	}
 +
 +	while (rc != rp) {
@@ -50880,7 +51108,7 @@
 +
 +static int __init blkif_init(void)
 +{
-+	int i,ret;
++	int i, ret;
 +	tap_blkif_t *info;
 +
 +	if (!is_running_on_xen())
@@ -50906,7 +51134,7 @@
 +
 +	ret = register_chrdev(BLKTAP_DEV_MAJOR,"blktap",&blktap_fops);
 +
-+	if (ret < 0) {
++	if ( (ret < 0) ) {
 +		WPRINTK("Couldn't register /dev/xen/blktap\n");
 +		return -ENOMEM;
 +	}	
@@ -50919,6 +51147,8 @@
 +		info->blkif = NULL;
 +
 +		info->dev_pending = info->dev_inuse = 0;
++
++		DPRINTK("Created misc_dev [/dev/xen/blktap%d]\n",i);
 +	}
 +	
 +	DPRINTK("Blktap device successfully created\n");
@@ -50931,8 +51161,8 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blktap/common.h linux-2.6.18-xen/drivers/xen/blktap/common.h
 --- linux-2.6.18/drivers/xen/blktap/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blktap/common.h	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,119 @@
++++ linux-2.6.18-xen/drivers/xen/blktap/common.h	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,120 @@
 +/* 
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License version 2
@@ -51025,6 +51255,7 @@
 +void tap_blkif_free(blkif_t *blkif);
 +int tap_blkif_map(blkif_t *blkif, unsigned long shared_page, 
 +		  unsigned int evtchn);
++void tap_blkif_unmap(blkif_t *blkif);
 +
 +#define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
 +#define blkif_put(_b)					\
@@ -51054,8 +51285,8 @@
 +#endif /* __BLKIF__BACKEND__COMMON_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blktap/interface.c linux-2.6.18-xen/drivers/xen/blktap/interface.c
 --- linux-2.6.18/drivers/xen/blktap/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blktap/interface.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,159 @@
++++ linux-2.6.18-xen/drivers/xen/blktap/interface.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,164 @@
 +/******************************************************************************
 + * drivers/xen/blktap/interface.c
 + * 
@@ -51193,20 +51424,25 @@
 +	return 0;
 +}
 +
-+void tap_blkif_free(blkif_t *blkif)
++void tap_blkif_unmap(blkif_t *blkif)
 +{
-+	atomic_dec(&blkif->refcnt);
-+	wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
-+
-+	/* Already disconnected? */
-+	if (blkif->irq)
++	if (blkif->irq) {
 +		unbind_from_irqhandler(blkif->irq, blkif);
-+
++		blkif->irq = 0;
++	}
 +	if (blkif->blk_ring.sring) {
 +		unmap_frontend_page(blkif);
 +		free_vm_area(blkif->blk_ring_area);
++		blkif->blk_ring.sring = NULL;
 +	}
++}
++
++void tap_blkif_free(blkif_t *blkif)
++{
++	atomic_dec(&blkif->refcnt);
++	wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
 +
++	tap_blkif_unmap(blkif);
 +	kmem_cache_free(blkif_cachep, blkif);
 +}
 +
@@ -51217,15 +51453,15 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blktap/Makefile linux-2.6.18-xen/drivers/xen/blktap/Makefile
 --- linux-2.6.18/drivers/xen/blktap/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blktap/Makefile	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/blktap/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,3 @@
 +LINUXINCLUDE += -I../xen/include/public/io
 +obj-y	:= xenbus.o interface.o blktap.o 
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/blktap/xenbus.c linux-2.6.18-xen/drivers/xen/blktap/xenbus.c
 --- linux-2.6.18/drivers/xen/blktap/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/blktap/xenbus.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,353 @@
++++ linux-2.6.18-xen/drivers/xen/blktap/xenbus.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,367 @@
 +/* drivers/xen/blktap/xenbus.c
 + *
 + * Xenbus code for blktap
@@ -51475,6 +51711,11 @@
 +
 +	switch (frontend_state) {
 +	case XenbusStateInitialising:
++		if (dev->state == XenbusStateClosed) {
++			printk("%s: %s: prepare for reconnect\n",
++			       __FUNCTION__, dev->nodename);
++			xenbus_switch_state(dev, XenbusStateInitWait);
++		}
 +		break;
 +
 +	case XenbusStateInitialised:
@@ -51492,11 +51733,20 @@
 +		break;
 +
 +	case XenbusStateClosing:
++		if (be->blkif->xenblkd) {
++			kthread_stop(be->blkif->xenblkd);
++			be->blkif->xenblkd = NULL;
++		}
++		tap_blkif_unmap(be->blkif);
 +		xenbus_switch_state(dev, XenbusStateClosing);
 +		break;
 +
-+	case XenbusStateUnknown:
 +	case XenbusStateClosed:
++		xenbus_switch_state(dev, XenbusStateClosed);
++		if (xenbus_dev_is_online(dev))
++			break;
++		/* fall through if not online */
++	case XenbusStateUnknown:
 +		device_unregister(&dev->dev);
 +		break;
 +
@@ -51581,13 +51831,13 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/char/Makefile linux-2.6.18-xen/drivers/xen/char/Makefile
 --- linux-2.6.18/drivers/xen/char/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/char/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/char/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= mem.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/char/mem.c linux-2.6.18-xen/drivers/xen/char/mem.c
 --- linux-2.6.18/drivers/xen/char/mem.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/char/mem.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/char/mem.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,180 @@
 +/*
 + *  Originally from linux/drivers/char/mem.c
@@ -51771,8 +52021,8 @@
 +};
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/console/console.c linux-2.6.18-xen/drivers/xen/console/console.c
 --- linux-2.6.18/drivers/xen/console/console.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/console/console.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,644 @@
++++ linux-2.6.18-xen/drivers/xen/console/console.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,688 @@
 +/******************************************************************************
 + * console.c
 + * 
@@ -51813,6 +52063,7 @@
 +#include <linux/interrupt.h>
 +#include <linux/tty.h>
 +#include <linux/tty_flip.h>
++#include <linux/vt.h>
 +#include <linux/serial.h>
 +#include <linux/major.h>
 +#include <linux/ptrace.h>
@@ -51823,7 +52074,7 @@
 +#include <linux/console.h>
 +#include <linux/bootmem.h>
 +#include <linux/sysrq.h>
-+#include <linux/vt.h>
++#include <linux/screen_info.h>
 +#include <asm/io.h>
 +#include <asm/irq.h>
 +#include <asm/uaccess.h>
@@ -51957,17 +52208,18 @@
 +	.index	= -1,
 +};
 +
-+#define __RETCODE 0
 +static int __init xen_console_init(void)
 +{
 +	if (!is_running_on_xen())
-+		return __RETCODE;
++		goto out;
 +
 +	if (is_initial_xendomain()) {
 +		if (xc_mode == XC_DEFAULT)
 +			xc_mode = XC_SERIAL;
 +		kcons_info.write = kcons_write_dom0;
 +	} else {
++		if (!xen_start_info->console.domU.evtchn)
++			goto out;
 +		if (xc_mode == XC_DEFAULT)
 +			xc_mode = XC_TTY;
 +		kcons_info.write = kcons_write;
@@ -51987,14 +52239,15 @@
 +		break;
 +
 +	default:
-+		return __RETCODE;
++		goto out;
 +	}
 +
 +	wbuf = alloc_bootmem(wbuf_size);
 +
 +	register_console(&kcons_info);
 +
-+	return __RETCODE;
++ out:
++	return 0;
 +}
 +console_initcall(xen_console_init);
 +
@@ -52022,7 +52275,9 @@
 +	int sz;
 +
 +	/* Emergency console is synchronous, so there's nothing to flush. */
-+	if (is_initial_xendomain())
++	if (!is_running_on_xen() ||
++	    is_initial_xendomain() ||
++	    !xen_start_info->console.domU.evtchn)
 +		return;
 +
 +	/* Spin until console data is flushed through to the daemon. */
@@ -52037,6 +52292,41 @@
 +}
 +
 +
++void dom0_init_screen_info(const struct dom0_vga_console_info *info)
++{
++	switch (info->video_type) {
++	case XEN_VGATYPE_TEXT_MODE_3:
++		screen_info.orig_video_mode = 3;
++		screen_info.orig_video_ega_bx = 3;
++		screen_info.orig_video_isVGA = 1;
++		screen_info.orig_video_lines = info->u.text_mode_3.rows;
++		screen_info.orig_video_cols = info->u.text_mode_3.columns;
++		screen_info.orig_x = info->u.text_mode_3.cursor_x;
++		screen_info.orig_y = info->u.text_mode_3.cursor_y;
++		screen_info.orig_video_points =
++			info->u.text_mode_3.font_height;
++		break;
++	case XEN_VGATYPE_VESA_LFB:
++		screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB;
++		screen_info.lfb_width = info->u.vesa_lfb.width;
++		screen_info.lfb_height = info->u.vesa_lfb.height;
++		screen_info.lfb_depth = info->u.vesa_lfb.bits_per_pixel;
++		screen_info.lfb_base = info->u.vesa_lfb.lfb_base;
++		screen_info.lfb_size = info->u.vesa_lfb.lfb_size;
++		screen_info.lfb_linelength = info->u.vesa_lfb.bytes_per_line;
++		screen_info.red_size = info->u.vesa_lfb.red_size;
++		screen_info.red_pos = info->u.vesa_lfb.red_pos;
++		screen_info.green_size = info->u.vesa_lfb.green_size;
++		screen_info.green_pos = info->u.vesa_lfb.green_pos;
++		screen_info.blue_size = info->u.vesa_lfb.blue_size;
++		screen_info.blue_pos = info->u.vesa_lfb.blue_pos;
++		screen_info.rsvd_size = info->u.vesa_lfb.rsvd_size;
++		screen_info.rsvd_pos = info->u.vesa_lfb.rsvd_pos;
++		break;
++	}
++}
++
++
 +/******************** User-space console driver (/dev/console) ************/
 +
 +#define DRV(_d)         (_d)
@@ -52357,7 +52647,11 @@
 +	if (xc_mode == XC_OFF)
 +		return 0;
 +
-+	xencons_ring_init();
++	if (!is_initial_xendomain()) {
++		rc = xencons_ring_init();
++		if (rc)
++			return rc;
++	}
 +
 +	xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
 +					  1 : MAX_NR_CONSOLES);
@@ -52419,14 +52713,14 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/console/Makefile linux-2.6.18-xen/drivers/xen/console/Makefile
 --- linux-2.6.18/drivers/xen/console/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/console/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/console/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= console.o xencons_ring.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/console/xencons_ring.c linux-2.6.18-xen/drivers/xen/console/xencons_ring.c
 --- linux-2.6.18/drivers/xen/console/xencons_ring.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/console/xencons_ring.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,141 @@
++++ linux-2.6.18-xen/drivers/xen/console/xencons_ring.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,143 @@
 +/* 
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License version 2
@@ -52539,24 +52833,26 @@
 +
 +int xencons_ring_init(void)
 +{
-+	int err;
++	int irq;
 +
 +	if (xencons_irq)
 +		unbind_from_irqhandler(xencons_irq, NULL);
 +	xencons_irq = 0;
 +
-+	if (!xen_start_info->console.domU.evtchn)
-+		return 0;
++	if (!is_running_on_xen() ||
++	    is_initial_xendomain() ||
++	    !xen_start_info->console.domU.evtchn)
++		return -ENODEV;
 +
-+	err = bind_evtchn_to_irqhandler(
++	irq = bind_evtchn_to_irqhandler(
 +		xen_start_info->console.domU.evtchn,
 +		handle_input, 0, "xencons", NULL);
-+	if (err <= 0) {
-+		printk(KERN_ERR "XEN console request irq failed %i\n", err);
-+		return err;
++	if (irq < 0) {
++		printk(KERN_ERR "XEN console request irq failed %i\n", irq);
++		return irq;
 +	}
 +
-+	xencons_irq = err;
++	xencons_irq = irq;
 +
 +	/* In case we have in-flight data after save/restore... */
 +	notify_daemon();
@@ -52570,7 +52866,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/cpu_hotplug.c linux-2.6.18-xen/drivers/xen/core/cpu_hotplug.c
 --- linux-2.6.18/drivers/xen/core/cpu_hotplug.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/cpu_hotplug.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/cpu_hotplug.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,188 @@
 +
 +#include <linux/init.h>
@@ -52762,8 +53058,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/evtchn.c linux-2.6.18-xen/drivers/xen/core/evtchn.c
 --- linux-2.6.18/drivers/xen/core/evtchn.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/evtchn.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,865 @@
++++ linux-2.6.18-xen/drivers/xen/core/evtchn.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,868 @@
 +/******************************************************************************
 + * evtchn.c
 + * 
@@ -53241,12 +53537,11 @@
 +static int retrigger(unsigned int irq)
 +{
 +	int evtchn = evtchn_from_irq(irq);
-+	struct shared_info *s = HYPERVISOR_shared_info;
++	shared_info_t *s = HYPERVISOR_shared_info;
 +	if (!VALID_EVTCHN(evtchn))
-+		goto out;
-+	BUG_ON(!test_bit(evtchn, &s->evtchn_mask[0]));
++		return 1;
++	BUG_ON(!synch_test_bit(evtchn, &s->evtchn_mask[0]));
 +	synch_set_bit(evtchn, &s->evtchn_pending[0]);
-+out:
 +	return 1;
 +}
 +
@@ -53307,15 +53602,17 @@
 +		unmask_evtchn(evtchn);
 +}
 +
-+static struct hw_interrupt_type dynirq_type __read_mostly = {
-+	.name		= "Dynamic-irq",
++static struct hw_interrupt_type dynirq_type = {
++	.typename	= "Dynamic-irq",
 +	.startup	= startup_dynirq,
 +	.shutdown	= shutdown_dynirq,
 +	.enable		= enable_dynirq,
 +	.disable	= disable_dynirq,
 +	.ack		= ack_dynirq,
 +	.end		= end_dynirq,
++#ifdef CONFIG_SMP
 +	.set_affinity	= set_affinity_irq,
++#endif
 +	.retrigger	= retrigger,
 +};
 +
@@ -53433,16 +53730,18 @@
 +	}
 +}
 +
-+static struct hw_interrupt_type pirq_type __read_mostly = {
-+	.name		= "Phys-irq",
++static struct hw_interrupt_type pirq_type = {
++	.typename	= "Phys-irq",
 +	.startup	= startup_pirq,
 +	.shutdown	= shutdown_pirq,
 +	.enable		= enable_pirq,
 +	.disable	= disable_pirq,
 +	.ack		= ack_pirq,
 +	.end		= end_pirq,
++#ifdef CONFIG_SMP
 +	.set_affinity	= set_affinity_irq,
-+	.retrigger	= retrigger
++#endif
++	.retrigger	= retrigger,
 +};
 +
 +int irq_ignore_unhandled(unsigned int irq)
@@ -53456,7 +53755,7 @@
 +	return !!(irq_status.flags & XENIRQSTAT_shared);
 +}
 +
-+void resend_irq_on_evtchn(struct hw_interrupt_type *h, unsigned int i)
++void resend_irq_on_evtchn(unsigned int i)
 +{
 +	int evtchn = evtchn_from_irq(i);
 +	shared_info_t *s = HYPERVISOR_shared_info;
@@ -53610,7 +53909,7 @@
 +		irq_desc[dynirq_to_irq(i)].status  = IRQ_DISABLED;
 +		irq_desc[dynirq_to_irq(i)].action  = NULL;
 +		irq_desc[dynirq_to_irq(i)].depth   = 1;
-+		irq_desc[dynirq_to_irq(i)].chip = &dynirq_type;
++		irq_desc[dynirq_to_irq(i)].chip    = &dynirq_type;
 +	}
 +
 +	/* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */
@@ -53626,12 +53925,12 @@
 +		irq_desc[pirq_to_irq(i)].status  = IRQ_DISABLED;
 +		irq_desc[pirq_to_irq(i)].action  = NULL;
 +		irq_desc[pirq_to_irq(i)].depth   = 1;
-+		irq_desc[pirq_to_irq(i)].chip = &pirq_type;
++		irq_desc[pirq_to_irq(i)].chip    = &pirq_type;
 +	}
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/features.c linux-2.6.18-xen/drivers/xen/core/features.c
 --- linux-2.6.18/drivers/xen/core/features.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/features.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/features.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,30 @@
 +/******************************************************************************
 + * features.c
@@ -53665,7 +53964,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/gnttab.c linux-2.6.18-xen/drivers/xen/core/gnttab.c
 --- linux-2.6.18/drivers/xen/core/gnttab.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/gnttab.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/gnttab.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,483 @@
 +/******************************************************************************
 + * gnttab.c
@@ -54152,7 +54451,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/hypervisor_sysfs.c linux-2.6.18-xen/drivers/xen/core/hypervisor_sysfs.c
 --- linux-2.6.18/drivers/xen/core/hypervisor_sysfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/hypervisor_sysfs.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/hypervisor_sysfs.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,59 @@
 +/*
 + *  copyright (c) 2006 IBM Corporation
@@ -54215,7 +54514,7 @@
 +EXPORT_SYMBOL_GPL(hypervisor_subsys);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/Makefile linux-2.6.18-xen/drivers/xen/core/Makefile
 --- linux-2.6.18/drivers/xen/core/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/Makefile	2006-07-07 20:51:41.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,13 @@
 +#
 +# Makefile for the linux kernel.
@@ -54232,7 +54531,7 @@
 +obj-$(CONFIG_XEN_SMPBOOT)	+= smpboot.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/reboot.c linux-2.6.18-xen/drivers/xen/core/reboot.c
 --- linux-2.6.18/drivers/xen/core/reboot.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/reboot.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/reboot.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,384 @@
 +#define __KERNEL_SYSCALLS__
 +#include <linux/version.h>
@@ -54620,7 +54919,7 @@
 +subsys_initcall(setup_shutdown_event);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/skbuff.c linux-2.6.18-xen/drivers/xen/core/skbuff.c
 --- linux-2.6.18/drivers/xen/core/skbuff.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/skbuff.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/skbuff.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,139 @@
 +
 +#include <linux/module.h>
@@ -54763,8 +55062,8 @@
 +EXPORT_SYMBOL(__dev_alloc_skb);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/smpboot.c linux-2.6.18-xen/drivers/xen/core/smpboot.c
 --- linux-2.6.18/drivers/xen/core/smpboot.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/smpboot.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,434 @@
++++ linux-2.6.18-xen/drivers/xen/core/smpboot.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,429 @@
 +/*
 + *	Xen SMP booting functions
 + *
@@ -54805,15 +55104,13 @@
 +
 +/* Number of siblings per CPU package */
 +int smp_num_siblings = 1;
-+int phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */
-+EXPORT_SYMBOL(phys_proc_id);
-+int cpu_core_id[NR_CPUS]; /* Core ID of each logical CPU */
-+EXPORT_SYMBOL(cpu_core_id);
++EXPORT_SYMBOL(smp_num_siblings);
 +#if defined(__i386__)
 +int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
 +#elif defined(__x86_64__)
 +u8 cpu_llc_id[NR_CPUS] __cpuinitdata  = {[0 ... NR_CPUS-1] = BAD_APICID};
 +#endif
++EXPORT_SYMBOL(cpu_llc_id);
 +
 +cpumask_t cpu_online_map;
 +EXPORT_SYMBOL(cpu_online_map);
@@ -54837,6 +55134,7 @@
 +void *xquad_portio;
 +
 +cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned;
++EXPORT_SYMBOL(cpu_sibling_map);
 +cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
 +EXPORT_SYMBOL(cpu_core_map);
 +
@@ -54865,8 +55163,8 @@
 +static inline void
 +set_cpu_sibling_map(int cpu)
 +{
-+	phys_proc_id[cpu] = cpu;
-+	cpu_core_id[cpu]  = 0;
++	cpu_data[cpu].phys_proc_id = cpu;
++	cpu_data[cpu].cpu_core_id = 0;
 +
 +	cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
 +	cpu_core_map[cpu]    = cpumask_of_cpu(cpu);
@@ -55108,8 +55406,8 @@
 +static void
 +remove_siblinginfo(int cpu)
 +{
-+	phys_proc_id[cpu] = BAD_APICID;
-+	cpu_core_id[cpu]  = BAD_APICID;
++	cpu_data[cpu].phys_proc_id = BAD_APICID;
++	cpu_data[cpu].cpu_core_id = BAD_APICID;
 +
 +	cpus_clear(cpu_sibling_map[cpu]);
 +	cpus_clear(cpu_core_map[cpu]);
@@ -55143,10 +55441,8 @@
 +
 +	xen_smp_intr_exit(cpu);
 +
-+#if defined(__i386__) || defined(__x86_64__)
 +	if (num_online_cpus() == 1)
 +		alternatives_smp_switch(0);
-+#endif
 +}
 +
 +#else /* !CONFIG_HOTPLUG_CPU */
@@ -55171,10 +55467,8 @@
 +	if (rc)
 +		return rc;
 +
-+#if defined(__i386__) || defined(__x86_64__)
 +	if (num_online_cpus() == 1)
 +		alternatives_smp_switch(1);
-+#endif
 +
 +	/* This must be done before setting cpu_online_map */
 +	set_cpu_sibling_map(cpu);
@@ -55201,7 +55495,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/xen_proc.c linux-2.6.18-xen/drivers/xen/core/xen_proc.c
 --- linux-2.6.18/drivers/xen/core/xen_proc.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/xen_proc.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/xen_proc.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,18 @@
 +
 +#include <linux/proc_fs.h>
@@ -55223,7 +55517,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/core/xen_sysfs.c linux-2.6.18-xen/drivers/xen/core/xen_sysfs.c
 --- linux-2.6.18/drivers/xen/core/xen_sysfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/core/xen_sysfs.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/core/xen_sysfs.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,378 @@
 +/*
 + *  copyright (c) 2006 IBM Corporation
@@ -55605,7 +55899,7 @@
 +module_exit(hyper_sysfs_exit);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/evtchn/evtchn.c linux-2.6.18-xen/drivers/xen/evtchn/evtchn.c
 --- linux-2.6.18/drivers/xen/evtchn/evtchn.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/evtchn/evtchn.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/evtchn/evtchn.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,456 @@
 +/******************************************************************************
 + * evtchn.c
@@ -56065,13 +56359,13 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/evtchn/Makefile linux-2.6.18-xen/drivers/xen/evtchn/Makefile
 --- linux-2.6.18/drivers/xen/evtchn/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/evtchn/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/evtchn/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= evtchn.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/Kconfig linux-2.6.18-xen/drivers/xen/Kconfig
 --- linux-2.6.18/drivers/xen/Kconfig	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/Kconfig	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/Kconfig	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,260 @@
 +#
 +# This Kconfig describe xen options
@@ -56335,7 +56629,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/Makefile linux-2.6.18-xen/drivers/xen/Makefile
 --- linux-2.6.18/drivers/xen/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/Makefile	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,17 @@
 +obj-y	+= core/
 +obj-y	+= console/
@@ -56356,8 +56650,8 @@
 +obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront/
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netback/common.h linux-2.6.18-xen/drivers/xen/netback/common.h
 --- linux-2.6.18/drivers/xen/netback/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netback/common.h	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,140 @@
++++ linux-2.6.18-xen/drivers/xen/netback/common.h	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,141 @@
 +/******************************************************************************
 + * arch/xen/drivers/netif/backend/common.h
 + * 
@@ -56405,6 +56699,7 @@
 +#include <xen/interface/grant_table.h>
 +#include <xen/gnttab.h>
 +#include <xen/driver_util.h>
++#include <asm/hypercall.h>
 +
 +#define DPRINTK(_f, _a...)			\
 +	pr_debug("(file=%s, line=%d) " _f,	\
@@ -56500,7 +56795,7 @@
 +#endif /* __NETIF__BACKEND__COMMON_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netback/interface.c linux-2.6.18-xen/drivers/xen/netback/interface.c
 --- linux-2.6.18/drivers/xen/netback/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netback/interface.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/netback/interface.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,339 @@
 +/******************************************************************************
 + * arch/xen/drivers/netif/backend/interface.c
@@ -56843,7 +57138,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netback/loopback.c linux-2.6.18-xen/drivers/xen/netback/loopback.c
 --- linux-2.6.18/drivers/xen/netback/loopback.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netback/loopback.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/netback/loopback.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,260 @@
 +/******************************************************************************
 + * netback/loopback.c
@@ -57107,7 +57402,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netback/Makefile linux-2.6.18-xen/drivers/xen/netback/Makefile
 --- linux-2.6.18/drivers/xen/netback/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netback/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/netback/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,5 @@
 +obj-$(CONFIG_XEN_NETDEV_BACKEND) := netbk.o
 +obj-$(CONFIG_XEN_NETDEV_LOOPBACK) += netloop.o
@@ -57116,8 +57411,8 @@
 +netloop-y := loopback.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netback/netback.c linux-2.6.18-xen/drivers/xen/netback/netback.c
 --- linux-2.6.18/drivers/xen/netback/netback.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netback/netback.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,1497 @@
++++ linux-2.6.18-xen/drivers/xen/netback/netback.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,1498 @@
 +/******************************************************************************
 + * drivers/xen/netback/netback.c
 + * 
@@ -57157,6 +57452,7 @@
 +#include "common.h"
 +#include <xen/balloon.h>
 +#include <xen/interface/memory.h>
++#include <asm/page.h>
 +
 +/*#define NETBE_DEBUG_INTERRUPT*/
 +
@@ -58617,8 +58913,8 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netback/xenbus.c linux-2.6.18-xen/drivers/xen/netback/xenbus.c
 --- linux-2.6.18/drivers/xen/netback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netback/xenbus.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,461 @@
++++ linux-2.6.18-xen/drivers/xen/netback/xenbus.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,473 @@
 +/*  Xenbus code for netif backend
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
 +    Copyright (C) 2005 XenSource Ltd
@@ -58849,13 +59145,13 @@
 +{
 +	struct backend_info *be = dev->dev.driver_data;
 +
-+	DPRINTK("");
++	DPRINTK("%s", xenbus_strstate(frontend_state));
 +
 +	be->frontend_state = frontend_state;
 +
 +	switch (frontend_state) {
 +	case XenbusStateInitialising:
-+		if (dev->state == XenbusStateClosing) {
++		if (dev->state == XenbusStateClosed) {
 +			printk("%s: %s: prepare for reconnect\n",
 +			       __FUNCTION__, dev->nodename);
 +			if (be->netif) {
@@ -58881,8 +59177,12 @@
 +		xenbus_switch_state(dev, XenbusStateClosing);
 +		break;
 +
-+	case XenbusStateUnknown:
 +	case XenbusStateClosed:
++		xenbus_switch_state(dev, XenbusStateClosed);
++		if (xenbus_dev_is_online(dev))
++			break;
++		/* fall through if not online */
++	case XenbusStateUnknown:
 +		if (be->netif != NULL)
 +			kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
 +		device_unregister(&dev->dev);
@@ -59044,6 +59344,14 @@
 +		be->netif->dev->features |= NETIF_F_TSO;
 +	}
 +
++	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload",
++			 "%d", &val) < 0)
++		val = 0;
++	if (val) {
++		be->netif->features &= ~NETIF_F_IP_CSUM;
++		be->netif->dev->features &= ~NETIF_F_IP_CSUM;
++	}
++
 +	/* Map the shared frame, irq etc. */
 +	err = netif_map(be->netif, tx_ring_ref, rx_ring_ref, evtchn);
 +	if (err) {
@@ -59082,7 +59390,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netfront/Kconfig linux-2.6.18-xen/drivers/xen/netfront/Kconfig
 --- linux-2.6.18/drivers/xen/netfront/Kconfig	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netfront/Kconfig	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/netfront/Kconfig	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,6 @@
 +
 +config XENNET
@@ -59092,7 +59400,7 @@
 +	  Network driver for Xen
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netfront/Makefile linux-2.6.18-xen/drivers/xen/netfront/Makefile
 --- linux-2.6.18/drivers/xen/netfront/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netfront/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/netfront/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,4 @@
 +
 +obj-$(CONFIG_XEN_NETDEV_FRONTEND)	:= xennet.o
@@ -59100,8 +59408,8 @@
 +xennet-objs := netfront.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/netfront/netfront.c linux-2.6.18-xen/drivers/xen/netfront/netfront.c
 --- linux-2.6.18/drivers/xen/netfront/netfront.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/netfront/netfront.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,2067 @@
++++ linux-2.6.18-xen/drivers/xen/netfront/netfront.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,2076 @@
 +/******************************************************************************
 + * Virtual network driver for conversing with remote driver backends.
 + *
@@ -59133,7 +59441,6 @@
 + * IN THE SOFTWARE.
 + */
 +
-+#include <linux/config.h>
 +#include <linux/module.h>
 +#include <linux/version.h>
 +#include <linux/kernel.h>
@@ -59155,6 +59462,7 @@
 +#include <net/pkt_sched.h>
 +#include <net/arp.h>
 +#include <net/route.h>
++#include <asm/hypercall.h>
 +#include <asm/uaccess.h>
 +#include <xen/evtchn.h>
 +#include <xen/xenbus.h>
@@ -59297,6 +59605,7 @@
 +
 +static void end_access(int, void *);
 +static void netif_disconnect_backend(struct netfront_info *);
++static int open_netdev(struct netfront_info *);
 +static void close_netdev(struct netfront_info *);
 +static void netif_free(struct netfront_info *);
 +
@@ -59367,15 +59676,22 @@
 +	dev->dev.driver_data = info;
 +
 +	err = talk_to_backend(dev, info);
-+	if (err) {
-+		xennet_sysfs_delif(info->netdev);
-+		unregister_netdev(netdev);
-+		free_netdev(netdev);
-+		dev->dev.driver_data = NULL;
-+		return err;
-+	}
++	if (err)
++		goto fail_backend;
++
++	err = open_netdev(info);
++	if (err)
++		goto fail_open;
 +
 +	return 0;
++
++ fail_open:
++	xennet_sysfs_delif(info->netdev);
++	unregister_netdev(netdev);
++ fail_backend:
++	free_netdev(netdev);
++	dev->dev.driver_data = NULL;
++	return err;
 +}
 +
 +
@@ -59582,7 +59898,7 @@
 +	struct netfront_info *np = dev->dev.driver_data;
 +	struct net_device *netdev = np->netdev;
 +
-+	DPRINTK("\n");
++	DPRINTK("%s\n", xenbus_strstate(backend_state));
 +
 +	switch (backend_state) {
 +	case XenbusStateInitialising:
@@ -60014,7 +60330,7 @@
 +#endif
 +
 +#ifdef HAVE_GSO
-+	if (skb_shinfo(skb)->gso_size) {
++	if (skb_is_gso(skb)) {
 +		struct netif_extra_info *gso = (struct netif_extra_info *)
 +			RING_GET_REQUEST(&np->tx, ++i);
 +
@@ -60681,7 +60997,7 @@
 +	xennet_set_sg(dev, 0);
 +
 +	/* We need checksum offload to enable scatter/gather and TSO. */
-+	if (!(dev->features & NETIF_F_ALL_CSUM))
++	if (!(dev->features & NETIF_F_IP_CSUM))
 +		return;
 +
 +	if (!xennet_set_sg(dev, 1))
@@ -60991,27 +61307,9 @@
 +	SET_MODULE_OWNER(netdev);
 +	SET_NETDEV_DEV(netdev, &dev->dev);
 +
-+	err = register_netdev(netdev);
-+	if (err) {
-+		printk(KERN_WARNING "%s> register_netdev err=%d\n",
-+		       __FUNCTION__, err);
-+		goto exit_free_rx;
-+	}
-+
-+	err = xennet_sysfs_addif(netdev);
-+	if (err) {
-+		/* This can be non-fatal: it only means no tuning parameters */
-+		printk(KERN_WARNING "%s> add sysfs failed err=%d\n",
-+		       __FUNCTION__, err);
-+	}
-+
 +	np->netdev = netdev;
-+
 +	return netdev;
 +
-+
-+ exit_free_rx:
-+	gnttab_free_grant_references(np->gref_rx_head);
 + exit_free_tx:
 +	gnttab_free_grant_references(np->gref_tx_head);
 + exit:
@@ -61050,11 +61348,10 @@
 +{
 +	struct netfront_info *info = dev->dev.driver_data;
 +
-+	DPRINTK("netfront_closing: %s removed\n", dev->nodename);
++	DPRINTK("%s\n", dev->nodename);
 +
 +	close_netdev(info);
-+
-+	xenbus_switch_state(dev, XenbusStateClosed);
++	xenbus_frontend_closed(dev);
 +}
 +
 +
@@ -61071,6 +61368,26 @@
 +}
 +
 +
++static int open_netdev(struct netfront_info *info)
++{
++	int err;
++	
++	err = register_netdev(info->netdev);
++	if (err) {
++		printk(KERN_WARNING "%s: register_netdev err=%d\n",
++		       __FUNCTION__, err);
++		return err;
++	}
++
++	err = xennet_sysfs_addif(info->netdev);
++	if (err) {
++		/* This can be non-fatal: it only means no tuning parameters */
++		printk(KERN_WARNING "%s: add sysfs failed err=%d\n",
++		       __FUNCTION__, err);
++	}
++	return 0;
++}
++
 +static void close_netdev(struct netfront_info *info)
 +{
 +	del_timer_sync(&info->rx_refill_timer);
@@ -61171,7 +61488,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space.c linux-2.6.18-xen/drivers/xen/pciback/conf_space.c
 --- linux-2.6.18/drivers/xen/pciback/conf_space.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,425 @@
 +/*
 + * PCI Backend - Functions for creating a virtual configuration space for
@@ -61600,7 +61917,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_capability.c linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability.c
 --- linux-2.6.18/drivers/xen/pciback/conf_space_capability.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,71 @@
 +/*
 + * PCI Backend - Handles the virtual fields found on the capability lists
@@ -61675,7 +61992,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_capability.h linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability.h
 --- linux-2.6.18/drivers/xen/pciback/conf_space_capability.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability.h	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,23 @@
 +/*
 + * PCI Backend - Data structures for special overlays for structures on
@@ -61702,7 +62019,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_capability_pm.c linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability_pm.c
 --- linux-2.6.18/drivers/xen/pciback/conf_space_capability_pm.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability_pm.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability_pm.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,113 @@
 +/*
 + * PCI Backend - Configuration space overlay for power management
@@ -61819,7 +62136,7 @@
 +};
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_capability_vpd.c linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability_vpd.c
 --- linux-2.6.18/drivers/xen/pciback/conf_space_capability_vpd.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability_vpd.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_capability_vpd.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,42 @@
 +/*
 + * PCI Backend - Configuration space overlay for Vital Product Data
@@ -61865,7 +62182,7 @@
 +};
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space.h linux-2.6.18-xen/drivers/xen/pciback/conf_space.h
 --- linux-2.6.18/drivers/xen/pciback/conf_space.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space.h	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,126 @@
 +/*
 + * PCI Backend - Common data structures for overriding the configuration space
@@ -61995,7 +62312,7 @@
 +#endif				/* __XEN_PCIBACK_CONF_SPACE_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_header.c linux-2.6.18-xen/drivers/xen/pciback/conf_space_header.c
 --- linux-2.6.18/drivers/xen/pciback/conf_space_header.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_header.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_header.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,299 @@
 +/*
 + * PCI Backend - Handles the virtual fields in the configuration space headers.
@@ -62298,7 +62615,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_quirks.c linux-2.6.18-xen/drivers/xen/pciback/conf_space_quirks.c
 --- linux-2.6.18/drivers/xen/pciback/conf_space_quirks.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_quirks.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_quirks.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,128 @@
 +/*
 + * PCI Backend - Handle special overlays for broken devices.
@@ -62430,7 +62747,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/conf_space_quirks.h linux-2.6.18-xen/drivers/xen/pciback/conf_space_quirks.h
 --- linux-2.6.18/drivers/xen/pciback/conf_space_quirks.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_quirks.h	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/conf_space_quirks.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,35 @@
 +/*
 + * PCI Backend - Data structures for special overlays for broken devices.
@@ -62469,7 +62786,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/Makefile linux-2.6.18-xen/drivers/xen/pciback/Makefile
 --- linux-2.6.18/drivers/xen/pciback/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/Makefile	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,15 @@
 +obj-$(CONFIG_XEN_PCIDEV_BACKEND) += pciback.o
 +
@@ -62488,7 +62805,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/passthrough.c linux-2.6.18-xen/drivers/xen/pciback/passthrough.c
 --- linux-2.6.18/drivers/xen/pciback/passthrough.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/passthrough.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/passthrough.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,157 @@
 +/*
 + * PCI Backend - Provides restricted access to the real PCI bus topology
@@ -62649,7 +62966,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/pciback.h linux-2.6.18-xen/drivers/xen/pciback/pciback.h
 --- linux-2.6.18/drivers/xen/pciback/pciback.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/pciback.h	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/pciback.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,93 @@
 +/*
 + * PCI Backend Common Data Structures & Function Declarations
@@ -62746,7 +63063,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/pciback_ops.c linux-2.6.18-xen/drivers/xen/pciback/pciback_ops.c
 --- linux-2.6.18/drivers/xen/pciback/pciback_ops.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/pciback_ops.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/pciback_ops.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,95 @@
 +/*
 + * PCI Backend Operations - respond to PCI requests from Frontend
@@ -62845,7 +63162,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/pci_stub.c linux-2.6.18-xen/drivers/xen/pciback/pci_stub.c
 --- linux-2.6.18/drivers/xen/pciback/pci_stub.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/pci_stub.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/pci_stub.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,916 @@
 +/*
 + * PCI Stub Driver - Grabs devices in backend to be exported later
@@ -63765,7 +64082,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/slot.c linux-2.6.18-xen/drivers/xen/pciback/slot.c
 --- linux-2.6.18/drivers/xen/pciback/slot.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/slot.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/slot.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,151 @@
 +/*
 + * PCI Backend - Provides a Virtual PCI bus (with real devices)
@@ -63920,7 +64237,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/vpci.c linux-2.6.18-xen/drivers/xen/pciback/vpci.c
 --- linux-2.6.18/drivers/xen/pciback/vpci.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/vpci.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/vpci.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,204 @@
 +/*
 + * PCI Backend - Provides a Virtual PCI bus (with real devices)
@@ -64128,7 +64445,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pciback/xenbus.c linux-2.6.18-xen/drivers/xen/pciback/xenbus.c
 --- linux-2.6.18/drivers/xen/pciback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pciback/xenbus.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pciback/xenbus.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,458 @@
 +/*
 + * PCI Backend Xenbus Setup - handles setup with frontend and xend
@@ -64590,7 +64907,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pcifront/Makefile linux-2.6.18-xen/drivers/xen/pcifront/Makefile
 --- linux-2.6.18/drivers/xen/pcifront/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pcifront/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pcifront/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,7 @@
 +obj-y += pcifront.o
 +
@@ -64601,7 +64918,7 @@
 +endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pcifront/pci.c linux-2.6.18-xen/drivers/xen/pcifront/pci.c
 --- linux-2.6.18/drivers/xen/pcifront/pci.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pcifront/pci.c	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pcifront/pci.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,46 @@
 +/*
 + * PCI Frontend Operations - ensure only one PCI frontend runs at a time
@@ -64651,7 +64968,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pcifront/pcifront.h linux-2.6.18-xen/drivers/xen/pcifront/pcifront.h
 --- linux-2.6.18/drivers/xen/pcifront/pcifront.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pcifront/pcifront.h	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pcifront/pcifront.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,40 @@
 +/*
 + * PCI Frontend - Common data structures & function declarations
@@ -64695,7 +65012,7 @@
 +#endif	/* __XEN_PCIFRONT_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pcifront/pci_op.c linux-2.6.18-xen/drivers/xen/pcifront/pci_op.c
 --- linux-2.6.18/drivers/xen/pcifront/pci_op.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pcifront/pci_op.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pcifront/pci_op.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,273 @@
 +/*
 + * PCI Frontend Operations - Communicates with frontend
@@ -64972,7 +65289,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/pcifront/xenbus.c linux-2.6.18-xen/drivers/xen/pcifront/xenbus.c
 --- linux-2.6.18/drivers/xen/pcifront/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/pcifront/xenbus.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/pcifront/xenbus.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,295 @@
 +/*
 + * PCI Frontend Xenbus Setup - handles setup with backend (imports page/evtchn)
@@ -65271,14 +65588,14 @@
 +subsys_initcall(pcifront_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/privcmd/Makefile linux-2.6.18-xen/drivers/xen/privcmd/Makefile
 --- linux-2.6.18/drivers/xen/privcmd/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/privcmd/Makefile	2006-07-07 20:51:41.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/privcmd/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +obj-$(CONFIG_XEN_PRIVCMD)	:= privcmd.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/privcmd/privcmd.c linux-2.6.18-xen/drivers/xen/privcmd/privcmd.c
 --- linux-2.6.18/drivers/xen/privcmd/privcmd.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/privcmd/privcmd.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,289 @@
++++ linux-2.6.18-xen/drivers/xen/privcmd/privcmd.c	2006-09-04 16:31:13.000000000 +0200
+@@ -0,0 +1,266 @@
 +/******************************************************************************
 + * privcmd.c
 + * 
@@ -65315,9 +65632,6 @@
 +static struct proc_dir_entry *privcmd_intf;
 +static struct proc_dir_entry *capabilities_intf;
 +
-+#define NR_HYPERCALLS 64
-+static DECLARE_BITMAP(hypercall_permission_map, NR_HYPERCALLS);
-+
 +static int privcmd_ioctl(struct inode *inode, struct file *file,
 +			 unsigned int cmd, unsigned long data)
 +{
@@ -65331,12 +65645,6 @@
 +		if (copy_from_user(&hypercall, udata, sizeof(hypercall)))
 +			return -EFAULT;
 +
-+		/* Check hypercall number for validity. */
-+		if (hypercall.op >= NR_HYPERCALLS)
-+			return -EINVAL;
-+		if (!test_bit(hypercall.op, hypercall_permission_map))
-+			return -EINVAL;
-+
 +#if defined(__i386__)
 +		__asm__ __volatile__ (
 +			"pushl %%ebx; pushl %%ecx; pushl %%edx; "
@@ -65513,7 +65821,7 @@
 +static int privcmd_mmap(struct file * file, struct vm_area_struct * vma)
 +{
 +	/* DONTCOPY is essential for Xen as copy_page_range is broken. */
-+	vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
++	vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
 +
 +	return 0;
 +}
@@ -65542,20 +65850,6 @@
 +	if (!is_running_on_xen())
 +		return -ENODEV;
 +
-+	/* Set of hypercalls that privileged applications may execute. */
-+	set_bit(__HYPERVISOR_acm_op,           hypercall_permission_map);
-+	set_bit(__HYPERVISOR_dom0_op,          hypercall_permission_map);
-+	set_bit(__HYPERVISOR_event_channel_op, hypercall_permission_map);
-+	set_bit(__HYPERVISOR_memory_op,        hypercall_permission_map);
-+	set_bit(__HYPERVISOR_mmu_update,       hypercall_permission_map);
-+	set_bit(__HYPERVISOR_mmuext_op,        hypercall_permission_map);
-+	set_bit(__HYPERVISOR_xen_version,      hypercall_permission_map);
-+	set_bit(__HYPERVISOR_sched_op,         hypercall_permission_map);
-+	set_bit(__HYPERVISOR_sched_op_compat,  hypercall_permission_map);
-+	set_bit(__HYPERVISOR_event_channel_op_compat,
-+		hypercall_permission_map);
-+	set_bit(__HYPERVISOR_hvm_op,           hypercall_permission_map);
-+
 +	privcmd_intf = create_xen_proc_entry("privcmd", 0400);
 +	if (privcmd_intf != NULL)
 +		privcmd_intf->proc_fops = &privcmd_file_ops;
@@ -65570,7 +65864,7 @@
 +__initcall(privcmd_init);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/tpmback/common.h linux-2.6.18-xen/drivers/xen/tpmback/common.h
 --- linux-2.6.18/drivers/xen/tpmback/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/tpmback/common.h	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/tpmback/common.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,84 @@
 +/******************************************************************************
 + * drivers/xen/tpmback/common.h
@@ -65658,7 +65952,7 @@
 +#endif /* __TPMIF__BACKEND__COMMON_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/tpmback/interface.c linux-2.6.18-xen/drivers/xen/tpmback/interface.c
 --- linux-2.6.18/drivers/xen/tpmback/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/tpmback/interface.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/tpmback/interface.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,177 @@
 + /*****************************************************************************
 + * drivers/xen/tpmback/interface.c
@@ -65839,7 +66133,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/tpmback/Makefile linux-2.6.18-xen/drivers/xen/tpmback/Makefile
 --- linux-2.6.18/drivers/xen/tpmback/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/tpmback/Makefile	2006-05-26 22:00:38.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/tpmback/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,4 @@
 +
 +obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmbk.o
@@ -65847,7 +66141,7 @@
 +tpmbk-y += tpmback.o interface.o xenbus.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/tpmback/tpmback.c linux-2.6.18-xen/drivers/xen/tpmback/tpmback.c
 --- linux-2.6.18/drivers/xen/tpmback/tpmback.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/tpmback/tpmback.c	2006-08-15 13:03:28.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/tpmback/tpmback.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,944 @@
 +/******************************************************************************
 + * drivers/xen/tpmback/tpmback.c
@@ -66795,7 +67089,7 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/tpmback/xenbus.c linux-2.6.18-xen/drivers/xen/tpmback/xenbus.c
 --- linux-2.6.18/drivers/xen/tpmback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/tpmback/xenbus.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/tpmback/xenbus.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,287 @@
 +/*  Xenbus code for tpmif backend
 +    Copyright (C) 2005 IBM Corporation
@@ -67086,7 +67380,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/util.c linux-2.6.18-xen/drivers/xen/util.c
 --- linux-2.6.18/drivers/xen/util.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/util.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/util.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,70 @@
 +
 +#include <linux/mm.h>
@@ -67160,7 +67454,7 @@
 +EXPORT_SYMBOL_GPL(unlock_vm_area);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/Makefile linux-2.6.18-xen/drivers/xen/xenbus/Makefile
 --- linux-2.6.18/drivers/xen/xenbus/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/Makefile	2006-07-07 20:51:41.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/xenbus/Makefile	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,12 @@
 +obj-y	+= xenbus.o
 +obj-$(CONFIG_XEN_BACKEND) += xenbus_be.o
@@ -67176,8 +67470,8 @@
 +obj-$(CONFIG_XEN_XENBUS_DEV) += xenbus_dev.o
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_backend_client.c linux-2.6.18-xen/drivers/xen/xenbus/xenbus_backend_client.c
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_backend_client.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_backend_client.c	2006-05-26 22:00:38.000000000 +0200
-@@ -0,0 +1,135 @@
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_backend_client.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,147 @@
 +/******************************************************************************
 + * Backend-client-facing interface for the Xenbus driver.  In other words, the
 + * interface between the Xenbus and the device-specific code in the backend
@@ -67312,11 +67606,23 @@
 +}
 +EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
 +
++int xenbus_dev_is_online(struct xenbus_device *dev)
++{
++	int rc, val;
++
++	rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val);
++	if (rc != 1)
++		val = 0; /* no online node present */
++
++	return val;
++}
++EXPORT_SYMBOL_GPL(xenbus_dev_is_online);
++
 +MODULE_LICENSE("Dual BSD/GPL");
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_client.c linux-2.6.18-xen/drivers/xen/xenbus/xenbus_client.c
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_client.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_client.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,278 @@
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_client.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,299 @@
 +/******************************************************************************
 + * Client-facing interface for the Xenbus driver.  In other words, the
 + * interface between the Xenbus and the device-specific code, be it the
@@ -67357,6 +67663,20 @@
 +#define DPRINTK(fmt, args...) \
 +    pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
 +
++char *xenbus_strstate(enum xenbus_state state)
++{
++	static char *name[] = {
++		[ XenbusStateUnknown      ] = "Unknown",
++		[ XenbusStateInitialising ] = "Initialising",
++		[ XenbusStateInitWait     ] = "InitWait",
++		[ XenbusStateInitialised  ] = "Initialised",
++		[ XenbusStateConnected    ] = "Connected",
++		[ XenbusStateClosing      ] = "Closing",
++		[ XenbusStateClosed	  ] = "Closed",
++	};
++	return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID";
++}
++
 +int xenbus_watch_path(struct xenbus_device *dev, const char *path,
 +		      struct xenbus_watch *watch,
 +		      void (*callback)(struct xenbus_watch *,
@@ -67440,6 +67760,13 @@
 +}
 +EXPORT_SYMBOL_GPL(xenbus_switch_state);
 +
++int xenbus_frontend_closed(struct xenbus_device *dev)
++{
++	xenbus_switch_state(dev, XenbusStateClosed);
++	complete(&dev->down);
++	return 0;
++}
++EXPORT_SYMBOL_GPL(xenbus_frontend_closed);
 +
 +/**
 + * Return the path to the error node for the given device, or NULL on failure.
@@ -67597,7 +67924,7 @@
 +EXPORT_SYMBOL_GPL(xenbus_read_driver_state);
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_comms.c linux-2.6.18-xen/drivers/xen/xenbus/xenbus_comms.c
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_comms.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_comms.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_comms.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,203 @@
 +/******************************************************************************
 + * xenbus_comms.c
@@ -67804,7 +68131,7 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_comms.h linux-2.6.18-xen/drivers/xen/xenbus/xenbus_comms.h
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_comms.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_comms.h	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_comms.h	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,45 @@
 +/*
 + * Private include for xenbus communications.
@@ -67853,7 +68180,7 @@
 +#endif /* _XENBUS_COMMS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_dev.c linux-2.6.18-xen/drivers/xen/xenbus/xenbus_dev.c
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_dev.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_dev.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_dev.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,356 @@
 +/*
 + * xenbus_dev.c
@@ -68213,8 +68540,8 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_probe.c linux-2.6.18-xen/drivers/xen/xenbus/xenbus_probe.c
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_probe.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_probe.c	2006-09-17 17:44:49.000000000 +0200
-@@ -0,0 +1,1149 @@
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_probe.c	2006-09-21 01:33:31.000000000 +0200
+@@ -0,0 +1,1176 @@
 +/******************************************************************************
 + * Talks to Xen Store to figure out what devices we have.
 + *
@@ -68265,6 +68592,7 @@
 +#include <asm/maddr.h>
 +#include <asm/pgtable.h>
 +#include <asm/hypervisor.h>
++#include <asm/hypercall.h>
 +#include <xen/xenbus.h>
 +#include <xen/xen_proc.h>
 +#include <xen/evtchn.h>
@@ -68290,6 +68618,7 @@
 +
 +static int xenbus_dev_probe(struct device *_dev);
 +static int xenbus_dev_remove(struct device *_dev);
++static void xenbus_dev_shutdown(struct device *_dev);
 +
 +/* If something in array of ids matches this device, return it. */
 +static const struct xenbus_device_id *
@@ -68409,6 +68738,7 @@
 +		.match    = xenbus_match,
 +		.probe    = xenbus_dev_probe,
 +		.remove   = xenbus_dev_remove,
++		.shutdown = xenbus_dev_shutdown,
 +	},
 +	.dev = {
 +		.bus_id = "xen",
@@ -68463,6 +68793,7 @@
 +		.match    = xenbus_match,
 +		.probe    = xenbus_dev_probe,
 +		.remove   = xenbus_dev_remove,
++//		.shutdown = xenbus_dev_shutdown,
 +		.uevent   = xenbus_uevent_backend,
 +	},
 +	.dev = {
@@ -68533,8 +68864,9 @@
 +
 +	state = xenbus_read_driver_state(dev->otherend);
 +
-+	DPRINTK("state is %d, %s, %s",
-+		state, dev->otherend_watch.node, vec[XS_WATCH_PATH]);
++	DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state),
++		dev->otherend_watch.node, vec[XS_WATCH_PATH]);
++
 +	if (drv->otherend_changed)
 +		drv->otherend_changed(dev, state);
 +}
@@ -68565,7 +68897,7 @@
 +	const struct xenbus_device_id *id;
 +	int err;
 +
-+	DPRINTK("");
++	DPRINTK("%s", dev->nodename);
 +
 +	if (!drv->probe) {
 +		err = -ENODEV;
@@ -68610,7 +68942,7 @@
 +	struct xenbus_device *dev = to_xenbus_device(_dev);
 +	struct xenbus_driver *drv = to_xenbus_driver(_dev->driver);
 +
-+	DPRINTK("");
++	DPRINTK("%s", dev->nodename);
 +
 +	free_otherend_watch(dev);
 +	free_otherend_details(dev);
@@ -68622,6 +68954,27 @@
 +	return 0;
 +}
 +
++static void xenbus_dev_shutdown(struct device *_dev)
++{
++	struct xenbus_device *dev = to_xenbus_device(_dev);
++	unsigned long timeout = 5*HZ;
++
++	DPRINTK("%s", dev->nodename);
++
++	get_device(&dev->dev);
++	if (dev->state != XenbusStateConnected) {
++		printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__,
++		       dev->nodename, xenbus_strstate(dev->state));
++		goto out;
++	}
++	xenbus_switch_state(dev, XenbusStateClosing);
++	timeout = wait_for_completion_timeout(&dev->down, timeout);
++	if (!timeout)
++		printk("%s: %s timeout closing device\n", __FUNCTION__, dev->nodename);
++ out:
++	put_device(&dev->dev);
++}
++
 +static int xenbus_register_driver_common(struct xenbus_driver *drv,
 +					 struct xen_bus_type *bus)
 +{
@@ -68783,6 +69136,7 @@
 +	tmpstring += strlen(tmpstring) + 1;
 +	strcpy(tmpstring, type);
 +	xendev->devicetype = tmpstring;
++	init_completion(&xendev->down);
 +
 +	xendev->dev.parent = &bus->dev;
 +	xendev->dev.bus = &bus->bus;
@@ -69366,7 +69720,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/drivers/xen/xenbus/xenbus_xs.c linux-2.6.18-xen/drivers/xen/xenbus/xenbus_xs.c
 --- linux-2.6.18/drivers/xen/xenbus/xenbus_xs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_xs.c	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/drivers/xen/xenbus/xenbus_xs.c	2006-09-04 16:31:13.000000000 +0200
 @@ -0,0 +1,853 @@
 +/******************************************************************************
 + * xenbus_xs.c
@@ -70221,272 +70575,9 @@
 +
 +	return 0;
 +}
-diff -urN -x .hg -x .hgtags linux-2.6.18/fs/aio.c linux-2.6.18-xen/fs/aio.c
---- linux-2.6.18/fs/aio.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/fs/aio.c	2006-08-15 13:03:29.000000000 +0200
-@@ -34,6 +34,11 @@
- #include <asm/uaccess.h>
- #include <asm/mmu_context.h>
- 
-+#ifdef CONFIG_EPOLL
-+#include <linux/poll.h>
-+#include <linux/eventpoll.h>
-+#endif
-+
- #if DEBUG > 1
- #define dprintk		printk
- #else
-@@ -1015,6 +1020,10 @@
- 	if (waitqueue_active(&ctx->wait))
- 		wake_up(&ctx->wait);
- 
-+#ifdef CONFIG_EPOLL
-+	if (ctx->file && waitqueue_active(&ctx->poll_wait))
-+		wake_up(&ctx->poll_wait);
-+#endif
- 	if (ret)
- 		put_ioctx(ctx);
- 
-@@ -1024,6 +1033,8 @@
- /* aio_read_evt
-  *	Pull an event off of the ioctx's event ring.  Returns the number of 
-  *	events fetched (0 or 1 ;-)
-+ *	If ent parameter is 0, just returns the number of events that would
-+ *	be fetched.
-  *	FIXME: make this use cmpxchg.
-  *	TODO: make the ringbuffer user mmap()able (requires FIXME).
-  */
-@@ -1046,13 +1057,18 @@
- 
- 	head = ring->head % info->nr;
- 	if (head != ring->tail) {
--		struct io_event *evp = aio_ring_event(info, head, KM_USER1);
--		*ent = *evp;
--		head = (head + 1) % info->nr;
--		smp_mb(); /* finish reading the event before updatng the head */
--		ring->head = head;
--		ret = 1;
--		put_aio_ring_event(evp, KM_USER1);
-+		if (ent) { /* event requested */
-+			struct io_event *evp =
-+				aio_ring_event(info, head, KM_USER1);
-+			*ent = *evp;
-+			head = (head + 1) % info->nr;
-+			/* finish reading the event before updatng the head */
-+			smp_mb();
-+			ring->head = head;
-+			ret = 1;
-+			put_aio_ring_event(evp, KM_USER1);
-+		} else /* only need to know availability */
-+			ret = 1;
- 	}
- 	spin_unlock(&info->ring_lock);
- 
-@@ -1235,9 +1251,78 @@
- 
- 	aio_cancel_all(ioctx);
- 	wait_for_all_aios(ioctx);
-+#ifdef CONFIG_EPOLL
-+	/* forget the poll file, but it's up to the user to close it */
-+	if (ioctx->file) {
-+		ioctx->file->private_data = 0;
-+		ioctx->file = 0;
-+	}
-+#endif
- 	put_ioctx(ioctx);	/* once for the lookup */
- }
- 
-+#ifdef CONFIG_EPOLL
-+
-+static int aio_queue_fd_close(struct inode *inode, struct file *file)
-+{
-+	struct kioctx *ioctx = file->private_data;
-+	if (ioctx) {
-+		file->private_data = 0;
-+		spin_lock_irq(&ioctx->ctx_lock);
-+		ioctx->file = 0;
-+		spin_unlock_irq(&ioctx->ctx_lock);
-+	}
-+	return 0;
-+}
-+
-+static unsigned int aio_queue_fd_poll(struct file *file, poll_table *wait)
-+{	unsigned int pollflags = 0;
-+	struct kioctx *ioctx = file->private_data;
-+
-+	if (ioctx) {
-+
-+		spin_lock_irq(&ioctx->ctx_lock);
-+		/* Insert inside our poll wait queue */
-+		poll_wait(file, &ioctx->poll_wait, wait);
-+
-+		/* Check our condition */
-+		if (aio_read_evt(ioctx, 0))
-+			pollflags = POLLIN | POLLRDNORM;
-+		spin_unlock_irq(&ioctx->ctx_lock);
-+	}
-+
-+	return pollflags;
-+}
-+
-+static struct file_operations aioq_fops = {
-+	.release	= aio_queue_fd_close,
-+	.poll		= aio_queue_fd_poll
-+};
-+
-+/* make_aio_fd:
-+ *  Create a file descriptor that can be used to poll the event queue.
-+ *  Based and piggybacked on the excellent epoll code.
-+ */
-+
-+static int make_aio_fd(struct kioctx *ioctx)
-+{
-+	int error, fd;
-+	struct inode *inode;
-+	struct file *file;
-+
-+	error = ep_getfd(&fd, &inode, &file, NULL, &aioq_fops);
-+	if (error)
-+		return error;
-+
-+	/* associate the file with the IO context */
-+	file->private_data = ioctx;
-+	ioctx->file = file;
-+	init_waitqueue_head(&ioctx->poll_wait);
-+	return fd;
-+}
-+#endif
-+
-+
- /* sys_io_setup:
-  *	Create an aio_context capable of receiving at least nr_events.
-  *	ctxp must not point to an aio_context that already exists, and
-@@ -1250,18 +1335,30 @@
-  *	resources are available.  May fail with -EFAULT if an invalid
-  *	pointer is passed for ctxp.  Will fail with -ENOSYS if not
-  *	implemented.
-+ *
-+ *	To request a selectable fd, the user context has to be initialized
-+ *	to 1, instead of 0, and the return value is the fd.
-+ *	This keeps the system call compatible, since a non-zero value
-+ *	was not allowed so far.
-  */
- asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)
- {
- 	struct kioctx *ioctx = NULL;
- 	unsigned long ctx;
- 	long ret;
-+	int make_fd = 0;
- 
- 	ret = get_user(ctx, ctxp);
- 	if (unlikely(ret))
- 		goto out;
- 
- 	ret = -EINVAL;
-+#ifdef CONFIG_EPOLL
-+	if (ctx == 1) {
-+		make_fd = 1;
-+		ctx = 0;
-+	}
-+#endif
- 	if (unlikely(ctx || nr_events == 0)) {
- 		pr_debug("EINVAL: io_setup: ctx %lu nr_events %u\n",
- 		         ctx, nr_events);
-@@ -1272,8 +1369,12 @@
- 	ret = PTR_ERR(ioctx);
- 	if (!IS_ERR(ioctx)) {
- 		ret = put_user(ioctx->user_id, ctxp);
--		if (!ret)
--			return 0;
-+#ifdef CONFIG_EPOLL
-+		if (make_fd && ret >= 0)
-+			ret = make_aio_fd(ioctx);
-+#endif
-+		if (ret >= 0)
-+			return ret;
- 
- 		get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */
- 		io_destroy(ioctx);
-diff -urN -x .hg -x .hgtags linux-2.6.18/fs/eventpoll.c linux-2.6.18-xen/fs/eventpoll.c
---- linux-2.6.18/fs/eventpoll.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/fs/eventpoll.c	2006-09-17 17:44:49.000000000 +0200
-@@ -236,8 +236,6 @@
- 
- static void ep_poll_safewake_init(struct poll_safewake *psw);
- static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
--static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
--		    struct eventpoll *ep);
- static int ep_alloc(struct eventpoll **pep);
- static void ep_free(struct eventpoll *ep);
- static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
-@@ -267,7 +265,7 @@
- static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
- 		   int maxevents, long timeout);
- static int eventpollfs_delete_dentry(struct dentry *dentry);
--static struct inode *ep_eventpoll_inode(void);
-+static struct inode *ep_eventpoll_inode(struct file_operations *fops);
- static int eventpollfs_get_sb(struct file_system_type *fs_type,
- 			      int flags, const char *dev_name,
- 			      void *data, struct vfsmount *mnt);
-@@ -517,7 +515,7 @@
- 	 * Creates all the items needed to setup an eventpoll file. That is,
- 	 * a file structure, and inode and a free file descriptor.
- 	 */
--	error = ep_getfd(&fd, &inode, &file, ep);
-+	error = ep_getfd(&fd, &inode, &file, ep, &eventpoll_fops);
- 	if (error)
- 		goto eexit_2;
- 
-@@ -702,8 +700,8 @@
- /*
-  * Creates the file descriptor to be used by the epoll interface.
-  */
--static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
--		    struct eventpoll *ep)
-+int ep_getfd(int *efd, struct inode **einode, struct file **efile,
-+		    struct eventpoll *ep, struct file_operations *fops)
- {
- 	struct qstr this;
- 	char name[32];
-@@ -719,7 +717,7 @@
- 		goto eexit_1;
- 
- 	/* Allocates an inode from the eventpoll file system */
--	inode = ep_eventpoll_inode();
-+	inode = ep_eventpoll_inode(fops);
- 	error = PTR_ERR(inode);
- 	if (IS_ERR(inode))
- 		goto eexit_2;
-@@ -750,7 +748,7 @@
- 
- 	file->f_pos = 0;
- 	file->f_flags = O_RDONLY;
--	file->f_op = &eventpoll_fops;
-+	file->f_op = fops;
- 	file->f_mode = FMODE_READ;
- 	file->f_version = 0;
- 	file->private_data = ep;
-@@ -1569,7 +1567,7 @@
- }
- 
- 
--static struct inode *ep_eventpoll_inode(void)
-+static struct inode *ep_eventpoll_inode(struct file_operations *fops)
- {
- 	int error = -ENOMEM;
- 	struct inode *inode = new_inode(eventpoll_mnt->mnt_sb);
-@@ -1577,7 +1575,7 @@
- 	if (!inode)
- 		goto eexit_1;
- 
--	inode->i_fop = &eventpoll_fops;
-+	inode->i_fop = fops;
- 
- 	/*
- 	 * Mark the inode dirty from the very beginning,
 diff -urN -x .hg -x .hgtags linux-2.6.18/fs/Kconfig linux-2.6.18-xen/fs/Kconfig
 --- linux-2.6.18/fs/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/fs/Kconfig	2006-09-17 17:44:49.000000000 +0200
++++ linux-2.6.18-xen/fs/Kconfig	2006-09-04 16:31:13.000000000 +0200
 @@ -865,6 +865,7 @@
  config HUGETLBFS
  	bool "HugeTLB file system support"
@@ -70495,21 +70586,19 @@
  	help
  	  hugetlbfs is a filesystem backing for HugeTLB pages, based on
  	  ramfs. For architectures that support it, say Y here and read
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/a.out.h linux-2.6.18-xen/include/asm-i386/a.out.h
---- linux-2.6.18/include/asm-i386/a.out.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/a.out.h	2006-05-26 22:00:47.000000000 +0200
-@@ -19,7 +19,7 @@
- 
- #ifdef __KERNEL__
- 
--#define STACK_TOP	TASK_SIZE
-+#define STACK_TOP	(TASK_SIZE - 3*PAGE_SIZE)
- 
- #endif
- 
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-generic/vmlinux.lds.h linux-2.6.18-xen/include/asm-generic/vmlinux.lds.h
+--- linux-2.6.18/include/asm-generic/vmlinux.lds.h	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/include/asm-generic/vmlinux.lds.h	2006-09-21 01:33:31.000000000 +0200
+@@ -194,3 +194,6 @@
+ 		.stab.index 0 : { *(.stab.index) }			\
+ 		.stab.indexstr 0 : { *(.stab.indexstr) }		\
+ 		.comment 0 : { *(.comment) }
++
++#define NOTES								\
++		.notes : { *(.note.*) } :note
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/apic.h linux-2.6.18-xen/include/asm-i386/apic.h
 --- linux-2.6.18/include/asm-i386/apic.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/apic.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/apic.h	2006-09-04 16:31:16.000000000 +0200
 @@ -119,10 +119,12 @@
  
  extern int disable_timer_pin_1;
@@ -70525,28 +70614,18 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/fixmap.h linux-2.6.18-xen/include/asm-i386/fixmap.h
 --- linux-2.6.18/include/asm-i386/fixmap.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/fixmap.h	2006-08-15 13:03:31.000000000 +0200
-@@ -19,7 +19,7 @@
++++ linux-2.6.18-xen/include/asm-i386/fixmap.h	2006-09-21 01:33:32.000000000 +0200
+@@ -19,6 +19,7 @@
   * Leave one empty page between vmalloc'ed areas and
   * the start of the fixmap.
   */
--#define __FIXADDR_TOP	0xfffff000
-+extern unsigned long __FIXADDR_TOP;
++
+ #define __FIXADDR_TOP	0xfffff000
  
  #ifndef __ASSEMBLY__
- #include <linux/kernel.h>
-@@ -94,6 +94,8 @@
- extern void __set_fixmap (enum fixed_addresses idx,
- 					unsigned long phys, pgprot_t flags);
- 
-+extern void set_fixaddr_top(unsigned long top);
-+
- #define set_fixmap(idx, phys) \
- 		__set_fixmap(idx, phys, PAGE_KERNEL)
- /*
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-default/mach_traps.h linux-2.6.18-xen/include/asm-i386/mach-default/mach_traps.h
 --- linux-2.6.18/include/asm-i386/mach-default/mach_traps.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/mach-default/mach_traps.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-default/mach_traps.h	2006-09-04 16:31:16.000000000 +0200
 @@ -15,6 +15,18 @@
  	outb(reason, 0x61);
  }
@@ -70568,7 +70647,7 @@
  	return inb(0x61);
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/agp.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/agp.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/agp.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/agp.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/agp.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,37 @@
 +#ifndef AGP_H
 +#define AGP_H 1
@@ -70609,7 +70688,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/desc.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/desc.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/desc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/desc.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/desc.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,164 @@
 +#ifndef __ARCH_DESC_H
 +#define __ARCH_DESC_H
@@ -70777,7 +70856,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/dma-mapping.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/dma-mapping.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/dma-mapping.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/dma-mapping.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/dma-mapping.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,151 @@
 +#ifndef _ASM_I386_DMA_MAPPING_H
 +#define _ASM_I386_DMA_MAPPING_H
@@ -70932,7 +71011,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/fixmap.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/fixmap.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/fixmap.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/fixmap.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/fixmap.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,156 @@
 +/*
 + * fixmap.h: compile-time virtual memory allocation
@@ -71092,7 +71171,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/floppy.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/floppy.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/floppy.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/floppy.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/floppy.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,147 @@
 +/*
 + * Architecture specific parts of the Floppy driver
@@ -71184,8 +71263,8 @@
 +
 +static int fd_request_irq(void)
 +{
-+	return request_irq(FLOPPY_IRQ, floppy_hardint, IRQF_DISABLED,
-+			   "floppy", NULL);
++	return request_irq(FLOPPY_IRQ, floppy_hardint,
++			   IRQF_DISABLED, "floppy", NULL);
 +}
 +
 +static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
@@ -71243,7 +71322,7 @@
 +#endif /* __ASM_XEN_I386_FLOPPY_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/highmem.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/highmem.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/highmem.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/highmem.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/highmem.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,80 @@
 +/*
 + * highmem.h: virtual kernel memory mappings for high memory
@@ -71327,7 +71406,7 @@
 +#endif /* _ASM_HIGHMEM_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/hw_irq.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hw_irq.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/hw_irq.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hw_irq.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hw_irq.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,72 @@
 +#ifndef _ASM_HW_IRQ_H
 +#define _ASM_HW_IRQ_H
@@ -71403,8 +71482,8 @@
 +#endif /* _ASM_HW_IRQ_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/hypercall.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hypercall.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/hypercall.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hypercall.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,379 @@
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hypercall.h	2006-09-04 16:31:16.000000000 +0200
+@@ -0,0 +1,389 @@
 +/******************************************************************************
 + * hypercall.h
 + * 
@@ -71449,11 +71528,21 @@
 +#define __STR(x) #x
 +#define STR(x) __STR(x)
 +
++#ifdef CONFIG_XEN
++#define HYPERCALL_STR(name)					\
++	"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
++#else
++#define HYPERCALL_STR(name)					\
++	"mov hypercall_stubs,%%eax; "				\
++	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "	\
++	"call *%%eax"
++#endif
++
 +#define _hypercall0(type, name)			\
 +({						\
 +	long __res;				\
 +	asm volatile (				\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)		\
 +		: "=a" (__res)			\
 +		:				\
 +		: "memory" );			\
@@ -71464,7 +71553,7 @@
 +({								\
 +	long __res, __ign1;					\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=b" (__ign1)			\
 +		: "1" ((long)(a1))				\
 +		: "memory" );					\
@@ -71475,7 +71564,7 @@
 +({								\
 +	long __res, __ign1, __ign2;				\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)	\
 +		: "1" ((long)(a1)), "2" ((long)(a2))		\
 +		: "memory" );					\
@@ -71486,7 +71575,7 @@
 +({								\
 +	long __res, __ign1, __ign2, __ign3;			\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
 +		"=d" (__ign3)					\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
@@ -71499,7 +71588,7 @@
 +({								\
 +	long __res, __ign1, __ign2, __ign3, __ign4;		\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
 +		"=d" (__ign3), "=S" (__ign4)			\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
@@ -71512,7 +71601,7 @@
 +({								\
 +	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;	\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
 +		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)	\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
@@ -71786,7 +71875,7 @@
 +#endif /* __HYPERCALL_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/hypervisor.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hypervisor.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hypervisor.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/hypervisor.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,234 @@
 +/******************************************************************************
 + * hypervisor.h
@@ -72024,7 +72113,7 @@
 +#endif /* __HYPERVISOR_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/io.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/io.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/io.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/io.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/io.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,389 @@
 +#ifndef _ASM_IO_H
 +#define _ASM_IO_H
@@ -72417,7 +72506,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/irqflags.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/irqflags.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/irqflags.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/irqflags.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/irqflags.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,80 @@
 +/*
 + * include/asm-i386/irqflags.h
@@ -72501,7 +72590,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/kmap_types.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/kmap_types.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/kmap_types.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/kmap_types.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/kmap_types.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,31 @@
 +#ifndef _ASM_KMAP_TYPES_H
 +#define _ASM_KMAP_TYPES_H
@@ -72536,7 +72625,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/maddr.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/maddr.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/maddr.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/maddr.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/maddr.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,160 @@
 +#ifndef _I386_MADDR_H
 +#define _I386_MADDR_H
@@ -72700,7 +72789,7 @@
 +#endif /* _I386_MADDR_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/mmu_context.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/mmu_context.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/mmu_context.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/mmu_context.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/mmu_context.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,108 @@
 +#ifndef __I386_SCHED_H
 +#define __I386_SCHED_H
@@ -72812,7 +72901,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/mmu.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/mmu.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/mmu.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/mmu.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/mmu.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,29 @@
 +#ifndef __i386_MMU_H
 +#define __i386_MMU_H
@@ -72845,8 +72934,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/page.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/page.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/page.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/page.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,217 @@
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/page.h	2006-09-04 16:31:16.000000000 +0200
+@@ -0,0 +1,220 @@
 +#ifndef _I386_PAGE_H
 +#define _I386_PAGE_H
 +
@@ -73055,7 +73144,10 @@
 +	((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 +		 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 +
-+#define __HAVE_ARCH_GATE_AREA 1
++/* VIRT <-> MACHINE conversion */
++#define virt_to_machine(v)	(phys_to_machine(__pa(v)))
++#define virt_to_mfn(v)		(pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
++#define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
 +
 +#include <asm-generic/memory_model.h>
 +#include <asm-generic/page.h>
@@ -73066,7 +73158,7 @@
 +#endif /* _I386_PAGE_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/param.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/param.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/param.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/param.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/param.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,23 @@
 +#ifndef _ASMi386_PARAM_H
 +#define _ASMi386_PARAM_H
@@ -73093,7 +73185,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pci.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pci.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pci.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pci.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pci.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,153 @@
 +#ifndef __i386_PCI_H
 +#define __i386_PCI_H
@@ -73250,7 +73342,7 @@
 +#endif /* __i386_PCI_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pgalloc.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgalloc.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pgalloc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgalloc.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgalloc.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,63 @@
 +#ifndef _I386_PGALLOC_H
 +#define _I386_PGALLOC_H
@@ -73317,7 +73409,7 @@
 +#endif /* _I386_PGALLOC_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,21 @@
 +#ifndef _I386_PGTABLE_2LEVEL_DEFS_H
 +#define _I386_PGTABLE_2LEVEL_DEFS_H
@@ -73342,7 +73434,7 @@
 +#endif /* _I386_PGTABLE_2LEVEL_DEFS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-2level.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-2level.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-2level.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-2level.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-2level.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,87 @@
 +#ifndef _I386_PGTABLE_2LEVEL_H
 +#define _I386_PGTABLE_2LEVEL_H
@@ -73433,7 +73525,7 @@
 +#endif /* _I386_PGTABLE_2LEVEL_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,25 @@
 +#ifndef _I386_PGTABLE_3LEVEL_DEFS_H
 +#define _I386_PGTABLE_3LEVEL_DEFS_H
@@ -73462,7 +73554,7 @@
 +#endif /* _I386_PGTABLE_3LEVEL_DEFS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-3level.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-3level.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable-3level.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-3level.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable-3level.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,185 @@
 +#ifndef _I386_PGTABLE_3LEVEL_H
 +#define _I386_PGTABLE_3LEVEL_H
@@ -73651,7 +73743,7 @@
 +#endif /* _I386_PGTABLE_3LEVEL_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/pgtable.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/pgtable.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,508 @@
 +#ifndef _I386_PGTABLE_H
 +#define _I386_PGTABLE_H
@@ -74163,7 +74255,7 @@
 +#endif /* _I386_PGTABLE_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/processor.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/processor.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/processor.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/processor.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/processor.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,741 @@
 +/*
 + * include/asm-i386/processor.h
@@ -74908,7 +75000,7 @@
 +#endif /* __ASM_I386_PROCESSOR_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/ptrace.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/ptrace.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/ptrace.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/ptrace.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/ptrace.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,90 @@
 +#ifndef _I386_PTRACE_H
 +#define _I386_PTRACE_H
@@ -75002,7 +75094,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/scatterlist.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/scatterlist.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/scatterlist.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/scatterlist.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/scatterlist.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,22 @@
 +#ifndef _I386_SCATTERLIST_H
 +#define _I386_SCATTERLIST_H
@@ -75028,7 +75120,7 @@
 +#endif /* !(_I386_SCATTERLIST_H) */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/segment.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/segment.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/segment.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/segment.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/segment.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,117 @@
 +#ifndef _ASM_SEGMENT_H
 +#define _ASM_SEGMENT_H
@@ -75149,7 +75241,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/setup.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/setup.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/setup.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/setup.h	2006-09-20 13:58:41.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/setup.h	2006-09-21 01:33:32.000000000 +0200
 @@ -0,0 +1,81 @@
 +/*
 + *	Just a place holder. We don't want to have to test x86 before
@@ -75234,7 +75326,7 @@
 +#endif /* _i386_SETUP_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/smp.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/smp.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/smp.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/smp.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/smp.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,103 @@
 +#ifndef __ASM_SMP_H
 +#define __ASM_SMP_H
@@ -75341,7 +75433,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/spinlock.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/spinlock.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/spinlock.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/spinlock.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/spinlock.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,202 @@
 +#ifndef __ASM_SPINLOCK_H
 +#define __ASM_SPINLOCK_H
@@ -75547,7 +75639,7 @@
 +#endif /* __ASM_SPINLOCK_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/swiotlb.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/swiotlb.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/swiotlb.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/swiotlb.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/swiotlb.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,41 @@
 +#ifndef _ASM_SWIOTLB_H
 +#define _ASM_SWIOTLB_H 1
@@ -75592,7 +75684,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/synch_bitops.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/synch_bitops.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/synch_bitops.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/synch_bitops.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,141 @@
 +#ifndef __XEN_SYNCH_BITOPS_H__
 +#define __XEN_SYNCH_BITOPS_H__
@@ -75737,8 +75829,8 @@
 +#endif /* __XEN_SYNCH_BITOPS_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/system.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/system.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/system.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/system.h	2006-09-20 13:58:41.000000000 +0200
-@@ -0,0 +1,495 @@
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/system.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,491 @@
 +#ifndef __ASM_SYSTEM_H
 +#define __ASM_SYSTEM_H
 +
@@ -75760,10 +75852,6 @@
 +struct task_struct;	/* one of the stranger aspects of C forward declarations.. */
 +extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
 +
-+/*
-+ * Saving eflags is important. It switches not only IOPL between tasks,
-+ * it also protects other tasks from NT leaking through sysenter etc.
-+ */
 +#define switch_to(prev,next,last) do {					\
 +	unsigned long esi,edi;						\
 +	asm volatile("pushfl\n\t"		/* Save flags */	\
@@ -76234,9 +76322,83 @@
 +void default_idle(void);
 +
 +#endif
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/timer.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/timer.h
+--- linux-2.6.18/include/asm-i386/mach-xen/asm/timer.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/timer.h	2006-09-04 16:31:16.000000000 +0200
+@@ -0,0 +1,70 @@
++#ifndef _ASMi386_TIMER_H
++#define _ASMi386_TIMER_H
++#include <linux/init.h>
++#include <linux/pm.h>
++
++/**
++ * struct timer_ops - used to define a timer source
++ *
++ * @name: name of the timer.
++ * @init: Probes and initializes the timer. Takes clock= override 
++ *        string as an argument. Returns 0 on success, anything else
++ *        on failure.
++ * @mark_offset: called by the timer interrupt.
++ * @get_offset:  called by gettimeofday(). Returns the number of microseconds
++ *               since the last timer interupt.
++ * @monotonic_clock: returns the number of nanoseconds since the init of the
++ *                   timer.
++ * @delay: delays this many clock cycles.
++ */
++struct timer_opts {
++	char* name;
++	void (*mark_offset)(void);
++	unsigned long (*get_offset)(void);
++	unsigned long long (*monotonic_clock)(void);
++	void (*delay)(unsigned long);
++	unsigned long (*read_timer)(void);
++	int (*suspend)(pm_message_t state);
++	int (*resume)(void);
++};
++
++struct init_timer_opts {
++	int (*init)(char *override);
++	struct timer_opts *opts;
++};
++
++#define TICK_SIZE (tick_nsec / 1000)
++
++extern struct timer_opts* __init select_timer(void);
++extern void clock_fallback(void);
++void setup_pit_timer(void);
++
++/* Modifiers for buggy PIT handling */
++
++extern int pit_latch_buggy;
++
++extern struct timer_opts *cur_timer;
++extern int timer_ack;
++
++/* list of externed timers */
++extern struct timer_opts timer_none;
++extern struct timer_opts timer_pit;
++extern struct init_timer_opts timer_pit_init;
++extern struct init_timer_opts timer_tsc_init;
++#ifdef CONFIG_X86_CYCLONE_TIMER
++extern struct init_timer_opts timer_cyclone_init;
++#endif
++
++extern unsigned long calibrate_tsc(void);
++extern unsigned long read_timer_tsc(void);
++extern void init_cpu_khz(void);
++extern int recalibrate_cpu_khz(void);
++#ifdef CONFIG_HPET_TIMER
++extern struct init_timer_opts timer_hpet_init;
++extern unsigned long calibrate_tsc_hpet(unsigned long *tsc_hpet_quotient_ptr);
++#endif
++
++#ifdef CONFIG_X86_PM_TIMER
++extern struct init_timer_opts timer_pmtmr_init;
++#endif
++#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/tlbflush.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/tlbflush.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/tlbflush.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/tlbflush.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/tlbflush.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,101 @@
 +#ifndef _I386_TLBFLUSH_H
 +#define _I386_TLBFLUSH_H
@@ -76341,7 +76503,7 @@
 +#endif /* _I386_TLBFLUSH_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/asm/vga.h linux-2.6.18-xen/include/asm-i386/mach-xen/asm/vga.h
 --- linux-2.6.18/include/asm-i386/mach-xen/asm/vga.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/vga.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/asm/vga.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,20 @@
 +/*
 + *	Access to VGA videoram
@@ -76365,7 +76527,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/irq_vectors.h linux-2.6.18-xen/include/asm-i386/mach-xen/irq_vectors.h
 --- linux-2.6.18/include/asm-i386/mach-xen/irq_vectors.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/irq_vectors.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/irq_vectors.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,125 @@
 +/*
 + * This file should contain #defines for all of the interrupt vector
@@ -76494,7 +76656,7 @@
 +#endif /* _ASM_IRQ_VECTORS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/mach_traps.h linux-2.6.18-xen/include/asm-i386/mach-xen/mach_traps.h
 --- linux-2.6.18/include/asm-i386/mach-xen/mach_traps.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/mach_traps.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/mach_traps.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,33 @@
 +/*
 + *  include/asm-xen/asm-i386/mach-xen/mach_traps.h
@@ -76531,37 +76693,16 @@
 +#endif /* !_MACH_TRAPS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/mach-xen/setup_arch.h linux-2.6.18-xen/include/asm-i386/mach-xen/setup_arch.h
 --- linux-2.6.18/include/asm-i386/mach-xen/setup_arch.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-i386/mach-xen/setup_arch.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/mach-xen/setup_arch.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,5 @@
 +/* Hook to call BIOS initialisation function */
 +
 +#define ARCH_SETUP machine_specific_arch_setup();
 +
 +void __init machine_specific_arch_setup(void);
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/page.h linux-2.6.18-xen/include/asm-i386/page.h
---- linux-2.6.18/include/asm-i386/page.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/page.h	2006-08-15 13:03:31.000000000 +0200
-@@ -122,7 +122,7 @@
- 
- #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
- #define VMALLOC_RESERVE		((unsigned long)__VMALLOC_RESERVE)
--#define MAXMEM			(-__PAGE_OFFSET-__VMALLOC_RESERVE)
-+#define MAXMEM			(__FIXADDR_TOP-__PAGE_OFFSET-__VMALLOC_RESERVE)
- #define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
- #define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
- #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
-@@ -138,6 +138,8 @@
- 	((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
- 		 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
- 
-+#define __HAVE_ARCH_GATE_AREA 1
-+
- #include <asm-generic/memory_model.h>
- #include <asm-generic/page.h>
- 
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/pgtable-2level-defs.h linux-2.6.18-xen/include/asm-i386/pgtable-2level-defs.h
 --- linux-2.6.18/include/asm-i386/pgtable-2level-defs.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/pgtable-2level-defs.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/pgtable-2level-defs.h	2006-09-04 16:31:16.000000000 +0200
 @@ -1,6 +1,8 @@
  #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
  #define _I386_PGTABLE_2LEVEL_DEFS_H
@@ -76573,7 +76714,7 @@
   */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-i386/pgtable-3level-defs.h linux-2.6.18-xen/include/asm-i386/pgtable-3level-defs.h
 --- linux-2.6.18/include/asm-i386/pgtable-3level-defs.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-i386/pgtable-3level-defs.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-i386/pgtable-3level-defs.h	2006-09-04 16:31:16.000000000 +0200
 @@ -1,6 +1,8 @@
  #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
  #define _I386_PGTABLE_3LEVEL_DEFS_H
@@ -76585,21 +76726,25 @@
   */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/agp.h linux-2.6.18-xen/include/asm-ia64/agp.h
 --- linux-2.6.18/include/asm-ia64/agp.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/agp.h	2006-09-17 17:44:50.000000000 +0200
-@@ -19,13 +19,32 @@
++++ linux-2.6.18-xen/include/asm-ia64/agp.h	2006-09-04 16:31:16.000000000 +0200
+@@ -19,13 +19,49 @@
  #define flush_agp_cache()		mb()
  
  /* Convert a physical address to an address suitable for the GART. */
--#define phys_to_gart(x) (x)
--#define gart_to_phys(x) (x)
++#ifndef CONFIG_XEN
+ #define phys_to_gart(x) (x)
+ #define gart_to_phys(x) (x)
++#else
 +#define phys_to_gart(x) phys_to_machine_for_dma(x)
 +#define gart_to_phys(x) machine_to_phys_for_dma(x)
++#endif
  
  /* GATT allocation. Returns/accepts GATT kernel virtual address. */
 -#define alloc_gatt_pages(order)		\
 -	((char *)__get_free_pages(GFP_KERNEL, (order)))
 -#define free_gatt_pages(table, order)	\
 -	free_pages((unsigned long)(table), (order))
++#ifdef CONFIG_XEN
 +#include <asm/hypervisor.h>
 +static inline char*
 +alloc_gatt_pages(unsigned int order)
@@ -76623,15 +76768,56 @@
 +	xen_destroy_contiguous_region((unsigned long)table, order);
 +	free_pages((unsigned long)table, order);
 +}
++#else	/* CONFIG_XEN */
++/* Convert a physical address to an address suitable for the GART. */
++#define phys_to_gart(x) (x)
++#define gart_to_phys(x) (x)
++
++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
++#define alloc_gatt_pages(order)         \
++        ((char *)__get_free_pages(GFP_KERNEL, (order)))
++#define free_gatt_pages(table, order)   \
++        free_pages((unsigned long)(table), (order))
++#endif	/* CONFIG_XEN */
  
  #endif /* _ASM_IA64_AGP_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/dma-mapping.h linux-2.6.18-xen/include/asm-ia64/dma-mapping.h
 --- linux-2.6.18/include/asm-ia64/dma-mapping.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/dma-mapping.h	2006-09-17 17:44:50.000000000 +0200
-@@ -6,20 +6,49 @@
-  *	David Mosberger-Tang <davidm at hpl.hp.com>
++++ linux-2.6.18-xen/include/asm-ia64/dma-mapping.h	2006-09-21 01:33:32.000000000 +0200
+@@ -7,19 +7,68 @@
   */
  #include <asm/machvec.h>
+ 
+-#define dma_alloc_coherent	platform_dma_alloc_coherent
+-#define dma_alloc_noncoherent	platform_dma_alloc_coherent	/* coherent mem. is cheap */
+-#define dma_free_coherent	platform_dma_free_coherent
+-#define dma_free_noncoherent	platform_dma_free_coherent
+-#define dma_map_single		platform_dma_map_single
+-#define dma_map_sg		platform_dma_map_sg
+-#define dma_unmap_single	platform_dma_unmap_single
+-#define dma_unmap_sg		platform_dma_unmap_sg
+-#define dma_sync_single_for_cpu	platform_dma_sync_single_for_cpu
+-#define dma_sync_sg_for_cpu	platform_dma_sync_sg_for_cpu
++#ifndef CONFIG_XEN
++
++#define dma_alloc_coherent      platform_dma_alloc_coherent
++#define dma_alloc_noncoherent   platform_dma_alloc_coherent     /* coherent mem. is cheap */
++#define dma_free_coherent       platform_dma_free_coherent
++#define dma_free_noncoherent    platform_dma_free_coherent
++#define dma_map_single          platform_dma_map_single
++#define dma_map_sg              platform_dma_map_sg
++#define dma_unmap_single        platform_dma_unmap_single
++#define dma_unmap_sg            platform_dma_unmap_sg
++#define dma_sync_single_for_cpu platform_dma_sync_single_for_cpu
++#define dma_sync_sg_for_cpu     platform_dma_sync_sg_for_cpu
+ #define dma_sync_single_for_device platform_dma_sync_single_for_device
+-#define dma_sync_sg_for_device	platform_dma_sync_sg_for_device
+-#define dma_mapping_error	platform_dma_mapping_error
++#define dma_sync_sg_for_device  platform_dma_sync_sg_for_device
++#define dma_mapping_error       platform_dma_mapping_error
++
++
++#else /* CONFIG_XEN */
 +/* Needed for arch/i386/kernel/swiotlb.c and arch/i386/kernel/pci-dma-xen.c */
 +#include <asm/hypervisor.h>
 +/* Needed for arch/i386/kernel/swiotlb.c */
@@ -76656,20 +76842,7 @@
 +                                size_t size,
 +                                enum dma_data_direction direction);
 +int dma_mapping_error(dma_addr_t dma_addr);
- 
--#define dma_alloc_coherent	platform_dma_alloc_coherent
--#define dma_alloc_noncoherent	platform_dma_alloc_coherent	/* coherent mem. is cheap */
--#define dma_free_coherent	platform_dma_free_coherent
--#define dma_free_noncoherent	platform_dma_free_coherent
--#define dma_map_single		platform_dma_map_single
--#define dma_map_sg		platform_dma_map_sg
--#define dma_unmap_single	platform_dma_unmap_single
--#define dma_unmap_sg		platform_dma_unmap_sg
--#define dma_sync_single_for_cpu	platform_dma_sync_single_for_cpu
--#define dma_sync_sg_for_cpu	platform_dma_sync_sg_for_cpu
--#define dma_sync_single_for_device platform_dma_sync_single_for_device
--#define dma_sync_sg_for_device	platform_dma_sync_sg_for_device
--#define dma_mapping_error	platform_dma_mapping_error
++
 +#define flush_write_buffers()	do { } while (0)
 +static inline void
 +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
@@ -76688,13 +76861,25 @@
 +		swiotlb_sync_sg_for_device(dev,sg,nelems,direction);
 +	flush_write_buffers();
 +}
++#endif /* CONFIG_XEN */
  
  #define dma_map_page(dev, pg, off, size, dir)				\
  	dma_map_single(dev, page_address(pg) + (off), (size), (dir))
-@@ -61,4 +90,25 @@
+@@ -36,7 +85,9 @@
+ #define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir)	\
+ 	dma_sync_single_for_device(dev, dma_handle, size, dir)
+ 
++#ifndef CONFIG_XEN
+ #define dma_supported		platform_dma_supported
++#endif
+ 
+ static inline int
+ dma_set_mask (struct device *dev, u64 mask)
+@@ -61,4 +112,29 @@
  
  #define dma_is_consistent(dma_handle)	(1)	/* all we do is coherent memory... */
  
++#ifdef CONFIG_XEN
 +/* arch/i386/kernel/swiotlb.o requires */
 +void contiguous_bitmap_init(unsigned long end_pfn);
 +
@@ -76707,6 +76892,9 @@
 +		mask = *hwdev->dma_mask;
 +	return (addr & ~mask) != 0;
 +}
++#else
++#define contiguous_bitmap_init(end_pfn)	((void)end_pfn)
++#endif
 +
 +static inline int
 +range_straddles_page_boundary(void *p, size_t size)
@@ -76719,13 +76907,13 @@
  #endif /* _ASM_IA64_DMA_MAPPING_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/fixmap.h linux-2.6.18-xen/include/asm-ia64/fixmap.h
 --- linux-2.6.18/include/asm-ia64/fixmap.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-ia64/fixmap.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/fixmap.h	2006-09-04 16:31:16.000000000 +0200
 @@ -0,0 +1,2 @@
 +#define clear_fixmap(x)	do {} while (0)
 +#define	set_fixmap(x,y)	do {} while (0)
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/gcc_intrin.h linux-2.6.18-xen/include/asm-ia64/gcc_intrin.h
 --- linux-2.6.18/include/asm-ia64/gcc_intrin.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/gcc_intrin.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/gcc_intrin.h	2006-09-04 16:31:16.000000000 +0200
 @@ -26,7 +26,7 @@
  
  register unsigned long ia64_r13 asm ("r13") __attribute_used__;
@@ -76917,7 +77105,7 @@
  #endif /* _ASM_IA64_GCC_INTRIN_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/hw_irq.h linux-2.6.18-xen/include/asm-ia64/hw_irq.h
 --- linux-2.6.18/include/asm-ia64/hw_irq.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/hw_irq.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/hw_irq.h	2006-09-04 16:31:16.000000000 +0200
 @@ -15,7 +15,11 @@
  #include <asm/ptrace.h>
  #include <asm/smp.h>
@@ -76930,15 +77118,14 @@
  
  /*
   * 0 special
-@@ -99,6 +103,13 @@
+@@ -99,6 +103,12 @@
  
  static inline void ia64_resend_irq(unsigned int vector)
  {
 +#ifdef CONFIG_XEN
-+	extern void resend_irq_on_evtchn(struct hw_interrupt_type *h,
-+					 unsigned int i);
++	extern void resend_irq_on_evtchn(unsigned int i);
 +	if (is_running_on_xen())
-+		resend_irq_on_evtchn(h, vector);
++		resend_irq_on_evtchn(vector);
 +	else
 +#endif /* CONFIG_XEN */
  	platform_send_ipi(smp_processor_id(), vector, IA64_IPI_DM_INT, 0);
@@ -76946,8 +77133,8 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/hypercall.h linux-2.6.18-xen/include/asm-ia64/hypercall.h
 --- linux-2.6.18/include/asm-ia64/hypercall.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-ia64/hypercall.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,496 @@
++++ linux-2.6.18-xen/include/asm-ia64/hypercall.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,423 @@
 +/******************************************************************************
 + * hypercall.h
 + * 
@@ -77001,7 +77188,7 @@
 +			      "break 0x1000 ;;\n"		\
 +			      "mov %0=r8 ;;\n"			\
 +			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name)	\
++			      : "J" (__HYPERVISOR_##name)	\
 +			      : "r2","r8",			\
 +			        "memory" );			\
 +	(type)__res;						\
@@ -77016,8 +77203,8 @@
 +			      "break 0x1000 ;;\n"		\
 +			      "mov %0=r8 ;;\n"			\
 +			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name),	\
-+				"r" ((unsigned long)(a1))	\
++			      : "J" (__HYPERVISOR_##name),	\
++				"rI" ((unsigned long)(a1))	\
 +			      : "r14","r2","r8",		\
 +				"memory" );			\
 +	(type)__res;						\
@@ -77033,9 +77220,9 @@
 +			      "break 0x1000 ;;\n"		\
 +			      "mov %0=r8 ;;\n"			\
 +			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name),	\
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2))	\
++			      : "J" (__HYPERVISOR_##name),	\
++				"rI" ((unsigned long)(a1)),	\
++				"rI" ((unsigned long)(a2))	\
 +			      : "r14","r15","r2","r8",		\
 +				"memory" );			\
 +	(type)__res;						\
@@ -77052,10 +77239,10 @@
 +			      "break 0x1000 ;;\n"               \
 +			      "mov %0=r8 ;;\n"                  \
 +			      : "=r" (__res)                    \
-+			      : "i" (__HYPERVISOR_##name),      \
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2)),	\
-+				"r" ((unsigned long)(a3))	\
++			      : "J" (__HYPERVISOR_##name),      \
++				"rI" ((unsigned long)(a1)),     \
++				"rI" ((unsigned long)(a2)),     \
++				"rI" ((unsigned long)(a3))      \
 +			      : "r14","r15","r16","r2","r8",	\
 +			        "memory" );                     \
 +	(type)__res;                                            \
@@ -77073,11 +77260,11 @@
 +			      "break 0x1000 ;;\n"               \
 +			      "mov %0=r8 ;;\n"                  \
 +			      : "=r" (__res)                    \
-+			      : "i" (__HYPERVISOR_##name),      \
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2)),	\
-+				"r" ((unsigned long)(a3)),	\
-+				"r" ((unsigned long)(a4))       \
++			      : "J" (__HYPERVISOR_##name),      \
++				"rI" ((unsigned long)(a1)),     \
++				"rI" ((unsigned long)(a2)),     \
++				"rI" ((unsigned long)(a3)),     \
++				"rI" ((unsigned long)(a4))      \
 +			      : "r14","r15","r16","r2","r8",	\
 +			        "r17","memory" );               \
 +	(type)__res;                                            \
@@ -77096,12 +77283,12 @@
 +			      "break 0x1000 ;;\n"               \
 +			      "mov %0=r8 ;;\n"                  \
 +			      : "=r" (__res)                    \
-+			      : "i" (__HYPERVISOR_##name),      \
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2)),	\
-+				"r" ((unsigned long)(a3)),	\
-+				"r" ((unsigned long)(a4)),	\
-+				"r" ((unsigned long)(a5))       \
++			      : "J" (__HYPERVISOR_##name),      \
++				"rI" ((unsigned long)(a1)),     \
++				"rI" ((unsigned long)(a2)),     \
++				"rI" ((unsigned long)(a3)),     \
++				"rI" ((unsigned long)(a4)),     \
++				"rI" ((unsigned long)(a5))      \
 +			      : "r14","r15","r16","r2","r8",	\
 +			        "r17","r18","memory" );         \
 +	(type)__res;                                            \
@@ -77155,8 +77342,12 @@
 +}
 +
 +#include <xen/interface/memory.h>
++#ifdef CONFIG_VMX_GUEST
++# define ia64_xenmem_reservation_op(op, xmr) (0)
++#else
 +int ia64_xenmem_reservation_op(unsigned long op,
 +		   struct xen_memory_reservation* reservation__);
++#endif
 +static inline int
 +HYPERVISOR_memory_op(
 +    unsigned int cmd, void *arg)
@@ -77225,9 +77416,10 @@
 +//XXX __HYPERVISOR_grant_table_op is used for this hypercall constant.
 +static inline int
 +____HYPERVISOR_grant_table_op(
-+    unsigned int cmd, void *uop, unsigned int count)
++    unsigned int cmd, void *uop, unsigned int count,
++    unsigned long pa1, unsigned long pa2)
 +{
-+    return _hypercall3(int, grant_table_op, cmd, uop, count);
++    return _hypercall5(int, grant_table_op, cmd, uop, count, pa1, pa2);
 +}
 +
 +int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
@@ -77241,6 +77433,13 @@
 +
 +extern int HYPERVISOR_suspend(unsigned long srec);
 +
++static inline unsigned long
++HYPERVISOR_hvm_op(
++	int cmd, void *arg)
++{
++	return _hypercall2(unsigned long, hvm_op, cmd, arg);
++}
++
 +static inline int
 +HYPERVISOR_callback_op(
 +	int cmd, void *arg)
@@ -77257,100 +77456,16 @@
 +})
 +
 +#include <linux/err.h>
++#ifdef CONFIG_XEN
 +#include <asm/xen/privop.h>
++#endif /* CONFIG_XEN */
 +
-+#define _hypercall_imm1(type, name, imm, a1)			\
-+({								\
-+	long __res;						\
-+	__asm__ __volatile__ (";;\n"				\
-+			      "mov r14=%2\n"			\
-+			      "mov r15=%3\n"			\
-+			      "mov r2=%1\n"			\
-+			      "break 0x1000 ;;\n"		\
-+			      "mov %0=r8 ;;\n"			\
-+			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name),	\
-+				"i" (imm),			\
-+				"r" ((unsigned long)(a1))	\
-+			      : "r14","r15","r2","r8",		\
-+				"memory" );			\
-+	(type)__res;						\
-+})
-+
-+#define _hypercall_imm2(type, name, imm, a1, a2)		\
-+({								\
-+	long __res;						\
-+	__asm__ __volatile__ (";;\n"				\
-+			      "mov r14=%2\n"			\
-+			      "mov r15=%3\n"			\
-+			      "mov r16=%4\n"			\
-+			      "mov r2=%1\n"			\
-+			      "break 0x1000 ;;\n"		\
-+			      "mov %0=r8 ;;\n"			\
-+			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name),	\
-+				"i" (imm),			\
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2))	\
-+			      : "r14","r15","r16","r2","r8",	\
-+				"memory" );			\
-+	(type)__res;						\
-+})
-+
-+#define _hypercall_imm3(type, name, imm, a1, a2, a3)		\
-+({								\
-+	long __res;						\
-+	__asm__ __volatile__ (";;\n"				\
-+			      "mov r14=%2\n"			\
-+			      "mov r15=%3\n"			\
-+			      "mov r16=%4\n"			\
-+			      "mov r17=%5\n"			\
-+			      "mov r2=%1\n"			\
-+			      "break 0x1000 ;;\n"		\
-+			      "mov %0=r8 ;;\n"			\
-+			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name),	\
-+				"i" (imm),			\
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2)),	\
-+				"r" ((unsigned long)(a3))	\
-+			      : "r14","r15","r16","r17",	\
-+				"r2","r8",			\
-+				"memory" );			\
-+	(type)__res;						\
-+})
-+
-+#define _hypercall_imm4(type, name, imm, a1, a2, a3, a4)	\
-+({								\
-+	long __res;						\
-+	__asm__ __volatile__ (";;\n"				\
-+			      "mov r14=%2\n"			\
-+			      "mov r15=%3\n"			\
-+			      "mov r16=%4\n"			\
-+			      "mov r17=%5\n"			\
-+			      "mov r18=%6\n"			\
-+			      "mov r2=%1\n"			\
-+			      "break 0x1000 ;;\n"		\
-+			      "mov %0=r8 ;;\n"			\
-+			      : "=r" (__res)			\
-+			      : "i" (__HYPERVISOR_##name),	\
-+				"i" (imm),			\
-+				"r" ((unsigned long)(a1)),	\
-+				"r" ((unsigned long)(a2)),	\
-+				"r" ((unsigned long)(a3)),	\
-+				"r" ((unsigned long)(a4))	\
-+			      : "r14","r15","r16","r17","r18",	\
-+				"r2","r8",			\
-+				"memory" );			\
-+	(type)__res;						\
-+})
-+
-+static inline unsigned long
-+__HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
-+{
-+	return _hypercall_imm2(unsigned long, ia64_dom0vp_op,
-+			       IA64_DOM0VP_ioremap, ioaddr, size);
-+}
++static inline unsigned long
++__HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
++{
++	return _hypercall3(unsigned long, ia64_dom0vp_op,
++	                   IA64_DOM0VP_ioremap, ioaddr, size);
++}
 +
 +static inline unsigned long
 +HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
@@ -77371,8 +77486,8 @@
 +static inline unsigned long
 +__HYPERVISOR_phystomach(unsigned long gpfn)
 +{
-+	return _hypercall_imm1(unsigned long, ia64_dom0vp_op,
-+			       IA64_DOM0VP_phystomach, gpfn);
++	return _hypercall2(unsigned long, ia64_dom0vp_op,
++	                   IA64_DOM0VP_phystomach, gpfn);
 +}
 +
 +static inline unsigned long
@@ -77388,8 +77503,8 @@
 +static inline unsigned long
 +__HYPERVISOR_machtophys(unsigned long mfn)
 +{
-+	return _hypercall_imm1(unsigned long, ia64_dom0vp_op,
-+			       IA64_DOM0VP_machtophys, mfn);
++	return _hypercall2(unsigned long, ia64_dom0vp_op,
++	                   IA64_DOM0VP_machtophys, mfn);
 +}
 +
 +static inline unsigned long
@@ -77405,8 +77520,8 @@
 +static inline unsigned long
 +__HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
 +{
-+	return _hypercall_imm2(unsigned long, ia64_dom0vp_op,
-+			       IA64_DOM0VP_zap_physmap, gpfn, extent_order);
++	return _hypercall3(unsigned long, ia64_dom0vp_op,
++	                   IA64_DOM0VP_zap_physmap, gpfn, extent_order);
 +}
 +
 +static inline unsigned long
@@ -77423,9 +77538,8 @@
 +__HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
 +			 unsigned long flags, domid_t domid)
 +{
-+	return _hypercall_imm4(unsigned long, ia64_dom0vp_op,
-+			       IA64_DOM0VP_add_physmap, gpfn, mfn, flags,
-+			       domid);
++	return _hypercall5(unsigned long, ia64_dom0vp_op,
++	                   IA64_DOM0VP_add_physmap, gpfn, mfn, flags, domid);
 +}
 +
 +static inline unsigned long
@@ -77446,8 +77560,8 @@
 +#endif /* __HYPERCALL_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/hypervisor.h linux-2.6.18-xen/include/asm-ia64/hypervisor.h
 --- linux-2.6.18/include/asm-ia64/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-ia64/hypervisor.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,192 @@
++++ linux-2.6.18-xen/include/asm-ia64/hypervisor.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,218 @@
 +/******************************************************************************
 + * hypervisor.h
 + * 
@@ -77483,15 +77597,19 @@
 +#ifndef __HYPERVISOR_H__
 +#define __HYPERVISOR_H__
 +
-+#ifndef CONFIG_XEN
-+#define is_running_on_xen()			(0)
-+#define HYPERVISOR_ioremap(offset, size)	(offset)
-+#else
++#ifdef CONFIG_XEN
 +extern int running_on_xen;
 +#define is_running_on_xen()			(running_on_xen)
-+#endif
++#else /* CONFIG_XEN */
++# ifdef CONFIG_VMX_GUEST
++#  define is_running_on_xen()			(1)
++# else /* CONFIG_VMX_GUEST */
++#  define is_running_on_xen()			(0)
++#  define HYPERVISOR_ioremap(offset, size)	(offset)
++# endif /* CONFIG_VMX_GUEST */
++#endif /* CONFIG_XEN */
 +
-+#ifdef CONFIG_XEN
++#if defined(CONFIG_XEN) || defined(CONFIG_VMX_GUEST)
 +#include <linux/types.h>
 +#include <linux/kernel.h>
 +#include <linux/version.h>
@@ -77508,10 +77626,9 @@
 +extern shared_info_t *HYPERVISOR_shared_info;
 +extern start_info_t *xen_start_info;
 +
-+#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
-+
 +void force_evtchn_callback(void);
 +
++#ifndef CONFIG_VMX_GUEST
 +/* Turn jiffies into Xen system time. XXX Implement me. */
 +#define jiffies_to_st(j)	0
 +
@@ -77596,10 +77713,14 @@
 +#define scrub_pages(_p,_n) ((void)0)
 +#endif
 +#define	pte_mfn(_x)	pte_pfn(_x)
-+#define __pte_ma(_x)	((pte_t) {(_x)})
 +#define phys_to_machine_mapping_valid(_x)	(1)
-+#define pfn_pte_ma(_x,_y)	__pte_ma(0)
 +
++#endif /* !CONFIG_VMX_GUEST */
++
++#define __pte_ma(_x)	((pte_t) {(_x)})        /* unmodified use */
++#define pfn_pte_ma(_x,_y)	__pte_ma(0)     /* unmodified use */
++
++#ifndef CONFIG_VMX_GUEST
 +int __xen_create_contiguous_region(unsigned long vstart, unsigned int order, unsigned int address_bits);
 +static inline int
 +xen_create_contiguous_region(unsigned long vstart,
@@ -77621,6 +77742,8 @@
 +		__xen_destroy_contiguous_region(vstart, order);
 +}
 +
++#endif /* !CONFIG_VMX_GUEST */
++
 +// for netfront.c, netback.c
 +#define MULTI_UVMFLAGS_INDEX 0 //XXX any value
 +
@@ -77633,16 +77756,33 @@
 +	mcl->result = 0;
 +}
 +
++static inline void
++MULTI_grant_table_op(multicall_entry_t *mcl, unsigned int cmd,
++	void *uop, unsigned int count)
++{
++	mcl->op = __HYPERVISOR_grant_table_op;
++	mcl->args[0] = cmd;
++	mcl->args[1] = (unsigned long)uop;
++	mcl->args[2] = count;
++}
++
 +// for debug
 +asmlinkage int xprintk(const char *fmt, ...);
 +#define xprintd(fmt, ...)	xprintk("%s:%d " fmt, __func__, __LINE__, \
 +					##__VA_ARGS__)
-+#endif /* CONFIG_XEN */
++
++#endif /* CONFIG_XEN || CONFIG_VMX_GUEST */
++
++#ifdef CONFIG_XEN_PRIVILEGED_GUEST
++#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
++#else
++#define is_initial_xendomain() 0
++#endif
 +
 +#endif /* __HYPERVISOR_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/intel_intrin.h linux-2.6.18-xen/include/asm-ia64/intel_intrin.h
 --- linux-2.6.18/include/asm-ia64/intel_intrin.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/intel_intrin.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/intel_intrin.h	2006-09-04 16:31:16.000000000 +0200
 @@ -16,8 +16,10 @@
  		 	 * intrinsic
  		 	 */
@@ -77768,7 +77908,7 @@
  #endif /* _ASM_IA64_INTEL_INTRIN_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/io.h linux-2.6.18-xen/include/asm-ia64/io.h
 --- linux-2.6.18/include/asm-ia64/io.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/io.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/io.h	2006-09-04 16:31:16.000000000 +0200
 @@ -66,9 +66,11 @@
  #define PIO_RESERVED		__IA64_UNCACHED_OFFSET
  #define HAVE_ARCH_PIO_SIZE
@@ -77781,13 +77921,17 @@
  #include <asm/system.h>
  #include <asm-generic/iomap.h>
  
-@@ -96,9 +98,33 @@
+@@ -96,9 +98,41 @@
   * The following two macros are deprecated and scheduled for removal.
   * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
   */
--#define bus_to_virt	phys_to_virt
--#define virt_to_bus	virt_to_phys
--#define page_to_bus	page_to_phys
++#ifndef CONFIG_XEN
+ #define bus_to_virt	phys_to_virt
+ #define virt_to_bus	virt_to_phys
+ #define page_to_bus	page_to_phys
++#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
++#define page_to_pseudophys(page)	page_to_phys(page)
++#else /* CONFIG_XEN */
 +#define bus_to_virt(bus)	\
 +	phys_to_virt(machine_to_phys_for_dma(bus))
 +#define virt_to_bus(virt)	\
@@ -77815,12 +77959,13 @@
 +	(((bvec_to_bus((vec1)) + (vec1)->bv_len) == bvec_to_bus((vec2))) && \
 +	 ((bvec_to_pseudophys((vec1)) + (vec1)->bv_len) ==		\
 +	  bvec_to_pseudophys((vec2))))
++#endif /* CONFIG_XEN */
  
  # endif /* KERNEL */
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/iosapic.h linux-2.6.18-xen/include/asm-ia64/iosapic.h
 --- linux-2.6.18/include/asm-ia64/iosapic.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/iosapic.h	2006-05-26 22:00:47.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/iosapic.h	2006-09-04 16:31:16.000000000 +0200
 @@ -53,6 +53,7 @@
  
  #define NR_IOSAPICS			256
@@ -77839,7 +77984,7 @@
  {
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/irq.h linux-2.6.18-xen/include/asm-ia64/irq.h
 --- linux-2.6.18/include/asm-ia64/irq.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/irq.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/irq.h	2006-09-04 16:31:16.000000000 +0200
 @@ -11,8 +11,39 @@
   * 02/29/00     D.Mosberger	moved most things into hw_irq.h
   */
@@ -77880,13 +78025,14 @@
  
  static __inline__ int
  irq_canonicalize (int irq)
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/machvec.h linux-2.6.18-xen/include/asm-ia64/machvec.h
---- linux-2.6.18/include/asm-ia64/machvec.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/machvec.h	2006-09-17 17:44:50.000000000 +0200
-@@ -260,6 +260,19 @@
- #  error Unknown configuration.  Update asm-ia64/machvec.h.
- # endif /* CONFIG_IA64_GENERIC */
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/machvec_dig.h linux-2.6.18-xen/include/asm-ia64/machvec_dig.h
+--- linux-2.6.18/include/asm-ia64/machvec_dig.h	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/machvec_dig.h	2006-09-21 01:33:32.000000000 +0200
+@@ -13,4 +13,19 @@
+ #define platform_name		"dig"
+ #define platform_setup		dig_setup
  
++#ifdef CONFIG_XEN
 +# define platform_dma_map_sg		dma_map_sg
 +# define platform_dma_unmap_sg		dma_unmap_sg
 +# define platform_dma_mapping_error	dma_mapping_error
@@ -77899,13 +78045,108 @@
 +					dma_sync_single_for_cpu
 +# define platform_dma_sync_single_for_device \
 +					dma_sync_single_for_device
++#endif
 +
- /*
-  * Declare default routines which aren't declared anywhere else:
-  */
+ #endif /* _ASM_IA64_MACHVEC_DIG_h */
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/maddr.h linux-2.6.18-xen/include/asm-ia64/maddr.h
+--- linux-2.6.18/include/asm-ia64/maddr.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/asm-ia64/maddr.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,92 @@
++#ifndef _ASM_IA64_MADDR_H
++#define _ASM_IA64_MADDR_H
++
++#include <linux/kernel.h>
++#include <asm/hypervisor.h>
++#include <xen/features.h>
++#include <xen/interface/xen.h>
++
++#ifdef CONFIG_XEN
++
++#define INVALID_P2M_ENTRY       (~0UL)
++
++/* XXX xen page size != page size */
++static inline unsigned long
++pfn_to_mfn_for_dma(unsigned long pfn)
++{
++	unsigned long mfn;
++	mfn = HYPERVISOR_phystomach(pfn);
++	BUG_ON(mfn == 0); // XXX
++	BUG_ON(mfn == INVALID_P2M_ENTRY); // XXX
++	BUG_ON(mfn == INVALID_MFN);
++	return mfn;
++}
++
++static inline unsigned long
++phys_to_machine_for_dma(unsigned long phys)
++{
++	unsigned long machine =
++	              pfn_to_mfn_for_dma(phys >> PAGE_SHIFT) << PAGE_SHIFT;
++	machine |= (phys & ~PAGE_MASK);
++	return machine;
++}
++
++static inline unsigned long
++mfn_to_pfn_for_dma(unsigned long mfn)
++{
++	unsigned long pfn;
++	pfn = HYPERVISOR_machtophys(mfn);
++	BUG_ON(pfn == 0);
++	//BUG_ON(pfn == INVALID_M2P_ENTRY);
++	return pfn;
++}
++
++static inline unsigned long
++machine_to_phys_for_dma(unsigned long machine)
++{
++	unsigned long phys =
++	              mfn_to_pfn_for_dma(machine >> PAGE_SHIFT) << PAGE_SHIFT;
++	phys |= (machine & ~PAGE_MASK);
++	return phys;
++}
++
++static inline unsigned long
++mfn_to_local_pfn(unsigned long mfn)
++{
++	extern unsigned long max_mapnr;
++	unsigned long pfn = mfn_to_pfn_for_dma(mfn);
++	if (!pfn_valid(pfn))
++		return INVALID_P2M_ENTRY;
++	return pfn;
++}
++
++#else /* !CONFIG_XEN */
++
++#define pfn_to_mfn_for_dma(pfn) (pfn)
++#define mfn_to_pfn_for_dma(mfn) (mfn)
++#define phys_to_machine_for_dma(phys) (phys)
++#define machine_to_phys_for_dma(machine) (machine)
++#define mfn_to_local_pfn(mfn) (mfn)
++
++#endif /* !CONFIG_XEN */
++
++/* XXX to compile set_phys_to_machine(vaddr, FOREIGN_FRAME(m)) */
++#define FOREIGN_FRAME(m)        (INVALID_P2M_ENTRY)
++
++#define mfn_to_pfn(mfn) (mfn)
++#define pfn_to_mfn(pfn) (pfn)
++
++#define mfn_to_virt(mfn) (__va((mfn) << PAGE_SHIFT))
++#define virt_to_mfn(virt) (__pa(virt) >> PAGE_SHIFT)
++#define virt_to_machine(virt) __pa(virt) // for tpmfront.c
++
++#define set_phys_to_machine(pfn, mfn) do { } while (0)
++#ifdef CONFIG_VMX_GUEST
++extern void xen_machphys_update(unsigned long mfn, unsigned long pfn);
++#else /* CONFIG_VMX_GUEST */
++#define xen_machphys_update(mfn, pfn) do { } while (0)
++#endif /* CONFIG_VMX_GUEST */
++
++typedef unsigned long maddr_t;	// to compile netback, netfront
++
++#endif /* _ASM_IA64_MADDR_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/meminit.h linux-2.6.18-xen/include/asm-ia64/meminit.h
 --- linux-2.6.18/include/asm-ia64/meminit.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/meminit.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/meminit.h	2006-09-04 16:31:16.000000000 +0200
 @@ -16,10 +16,15 @@
   * 	- command line string
   * 	- kernel code & data
@@ -77924,28 +78165,27 @@
  	unsigned long start;	/* virtual address of beginning of element */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/page.h linux-2.6.18-xen/include/asm-ia64/page.h
 --- linux-2.6.18/include/asm-ia64/page.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/page.h	2006-09-20 13:58:41.000000000 +0200
-@@ -126,7 +126,6 @@
++++ linux-2.6.18-xen/include/asm-ia64/page.h	2006-09-21 01:33:32.000000000 +0200
+@@ -126,7 +126,9 @@
  # define pfn_valid(pfn)		(((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
  #endif
  
--#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
++#ifndef CONFIG_XEN
+ #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
++#endif
  #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
  #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
  
-@@ -227,5 +226,118 @@
+@@ -227,5 +229,53 @@
  					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
  					  ? VM_EXEC : 0))
  
 +#ifndef __ASSEMBLY__
 +#ifdef CONFIG_XEN
 +
-+#define INVALID_P2M_ENTRY	(~0UL)
-+
 +#include <linux/kernel.h>
 +#include <asm/hypervisor.h>
 +#include <xen/features.h>	// to compile netback, netfront
-+typedef unsigned long maddr_t;	// to compile netback, netfront
 +
 +/*
 + * XXX hack!
@@ -77984,77 +78224,15 @@
 +})
 +#define HAVE_ARCH_FREE_PAGE
 +
-+/* XXX xen page size != page size */
-+
-+static inline unsigned long
-+pfn_to_mfn_for_dma(unsigned long pfn)
-+{
-+	unsigned long mfn;
-+	mfn = HYPERVISOR_phystomach(pfn);
-+	BUG_ON(mfn == 0); // XXX
-+	BUG_ON(mfn == INVALID_P2M_ENTRY); // XXX
-+	BUG_ON(mfn == INVALID_MFN);
-+	return mfn;
-+}
-+
-+static inline unsigned long
-+phys_to_machine_for_dma(unsigned long phys)
-+{
-+	unsigned long machine =
-+	              pfn_to_mfn_for_dma(phys >> PAGE_SHIFT) << PAGE_SHIFT;
-+	machine |= (phys & ~PAGE_MASK);
-+	return machine;
-+}
-+
-+static inline unsigned long
-+mfn_to_pfn_for_dma(unsigned long mfn)
-+{
-+	unsigned long pfn;
-+	pfn = HYPERVISOR_machtophys(mfn);
-+	BUG_ON(pfn == 0);
-+	//BUG_ON(pfn == INVALID_M2P_ENTRY);
-+	return pfn;
-+}
-+
-+static inline unsigned long
-+machine_to_phys_for_dma(unsigned long machine)
-+{
-+	unsigned long phys =
-+	              mfn_to_pfn_for_dma(machine >> PAGE_SHIFT) << PAGE_SHIFT;
-+	phys |= (machine & ~PAGE_MASK);
-+	return phys;
-+}
-+
-+#define set_phys_to_machine(pfn, mfn) do { } while (0)
-+#define xen_machphys_update(mfn, pfn) do { } while (0)
-+
-+/* XXX to compile set_phys_to_machine(vaddr, FOREIGN_FRAME(m)) */
-+#define FOREIGN_FRAME(m)        (INVALID_P2M_ENTRY)
-+
-+#define mfn_to_pfn(mfn)			(mfn)
-+#define mfn_to_virt(mfn)		(__va((mfn) << PAGE_SHIFT))
-+#define pfn_to_mfn(pfn)			(pfn)
-+#define virt_to_mfn(virt)		(__pa(virt) >> PAGE_SHIFT)
-+#define virt_to_machine(virt)		__pa(virt) // for tpmfront.c
-+
-+static inline unsigned long
-+mfn_to_local_pfn(unsigned long mfn)
-+{
-+	extern unsigned long max_mapnr;
-+	unsigned long pfn = mfn_to_pfn_for_dma(mfn);
-+	if (!pfn_valid(pfn))
-+		return INVALID_P2M_ENTRY;
-+	return pfn;
-+}
++#include <asm/maddr.h>
 +
 +#endif /* CONFIG_XEN */
 +#endif /* __ASSEMBLY__ */
-+
  # endif /* __KERNEL__ */
  #endif /* _ASM_IA64_PAGE_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/pal.h linux-2.6.18-xen/include/asm-ia64/pal.h
 --- linux-2.6.18/include/asm-ia64/pal.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/pal.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/pal.h	2006-09-04 16:31:16.000000000 +0200
 @@ -82,6 +82,7 @@
  #ifndef __ASSEMBLY__
  
@@ -78065,19 +78243,22 @@
  /*
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/pgalloc.h linux-2.6.18-xen/include/asm-ia64/pgalloc.h
 --- linux-2.6.18/include/asm-ia64/pgalloc.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/pgalloc.h	2006-07-07 20:51:43.000000000 +0200
-@@ -125,7 +125,7 @@
++++ linux-2.6.18-xen/include/asm-ia64/pgalloc.h	2006-09-04 16:31:16.000000000 +0200
+@@ -125,7 +125,11 @@
  static inline void
  pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
  {
--	pmd_val(*pmd_entry) = page_to_phys(pte);
++#ifndef CONFIG_XEN
+ 	pmd_val(*pmd_entry) = page_to_phys(pte);
++#else
 +	pmd_val(*pmd_entry) = page_to_pseudophys(pte);
++#endif
  }
  
  static inline void
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/privop.h linux-2.6.18-xen/include/asm-ia64/privop.h
 --- linux-2.6.18/include/asm-ia64/privop.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-ia64/privop.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/privop.h	2006-09-04 16:31:17.000000000 +0200
 @@ -0,0 +1,59 @@
 +#ifndef _ASM_IA64_PRIVOP_H
 +#define _ASM_IA64_PRIVOP_H
@@ -78140,7 +78321,7 @@
 +#endif /* _ASM_IA64_PRIVOP_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/processor.h linux-2.6.18-xen/include/asm-ia64/processor.h
 --- linux-2.6.18/include/asm-ia64/processor.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/processor.h	2006-07-07 20:51:43.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/processor.h	2006-09-04 16:31:17.000000000 +0200
 @@ -18,6 +18,7 @@
  #include <asm/kregs.h>
  #include <asm/ptrace.h>
@@ -78151,7 +78332,7 @@
  /*
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/synch_bitops.h linux-2.6.18-xen/include/asm-ia64/synch_bitops.h
 --- linux-2.6.18/include/asm-ia64/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-ia64/synch_bitops.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/synch_bitops.h	2006-09-04 16:31:17.000000000 +0200
 @@ -0,0 +1,61 @@
 +#ifndef __XEN_SYNCH_BITOPS_H__
 +#define __XEN_SYNCH_BITOPS_H__
@@ -78216,7 +78397,7 @@
 +#endif /* __XEN_SYNCH_BITOPS_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/system.h linux-2.6.18-xen/include/asm-ia64/system.h
 --- linux-2.6.18/include/asm-ia64/system.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-ia64/system.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/system.h	2006-09-04 16:31:17.000000000 +0200
 @@ -123,7 +123,7 @@
  #define __local_irq_save(x)			\
  do {						\
@@ -78237,7 +78418,7 @@
  ({						\
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-ia64/xen/privop.h linux-2.6.18-xen/include/asm-ia64/xen/privop.h
 --- linux-2.6.18/include/asm-ia64/xen/privop.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-ia64/xen/privop.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-ia64/xen/privop.h	2006-09-04 16:31:17.000000000 +0200
 @@ -0,0 +1,304 @@
 +#ifndef _ASM_IA64_XEN_PRIVOP_H
 +#define _ASM_IA64_XEN_PRIVOP_H
@@ -78545,7 +78726,7 @@
 +#endif /* _ASM_IA64_XEN_PRIVOP_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-um/page.h linux-2.6.18-xen/include/asm-um/page.h
 --- linux-2.6.18/include/asm-um/page.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-um/page.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-um/page.h	2006-09-04 16:31:18.000000000 +0200
 @@ -114,7 +114,7 @@
  extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
  #define HAVE_ARCH_VALIDATE
@@ -78557,7 +78738,7 @@
  #include <asm-generic/memory_model.h>
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/apic.h linux-2.6.18-xen/include/asm-x86_64/apic.h
 --- linux-2.6.18/include/asm-x86_64/apic.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/asm-x86_64/apic.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/apic.h	2006-09-04 16:31:18.000000000 +0200
 @@ -98,11 +98,13 @@
  extern int disable_timer_pin_1;
  
@@ -78572,9 +78753,27 @@
  
  #endif /* CONFIG_X86_LOCAL_APIC */
  
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/ipi.h linux-2.6.18-xen/include/asm-x86_64/ipi.h
+--- linux-2.6.18/include/asm-x86_64/ipi.h	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/ipi.h	2006-09-21 01:33:32.000000000 +0200
+@@ -49,6 +49,7 @@
+ 	return SET_APIC_DEST_FIELD(mask);
+ }
+ 
++#ifndef CONFIG_XEN_UNPRIVILEGED_GUEST
+ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest)
+ {
+ 	/*
+@@ -113,5 +114,6 @@
+ 	}
+ 	local_irq_restore(flags);
+ }
++#endif /* CONFIG_XEN_UNPRIVILEGED_GUEST */
+ 
+ #endif /* __ASM_IPI_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/arch_hooks.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/arch_hooks.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/arch_hooks.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/arch_hooks.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/arch_hooks.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,27 @@
 +#ifndef _ASM_ARCH_HOOKS_H
 +#define _ASM_ARCH_HOOKS_H
@@ -78605,7 +78804,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/bootsetup.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/bootsetup.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/bootsetup.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/bootsetup.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/bootsetup.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,42 @@
 +
 +#ifndef _X86_64_BOOTSETUP_H
@@ -78651,7 +78850,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/desc.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/desc.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/desc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/desc.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/desc.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,263 @@
 +/* Written 2000 by Andi Kleen */ 
 +#ifndef __ARCH_DESC_H
@@ -78918,8 +79117,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/dma-mapping.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/dma-mapping.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/dma-mapping.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/dma-mapping.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,207 @@
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/dma-mapping.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,208 @@
 +#ifndef _X8664_DMA_MAPPING_H
 +#define _X8664_DMA_MAPPING_H 1
 +
@@ -79122,6 +79321,7 @@
 +
 +extern struct device fallback_dev;
 +#endif
++
 +extern int panic_on_overflow;
 +
 +#endif /* _X8664_DMA_MAPPING_H */
@@ -79129,7 +79329,7 @@
 +#include <asm-i386/mach-xen/asm/dma-mapping.h>
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/dmi.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/dmi.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/dmi.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/dmi.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/dmi.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,29 @@
 +#ifndef _ASM_DMI_H
 +#define _ASM_DMI_H 1
@@ -79162,8 +79362,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/e820.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/e820.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/e820.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/e820.h	2006-06-19 13:20:42.000000000 +0200
-@@ -0,0 +1,63 @@
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/e820.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,64 @@
 +/*
 + * structures and definitions for the int 15, ax=e820 memory map
 + * scheme.
@@ -79213,7 +79413,8 @@
 +extern unsigned long e820_end_of_ram(void);
 +extern void e820_reserve_resources(struct e820entry *e820, int nr_map);
 +extern void e820_print_map(char *who);
-+extern int e820_mapped(unsigned long start, unsigned long end, unsigned type);
++extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
++extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
 +
 +extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
 +extern void e820_setup_gap(struct e820entry *e820, int nr_map);
@@ -79229,7 +79430,7 @@
 +#endif/*__E820_HEADER*/
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/fixmap.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/fixmap.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/fixmap.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/fixmap.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/fixmap.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,113 @@
 +/*
 + * fixmap.h: compile-time virtual memory allocation
@@ -79346,7 +79547,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/floppy.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/floppy.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/floppy.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/floppy.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/floppy.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,206 @@
 +/*
 + * Architecture specific parts of the Floppy driver
@@ -79484,8 +79685,8 @@
 +
 +static int fd_request_irq(void)
 +{
-+	return request_irq(FLOPPY_IRQ, floppy_hardint, IRQF_DISABLED,
-+			   "floppy", NULL);
++	return request_irq(FLOPPY_IRQ, floppy_hardint,
++			   IRQF_DISABLED, "floppy", NULL);
 +}
 +
 +#if 0
@@ -79556,7 +79757,7 @@
 +#endif /* __ASM_XEN_X86_64_FLOPPY_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/hw_irq.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hw_irq.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/hw_irq.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hw_irq.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hw_irq.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,136 @@
 +#ifndef _ASM_HW_IRQ_H
 +#define _ASM_HW_IRQ_H
@@ -79686,7 +79887,7 @@
 +__asm__( \
 +"\n.p2align\n" \
 +"IRQ" #nr "_interrupt:\n\t" \
-+	"push $~(" #nr ") ; " \
++	"push $" #nr "-256 ; " \
 +	"jmp common_interrupt");
 +
 +#define platform_legacy_irq(irq)	((irq) < 16)
@@ -79696,8 +79897,8 @@
 +#endif /* _ASM_HW_IRQ_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/hypercall.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hypercall.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/hypercall.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hypercall.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,379 @@
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hypercall.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,389 @@
 +/******************************************************************************
 + * hypercall.h
 + * 
@@ -79746,11 +79947,21 @@
 +#define __STR(x) #x
 +#define STR(x) __STR(x)
 +
++#ifdef CONFIG_XEN
++#define HYPERCALL_STR(name)					\
++	"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
++#else
++#define HYPERCALL_STR(name)					\
++	"mov hypercall_stubs,%%rax; "				\
++	"add $("STR(__HYPERVISOR_##name)" * 32),%%rax; "	\
++	"call *%%rax"
++#endif
++
 +#define _hypercall0(type, name)			\
 +({						\
 +	long __res;				\
 +	asm volatile (				\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)		\
 +		: "=a" (__res)			\
 +		:				\
 +		: "memory" );			\
@@ -79761,7 +79972,7 @@
 +({								\
 +	long __res, __ign1;					\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=D" (__ign1)			\
 +		: "1" ((long)(a1))				\
 +		: "memory" );					\
@@ -79772,7 +79983,7 @@
 +({								\
 +	long __res, __ign1, __ign2;				\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2)	\
 +		: "1" ((long)(a1)), "2" ((long)(a2))		\
 +		: "memory" );					\
@@ -79783,7 +79994,7 @@
 +({								\
 +	long __res, __ign1, __ign2, __ign3;			\
 +	asm volatile (						\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2), 	\
 +		"=d" (__ign3)					\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
@@ -79797,7 +80008,7 @@
 +	long __res, __ign1, __ign2, __ign3;			\
 +	asm volatile (						\
 +		"movq %7,%%r10; "				\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
 +		"=d" (__ign3)					\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
@@ -79811,7 +80022,7 @@
 +	long __res, __ign1, __ign2, __ign3;			\
 +	asm volatile (						\
 +		"movq %7,%%r10; movq %8,%%r8; "			\
-+		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
++		HYPERCALL_STR(name)				\
 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
 +		"=d" (__ign3)					\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
@@ -80079,13 +80290,13 @@
 +#endif /* __HYPERCALL_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/hypervisor.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hypervisor.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hypervisor.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/hypervisor.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +#include <asm-i386/mach-xen/asm/hypervisor.h>
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/io.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/io.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/io.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/io.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/io.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,327 @@
 +#ifndef _ASM_IO_H
 +#define _ASM_IO_H
@@ -80416,7 +80627,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/irqflags.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/irqflags.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/irqflags.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/irqflags.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/irqflags.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,65 @@
 +/*
 + * include/asm-x86_64/irqflags.h
@@ -80485,7 +80696,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/irq.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/irq.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/irq.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/irq.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/irq.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,38 @@
 +#ifndef _ASM_IRQ_H
 +#define _ASM_IRQ_H
@@ -80527,7 +80738,7 @@
 +#endif /* _ASM_IRQ_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/maddr.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/maddr.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/maddr.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/maddr.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/maddr.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,139 @@
 +#ifndef _X86_64_MADDR_H
 +#define _X86_64_MADDR_H
@@ -80670,7 +80881,7 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/mmu_context.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/mmu_context.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/mmu_context.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/mmu_context.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/mmu_context.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,135 @@
 +#ifndef __X86_64_MMU_CONTEXT_H
 +#define __X86_64_MMU_CONTEXT_H
@@ -80809,7 +81020,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/mmu.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/mmu.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/mmu.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/mmu.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/mmu.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,38 @@
 +#ifndef __x86_64_MMU_H
 +#define __x86_64_MMU_H
@@ -80851,7 +81062,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/msr.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/msr.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/msr.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/msr.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/msr.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,399 @@
 +#ifndef X86_64_MSR_H
 +#define X86_64_MSR_H 1
@@ -81254,7 +81465,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/nmi.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/nmi.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/nmi.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/nmi.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/nmi.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,93 @@
 +/*
 + *  linux/include/asm-i386/nmi.h
@@ -81287,7 +81498,7 @@
 +void unset_nmi_callback(void);
 +
 +#ifdef CONFIG_PM
-+
++ 
 +/** Replace the PM callback routine for NMI. */
 +struct pm_dev * set_nmi_pm_callback(pm_callback callback);
 +
@@ -81300,13 +81511,13 @@
 +{
 +	return 0;
 +} 
-+
++ 
 +static inline void unset_nmi_pm_callback(struct pm_dev * dev)
 +{
 +}
 +
 +#endif /* CONFIG_PM */
-+
++ 
 +extern void default_do_nmi(struct pt_regs *);
 +extern void die_nmi(char *str, struct pt_regs *regs);
 +
@@ -81330,7 +81541,7 @@
 +extern int unknown_nmi_panic;
 +
 +extern int check_nmi_watchdog(void);
-+
++ 
 +extern void setup_apic_nmi_watchdog (void);
 +extern int reserve_lapic_nmi(void);
 +extern void release_lapic_nmi(void);
@@ -81351,7 +81562,7 @@
 +#endif /* ASM_NMI_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/page.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/page.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/page.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/page.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/page.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,208 @@
 +#ifndef _X86_64_PAGE_H
 +#define _X86_64_PAGE_H
@@ -81563,7 +81774,7 @@
 +#endif /* _X86_64_PAGE_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/param.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/param.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/param.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/param.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/param.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,22 @@
 +#ifndef _ASMx86_64_PARAM_H
 +#define _ASMx86_64_PARAM_H
@@ -81589,7 +81800,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/pci.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pci.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/pci.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pci.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pci.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,173 @@
 +#ifndef __x8664_PCI_H
 +#define __x8664_PCI_H
@@ -81766,7 +81977,7 @@
 +#endif /* __x8664_PCI_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/pgalloc.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pgalloc.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/pgalloc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pgalloc.h	2006-05-26 22:00:53.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pgalloc.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,226 @@
 +#ifndef _X86_64_PGALLOC_H
 +#define _X86_64_PGALLOC_H
@@ -81996,8 +82207,8 @@
 +#endif /* _X86_64_PGALLOC_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/pgtable.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pgtable.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/pgtable.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pgtable.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,559 @@
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/pgtable.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,558 @@
 +#ifndef _X86_64_PGTABLE_H
 +#define _X86_64_PGTABLE_H
 +
@@ -82206,7 +82417,7 @@
 +#define _PAGE_NX        (1UL<<_PAGE_BIT_NX)
 +
 +#define _PAGE_TABLE	(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
-+#define _KERNPG_TABLE	_PAGE_TABLE
++#define _KERNPG_TABLE	(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
 +
 +#define _PAGE_CHG_MASK	(PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
 +
@@ -82219,22 +82430,21 @@
 +#define PAGE_READONLY	__pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_NX)
 +#define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
 +#define __PAGE_KERNEL \
-+	(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX | _PAGE_USER )
++	(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX)
 +#define __PAGE_KERNEL_EXEC \
-+	(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER )
++	(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
 +#define __PAGE_KERNEL_NOCACHE \
-+	(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED | _PAGE_NX | _PAGE_USER )
++	(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED | _PAGE_NX)
 +#define __PAGE_KERNEL_RO \
-+	(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX | _PAGE_USER )
++	(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX)
 +#define __PAGE_KERNEL_VSYSCALL \
-+	(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_USER )
++	(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
 +#define __PAGE_KERNEL_VSYSCALL_NOCACHE \
-+	(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD | _PAGE_USER )
++	(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD)
 +#define __PAGE_KERNEL_LARGE \
-+	(__PAGE_KERNEL | _PAGE_PSE | _PAGE_USER )
++	(__PAGE_KERNEL | _PAGE_PSE)
 +#define __PAGE_KERNEL_LARGE_EXEC \
-+	(__PAGE_KERNEL_EXEC | _PAGE_PSE | _PAGE_USER )
-+
++	(__PAGE_KERNEL_EXEC | _PAGE_PSE)
 +
 +/*
 + * We don't support GLOBAL page in xenolinux64
@@ -82419,7 +82629,7 @@
 +   can temporarily clear it. */
 +#define pmd_present(x)	(pmd_val(x))
 +#define pmd_clear(xp)	do { set_pmd(xp, __pmd(0)); } while (0)
-+#define	pmd_bad(x)	((pmd_val(x) & (~PAGE_MASK & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
++#define	pmd_bad(x)	((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
 +#define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
 +#define pmd_pfn(x)  ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 +
@@ -82559,8 +82769,8 @@
 +#endif /* _X86_64_PGTABLE_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/processor.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/processor.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/processor.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/processor.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,503 @@
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/processor.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,504 @@
 +/*
 + * include/asm-x86_64/processor.h
 + *
@@ -82807,6 +83017,7 @@
 +DECLARE_PER_CPU(struct tss_struct,init_tss);
 +#endif
 +
++
 +extern struct cpuinfo_x86 boot_cpu_data;
 +/* Save the original ist values for checking stack pointers during debugging */
 +struct orig_ist {
@@ -83066,7 +83277,7 @@
 +#endif /* __ASM_X86_64_PROCESSOR_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/ptrace.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/ptrace.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/ptrace.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/ptrace.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/ptrace.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,125 @@
 +#ifndef _X86_64_PTRACE_H
 +#define _X86_64_PTRACE_H
@@ -83195,7 +83406,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/smp.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/smp.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/smp.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/smp.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/smp.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,150 @@
 +#ifndef __ASM_SMP_H
 +#define __ASM_SMP_H
@@ -83349,20 +83560,19 @@
 +
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/synch_bitops.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/synch_bitops.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/synch_bitops.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/synch_bitops.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +#include <asm-i386/mach-xen/asm/synch_bitops.h>
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/system.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/system.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/system.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/system.h	2006-08-15 13:03:31.000000000 +0200
-@@ -0,0 +1,265 @@
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/system.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,264 @@
 +#ifndef __ASM_SYSTEM_H
 +#define __ASM_SYSTEM_H
 +
 +#include <linux/kernel.h>
 +#include <asm/segment.h>
-+#include <asm/alternative.h>
 +#include <asm/synch_bitops.h>
 +#include <asm/hypervisor.h>
 +#include <xen/interface/arch-x86_64.h>
@@ -83624,7 +83834,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/timer.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/timer.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/timer.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/timer.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/timer.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,67 @@
 +#ifndef _ASMi386_TIMER_H
 +#define _ASMi386_TIMER_H
@@ -83695,7 +83905,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/tlbflush.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/tlbflush.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/tlbflush.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/tlbflush.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/tlbflush.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,103 @@
 +#ifndef _X8664_TLBFLUSH_H
 +#define _X8664_TLBFLUSH_H
@@ -83802,7 +84012,7 @@
 +#endif /* _X8664_TLBFLUSH_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/vga.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/vga.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/vga.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/vga.h	2006-07-07 20:51:46.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/vga.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,20 @@
 +/*
 + *	Access to VGA videoram
@@ -83826,7 +84036,7 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/asm/xor.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/xor.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/asm/xor.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/xor.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/asm/xor.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,328 @@
 +/*
 + * x86-64 changes / gcc fixes from Andi Kleen. 
@@ -84158,7 +84368,7 @@
 +#define XOR_SELECT_TEMPLATE(FASTEST) (&xor_block_sse)
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/irq_vectors.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/irq_vectors.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/irq_vectors.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/irq_vectors.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/irq_vectors.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,123 @@
 +/*
 + * This file should contain #defines for all of the interrupt vector
@@ -84285,7 +84495,7 @@
 +#endif /* _ASM_IRQ_VECTORS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/mach_time.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/mach_time.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/mach_time.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/mach_time.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/mach_time.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,111 @@
 +/*
 + *  include/asm-i386/mach-default/mach_time.h
@@ -84400,7 +84610,7 @@
 +#endif /* !_MACH_TIME_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/mach_timer.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/mach_timer.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/mach_timer.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/mach_timer.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/mach_timer.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,48 @@
 +/*
 + *  include/asm-i386/mach-default/mach_timer.h
@@ -84452,7 +84662,7 @@
 +#endif /* !_MACH_TIMER_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/setup_arch_post.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/setup_arch_post.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/setup_arch_post.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/setup_arch_post.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/setup_arch_post.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,58 @@
 +/**
 + * machine_specific_* - Hooks for machine specific setup.
@@ -84514,48 +84724,110 @@
 +}
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/asm-x86_64/mach-xen/setup_arch_pre.h linux-2.6.18-xen/include/asm-x86_64/mach-xen/setup_arch_pre.h
 --- linux-2.6.18/include/asm-x86_64/mach-xen/setup_arch_pre.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/setup_arch_pre.h	2006-05-26 22:00:54.000000000 +0200
++++ linux-2.6.18-xen/include/asm-x86_64/mach-xen/setup_arch_pre.h	2006-09-04 16:31:18.000000000 +0200
 @@ -0,0 +1,5 @@
 +/* Hook to call BIOS initialisation function */
 +
 +#define ARCH_SETUP machine_specific_arch_setup();
 +
 +static void __init machine_specific_arch_setup(void);
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/aio.h linux-2.6.18-xen/include/linux/aio.h
---- linux-2.6.18/include/linux/aio.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/aio.h	2006-08-15 13:03:31.000000000 +0200
-@@ -191,6 +191,11 @@
- 	struct aio_ring_info	ring_info;
- 
- 	struct work_struct	wq;
-+#ifdef CONFIG_EPOLL
-+	// poll integration
-+	wait_queue_head_t       poll_wait;
-+	struct file		*file;
-+#endif
- };
- 
- /* prototypes */
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/eventpoll.h linux-2.6.18-xen/include/linux/eventpoll.h
---- linux-2.6.18/include/linux/eventpoll.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/eventpoll.h	2006-08-15 13:03:31.000000000 +0200
-@@ -90,6 +90,13 @@
- 	eventpoll_release_file(file);
- }
- 
-+
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/elfnote.h linux-2.6.18-xen/include/linux/elfnote.h
+--- linux-2.6.18/include/linux/elfnote.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/linux/elfnote.h	2006-09-04 16:31:18.000000000 +0200
+@@ -0,0 +1,90 @@
++#ifndef _LINUX_ELFNOTE_H
++#define _LINUX_ELFNOTE_H
 +/*
-+ * called by aio code to create fd that can poll the  aio event queueQ
-+ */
-+struct eventpoll;
-+int ep_getfd(int *efd, struct inode **einode, struct file **efile,
-+             struct eventpoll *ep, struct file_operations *fops);
- #else
- 
- static inline void eventpoll_init_file(struct file *file) {}
++ * Helper macros to generate ELF Note structures, which are put into a
++ * PT_NOTE segment of the final vmlinux image.  These are useful for
++ * including name-value pairs of metadata into the kernel binary (or
++ * modules?) for use by external programs.
++ *
++ * Each note has three parts: a name, a type and a desc.  The name is
++ * intended to distinguish the note's originator, so it would be a
++ * company, project, subsystem, etc; it must be in a suitable form for
++ * use in a section name.  The type is an integer which is used to tag
++ * the data, and is considered to be within the "name" namespace (so
++ * "FooCo"'s type 42 is distinct from "BarProj"'s type 42).  The
++ * "desc" field is the actual data.  There are no constraints on the
++ * desc field's contents, though typically they're fairly small.
++ *
++ * All notes from a given NAME are put into a section named
++ * .note.NAME.  When the kernel image is finally linked, all the notes
++ * are packed into a single .notes section, which is mapped into the
++ * PT_NOTE segment.  Because notes for a given name are grouped into
++ * the same section, they'll all be adjacent the output file.
++ *
++ * This file defines macros for both C and assembler use.  Their
++ * syntax is slightly different, but they're semantically similar.
++ *
++ * See the ELF specification for more detail about ELF notes.
++ */
++
++#ifdef __ASSEMBLER__
++/*
++ * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
++ * turn out to be the same size and shape), followed by the name and
++ * desc data with appropriate padding.  The 'desctype' argument is the
++ * assembler pseudo op defining the type of the data e.g. .asciz while
++ * 'descdata' is the data itself e.g.  "hello, world".
++ *
++ * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
++ *      ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
++ */
++#define ELFNOTE(name, type, desctype, descdata)	\
++.pushsection .note.name			;	\
++  .align 4				;	\
++  .long 2f - 1f		/* namesz */	;	\
++  .long 4f - 3f		/* descsz */	;	\
++  .long type				;	\
++1:.asciz "name"				;	\
++2:.align 4				;	\
++3:desctype descdata			;	\
++4:.align 4				;	\
++.popsection				;
++#else	/* !__ASSEMBLER__ */
++#include <linux/elf.h>
++/*
++ * Use an anonymous structure which matches the shape of
++ * Elf{32,64}_Nhdr, but includes the name and desc data.  The size and
++ * type of name and desc depend on the macro arguments.  "name" must
++ * be a literal string, and "desc" must be passed by value.  You may
++ * only define one note per line, since __LINE__ is used to generate
++ * unique symbols.
++ */
++#define _ELFNOTE_PASTE(a,b)	a##b
++#define _ELFNOTE(size, name, unique, type, desc)			\
++	static const struct {						\
++		struct elf##size##_note _nhdr;				\
++		unsigned char _name[sizeof(name)]			\
++		__attribute__((aligned(sizeof(Elf##size##_Word))));	\
++		typeof(desc) _desc					\
++			     __attribute__((aligned(sizeof(Elf##size##_Word)))); \
++	} _ELFNOTE_PASTE(_note_, unique)				\
++		__attribute_used__					\
++		__attribute__((section(".note." name),			\
++			       aligned(sizeof(Elf##size##_Word)),	\
++			       unused)) = {				\
++		{							\
++			sizeof(name),					\
++			sizeof(desc),					\
++			type,						\
++		},							\
++		name,							\
++		desc							\
++	}
++#define ELFNOTE(size, name, type, desc)		\
++	_ELFNOTE(size, name, __LINE__, type, desc)
++
++#define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
++#define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc)
++#endif	/* __ASSEMBLER__ */
++
++#endif /* _LINUX_ELFNOTE_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/gfp.h linux-2.6.18-xen/include/linux/gfp.h
 --- linux-2.6.18/include/linux/gfp.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/gfp.h	2006-07-07 20:51:47.000000000 +0200
++++ linux-2.6.18-xen/include/linux/gfp.h	2006-09-04 16:31:18.000000000 +0200
 @@ -99,7 +99,11 @@
   */
  
@@ -84571,7 +84843,7 @@
  extern struct page *
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/highmem.h linux-2.6.18-xen/include/linux/highmem.h
 --- linux-2.6.18/include/linux/highmem.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/highmem.h	2006-07-07 20:51:47.000000000 +0200
++++ linux-2.6.18-xen/include/linux/highmem.h	2006-09-04 16:31:18.000000000 +0200
 @@ -24,10 +24,16 @@
  
  /* declarations for linux/mm/highmem.c */
@@ -84591,7 +84863,7 @@
  {
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/interrupt.h linux-2.6.18-xen/include/linux/interrupt.h
 --- linux-2.6.18/include/linux/interrupt.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/interrupt.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/linux/interrupt.h	2006-09-04 16:31:18.000000000 +0200
 @@ -166,6 +166,12 @@
  
  #endif /* CONFIG_GENERIC_HARDIRQS */
@@ -84607,7 +84879,7 @@
  #define or_softirq_pending(x)  (local_softirq_pending() |= (x))
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/mm.h linux-2.6.18-xen/include/linux/mm.h
 --- linux-2.6.18/include/linux/mm.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/mm.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/linux/mm.h	2006-09-04 16:31:19.000000000 +0200
 @@ -164,6 +164,9 @@
  #define VM_NONLINEAR	0x00800000	/* Is non-linear (remap_file_pages) */
  #define VM_MAPPED_COPY	0x01000000	/* T if mapped copy of data (nommu mmap) */
@@ -84634,7 +84906,7 @@
  #else
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/oprofile.h linux-2.6.18-xen/include/linux/oprofile.h
 --- linux-2.6.18/include/linux/oprofile.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/oprofile.h	2006-08-15 13:03:31.000000000 +0200
++++ linux-2.6.18-xen/include/linux/oprofile.h	2006-09-04 16:31:19.000000000 +0200
 @@ -16,6 +16,10 @@
  #include <linux/types.h>
  #include <linux/spinlock.h>
@@ -84667,20 +84939,9 @@
  
  /**
   * Create a file of the given name as a child of the given root, with
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/pfn.h linux-2.6.18-xen/include/linux/pfn.h
---- linux-2.6.18/include/linux/pfn.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/pfn.h	2006-05-26 22:00:56.000000000 +0200
-@@ -4,6 +4,6 @@
- #define PFN_ALIGN(x)	(((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
- #define PFN_UP(x)	(((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
- #define PFN_DOWN(x)	((x) >> PAGE_SHIFT)
--#define PFN_PHYS(x)	((x) << PAGE_SHIFT)
-+#define PFN_PHYS(x)	((unsigned long long)(x) << PAGE_SHIFT)
- 
- #endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/linux/skbuff.h linux-2.6.18-xen/include/linux/skbuff.h
 --- linux-2.6.18/include/linux/skbuff.h	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/include/linux/skbuff.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/linux/skbuff.h	2006-09-04 16:31:19.000000000 +0200
 @@ -203,6 +203,8 @@
   *	@local_df: allow local fragmentation
   *	@cloned: Head may be cloned (check refcnt to be sure)
@@ -84734,8 +84995,8 @@
   *	dev_alloc_skb - allocate an skbuff for receiving
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/balloon.h linux-2.6.18-xen/include/xen/balloon.h
 --- linux-2.6.18/include/xen/balloon.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/balloon.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,65 @@
++++ linux-2.6.18-xen/include/xen/balloon.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,67 @@
 +/******************************************************************************
 + * balloon.h
 + *
@@ -84776,21 +85037,23 @@
 + * Inform the balloon driver that it should allow some slop for device-driver
 + * memory activities.
 + */
-+extern void
++void
 +balloon_update_driver_allowance(
 +	long delta);
 +
 +/* Allocate an empty low-memory page range. */
-+extern struct page *
++struct page *
 +balloon_alloc_empty_page_range(
 +	unsigned long nr_pages);
 +
 +/* Deallocate an empty page range, adding to the balloon. */
-+extern void
++void
 +balloon_dealloc_empty_page_range(
 +	struct page *page, unsigned long nr_pages);
 +
-+void balloon_release_driver_page(struct page *page);
++void
++balloon_release_driver_page(
++	struct page *page);
 +
 +/*
 + * Prevent the balloon driver from changing the memory reservation during
@@ -84803,7 +85066,7 @@
 +#endif /* __ASM_BALLOON_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/cpu_hotplug.h linux-2.6.18-xen/include/xen/cpu_hotplug.h
 --- linux-2.6.18/include/xen/cpu_hotplug.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/cpu_hotplug.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/cpu_hotplug.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,43 @@
 +#ifndef __XEN_CPU_HOTPLUG_H__
 +#define __XEN_CPU_HOTPLUG_H__
@@ -84850,7 +85113,7 @@
 +#endif /* __XEN_CPU_HOTPLUG_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/driver_util.h linux-2.6.18-xen/include/xen/driver_util.h
 --- linux-2.6.18/include/xen/driver_util.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/driver_util.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/driver_util.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,15 @@
 +
 +#ifndef __ASM_XEN_DRIVER_UTIL_H__
@@ -84869,7 +85132,7 @@
 +#endif /* __ASM_XEN_DRIVER_UTIL_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/evtchn.h linux-2.6.18-xen/include/xen/evtchn.h
 --- linux-2.6.18/include/xen/evtchn.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/evtchn.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/evtchn.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,113 @@
 +/******************************************************************************
 + * evtchn.h
@@ -84986,7 +85249,7 @@
 +#endif /* __ASM_EVTCHN_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/features.h linux-2.6.18-xen/include/xen/features.h
 --- linux-2.6.18/include/xen/features.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/features.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/features.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,20 @@
 +/******************************************************************************
 + * features.h
@@ -85010,7 +85273,7 @@
 +#endif /* __ASM_XEN_FEATURES_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/foreign_page.h linux-2.6.18-xen/include/xen/foreign_page.h
 --- linux-2.6.18/include/xen/foreign_page.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/foreign_page.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/foreign_page.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,30 @@
 +/******************************************************************************
 + * foreign_page.h
@@ -85044,7 +85307,7 @@
 +#endif /* __ASM_XEN_FOREIGN_PAGE_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/gnttab.h linux-2.6.18-xen/include/xen/gnttab.h
 --- linux-2.6.18/include/xen/gnttab.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/gnttab.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/gnttab.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,150 @@
 +/******************************************************************************
 + * gnttab.h
@@ -85198,7 +85461,7 @@
 +#endif /* __ASM_GNTTAB_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/hvm.h linux-2.6.18-xen/include/xen/hvm.h
 --- linux-2.6.18/include/xen/hvm.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/hvm.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/hvm.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,24 @@
 +/* Simple wrappers around HVM functions */
 +#ifndef XEN_HVM_H__
@@ -85226,7 +85489,7 @@
 +#endif /* XEN_HVM_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/hypervisor_sysfs.h linux-2.6.18-xen/include/xen/hypervisor_sysfs.h
 --- linux-2.6.18/include/xen/hypervisor_sysfs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/hypervisor_sysfs.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/hypervisor_sysfs.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,32 @@
 +/*
 + *  copyright (c) 2006 IBM Corporation
@@ -85262,8 +85525,8 @@
 +#endif /* _HYP_SYSFS_H_ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/acm.h linux-2.6.18-xen/include/xen/interface/acm.h
 --- linux-2.6.18/include/xen/interface/acm.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/acm.h	2006-07-07 20:51:48.000000000 +0200
-@@ -0,0 +1,188 @@
++++ linux-2.6.18-xen/include/xen/interface/acm.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,187 @@
 +/*
 + * acm.h: Xen access control module interface defintions
 + *
@@ -85275,7 +85538,6 @@
 +#define _XEN_PUBLIC_ACM_H
 +
 +#include "xen.h"
-+#include "sched_ctl.h"
 +
 +/* if ACM_DEBUG defined, all hooks should
 + * print a short trace message (comment it out
@@ -85454,8 +85716,8 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/acm_ops.h linux-2.6.18-xen/include/xen/interface/acm_ops.h
 --- linux-2.6.18/include/xen/interface/acm_ops.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/acm_ops.h	2006-07-07 20:51:48.000000000 +0200
-@@ -0,0 +1,103 @@
++++ linux-2.6.18-xen/include/xen/interface/acm_ops.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,102 @@
 +/*
 + * acm_ops.h: Xen access control module hypervisor commands
 + *
@@ -85467,7 +85729,6 @@
 +#define __XEN_PUBLIC_ACM_OPS_H__
 +
 +#include "xen.h"
-+#include "sched_ctl.h"
 +#include "acm.h"
 +
 +/*
@@ -85561,7 +85822,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/arch-ia64.h linux-2.6.18-xen/include/xen/interface/arch-ia64.h
 --- linux-2.6.18/include/xen/interface/arch-ia64.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/arch-ia64.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/arch-ia64.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,448 @@
 +/******************************************************************************
 + * arch-ia64/hypervisor-if.h
@@ -86013,7 +86274,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/arch-powerpc.h linux-2.6.18-xen/include/xen/interface/arch-powerpc.h
 --- linux-2.6.18/include/xen/interface/arch-powerpc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/arch-powerpc.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/arch-powerpc.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,115 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify
@@ -86132,8 +86393,8 @@
 +#endif
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/arch-x86_32.h linux-2.6.18-xen/include/xen/interface/arch-x86_32.h
 --- linux-2.6.18/include/xen/interface/arch-x86_32.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/arch-x86_32.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,256 @@
++++ linux-2.6.18-xen/include/xen/interface/arch-x86_32.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,255 @@
 +/******************************************************************************
 + * arch-x86_32.h
 + * 
@@ -86163,7 +86424,6 @@
 +#define TRAP_INSTR "int $0x82"
 +#endif
 +
-+
 +/* Structural guest handles introduced in 0x00030201. */
 +#if __XEN_INTERFACE_VERSION__ >= 0x00030201
 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
@@ -86392,7 +86652,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/arch-x86_64.h linux-2.6.18-xen/include/xen/interface/arch-x86_64.h
 --- linux-2.6.18/include/xen/interface/arch-x86_64.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/arch-x86_64.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/arch-x86_64.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,322 @@
 +/******************************************************************************
 + * arch-x86_64.h
@@ -86718,7 +86978,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/callback.h linux-2.6.18-xen/include/xen/interface/callback.h
 --- linux-2.6.18/include/xen/interface/callback.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/callback.h	2006-06-19 13:20:42.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/callback.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,74 @@
 +/******************************************************************************
 + * callback.h
@@ -86796,96 +87056,160 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/dom0_ops.h linux-2.6.18-xen/include/xen/interface/dom0_ops.h
 --- linux-2.6.18/include/xen/interface/dom0_ops.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/dom0_ops.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,619 @@
++++ linux-2.6.18-xen/include/xen/interface/dom0_ops.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,102 @@
 +/******************************************************************************
 + * dom0_ops.h
 + * 
 + * Process command requests from domain-0 guest OS.
 + * 
 + * Copyright (c) 2002-2003, B Dragovic
-+ * Copyright (c) 2002-2004, K Fraser
++ * Copyright (c) 2002-2006, K Fraser
 + */
 +
-+
 +#ifndef __XEN_PUBLIC_DOM0_OPS_H__
 +#define __XEN_PUBLIC_DOM0_OPS_H__
 +
 +#include "xen.h"
-+#include "sched_ctl.h"
++#include "platform.h"
 +
-+/*
-+ * Make sure you increment the interface version whenever you modify this file!
-+ * This makes sure that old versions of dom0 tools will stop working in a
-+ * well-defined way (rather than crashing the machine, for instance).
-+ */
-+#define DOM0_INTERFACE_VERSION   0x03000001
++#if __XEN_INTERFACE_VERSION__ >= 0x00030204
++#error "dom0_ops.h is a compatibility interface only"
++#endif
 +
-+/************************************************************************/
++#define DOM0_INTERFACE_VERSION XENPF_INTERFACE_VERSION
++
++#define DOM0_SETTIME          XENPF_settime
++#define dom0_settime          xenpf_settime
++#define dom0_settime_t        xenpf_settime_t
++
++#define DOM0_ADD_MEMTYPE      XENPF_add_memtype
++#define dom0_add_memtype      xenpf_add_memtype
++#define dom0_add_memtype_t    xenpf_add_memtype_t
++
++#define DOM0_DEL_MEMTYPE      XENPF_del_memtype
++#define dom0_del_memtype      xenpf_del_memtype
++#define dom0_del_memtype_t    xenpf_del_memtype_t
++
++#define DOM0_READ_MEMTYPE     XENPF_read_memtype
++#define dom0_read_memtype     xenpf_read_memtype
++#define dom0_read_memtype_t   xenpf_read_memtype_t
++
++#define DOM0_MICROCODE        XENPF_microcode_update
++#define dom0_microcode        xenpf_microcode_update
++#define dom0_microcode_t      xenpf_microcode_update_t
 +
-+#define DOM0_GETMEMLIST        2
-+struct dom0_getmemlist {
++#define DOM0_PLATFORM_QUIRK   XENPF_platform_quirk
++#define dom0_platform_quirk   xenpf_platform_quirk
++#define dom0_platform_quirk_t xenpf_platform_quirk_t
++
++typedef uint64_t cpumap_t;
++
++/* Unsupported legacy operation -- defined for API compatibility. */
++#define DOM0_MSR                 15
++struct dom0_msr {
 +    /* IN variables. */
-+    domid_t       domain;
-+    uint64_t max_pfns;
-+    XEN_GUEST_HANDLE(xen_pfn_t) buffer;
++    uint32_t write;
++    cpumap_t cpu_mask;
++    uint32_t msr;
++    uint32_t in1;
++    uint32_t in2;
 +    /* OUT variables. */
-+    uint64_t num_pfns;
++    uint32_t out1;
++    uint32_t out2;
 +};
-+typedef struct dom0_getmemlist dom0_getmemlist_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getmemlist_t);
-+
-+#define DOM0_SCHEDCTL          6
-+ /* struct sched_ctl_cmd is from sched-ctl.h   */
-+typedef struct sched_ctl_cmd dom0_schedctl_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_schedctl_t);
-+
-+#define DOM0_ADJUSTDOM         7
-+/* struct sched_adjdom_cmd is from sched-ctl.h */
-+typedef struct sched_adjdom_cmd dom0_adjustdom_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_adjustdom_t);
++typedef struct dom0_msr dom0_msr_t;
++DEFINE_XEN_GUEST_HANDLE(dom0_msr_t);
 +
-+#define DOM0_CREATEDOMAIN      8
-+struct dom0_createdomain {
-+    /* IN parameters */
-+    uint32_t ssidref;
-+    xen_domain_handle_t handle;
-+    /* IN/OUT parameters. */
-+    /* Identifier for new domain (auto-allocate if zero is specified). */
-+    domid_t domain;
++/* Unsupported legacy operation -- defined for API compatibility. */
++#define DOM0_PHYSICAL_MEMORY_MAP 40
++struct dom0_memory_map_entry {
++    uint64_t start, end;
++    uint32_t flags; /* reserved */
++    uint8_t  is_ram;
 +};
-+typedef struct dom0_createdomain dom0_createdomain_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_createdomain_t);
++typedef struct dom0_memory_map_entry dom0_memory_map_entry_t;
++DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t);
 +
-+#define DOM0_DESTROYDOMAIN     9
-+struct dom0_destroydomain {
-+    /* IN variables. */
-+    domid_t domain;
++struct dom0_op {
++    uint32_t cmd;
++    uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
++    union {
++        struct dom0_msr               msr;
++        struct dom0_settime           settime;
++        struct dom0_add_memtype       add_memtype;
++        struct dom0_del_memtype       del_memtype;
++        struct dom0_read_memtype      read_memtype;
++        struct dom0_microcode         microcode;
++        struct dom0_platform_quirk    platform_quirk;
++        struct dom0_memory_map_entry  physical_memory_map;
++        uint8_t                       pad[128];
++    } u;
 +};
-+typedef struct dom0_destroydomain dom0_destroydomain_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_destroydomain_t);
++typedef struct dom0_op dom0_op_t;
++DEFINE_XEN_GUEST_HANDLE(dom0_op_t);
 +
-+#define DOM0_PAUSEDOMAIN      10
-+struct dom0_pausedomain {
-+    /* IN parameters. */
-+    domid_t domain;
++#endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
++
++/*
++ * Local variables:
++ * mode: C
++ * c-set-style: "BSD"
++ * c-basic-offset: 4
++ * tab-width: 4
++ * indent-tabs-mode: nil
++ * End:
++ */
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/domctl.h linux-2.6.18-xen/include/xen/interface/domctl.h
+--- linux-2.6.18/include/xen/interface/domctl.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/xen/interface/domctl.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,392 @@
++/******************************************************************************
++ * domctl.h
++ * 
++ * Domain management operations. For use by node control stack.
++ * 
++ * Copyright (c) 2002-2003, B Dragovic
++ * Copyright (c) 2002-2006, K Fraser
++ */
++
++#ifndef __XEN_PUBLIC_DOMCTL_H__
++#define __XEN_PUBLIC_DOMCTL_H__
++
++#if !defined(__XEN__) && !defined(__XEN_TOOLS__)
++#error "domctl operations are intended for use by node control tools only"
++#endif
++
++#include "xen.h"
++
++#define XEN_DOMCTL_INTERFACE_VERSION 0x00000003
++
++struct xenctl_cpumap {
++    XEN_GUEST_HANDLE(uint8_t) bitmap;
++    uint32_t nr_cpus;
 +};
-+typedef struct dom0_pausedomain dom0_pausedomain_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_pausedomain_t);
 +
-+#define DOM0_UNPAUSEDOMAIN    11
-+struct dom0_unpausedomain {
-+    /* IN parameters. */
-+    domid_t domain;
++/*
++ * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
++ * If it is specified as zero, an id is auto-allocated and returned.
++ */
++#define XEN_DOMCTL_createdomain       1
++struct xen_domctl_createdomain {
++    /* IN parameters */
++    uint32_t ssidref;
++    xen_domain_handle_t handle;
 +};
-+typedef struct dom0_unpausedomain dom0_unpausedomain_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_unpausedomain_t);
++typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
 +
-+#define DOM0_GETDOMAININFO    12
-+struct dom0_getdomaininfo {
-+    /* IN variables. */
-+    domid_t  domain;                  /* NB. IN/OUT variable. */
++#define XEN_DOMCTL_destroydomain      2
++#define XEN_DOMCTL_pausedomain        3
++#define XEN_DOMCTL_unpausedomain      4
++
++#define XEN_DOMCTL_getdomaininfo      5
++struct xen_domctl_getdomaininfo {
 +    /* OUT variables. */
++    domid_t  domain;              /* Also echoed in domctl.domain */
 +#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
 +#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut down.             */
 +#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
@@ -86898,515 +87222,467 @@
 +    uint32_t flags;
 +    uint64_t tot_pages;
 +    uint64_t max_pages;
-+    xen_pfn_t shared_info_frame;  /* MFN of shared_info struct */
++    uint64_t shared_info_frame;  /* MFN of shared_info struct */
 +    uint64_t cpu_time;
 +    uint32_t nr_online_vcpus;     /* Number of VCPUs currently online. */
 +    uint32_t max_vcpu_id;         /* Maximum VCPUID in use by this domain. */
 +    uint32_t ssidref;
 +    xen_domain_handle_t handle;
 +};
-+typedef struct dom0_getdomaininfo dom0_getdomaininfo_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfo_t);
++typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
 +
-+#define DOM0_SETVCPUCONTEXT   13
-+struct dom0_setvcpucontext {
-+    /* IN variables. */
-+    domid_t               domain;
-+    uint32_t              vcpu;
-+    /* IN/OUT parameters */
-+    XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt;
-+};
-+typedef struct dom0_setvcpucontext dom0_setvcpucontext_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_setvcpucontext_t);
 +
-+#define DOM0_MSR              15
-+struct dom0_msr {
++#define XEN_DOMCTL_getmemlist         6
++struct xen_domctl_getmemlist {
 +    /* IN variables. */
-+    uint32_t write;
-+    cpumap_t cpu_mask;
-+    uint32_t msr;
-+    uint32_t in1;
-+    uint32_t in2;
++    /* Max entries to write to output buffer. */
++    uint64_t max_pfns;
++    /* Start index in guest's page list. */
++    uint64_t start_pfn;
++    XEN_GUEST_HANDLE(xen_pfn_t) buffer;
 +    /* OUT variables. */
-+    uint32_t out1;
-+    uint32_t out2;
++    uint64_t num_pfns;
 +};
-+typedef struct dom0_msr dom0_msr_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_msr_t);
++typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
 +
-+/*
-+ * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
-+ * 1 January, 1970 if the current system time was <system_time>.
-+ */
-+#define DOM0_SETTIME          17
-+struct dom0_settime {
-+    /* IN variables. */
-+    uint32_t secs;
-+    uint32_t nsecs;
-+    uint64_t system_time;
-+};
-+typedef struct dom0_settime dom0_settime_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_settime_t);
 +
-+#define DOM0_GETPAGEFRAMEINFO 18
-+#define LTAB_SHIFT 28
-+#define NOTAB 0         /* normal page */
-+#define L1TAB (1<<LTAB_SHIFT)
-+#define L2TAB (2<<LTAB_SHIFT)
-+#define L3TAB (3<<LTAB_SHIFT)
-+#define L4TAB (4<<LTAB_SHIFT)
-+#define LPINTAB  (1<<31)
-+#define XTAB  (0xf<<LTAB_SHIFT) /* invalid page */
-+#define LTAB_MASK XTAB
-+#define LTABTYPE_MASK (0x7<<LTAB_SHIFT)
++#define XEN_DOMCTL_getpageframeinfo   7
++
++#define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
++#define XEN_DOMCTL_PFINFO_NOTAB   (0x0<<28)
++#define XEN_DOMCTL_PFINFO_L1TAB   (0x1<<28)
++#define XEN_DOMCTL_PFINFO_L2TAB   (0x2<<28)
++#define XEN_DOMCTL_PFINFO_L3TAB   (0x3<<28)
++#define XEN_DOMCTL_PFINFO_L4TAB   (0x4<<28)
++#define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7<<28)
++#define XEN_DOMCTL_PFINFO_LPINTAB (0x1<<31)
++#define XEN_DOMCTL_PFINFO_XTAB    (0xf<<28) /* invalid page */
++#define XEN_DOMCTL_PFINFO_LTAB_MASK (0xf<<28)
 +
-+struct dom0_getpageframeinfo {
++struct xen_domctl_getpageframeinfo {
 +    /* IN variables. */
-+    xen_pfn_t gmfn;        /* GMFN to query.                            */
-+    domid_t domain;        /* To which domain does the frame belong?    */
++    uint64_t gmfn;        /* GMFN to query */
 +    /* OUT variables. */
 +    /* Is the page PINNED to a type? */
 +    uint32_t type;         /* see above type defs */
 +};
-+typedef struct dom0_getpageframeinfo dom0_getpageframeinfo_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo_t);
++typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
 +
-+/*
-+ * Read console content from Xen buffer ring.
-+ */
-+#define DOM0_READCONSOLE      19
-+struct dom0_readconsole {
++
++#define XEN_DOMCTL_getpageframeinfo2  8
++struct xen_domctl_getpageframeinfo2 {
 +    /* IN variables. */
-+    uint32_t clear;                /* Non-zero -> clear after reading. */
-+    XEN_GUEST_HANDLE(char) buffer; /* Buffer start */
++    uint64_t num;
 +    /* IN/OUT variables. */
-+    uint32_t count;            /* In: Buffer size;  Out: Used buffer size  */
++    XEN_GUEST_HANDLE(ulong) array;
 +};
-+typedef struct dom0_readconsole dom0_readconsole_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_readconsole_t);
++typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
 +
-+/*
-+ * Set which physical cpus a vcpu can execute on.
-+ */
-+#define DOM0_SETVCPUAFFINITY  20
-+struct dom0_setvcpuaffinity {
-+    /* IN variables. */
-+    domid_t   domain;
-+    uint32_t  vcpu;
-+    cpumap_t  cpumap;
-+};
-+typedef struct dom0_setvcpuaffinity dom0_setvcpuaffinity_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_setvcpuaffinity_t);
-+
-+/* Get trace buffers machine base address */
-+#define DOM0_TBUFCONTROL       21
-+struct dom0_tbufcontrol {
-+    /* IN variables */
-+#define DOM0_TBUF_GET_INFO     0
-+#define DOM0_TBUF_SET_CPU_MASK 1
-+#define DOM0_TBUF_SET_EVT_MASK 2
-+#define DOM0_TBUF_SET_SIZE     3
-+#define DOM0_TBUF_ENABLE       4
-+#define DOM0_TBUF_DISABLE      5
-+    uint32_t      op;
-+    /* IN/OUT variables */
-+    cpumap_t      cpu_mask;
-+    uint32_t      evt_mask;
-+    /* OUT variables */
-+    xen_pfn_t buffer_mfn;
-+    uint32_t size;
-+};
-+typedef struct dom0_tbufcontrol dom0_tbufcontrol_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_tbufcontrol_t);
 +
 +/*
-+ * Get physical information about the host machine
++ * Control shadow pagetables operation
 + */
-+#define DOM0_PHYSINFO         22
-+struct dom0_physinfo {
-+    uint32_t threads_per_core;
-+    uint32_t cores_per_socket;
-+    uint32_t sockets_per_node;
-+    uint32_t nr_nodes;
-+    uint32_t cpu_khz;
-+    uint64_t total_pages;
-+    uint64_t free_pages;
-+    uint64_t scrub_pages;
-+    uint32_t hw_cap[8];
-+};
-+typedef struct dom0_physinfo dom0_physinfo_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_physinfo_t);
++#define XEN_DOMCTL_shadow_op         10
 +
-+/*
-+ * Get the ID of the current scheduler.
-+ */
-+#define DOM0_SCHED_ID        24
-+struct dom0_sched_id {
-+    /* OUT variable */
-+    uint32_t sched_id;
-+};
-+typedef struct dom0_physinfo dom0_sched_id_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_sched_id_t);
++/* Disable shadow mode. */
++#define XEN_DOMCTL_SHADOW_OP_OFF         0
 +
-+/*
-+ * Control shadow pagetables operation
-+ */
-+#define DOM0_SHADOW_CONTROL  25
++/* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
++#define XEN_DOMCTL_SHADOW_OP_ENABLE      32
 +
-+#define DOM0_SHADOW_CONTROL_OP_OFF         0
-+#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
-+#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
-+#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
-+
-+#define DOM0_SHADOW_CONTROL_OP_FLUSH       10     /* table ops */
-+#define DOM0_SHADOW_CONTROL_OP_CLEAN       11
-+#define DOM0_SHADOW_CONTROL_OP_PEEK        12
-+
-+/* Shadow2 operations */
-+#define DOM0_SHADOW2_CONTROL_OP_GET_ALLOCATION   30
-+#define DOM0_SHADOW2_CONTROL_OP_SET_ALLOCATION   31
-+#define DOM0_SHADOW2_CONTROL_OP_ENABLE           32
-+
-+/* Mode flags for Shadow2 enable op */
-+#define DOM0_SHADOW2_CONTROL_FLAG_ENABLE    (1 << 0)
-+#define DOM0_SHADOW2_CONTROL_FLAG_REFCOUNT  (1 << 1)
-+#define DOM0_SHADOW2_CONTROL_FLAG_LOG_DIRTY (1 << 2)
-+#define DOM0_SHADOW2_CONTROL_FLAG_TRANSLATE (1 << 3)
-+#define DOM0_SHADOW2_CONTROL_FLAG_EXTERNAL  (1 << 4)
++/* Log-dirty bitmap operations. */
++ /* Return the bitmap and clean internal copy for next round. */
++#define XEN_DOMCTL_SHADOW_OP_CLEAN       11
++ /* Return the bitmap but do not modify internal copy. */
++#define XEN_DOMCTL_SHADOW_OP_PEEK        12
++
++/* Memory allocation accessors. */
++#define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
++#define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
++
++/* Legacy enable operations. */
++ /* Equiv. to ENABLE with no mode flags. */
++#define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
++ /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
++#define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
++ /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
++#define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
 +
-+struct dom0_shadow_control_stats {
++/* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
++ /*
++  * Shadow pagetables are refcounted: guest does not use explicit mmu
++  * operations nor write-protect its pagetables.
++  */
++#define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
++ /*
++  * Log pages in a bitmap as they are dirtied.
++  * Used for live relocation to determine which pages must be re-sent.
++  */
++#define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
++ /*
++  * Automatically translate GPFNs into MFNs.
++  */
++#define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
++ /*
++  * Xen does not steal virtual address space from the guest.
++  * Requires HVM support.
++  */
++#define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
++
++struct xen_domctl_shadow_op_stats {
 +    uint32_t fault_count;
 +    uint32_t dirty_count;
-+    uint32_t dirty_net_count;
-+    uint32_t dirty_block_count;
-+};
-+typedef struct dom0_shadow_control_stats dom0_shadow_control_stats_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_stats_t);
-+
-+struct dom0_shadow_control {
-+    /* IN variables. */
-+    domid_t        domain;
-+    uint32_t       op;
-+    XEN_GUEST_HANDLE(ulong) dirty_bitmap;
-+    /* IN/OUT variables. */
-+    uint64_t       pages;    /* size of buffer, updated with actual size */
-+    uint32_t       mb;       /* Shadow2 memory allocation in MB */
-+    uint32_t       mode;     /* Shadow2 mode to enable */
-+    /* OUT variables. */
-+    struct dom0_shadow_control_stats stats;
 +};
-+typedef struct dom0_shadow_control dom0_shadow_control_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_t);
++typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
 +
-+#define DOM0_SETDOMAINMAXMEM   28
-+struct dom0_setdomainmaxmem {
++struct xen_domctl_shadow_op {
 +    /* IN variables. */
-+    domid_t  domain;
-+    uint64_t max_memkb;
-+};
-+typedef struct dom0_setdomainmaxmem dom0_setdomainmaxmem_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_setdomainmaxmem_t);
++    uint32_t       op;       /* XEN_DOMCTL_SHADOW_OP_* */
 +
-+#define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
-+struct dom0_getpageframeinfo2 {
-+    /* IN variables. */
-+    domid_t  domain;
-+    uint64_t num;
-+    /* IN/OUT variables. */
-+    XEN_GUEST_HANDLE(ulong) array;
-+};
-+typedef struct dom0_getpageframeinfo2 dom0_getpageframeinfo2_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo2_t);
++    /* OP_ENABLE */
++    uint32_t       mode;     /* XEN_DOMCTL_SHADOW_ENABLE_* */
 +
-+/*
-+ * Request memory range (@mfn, @mfn+ at nr_mfns-1) to have type @type.
-+ * On x86, @type is an architecture-defined MTRR memory type.
-+ * On success, returns the MTRR that was used (@reg) and a handle that can
-+ * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
-+ * (x86-specific).
-+ */
-+#define DOM0_ADD_MEMTYPE         31
-+struct dom0_add_memtype {
-+    /* IN variables. */
-+    xen_pfn_t mfn;
-+    uint64_t nr_mfns;
-+    uint32_t type;
-+    /* OUT variables. */
-+    uint32_t handle;
-+    uint32_t reg;
-+};
-+typedef struct dom0_add_memtype dom0_add_memtype_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_add_memtype_t);
++    /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
++    uint32_t       mb;       /* Shadow memory allocation in MB */
 +
-+/*
-+ * Tear down an existing memory-range type. If @handle is remembered then it
-+ * should be passed in to accurately tear down the correct setting (in case
-+ * of overlapping memory regions with differing types). If it is not known
-+ * then @handle should be set to zero. In all cases @reg must be set.
-+ * (x86-specific).
-+ */
-+#define DOM0_DEL_MEMTYPE         32
-+struct dom0_del_memtype {
-+    /* IN variables. */
-+    uint32_t handle;
-+    uint32_t reg;
-+};
-+typedef struct dom0_del_memtype dom0_del_memtype_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_del_memtype_t);
-+
-+/* Read current type of an MTRR (x86-specific). */
-+#define DOM0_READ_MEMTYPE        33
-+struct dom0_read_memtype {
-+    /* IN variables. */
-+    uint32_t reg;
-+    /* OUT variables. */
-+    xen_pfn_t mfn;
-+    uint64_t nr_mfns;
-+    uint32_t type;
++    /* OP_PEEK / OP_CLEAN */
++    XEN_GUEST_HANDLE(ulong) dirty_bitmap;
++    uint64_t       pages;    /* Size of buffer. Updated with actual size. */
++    struct xen_domctl_shadow_op_stats stats;
 +};
-+typedef struct dom0_read_memtype dom0_read_memtype_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_read_memtype_t);
++typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
 +
-+/* Interface for controlling Xen software performance counters. */
-+#define DOM0_PERFCCONTROL        34
-+/* Sub-operations: */
-+#define DOM0_PERFCCONTROL_OP_RESET 1   /* Reset all counters to zero. */
-+#define DOM0_PERFCCONTROL_OP_QUERY 2   /* Get perfctr information. */
-+struct dom0_perfc_desc {
-+    char         name[80];             /* name of perf counter */
-+    uint32_t     nr_vals;              /* number of values for this counter */
-+};
-+typedef struct dom0_perfc_desc dom0_perfc_desc_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_perfc_desc_t);
-+typedef uint32_t dom0_perfc_val_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_perfc_val_t);
 +
-+struct dom0_perfccontrol {
++#define XEN_DOMCTL_max_mem           11
++struct xen_domctl_max_mem {
 +    /* IN variables. */
-+    uint32_t       op;                /*  DOM0_PERFCCONTROL_OP_??? */
-+    /* OUT variables. */
-+    uint32_t       nr_counters;       /*  number of counters description  */
-+    uint32_t       nr_vals;			  /*  number of values  */
-+    XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc; /*  counter information (or NULL) */
-+    XEN_GUEST_HANDLE(dom0_perfc_val_t) val;   /*  counter values (or NULL)  */
++    uint64_t max_memkb;
 +};
-+typedef struct dom0_perfccontrol dom0_perfccontrol_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_perfccontrol_t);
++typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
 +
-+#define DOM0_MICROCODE           35
-+struct dom0_microcode {
-+    /* IN variables. */
-+    XEN_GUEST_HANDLE(void) data;          /* Pointer to microcode data */
-+    uint32_t length;                  /* Length of microcode data. */
-+};
-+typedef struct dom0_microcode dom0_microcode_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_microcode_t);
 +
-+#define DOM0_IOPORT_PERMISSION   36
-+struct dom0_ioport_permission {
-+    domid_t  domain;                  /* domain to be affected */
-+    uint32_t first_port;              /* first port int range */
-+    uint32_t nr_ports;                /* size of port range */
-+    uint8_t  allow_access;            /* allow or deny access to range? */
++#define XEN_DOMCTL_setvcpucontext    12
++#define XEN_DOMCTL_getvcpucontext    13
++struct xen_domctl_vcpucontext {
++    uint32_t              vcpu;                  /* IN */
++    XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; /* IN/OUT */
 +};
-+typedef struct dom0_ioport_permission dom0_ioport_permission_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_ioport_permission_t);
++typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
 +
-+#define DOM0_GETVCPUCONTEXT      37
-+struct dom0_getvcpucontext {
-+    /* IN variables. */
-+    domid_t  domain;                  /* domain to be affected */
-+    uint32_t vcpu;                    /* vcpu # */
-+    /* OUT variables. */
-+    XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt;
-+};
-+typedef struct dom0_getvcpucontext dom0_getvcpucontext_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getvcpucontext_t);
 +
-+#define DOM0_GETVCPUINFO         43
-+struct dom0_getvcpuinfo {
++#define XEN_DOMCTL_getvcpuinfo       14
++struct xen_domctl_getvcpuinfo {
 +    /* IN variables. */
-+    domid_t  domain;                  /* domain to be affected */
-+    uint32_t vcpu;                    /* vcpu # */
++    uint32_t vcpu;
 +    /* OUT variables. */
 +    uint8_t  online;                  /* currently online (not hotplugged)? */
 +    uint8_t  blocked;                 /* blocked waiting for an event? */
 +    uint8_t  running;                 /* currently scheduled on its CPU? */
 +    uint64_t cpu_time;                /* total cpu time consumed (ns) */
 +    uint32_t cpu;                     /* current mapping   */
-+    cpumap_t cpumap;                  /* allowable mapping */
 +};
-+typedef struct dom0_getvcpuinfo dom0_getvcpuinfo_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getvcpuinfo_t);
++typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
 +
-+#define DOM0_GETDOMAININFOLIST   38
-+struct dom0_getdomaininfolist {
-+    /* IN variables. */
-+    domid_t               first_domain;
-+    uint32_t              max_domains;
-+    XEN_GUEST_HANDLE(dom0_getdomaininfo_t) buffer;
-+    /* OUT variables. */
-+    uint32_t              num_domains;
-+};
-+typedef struct dom0_getdomaininfolist dom0_getdomaininfolist_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfolist_t);
 +
-+#define DOM0_PLATFORM_QUIRK      39
-+#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
-+#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
-+#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
-+struct dom0_platform_quirk {
-+    /* IN variables. */
-+    uint32_t quirk_id;
++/* Get/set which physical cpus a vcpu can execute on. */
++#define XEN_DOMCTL_setvcpuaffinity    9
++#define XEN_DOMCTL_getvcpuaffinity   25
++struct xen_domctl_vcpuaffinity {
++    uint32_t  vcpu;              /* IN */
++    struct xenctl_cpumap cpumap; /* IN/OUT */
 +};
-+typedef struct dom0_platform_quirk dom0_platform_quirk_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_platform_quirk_t);
++typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
 +
-+#define DOM0_PHYSICAL_MEMORY_MAP 40   /* Unimplemented from 3.0.3 onwards */
-+struct dom0_memory_map_entry {
-+    uint64_t start, end;
-+    uint32_t flags; /* reserved */
-+    uint8_t  is_ram;
-+};
-+typedef struct dom0_memory_map_entry dom0_memory_map_entry_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t);
 +
-+struct dom0_physical_memory_map {
-+    /* IN variables. */
-+    uint32_t max_map_entries;
-+    /* OUT variables. */
-+    uint32_t nr_map_entries;
-+    XEN_GUEST_HANDLE(dom0_memory_map_entry_t) memory_map;
++#define XEN_DOMCTL_max_vcpus         15
++struct xen_domctl_max_vcpus {
++    uint32_t max;           /* maximum number of vcpus */
 +};
-+typedef struct dom0_physical_memory_map dom0_physical_memory_map_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_physical_memory_map_t);
++typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
 +
-+#define DOM0_MAX_VCPUS 41
-+struct dom0_max_vcpus {
-+    domid_t  domain;        /* domain to be affected */
-+    uint32_t max;           /* maximum number of vcpus */
++
++#define XEN_DOMCTL_scheduler_op      16
++/* Scheduler types. */
++#define XEN_SCHEDULER_SEDF     4
++#define XEN_SCHEDULER_CREDIT   5
++/* Set or get info? */
++#define XEN_DOMCTL_SCHEDOP_putinfo 0
++#define XEN_DOMCTL_SCHEDOP_getinfo 1
++struct xen_domctl_scheduler_op {
++    uint32_t sched_id;  /* XEN_SCHEDULER_* */
++    uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
++    union {
++        struct xen_domctl_sched_sedf {
++            uint64_t period;
++            uint64_t slice;
++            uint64_t latency;
++            uint32_t extratime;
++            uint32_t weight;
++        } sedf;
++        struct xen_domctl_sched_credit {
++            uint16_t weight;
++            uint16_t cap;
++        } credit;
++    } u;
 +};
-+typedef struct dom0_max_vcpus dom0_max_vcpus_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_max_vcpus_t);
++typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
 +
-+#define DOM0_SETDOMAINHANDLE 44
-+struct dom0_setdomainhandle {
-+    domid_t domain;
++
++#define XEN_DOMCTL_setdomainhandle   17
++struct xen_domctl_setdomainhandle {
 +    xen_domain_handle_t handle;
 +};
-+typedef struct dom0_setdomainhandle dom0_setdomainhandle_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_setdomainhandle_t);
++typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
++
 +
-+#define DOM0_SETDEBUGGING 45
-+struct dom0_setdebugging {
-+    domid_t domain;
++#define XEN_DOMCTL_setdebugging      18
++struct xen_domctl_setdebugging {
 +    uint8_t enable;
 +};
-+typedef struct dom0_setdebugging dom0_setdebugging_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_setdebugging_t);
++typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
++
 +
-+#define DOM0_IRQ_PERMISSION 46
-+struct dom0_irq_permission {
-+    domid_t domain;          /* domain to be affected */
++#define XEN_DOMCTL_irq_permission    19
++struct xen_domctl_irq_permission {
 +    uint8_t pirq;
 +    uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
 +};
-+typedef struct dom0_irq_permission dom0_irq_permission_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_irq_permission_t);
++typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
 +
-+#define DOM0_IOMEM_PERMISSION 47
-+struct dom0_iomem_permission {
-+    domid_t  domain;          /* domain to be affected */
-+    xen_pfn_t first_mfn;      /* first page (physical page number) in range */
++
++#define XEN_DOMCTL_iomem_permission  20
++struct xen_domctl_iomem_permission {
++    uint64_t first_mfn;       /* first page (physical page number) in range */
 +    uint64_t nr_mfns;         /* number of pages in range (>0) */
-+    uint8_t allow_access;     /* allow (!0) or deny (0) access to range? */
++    uint8_t  allow_access;    /* allow (!0) or deny (0) access to range? */
++};
++typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
++
++
++#define XEN_DOMCTL_ioport_permission 21
++struct xen_domctl_ioport_permission {
++    uint32_t first_port;              /* first port int range */
++    uint32_t nr_ports;                /* size of port range */
++    uint8_t  allow_access;            /* allow or deny access to range? */
 +};
-+typedef struct dom0_iomem_permission dom0_iomem_permission_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_iomem_permission_t);
++typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
 +
-+#define DOM0_HYPERCALL_INIT   48
-+struct dom0_hypercall_init {
-+    domid_t   domain;          /* domain to be affected */
-+    xen_pfn_t gmfn;            /* GMFN to be initialised */
++#define XEN_DOMCTL_hypercall_init    22
++struct xen_domctl_hypercall_init {
++    uint64_t  gmfn;            /* GMFN to be initialised */
 +};
-+typedef struct dom0_hypercall_init dom0_hypercall_init_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t);
++typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
 +
-+#define DOM0_DOMAIN_SETUP     49
++#define XEN_DOMCTL_arch_setup        23
 +#define _XEN_DOMAINSETUP_hvm_guest 0
 +#define XEN_DOMAINSETUP_hvm_guest  (1UL<<_XEN_DOMAINSETUP_hvm_guest)
-+#define _XEN_DOMAINSETUP_query 1	/* Get parameters (for save)  */
++#define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save)  */
 +#define XEN_DOMAINSETUP_query  (1UL<<_XEN_DOMAINSETUP_query)
-+typedef struct dom0_domain_setup {
-+    domid_t  domain;          /* domain to be affected */
-+    unsigned long flags;      /* XEN_DOMAINSETUP_* */
++typedef struct xen_domctl_arch_setup {
++    uint64_t flags;      /* XEN_DOMAINSETUP_* */
 +#ifdef __ia64__
-+    unsigned long bp;         /* mpaddr of boot param area */
-+    unsigned long maxmem;	  /* Highest memory address for MDT.  */
-+    unsigned long xsi_va;     /* Xen shared_info area virtual address.  */
-+    unsigned int hypercall_imm;	/* Break imm for Xen hypercalls.  */
++    uint64_t bp;            /* mpaddr of boot param area */
++    uint64_t maxmem;        /* Highest memory address for MDT.  */
++    uint64_t xsi_va;        /* Xen shared_info area virtual address.  */
++    uint32_t hypercall_imm; /* Break imm for Xen hypercalls.  */
 +#endif
-+} dom0_domain_setup_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_domain_setup_t);
++} xen_domctl_arch_setup_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
 +
-+#define DOM0_SETTIMEOFFSET    50
-+struct dom0_settimeoffset {
-+    domid_t  domain;
++#define XEN_DOMCTL_settimeoffset     24
++struct xen_domctl_settimeoffset {
 +    int32_t  time_offset_seconds; /* applied to domain wallclock time */
 +};
-+typedef struct dom0_settimeoffset dom0_settimeoffset_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_settimeoffset_t);
++typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
 +
-+struct dom0_op {
++struct xen_domctl {
 +    uint32_t cmd;
-+    uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
++    uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
++    domid_t  domain;
 +    union {
-+        struct dom0_createdomain      createdomain;
-+        struct dom0_pausedomain       pausedomain;
-+        struct dom0_unpausedomain     unpausedomain;
-+        struct dom0_destroydomain     destroydomain;
-+        struct dom0_getmemlist        getmemlist;
-+        struct sched_ctl_cmd          schedctl;
-+        struct sched_adjdom_cmd       adjustdom;
-+        struct dom0_setvcpucontext    setvcpucontext;
-+        struct dom0_getdomaininfo     getdomaininfo;
-+        struct dom0_getpageframeinfo  getpageframeinfo;
-+        struct dom0_msr               msr;
-+        struct dom0_settime           settime;
-+        struct dom0_readconsole       readconsole;
-+        struct dom0_setvcpuaffinity   setvcpuaffinity;
-+        struct dom0_tbufcontrol       tbufcontrol;
-+        struct dom0_physinfo          physinfo;
-+        struct dom0_sched_id          sched_id;
-+        struct dom0_shadow_control    shadow_control;
-+        struct dom0_setdomainmaxmem   setdomainmaxmem;
-+        struct dom0_getpageframeinfo2 getpageframeinfo2;
-+        struct dom0_add_memtype       add_memtype;
-+        struct dom0_del_memtype       del_memtype;
-+        struct dom0_read_memtype      read_memtype;
-+        struct dom0_perfccontrol      perfccontrol;
-+        struct dom0_microcode         microcode;
-+        struct dom0_ioport_permission ioport_permission;
-+        struct dom0_getvcpucontext    getvcpucontext;
-+        struct dom0_getvcpuinfo       getvcpuinfo;
-+        struct dom0_getdomaininfolist getdomaininfolist;
-+        struct dom0_platform_quirk    platform_quirk;
-+        struct dom0_physical_memory_map physical_memory_map;
-+        struct dom0_max_vcpus         max_vcpus;
-+        struct dom0_setdomainhandle   setdomainhandle;
-+        struct dom0_setdebugging      setdebugging;
-+        struct dom0_irq_permission    irq_permission;
-+        struct dom0_iomem_permission  iomem_permission;
-+        struct dom0_hypercall_init    hypercall_init;
-+        struct dom0_domain_setup      domain_setup;
-+        struct dom0_settimeoffset     settimeoffset;
-+        uint8_t                       pad[128];
++        struct xen_domctl_createdomain      createdomain;
++        struct xen_domctl_getdomaininfo     getdomaininfo;
++        struct xen_domctl_getmemlist        getmemlist;
++        struct xen_domctl_getpageframeinfo  getpageframeinfo;
++        struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
++        struct xen_domctl_vcpuaffinity      vcpuaffinity;
++        struct xen_domctl_shadow_op         shadow_op;
++        struct xen_domctl_max_mem           max_mem;
++        struct xen_domctl_vcpucontext       vcpucontext;
++        struct xen_domctl_getvcpuinfo       getvcpuinfo;
++        struct xen_domctl_max_vcpus         max_vcpus;
++        struct xen_domctl_scheduler_op      scheduler_op;
++        struct xen_domctl_setdomainhandle   setdomainhandle;
++        struct xen_domctl_setdebugging      setdebugging;
++        struct xen_domctl_irq_permission    irq_permission;
++        struct xen_domctl_iomem_permission  iomem_permission;
++        struct xen_domctl_ioport_permission ioport_permission;
++        struct xen_domctl_hypercall_init    hypercall_init;
++        struct xen_domctl_arch_setup        arch_setup;
++        struct xen_domctl_settimeoffset     settimeoffset;
++        uint8_t                             pad[128];
 +    } u;
 +};
-+typedef struct dom0_op dom0_op_t;
-+DEFINE_XEN_GUEST_HANDLE(dom0_op_t);
++typedef struct xen_domctl xen_domctl_t;
++DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
 +
-+#endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
++#endif /* __XEN_PUBLIC_DOMCTL_H__ */
++
++/*
++ * Local variables:
++ * mode: C
++ * c-set-style: "BSD"
++ * c-basic-offset: 4
++ * tab-width: 4
++ * indent-tabs-mode: nil
++ * End:
++ */
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/elfnote.h linux-2.6.18-xen/include/xen/interface/elfnote.h
+--- linux-2.6.18/include/xen/interface/elfnote.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/xen/interface/elfnote.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,133 @@
++/******************************************************************************
++ * elfnote.h
++ *
++ * Definitions used for the Xen ELF notes.
++ *
++ * Copyright (c) 2006, Ian Campbell, XenSource Ltd.
++ */
++
++#ifndef __XEN_PUBLIC_ELFNOTE_H__
++#define __XEN_PUBLIC_ELFNOTE_H__
++
++/*
++ * The notes should live in a SHT_NOTE segment and have "Xen" in the
++ * name field.
++ *
++ * Numeric types are either 4 or 8 bytes depending on the content of
++ * the desc field.
++ *
++ * LEGACY indicated the fields in the legacy __xen_guest string which
++ * this a note type replaces.
++ */
++
++/*
++ * NAME=VALUE pair (string).
++ *
++ * LEGACY: FEATURES and PAE
++ */
++#define XEN_ELFNOTE_INFO           0
++
++/*
++ * The virtual address of the entry point (numeric).
++ *
++ * LEGACY: VIRT_ENTRY
++ */
++#define XEN_ELFNOTE_ENTRY          1
++
++/* The virtual address of the hypercall transfer page (numeric).
++ *
++ * LEGACY: HYPERCALL_PAGE. (n.b. legacy value is a physical page
++ * number not a virtual address)
++ */
++#define XEN_ELFNOTE_HYPERCALL_PAGE 2
++
++/* The virtual address where the kernel image should be mapped (numeric).
++ *
++ * Defaults to 0.
++ *
++ * LEGACY: VIRT_BASE
++ */
++#define XEN_ELFNOTE_VIRT_BASE      3
++
++/*
++ * The offset of the ELF paddr field from the acutal required
++ * psuedo-physical address (numeric).
++ *
++ * This is used to maintain backwards compatibility with older kernels
++ * which wrote __PAGE_OFFSET into that field. This field defaults to 0
++ * if not present.
++ *
++ * LEGACY: ELF_PADDR_OFFSET. (n.b. legacy default is VIRT_BASE)
++ */
++#define XEN_ELFNOTE_PADDR_OFFSET   4
++
++/*
++ * The version of Xen that we work with (string).
++ *
++ * LEGACY: XEN_VER
++ */
++#define XEN_ELFNOTE_XEN_VERSION    5
++
++/*
++ * The name of the guest operating system (string).
++ *
++ * LEGACY: GUEST_OS
++ */
++#define XEN_ELFNOTE_GUEST_OS       6
++
++/*
++ * The version of the guest operating system (string).
++ *
++ * LEGACY: GUEST_VER
++ */
++#define XEN_ELFNOTE_GUEST_VERSION  7
++
++/*
++ * The loader type (string).
++ *
++ * LEGACY: LOADER
++ */
++#define XEN_ELFNOTE_LOADER         8
++
++/*
++ * The kernel supports PAE (x86/32 only, string = "yes" or "no").
++ *
++ * LEGACY: PAE (n.b. The legacy interface included a provision to
++ * indicate 'extended-cr3' support allowing L3 page tables to be
++ * placed above 4G. It is assumed that any kernel new enough to use
++ * these ELF notes will include this and therefore "yes" here is
++ * equivalent to "yes[entended-cr3]" in the __xen_guest interface.
++ */
++#define XEN_ELFNOTE_PAE_MODE       9
++
++/*
++ * The features supported/required by this kernel (string).
++ *
++ * The string must consist of a list of feature names (as given in
++ * features.h, without the "XENFEAT_" prefix) separated by '|'
++ * characters. If a feature is required for the kernel to function
++ * then the feature name must be preceded by a '!' character.
++ *
++ * LEGACY: FEATURES
++ */
++#define XEN_ELFNOTE_FEATURES      10
++
++/*
++ * The kernel requires the symbol table to be loaded (string = "yes" or "no")
++ * LEGACY: BSD_SYMTAB (n.b. The legacy treated the presence or absence
++ * of this string as a boolean flag rather than requiring "yes" or
++ * "no".
++ */
++#define XEN_ELFNOTE_BSD_SYMTAB    11
++
++#endif /* __XEN_PUBLIC_ELFNOTE_H__ */
 +
 +/*
 + * Local variables:
@@ -87419,7 +87695,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/event_channel.h linux-2.6.18-xen/include/xen/interface/event_channel.h
 --- linux-2.6.18/include/xen/interface/event_channel.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/event_channel.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/event_channel.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,233 @@
 +/******************************************************************************
 + * event_channel.h
@@ -87656,7 +87932,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/features.h linux-2.6.18-xen/include/xen/interface/features.h
 --- linux-2.6.18/include/xen/interface/features.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/features.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/features.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,53 @@
 +/******************************************************************************
 + * features.h
@@ -87713,7 +87989,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/grant_table.h linux-2.6.18-xen/include/xen/interface/grant_table.h
 --- linux-2.6.18/include/xen/interface/grant_table.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/grant_table.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/grant_table.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,362 @@
 +/******************************************************************************
 + * grant_table.h
@@ -88079,7 +88355,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/hvm/e820.h linux-2.6.18-xen/include/xen/interface/hvm/e820.h
 --- linux-2.6.18/include/xen/interface/hvm/e820.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/hvm/e820.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/hvm/e820.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,32 @@
 +#ifndef __XEN_PUBLIC_HVM_E820_H__
 +#define __XEN_PUBLIC_HVM_E820_H__
@@ -88115,7 +88391,7 @@
 +#endif /* __XEN_PUBLIC_HVM_E820_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/hvm/hvm_info_table.h linux-2.6.18-xen/include/xen/interface/hvm/hvm_info_table.h
 --- linux-2.6.18/include/xen/interface/hvm/hvm_info_table.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/hvm/hvm_info_table.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/hvm/hvm_info_table.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,22 @@
 +/******************************************************************************
 + * hvm/hvm_info_table.h
@@ -88141,7 +88417,7 @@
 +#endif /* __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/hvm/ioreq.h linux-2.6.18-xen/include/xen/interface/hvm/ioreq.h
 --- linux-2.6.18/include/xen/interface/hvm/ioreq.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/hvm/ioreq.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/hvm/ioreq.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,99 @@
 +/*
 + * ioreq.h: I/O request definitions for device models
@@ -88244,7 +88520,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/hvm/params.h linux-2.6.18-xen/include/xen/interface/hvm/params.h
 --- linux-2.6.18/include/xen/interface/hvm/params.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/hvm/params.h	2006-08-15 13:03:32.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/hvm/params.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,24 @@
 +#ifndef __XEN_PUBLIC_HVM_PARAMS_H__
 +#define __XEN_PUBLIC_HVM_PARAMS_H__
@@ -88272,7 +88548,7 @@
 +#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/hvm/vmx_assist.h linux-2.6.18-xen/include/xen/interface/hvm/vmx_assist.h
 --- linux-2.6.18/include/xen/interface/hvm/vmx_assist.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/hvm/vmx_assist.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/hvm/vmx_assist.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,98 @@
 +/*
 + * vmx_assist.h: Context definitions for the VMXASSIST world switch.
@@ -88374,7 +88650,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/blkif.h linux-2.6.18-xen/include/xen/interface/io/blkif.h
 --- linux-2.6.18/include/xen/interface/io/blkif.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/blkif.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/blkif.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,87 @@
 +/******************************************************************************
 + * blkif.h
@@ -88465,7 +88741,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/console.h linux-2.6.18-xen/include/xen/interface/io/console.h
 --- linux-2.6.18/include/xen/interface/io/console.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/console.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/console.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,33 @@
 +/******************************************************************************
 + * console.h
@@ -88502,7 +88778,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/netif.h linux-2.6.18-xen/include/xen/interface/io/netif.h
 --- linux-2.6.18/include/xen/interface/io/netif.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/netif.h	2006-08-15 13:03:32.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/netif.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,166 @@
 +/******************************************************************************
 + * netif.h
@@ -88672,7 +88948,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/pciif.h linux-2.6.18-xen/include/xen/interface/io/pciif.h
 --- linux-2.6.18/include/xen/interface/io/pciif.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/pciif.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/pciif.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,55 @@
 +/*
 + * PCI Backend/Frontend Common Data Structures & Macros
@@ -88731,7 +89007,7 @@
 +#endif /* __XEN_PCI_COMMON_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/ring.h linux-2.6.18-xen/include/xen/interface/io/ring.h
 --- linux-2.6.18/include/xen/interface/io/ring.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/ring.h	2006-06-19 13:20:42.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/ring.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,273 @@
 +/******************************************************************************
 + * ring.h
@@ -89008,7 +89284,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/tpmif.h linux-2.6.18-xen/include/xen/interface/io/tpmif.h
 --- linux-2.6.18/include/xen/interface/io/tpmif.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/tpmif.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/tpmif.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,59 @@
 +/******************************************************************************
 + * tpmif.h
@@ -89071,7 +89347,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/xenbus.h linux-2.6.18-xen/include/xen/interface/io/xenbus.h
 --- linux-2.6.18/include/xen/interface/io/xenbus.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/xenbus.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/xenbus.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,45 @@
 +/*****************************************************************************
 + * xenbus.h
@@ -89120,7 +89396,7 @@
 +#endif /* _XEN_PUBLIC_IO_XENBUS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/io/xs_wire.h linux-2.6.18-xen/include/xen/interface/io/xs_wire.h
 --- linux-2.6.18/include/xen/interface/io/xs_wire.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/io/xs_wire.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/io/xs_wire.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,97 @@
 +/*
 + * Details of the "wire" protocol between Xen Store Daemon and client
@@ -89221,7 +89497,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/memory.h linux-2.6.18-xen/include/xen/interface/memory.h
 --- linux-2.6.18/include/xen/interface/memory.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/memory.h	2006-08-15 13:03:32.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/memory.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,243 @@
 +/******************************************************************************
 + * memory.h
@@ -89468,7 +89744,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/nmi.h linux-2.6.18-xen/include/xen/interface/nmi.h
 --- linux-2.6.18/include/xen/interface/nmi.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/nmi.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/nmi.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,60 @@
 +/******************************************************************************
 + * nmi.h
@@ -89532,7 +89808,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/physdev.h linux-2.6.18-xen/include/xen/interface/physdev.h
 --- linux-2.6.18/include/xen/interface/physdev.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/physdev.h	2006-07-07 20:51:48.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/physdev.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,149 @@
 +
 +#ifndef __XEN_PUBLIC_PHYSDEV_H__
@@ -89683,69 +89959,125 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/sched_ctl.h linux-2.6.18-xen/include/xen/interface/sched_ctl.h
---- linux-2.6.18/include/xen/interface/sched_ctl.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/sched_ctl.h	2006-06-19 13:20:42.000000000 +0200
-@@ -0,0 +1,69 @@
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/platform.h linux-2.6.18-xen/include/xen/interface/platform.h
+--- linux-2.6.18/include/xen/interface/platform.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/xen/interface/platform.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,125 @@
 +/******************************************************************************
-+ * Generic scheduler control interface.
-+ *
-+ * Mark Williamson, (C) 2004 Intel Research Cambridge
++ * platform.h
++ * 
++ * Hardware platform operations. Intended for use by domain-0 kernel.
++ * 
++ * Copyright (c) 2002-2006, K Fraser
 + */
 +
-+#ifndef __XEN_PUBLIC_SCHED_CTL_H__
-+#define __XEN_PUBLIC_SCHED_CTL_H__
++#ifndef __XEN_PUBLIC_PLATFORM_H__
++#define __XEN_PUBLIC_PLATFORM_H__
 +
-+/* Scheduler types. */
-+#define SCHED_BVT      0
-+#define SCHED_SEDF     4
-+#define SCHED_CREDIT   5
++#include "xen.h"
 +
-+/* Set or get info? */
-+#define SCHED_INFO_PUT 0
-+#define SCHED_INFO_GET 1
++#define XENPF_INTERFACE_VERSION 0x03000001
++
++/*
++ * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
++ * 1 January, 1970 if the current system time was <system_time>.
++ */
++#define XENPF_settime             17
++struct xenpf_settime {
++    /* IN variables. */
++    uint32_t secs;
++    uint32_t nsecs;
++    uint64_t system_time;
++};
++typedef struct xenpf_settime xenpf_settime_t;
++DEFINE_XEN_GUEST_HANDLE(xenpf_settime_t);
 +
 +/*
-+ * Generic scheduler control command - used to adjust system-wide scheduler
-+ * parameters
++ * Request memory range (@mfn, @mfn+ at nr_mfns-1) to have type @type.
++ * On x86, @type is an architecture-defined MTRR memory type.
++ * On success, returns the MTRR that was used (@reg) and a handle that can
++ * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
++ * (x86-specific).
 + */
-+struct sched_ctl_cmd {
-+    uint32_t sched_id;
-+    uint32_t direction;
-+    union {
-+        struct bvt_ctl {
-+            uint32_t ctx_allow;
-+        } bvt;
-+    } u;
++#define XENPF_add_memtype         31
++struct xenpf_add_memtype {
++    /* IN variables. */
++    xen_pfn_t mfn;
++    uint64_t nr_mfns;
++    uint32_t type;
++    /* OUT variables. */
++    uint32_t handle;
++    uint32_t reg;
 +};
++typedef struct xenpf_add_memtype xenpf_add_memtype_t;
++DEFINE_XEN_GUEST_HANDLE(xenpf_add_memtype_t);
 +
-+struct sched_adjdom_cmd {
-+    uint32_t sched_id;
-+    uint32_t direction;
-+    domid_t  domain;
++/*
++ * Tear down an existing memory-range type. If @handle is remembered then it
++ * should be passed in to accurately tear down the correct setting (in case
++ * of overlapping memory regions with differing types). If it is not known
++ * then @handle should be set to zero. In all cases @reg must be set.
++ * (x86-specific).
++ */
++#define XENPF_del_memtype         32
++struct xenpf_del_memtype {
++    /* IN variables. */
++    uint32_t handle;
++    uint32_t reg;
++};
++typedef struct xenpf_del_memtype xenpf_del_memtype_t;
++DEFINE_XEN_GUEST_HANDLE(xenpf_del_memtype_t);
++
++/* Read current type of an MTRR (x86-specific). */
++#define XENPF_read_memtype        33
++struct xenpf_read_memtype {
++    /* IN variables. */
++    uint32_t reg;
++    /* OUT variables. */
++    xen_pfn_t mfn;
++    uint64_t nr_mfns;
++    uint32_t type;
++};
++typedef struct xenpf_read_memtype xenpf_read_memtype_t;
++DEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t);
++
++#define XENPF_microcode_update    35
++struct xenpf_microcode_update {
++    /* IN variables. */
++    XEN_GUEST_HANDLE(void) data;      /* Pointer to microcode data */
++    uint32_t length;                  /* Length of microcode data. */
++};
++typedef struct xenpf_microcode_update xenpf_microcode_update_t;
++DEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update_t);
++
++#define XENPF_platform_quirk      39
++#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
++#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
++#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
++struct xenpf_platform_quirk {
++    /* IN variables. */
++    uint32_t quirk_id;
++};
++typedef struct xenpf_platform_quirk xenpf_platform_quirk_t;
++DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t);
++
++struct xen_platform_op {
++    uint32_t cmd;
++    uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
 +    union {
-+        struct bvt_adjdom {
-+            uint32_t mcu_adv;      /* mcu advance: inverse of weight */
-+            uint32_t warpback;     /* warp? */
-+            int32_t  warpvalue;    /* warp value */
-+            int64_t  warpl;        /* warp limit */
-+            int64_t  warpu;        /* unwarp time requirement */
-+        } bvt;
-+        struct sedf_adjdom {
-+            uint64_t period;
-+            uint64_t slice;
-+            uint64_t latency;
-+            uint32_t extratime;
-+            uint32_t weight;
-+        } sedf;
-+        struct sched_credit_adjdom {
-+            uint16_t weight;
-+            uint16_t cap;
-+        } credit;
++        struct xenpf_settime           settime;
++        struct xenpf_add_memtype       add_memtype;
++        struct xenpf_del_memtype       del_memtype;
++        struct xenpf_read_memtype      read_memtype;
++        struct xenpf_microcode_update  microcode;
++        struct xenpf_platform_quirk    platform_quirk;
++        uint8_t                        pad[128];
 +    } u;
 +};
++typedef struct xen_platform_op xen_platform_op_t;
++DEFINE_XEN_GUEST_HANDLE(xen_platform_op_t);
 +
-+#endif /* __XEN_PUBLIC_SCHED_CTL_H__ */
++#endif /* __XEN_PUBLIC_PLATFORM_H__ */
 +
 +/*
 + * Local variables:
@@ -89758,7 +90090,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/sched.h linux-2.6.18-xen/include/xen/interface/sched.h
 --- linux-2.6.18/include/xen/interface/sched.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/sched.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/sched.h	2006-09-04 16:31:19.000000000 +0200
 @@ -0,0 +1,103 @@
 +/******************************************************************************
 + * sched.h
@@ -89863,9 +90195,164 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
+diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/sysctl.h linux-2.6.18-xen/include/xen/interface/sysctl.h
+--- linux-2.6.18/include/xen/interface/sysctl.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.18-xen/include/xen/interface/sysctl.h	2006-09-04 16:31:19.000000000 +0200
+@@ -0,0 +1,151 @@
++/******************************************************************************
++ * sysctl.h
++ * 
++ * System management operations. For use by node control stack.
++ * 
++ * Copyright (c) 2002-2006, K Fraser
++ */
++
++#ifndef __XEN_PUBLIC_SYSCTL_H__
++#define __XEN_PUBLIC_SYSCTL_H__
++
++#if !defined(__XEN__) && !defined(__XEN_TOOLS__)
++#error "sysctl operations are intended for use by node control tools only"
++#endif
++
++#include "xen.h"
++#include "domctl.h"
++
++#define XEN_SYSCTL_INTERFACE_VERSION 0x00000002
++
++/*
++ * Read console content from Xen buffer ring.
++ */
++#define XEN_SYSCTL_readconsole       1
++struct xen_sysctl_readconsole {
++    /* IN variables. */
++    uint32_t clear;                /* Non-zero -> clear after reading. */
++    XEN_GUEST_HANDLE(char) buffer; /* Buffer start */
++    /* IN/OUT variables. */
++    uint32_t count;            /* In: Buffer size;  Out: Used buffer size  */
++};
++typedef struct xen_sysctl_readconsole xen_sysctl_readconsole_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_readconsole_t);
++
++/* Get trace buffers machine base address */
++#define XEN_SYSCTL_tbuf_op           2
++struct xen_sysctl_tbuf_op {
++    /* IN variables */
++#define XEN_SYSCTL_TBUFOP_get_info     0
++#define XEN_SYSCTL_TBUFOP_set_cpu_mask 1
++#define XEN_SYSCTL_TBUFOP_set_evt_mask 2
++#define XEN_SYSCTL_TBUFOP_set_size     3
++#define XEN_SYSCTL_TBUFOP_enable       4
++#define XEN_SYSCTL_TBUFOP_disable      5
++    uint32_t cmd;
++    /* IN/OUT variables */
++    struct xenctl_cpumap cpu_mask;
++    uint32_t             evt_mask;
++    /* OUT variables */
++    uint64_t buffer_mfn;
++    uint32_t size;
++};
++typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
++
++/*
++ * Get physical information about the host machine
++ */
++#define XEN_SYSCTL_physinfo          3
++struct xen_sysctl_physinfo {
++    uint32_t threads_per_core;
++    uint32_t cores_per_socket;
++    uint32_t sockets_per_node;
++    uint32_t nr_nodes;
++    uint32_t cpu_khz;
++    uint64_t total_pages;
++    uint64_t free_pages;
++    uint64_t scrub_pages;
++    uint32_t hw_cap[8];
++};
++typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
++
++/*
++ * Get the ID of the current scheduler.
++ */
++#define XEN_SYSCTL_sched_id          4
++struct xen_sysctl_sched_id {
++    /* OUT variable */
++    uint32_t sched_id;
++};
++typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t);
++
++/* Interface for controlling Xen software performance counters. */
++#define XEN_SYSCTL_perfc_op          5
++/* Sub-operations: */
++#define XEN_SYSCTL_PERFCOP_reset 1   /* Reset all counters to zero. */
++#define XEN_SYSCTL_PERFCOP_query 2   /* Get perfctr information. */
++struct xen_sysctl_perfc_desc {
++    char         name[80];             /* name of perf counter */
++    uint32_t     nr_vals;              /* number of values for this counter */
++};
++typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
++typedef uint32_t xen_sysctl_perfc_val_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
++
++struct xen_sysctl_perfc_op {
++    /* IN variables. */
++    uint32_t       cmd;                /*  XEN_SYSCTL_PERFCOP_??? */
++    /* OUT variables. */
++    uint32_t       nr_counters;       /*  number of counters description  */
++    uint32_t       nr_vals;			  /*  number of values  */
++    /* counter information (or NULL) */
++    XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc;
++    /* counter values (or NULL) */
++    XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t) val;
++};
++typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
++
++#define XEN_SYSCTL_getdomaininfolist 6
++struct xen_sysctl_getdomaininfolist {
++    /* IN variables. */
++    domid_t               first_domain;
++    uint32_t              max_domains;
++    XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t) buffer;
++    /* OUT variables. */
++    uint32_t              num_domains;
++};
++typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
++
++struct xen_sysctl {
++    uint32_t cmd;
++    uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
++    union {
++        struct xen_sysctl_readconsole       readconsole;
++        struct xen_sysctl_tbuf_op           tbuf_op;
++        struct xen_sysctl_physinfo          physinfo;
++        struct xen_sysctl_sched_id          sched_id;
++        struct xen_sysctl_perfc_op          perfc_op;
++        struct xen_sysctl_getdomaininfolist getdomaininfolist;
++        uint8_t                             pad[128];
++    } u;
++};
++typedef struct xen_sysctl xen_sysctl_t;
++DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
++
++#endif /* __XEN_PUBLIC_SYSCTL_H__ */
++
++/*
++ * Local variables:
++ * mode: C
++ * c-set-style: "BSD"
++ * c-basic-offset: 4
++ * tab-width: 4
++ * indent-tabs-mode: nil
++ * End:
++ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/trace.h linux-2.6.18-xen/include/xen/interface/trace.h
 --- linux-2.6.18/include/xen/interface/trace.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/trace.h	2006-08-15 13:03:32.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/trace.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,87 @@
 +/******************************************************************************
 + * include/public/trace.h
@@ -89956,7 +90443,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/vcpu.h linux-2.6.18-xen/include/xen/interface/vcpu.h
 --- linux-2.6.18/include/xen/interface/vcpu.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/vcpu.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/vcpu.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,121 @@
 +/******************************************************************************
 + * vcpu.h
@@ -90081,7 +90568,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/version.h linux-2.6.18-xen/include/xen/interface/version.h
 --- linux-2.6.18/include/xen/interface/version.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/version.h	2006-08-15 13:03:32.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/version.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,73 @@
 +/******************************************************************************
 + * version.h
@@ -90158,7 +90645,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/xencomm.h linux-2.6.18-xen/include/xen/interface/xencomm.h
 --- linux-2.6.18/include/xen/interface/xencomm.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/xencomm.h	2006-08-15 13:03:32.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/xencomm.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,37 @@
 +/*
 + * Copyright (C) 2006 Hollis Blanchard <hollisb at us.ibm.com>, IBM Corporation
@@ -90199,7 +90686,7 @@
 +#endif /* _XEN_XENCOMM_H_ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/xen-compat.h linux-2.6.18-xen/include/xen/interface/xen-compat.h
 --- linux-2.6.18/include/xen/interface/xen-compat.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/xen-compat.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/interface/xen-compat.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,26 @@
 +/******************************************************************************
 + * xen-compat.h
@@ -90212,7 +90699,7 @@
 +#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 +#define __XEN_PUBLIC_XEN_COMPAT_H__
 +
-+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030203
++#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030204
 +
 +#if defined(__XEN__) || defined(__XEN_TOOLS__)
 +/* Xen is built with matching headers and implements the latest interface. */
@@ -90229,8 +90716,8 @@
 +#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/xen.h linux-2.6.18-xen/include/xen/interface/xen.h
 --- linux-2.6.18/include/xen/interface/xen.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/xen.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,558 @@
++++ linux-2.6.18-xen/include/xen/interface/xen.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,581 @@
 +/******************************************************************************
 + * xen.h
 + * 
@@ -90267,7 +90754,7 @@
 +#define __HYPERVISOR_set_callbacks         4
 +#define __HYPERVISOR_fpu_taskswitch        5
 +#define __HYPERVISOR_sched_op_compat       6 /* compat since 0x00030101 */
-+#define __HYPERVISOR_dom0_op               7
++#define __HYPERVISOR_platform_op           7
 +#define __HYPERVISOR_set_debugreg          8
 +#define __HYPERVISOR_get_debugreg          9
 +#define __HYPERVISOR_update_descriptor    10
@@ -90294,6 +90781,9 @@
 +#define __HYPERVISOR_event_channel_op     32
 +#define __HYPERVISOR_physdev_op           33
 +#define __HYPERVISOR_hvm_op               34
++#define __HYPERVISOR_sysctl               35
++#define __HYPERVISOR_domctl               36
++#define __HYPERVISOR_kexec_op             37
 +
 +/* Architecture-specific hypercall definitions. */
 +#define __HYPERVISOR_arch_0               48
@@ -90323,6 +90813,11 @@
 +#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
 +#endif
 +
++/* New platform_op hypercall introduced in 0x00030204. */
++#if __XEN_INTERFACE_VERSION__ < 0x00030204
++#define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
++#endif
++
 +/* 
 + * VIRTUAL INTERRUPTS
 + * 
@@ -90742,28 +91237,38 @@
 +#define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 +
 +typedef struct dom0_vga_console_info {
-+    uint8_t video_type;
-+    uint8_t txt_points;
-+    uint16_t txt_mode;
-+    uint16_t txt_x;
-+    uint16_t txt_y;
-+    uint16_t video_width;
-+    uint16_t video_height;
-+    uint16_t lfb_linelen;
-+    uint16_t lfb_depth;
-+    unsigned long lfb_base;
-+    unsigned long lfb_size;
-+    uint8_t red_pos;
-+    uint8_t red_size;
-+    uint8_t green_pos;
-+    uint8_t green_size;
-+    uint8_t blue_pos;
-+    uint8_t blue_size;
-+    uint8_t rsvd_pos;
-+    uint8_t rsvd_size;
-+} dom0_vga_console_info_t;
++    uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
++#define XEN_VGATYPE_TEXT_MODE_3 0x03
++#define XEN_VGATYPE_VESA_LFB    0x23
 +
-+typedef uint64_t cpumap_t;
++    union {
++        struct {
++            /* Font height, in pixels. */
++            uint16_t font_height;
++            /* Cursor location (column, row). */
++            uint16_t cursor_x, cursor_y;
++            /* Number of rows and columns (dimensions in characters). */
++            uint16_t rows, columns;
++        } text_mode_3;
++
++        struct {
++            /* Width and height, in pixels. */
++            uint16_t width, height;
++            /* Bytes per scan line. */
++            uint16_t bytes_per_line;
++            /* Bits per pixel. */
++            uint16_t bits_per_pixel;
++            /* LFB physical address, and size (in units of 64kB). */
++            uint32_t lfb_base;
++            uint32_t lfb_size;
++            /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
++            uint8_t  red_pos, red_size;
++            uint8_t  green_pos, green_size;
++            uint8_t  blue_pos, blue_size;
++            uint8_t  rsvd_pos, rsvd_size;
++        } vesa_lfb;
++    } u;
++} dom0_vga_console_info_t;
 +
 +typedef uint8_t xen_domain_handle_t[16];
 +
@@ -90771,6 +91276,11 @@
 +#define __mk_unsigned_long(x) x ## UL
 +#define mk_unsigned_long(x) __mk_unsigned_long(x)
 +
++DEFINE_XEN_GUEST_HANDLE(uint8_t);
++DEFINE_XEN_GUEST_HANDLE(uint16_t);
++DEFINE_XEN_GUEST_HANDLE(uint32_t);
++DEFINE_XEN_GUEST_HANDLE(uint64_t);
++
 +#else /* __ASSEMBLY__ */
 +
 +/* In assembly code we cannot use C numeric constant suffixes. */
@@ -90791,8 +91301,8 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/interface/xenoprof.h linux-2.6.18-xen/include/xen/interface/xenoprof.h
 --- linux-2.6.18/include/xen/interface/xenoprof.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/interface/xenoprof.h	2006-08-15 13:03:32.000000000 +0200
-@@ -0,0 +1,103 @@
++++ linux-2.6.18-xen/include/xen/interface/xenoprof.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,110 @@
 +/******************************************************************************
 + * xenoprof.h
 + * 
@@ -90823,6 +91333,8 @@
 +#define XENOPROF_disable_virq       11
 +#define XENOPROF_release_counters   12
 +#define XENOPROF_shutdown           13
++#define XENOPROF_get_buffer         14
++#define XENOPROF_last_op            14
 +
 +#define MAX_OPROF_EVENTS    32
 +#define MAX_OPROF_DOMAINS   25	
@@ -90851,17 +91363,22 @@
 +DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t);
 +
 +struct xenoprof_init {
-+    int32_t  max_samples;
 +    int32_t  num_events;
 +    int32_t  is_primary;
-+    int32_t  nbuf;
-+    int32_t  bufsize;
-+    uint64_t buf_maddr;
 +    char cpu_type[XENOPROF_CPU_TYPE_SIZE];
 +};
 +typedef struct xenoprof_init xenoprof_init_t;
 +DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t);
 +
++struct xenoprof_get_buffer {
++    int32_t  max_samples;
++    int32_t  nbuf;
++    int32_t  bufsize;
++    uint64_t buf_maddr;
++};
++typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
++DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
++
 +struct xenoprof_counter {
 +    uint32_t ind;
 +    uint64_t count;
@@ -90898,7 +91415,7 @@
 + */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/pcifront.h linux-2.6.18-xen/include/xen/pcifront.h
 --- linux-2.6.18/include/xen/pcifront.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/pcifront.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/pcifront.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,76 @@
 +/*
 + * PCI Frontend - arch-dependendent declarations
@@ -90969,7 +91486,7 @@
 +	sd->platform_data = pdev;
 +}
 +
-+#endif /* __ia64__ */ 
++#endif /* __ia64__ */
 +
 +extern struct rw_semaphore pci_bus_sem;
 +
@@ -90978,7 +91495,7 @@
 +#endif /* __XEN_ASM_PCIFRONT_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/public/evtchn.h linux-2.6.18-xen/include/xen/public/evtchn.h
 --- linux-2.6.18/include/xen/public/evtchn.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/public/evtchn.h	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/include/xen/public/evtchn.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,91 @@
 +/******************************************************************************
 + * evtchn.h
@@ -91073,7 +91590,7 @@
 +#endif /* __LINUX_PUBLIC_EVTCHN_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/public/privcmd.h linux-2.6.18-xen/include/xen/public/privcmd.h
 --- linux-2.6.18/include/xen/public/privcmd.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/public/privcmd.h	2006-06-19 13:20:42.000000000 +0200
++++ linux-2.6.18-xen/include/xen/public/privcmd.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,79 @@
 +/******************************************************************************
 + * privcmd.h
@@ -91156,8 +91673,8 @@
 +#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/xenbus.h linux-2.6.18-xen/include/xen/xenbus.h
 --- linux-2.6.18/include/xen/xenbus.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/xenbus.h	2006-09-17 17:44:50.000000000 +0200
-@@ -0,0 +1,300 @@
++++ linux-2.6.18-xen/include/xen/xenbus.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,306 @@
 +/******************************************************************************
 + * xenbus.h
 + *
@@ -91197,6 +91714,7 @@
 +#include <linux/device.h>
 +#include <linux/notifier.h>
 +#include <linux/mutex.h>
++#include <linux/completion.h>
 +#include <xen/interface/xen.h>
 +#include <xen/interface/grant_table.h>
 +#include <xen/interface/io/xenbus.h>
@@ -91234,6 +91752,7 @@
 +	struct xenbus_watch otherend_watch;
 +	struct device dev;
 +	enum xenbus_state state;
++	struct completion down;
 +};
 +
 +static inline struct xenbus_device *to_xenbus_device(struct device *dev)
@@ -91457,14 +91976,21 @@
 +
 +int __init xenbus_dev_init(void);
 +
++char *xenbus_strstate(enum xenbus_state state);
++int xenbus_dev_is_online(struct xenbus_device *dev);
++int xenbus_frontend_closed(struct xenbus_device *dev);
++
 +#endif /* _XEN_XENBUS_H */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/xencons.h linux-2.6.18-xen/include/xen/xencons.h
 --- linux-2.6.18/include/xen/xencons.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/xencons.h	2006-05-26 22:00:57.000000000 +0200
-@@ -0,0 +1,14 @@
++++ linux-2.6.18-xen/include/xen/xencons.h	2006-09-21 01:33:32.000000000 +0200
+@@ -0,0 +1,17 @@
 +#ifndef __ASM_XENCONS_H__
 +#define __ASM_XENCONS_H__
 +
++struct dom0_vga_console_info;
++void dom0_init_screen_info(const struct dom0_vga_console_info *info);
++
 +void xencons_force_flush(void);
 +void xencons_resume(void);
 +
@@ -91478,7 +92004,7 @@
 +#endif /* __ASM_XENCONS_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/include/xen/xen_proc.h linux-2.6.18-xen/include/xen/xen_proc.h
 --- linux-2.6.18/include/xen/xen_proc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/include/xen/xen_proc.h	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/include/xen/xen_proc.h	2006-09-04 16:31:20.000000000 +0200
 @@ -0,0 +1,12 @@
 +
 +#ifndef __ASM_XEN_PROC_H__
@@ -91494,7 +92020,7 @@
 +#endif /* __ASM_XEN_PROC_H__ */
 diff -urN -x .hg -x .hgtags linux-2.6.18/kernel/fork.c linux-2.6.18-xen/kernel/fork.c
 --- linux-2.6.18/kernel/fork.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/kernel/fork.c	2006-09-20 13:58:41.000000000 +0200
++++ linux-2.6.18-xen/kernel/fork.c	2006-09-05 10:45:48.000000000 +0200
 @@ -276,6 +276,9 @@
  		if (retval)
  			goto out;
@@ -91507,7 +92033,7 @@
  	up_write(&mm->mmap_sem);
 diff -urN -x .hg -x .hgtags linux-2.6.18/kernel/irq/manage.c linux-2.6.18-xen/kernel/irq/manage.c
 --- linux-2.6.18/kernel/irq/manage.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/kernel/irq/manage.c	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/kernel/irq/manage.c	2006-09-04 16:31:20.000000000 +0200
 @@ -350,7 +350,6 @@
  	struct irqaction **p;
  	unsigned long flags;
@@ -91518,7 +92044,7 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/kernel/Kconfig.preempt linux-2.6.18-xen/kernel/Kconfig.preempt
 --- linux-2.6.18/kernel/Kconfig.preempt	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/kernel/Kconfig.preempt	2006-05-26 22:00:57.000000000 +0200
++++ linux-2.6.18-xen/kernel/Kconfig.preempt	2006-09-04 16:31:20.000000000 +0200
 @@ -35,6 +35,7 @@
  
  config PREEMPT
@@ -91527,9 +92053,21 @@
  	help
  	  This option reduces the latency of the kernel by making
  	  all kernel code (that is not executing in a critical section)
+diff -urN -x .hg -x .hgtags linux-2.6.18/lib/Kconfig.debug linux-2.6.18-xen/lib/Kconfig.debug
+--- linux-2.6.18/lib/Kconfig.debug	2006-09-20 05:42:06.000000000 +0200
++++ linux-2.6.18-xen/lib/Kconfig.debug	2006-09-04 16:31:20.000000000 +0200
+@@ -325,7 +325,7 @@
+ 
+ config UNWIND_INFO
+ 	bool "Compile the kernel with frame unwind information"
+-	depends on !IA64 && !PARISC
++	depends on !IA64 && !PARISC && !X86_64_XEN
+ 	depends on !MODULES || !(MIPS || PPC || SUPERH || V850)
+ 	help
+ 	  If you say Y here the resulting kernel image will be slightly larger
 diff -urN -x .hg -x .hgtags linux-2.6.18/lib/Makefile linux-2.6.18-xen/lib/Makefile
 --- linux-2.6.18/lib/Makefile	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/lib/Makefile	2006-09-20 13:58:41.000000000 +0200
++++ linux-2.6.18-xen/lib/Makefile	2006-09-21 01:33:32.000000000 +0200
 @@ -52,6 +52,9 @@
  obj-$(CONFIG_AUDIT_GENERIC) += audit.o
  
@@ -91542,7 +92080,7 @@
  clean-files	:= crc32table.h
 diff -urN -x .hg -x .hgtags linux-2.6.18/mm/highmem.c linux-2.6.18-xen/mm/highmem.c
 --- linux-2.6.18/mm/highmem.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/mm/highmem.c	2006-08-15 13:03:33.000000000 +0200
++++ linux-2.6.18-xen/mm/highmem.c	2006-09-04 16:31:20.000000000 +0200
 @@ -142,6 +142,17 @@
  	return vaddr;
  }
@@ -91563,7 +92101,7 @@
  	unsigned long vaddr;
 diff -urN -x .hg -x .hgtags linux-2.6.18/mm/Kconfig linux-2.6.18-xen/mm/Kconfig
 --- linux-2.6.18/mm/Kconfig	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/mm/Kconfig	2006-08-15 13:03:33.000000000 +0200
++++ linux-2.6.18-xen/mm/Kconfig	2006-09-04 16:31:20.000000000 +0200
 @@ -127,11 +127,14 @@
  # Default to 4 for wider testing, though 8 might be more appropriate.
  # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
@@ -91581,7 +92119,7 @@
  #
 diff -urN -x .hg -x .hgtags linux-2.6.18/mm/memory.c linux-2.6.18-xen/mm/memory.c
 --- linux-2.6.18/mm/memory.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/mm/memory.c	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/mm/memory.c	2006-09-04 16:31:20.000000000 +0200
 @@ -390,7 +390,7 @@
  
  	if (unlikely(vma->vm_flags & VM_PFNMAP)) {
@@ -91723,7 +92261,7 @@
   * which was read non-atomically.  Before making any commitment, on
 diff -urN -x .hg -x .hgtags linux-2.6.18/mm/mmap.c linux-2.6.18-xen/mm/mmap.c
 --- linux-2.6.18/mm/mmap.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/mm/mmap.c	2006-09-20 13:58:41.000000000 +0200
++++ linux-2.6.18-xen/mm/mmap.c	2006-09-21 01:33:32.000000000 +0200
 @@ -1963,6 +1963,10 @@
  	unsigned long nr_accounted = 0;
  	unsigned long end;
@@ -91737,7 +92275,7 @@
  	tlb = tlb_gather_mmu(mm, 1);
 diff -urN -x .hg -x .hgtags linux-2.6.18/mm/page_alloc.c linux-2.6.18-xen/mm/page_alloc.c
 --- linux-2.6.18/mm/page_alloc.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/mm/page_alloc.c	2006-08-15 13:03:33.000000000 +0200
++++ linux-2.6.18-xen/mm/page_alloc.c	2006-09-04 16:31:20.000000000 +0200
 @@ -443,7 +443,8 @@
  	int i;
  	int reserved = 0;
@@ -91760,7 +92298,7 @@
  		page->mapping = NULL;
 diff -urN -x .hg -x .hgtags linux-2.6.18/net/core/dev.c linux-2.6.18-xen/net/core/dev.c
 --- linux-2.6.18/net/core/dev.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/net/core/dev.c	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/net/core/dev.c	2006-09-04 16:31:20.000000000 +0200
 @@ -118,6 +118,12 @@
  #include <linux/err.h>
  #include <linux/ctype.h>
@@ -91861,7 +92399,7 @@
  EXPORT_SYMBOL(br_handle_frame_hook);
 diff -urN -x .hg -x .hgtags linux-2.6.18/net/core/skbuff.c linux-2.6.18-xen/net/core/skbuff.c
 --- linux-2.6.18/net/core/skbuff.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/net/core/skbuff.c	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/net/core/skbuff.c	2006-09-04 16:31:21.000000000 +0200
 @@ -139,6 +139,7 @@
   *	Buffers may only be allocated from interrupts using a @gfp_mask of
   *	%GFP_ATOMIC.
@@ -91934,7 +92472,7 @@
  	C(priority);
 diff -urN -x .hg -x .hgtags linux-2.6.18/net/ipv4/netfilter/ip_nat_proto_tcp.c linux-2.6.18-xen/net/ipv4/netfilter/ip_nat_proto_tcp.c
 --- linux-2.6.18/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-08-15 13:03:34.000000000 +0200
++++ linux-2.6.18-xen/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-09-04 16:31:22.000000000 +0200
 @@ -129,7 +129,12 @@
  	if (hdrsize < sizeof(*hdr))
  		return 1;
@@ -91951,7 +92489,7 @@
  							   hdr->check));
 diff -urN -x .hg -x .hgtags linux-2.6.18/net/ipv4/netfilter/ip_nat_proto_udp.c linux-2.6.18-xen/net/ipv4/netfilter/ip_nat_proto_udp.c
 --- linux-2.6.18/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-09-04 16:31:22.000000000 +0200
 @@ -114,7 +114,12 @@
  		portptr = &hdr->dest;
  	}
@@ -91968,7 +92506,7 @@
  							   hdr->check));
 diff -urN -x .hg -x .hgtags linux-2.6.18/net/ipv4/xfrm4_output.c linux-2.6.18-xen/net/ipv4/xfrm4_output.c
 --- linux-2.6.18/net/ipv4/xfrm4_output.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/net/ipv4/xfrm4_output.c	2006-08-15 13:03:34.000000000 +0200
++++ linux-2.6.18-xen/net/ipv4/xfrm4_output.c	2006-09-04 16:31:23.000000000 +0200
 @@ -18,6 +18,8 @@
  #include <net/xfrm.h>
  #include <net/icmp.h>
@@ -91991,7 +92529,7 @@
  		if (err)
 diff -urN -x .hg -x .hgtags linux-2.6.18/net/ipv6/addrconf.c linux-2.6.18-xen/net/ipv6/addrconf.c
 --- linux-2.6.18/net/ipv6/addrconf.c	2006-09-20 05:42:06.000000000 +0200
-+++ linux-2.6.18-xen/net/ipv6/addrconf.c	2006-09-17 17:44:50.000000000 +0200
++++ linux-2.6.18-xen/net/ipv6/addrconf.c	2006-09-04 16:31:23.000000000 +0200
 @@ -2514,6 +2514,7 @@
  	spin_lock_bh(&ifp->lock);
  
@@ -92010,7 +92548,7 @@
  
 diff -urN -x .hg -x .hgtags linux-2.6.18/scripts/Makefile.xen linux-2.6.18-xen/scripts/Makefile.xen
 --- linux-2.6.18/scripts/Makefile.xen	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18-xen/scripts/Makefile.xen	2006-05-26 22:01:02.000000000 +0200
++++ linux-2.6.18-xen/scripts/Makefile.xen	2006-09-04 16:31:23.000000000 +0200
 @@ -0,0 +1,14 @@
 +
 +# cherrypickxen($1 = allobj)

Modified: dists/trunk/linux-2.6/debian/patches/series/1-extra
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/1-extra	(original)
+++ dists/trunk/linux-2.6/debian/patches/series/1-extra	Wed Sep 20 23:39:37 2006
@@ -1,4 +1,4 @@
-+ features/all/xen/upstream-35844.patch *_xen *_xen-vserver
++ features/all/xen/fedora-36175.patch *_xen *_xen-vserver
 + mips-tulip.patch mipsel
 + mips-tulip_dc21143.patch mipsel
 + mips-dec-scsi.patch mipsel



More information about the Kernel-svn-changes mailing list