[kernel] r7167 - in dists/sid/linux-2.6.16/debian: . patches

Bastian Blank waldi at costa.debian.org
Tue Aug 15 18:02:14 UTC 2006


Author: waldi
Date: Tue Aug 15 18:02:05 2006
New Revision: 7167

Added:
   dists/sid/linux-2.6.16/debian/patches/series/18-extra
   dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9762.patch
      - copied, changed from r6831, /dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9668.patch
Removed:
   dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9668.patch
   dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9687-update.patch
Modified:
   dists/sid/linux-2.6.16/debian/changelog
   dists/sid/linux-2.6.16/debian/patches/series/13-extra
   dists/sid/linux-2.6.16/debian/patches/series/14-extra

Log:
Update xen patch to changeset 9762.

* debian/changelog: Update.
* debian/patches/series/13-extra, debian/patches/series/14-extra:
  Remove xen patches.
* debian/patches/series/18-extra: Add xen-tree-3.0-testing-9762.patch.
* debian/patches/xen-tree-3.0-testing-9668.patch, 
  debian/patches/xen-tree-3.0-testing-9687-update.patch: Remove.
* debian/patches/xen-tree-3.0-testing-9762.patch: Add.


Modified: dists/sid/linux-2.6.16/debian/changelog
==============================================================================
--- dists/sid/linux-2.6.16/debian/changelog	(original)
+++ dists/sid/linux-2.6.16/debian/changelog	Tue Aug 15 18:02:05 2006
@@ -8,7 +8,10 @@
   * fs-ext3-bad-nfs-handle.patch: avoid triggering ext3_error on bad NFS
     file handle (CVE-2006-3468)
 
- -- dann frazier <dannf at debian.org>  Sun, 13 Aug 2006 23:11:56 -0600
+  [ Bastian Blank ]
+  * Update xen patch to changeset 9762.
+
+ -- Bastian Blank <waldi at debian.org>  Tue, 15 Aug 2006 19:58:16 +0200
 
 linux-2.6.16 (2.6.16-17) unstable; urgency=high
 

Modified: dists/sid/linux-2.6.16/debian/patches/series/13-extra
==============================================================================
--- dists/sid/linux-2.6.16/debian/patches/series/13-extra	(original)
+++ dists/sid/linux-2.6.16/debian/patches/series/13-extra	Tue Aug 15 18:02:05 2006
@@ -1,6 +1,3 @@
 + vserver-vs2.0.2-rc19.patch *_vserver *_xen-vserver
-+ vserver-xen-clash.patch *_xen-vserver
-+ xen-tree-3.0-testing-9668.patch *_xen *_xen-vserver
-+ xen-tls.patch *_xen *_xen-vserver
 + m68k-atari-stdma.patch m68k
 + m68k-atyfb.patch  m68k

Modified: dists/sid/linux-2.6.16/debian/patches/series/14-extra
==============================================================================
--- dists/sid/linux-2.6.16/debian/patches/series/14-extra	(original)
+++ dists/sid/linux-2.6.16/debian/patches/series/14-extra	Tue Aug 15 18:02:05 2006
@@ -3,4 +3,3 @@
 + m68k-sun3.patch m68k
 + m68k-sun3-scsi.patch m68k
 + vserver-vs2.0.2-rc20-update.patch *_vserver *_xen-vserver
-+ xen-tree-3.0-testing-9687-update.patch *_xen *_xen-vserver

Added: dists/sid/linux-2.6.16/debian/patches/series/18-extra
==============================================================================
--- (empty file)
+++ dists/sid/linux-2.6.16/debian/patches/series/18-extra	Tue Aug 15 18:02:05 2006
@@ -0,0 +1,3 @@
++ vserver-xen-clash.patch *_xen-vserver
++ xen-tree-3.0-testing-9762.patch *_xen *_xen-vserver
++ xen-tls.patch *_xen *_xen-vserver

Copied: dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9762.patch (from r6831, /dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9668.patch)
==============================================================================
--- /dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9668.patch	(original)
+++ dists/sid/linux-2.6.16/debian/patches/xen-tree-3.0-testing-9762.patch	Tue Aug 15 18:02:05 2006
@@ -1,5 +1,5 @@
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/boot-xen/Makefile tmp-linux-2.6-xen.patch/arch/i386/boot-xen/Makefile
---- pristine-linux-2.6.16.12/arch/i386/boot-xen/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/boot-xen/Makefile tmp-linux-2.6-xen.patch/arch/i386/boot-xen/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/boot-xen/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/boot-xen/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,21 @@
 +
@@ -23,8 +23,8 @@
 +	install -m0664 .config $(INSTALL_ROOT)/boot/config-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
 +	install -m0664 System.map $(INSTALL_ROOT)/boot/System.map-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
 +	ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/Kconfig tmp-linux-2.6-xen.patch/arch/i386/Kconfig
---- pristine-linux-2.6.16.12/arch/i386/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/Kconfig tmp-linux-2.6-xen.patch/arch/i386/Kconfig
+--- pristine-linux-2.6.16.13/arch/i386/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -58,6 +58,15 @@ config X86_PC
  	help
@@ -349,8 +349,8 @@
  config KTIME_SCALAR
  	bool
  	default y
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/Kconfig.cpu tmp-linux-2.6-xen.patch/arch/i386/Kconfig.cpu
---- pristine-linux-2.6.16.12/arch/i386/Kconfig.cpu	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/Kconfig.cpu tmp-linux-2.6-xen.patch/arch/i386/Kconfig.cpu
+--- pristine-linux-2.6.16.13/arch/i386/Kconfig.cpu	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/Kconfig.cpu	2006-04-05 22:43:19.000000000 +0200
 @@ -251,7 +251,7 @@ config X86_PPRO_FENCE
  
@@ -361,8 +361,8 @@
  	default y
  
  config X86_WP_WORKS_OK
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/acpi/boot-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/acpi/boot-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/acpi/boot-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/acpi/boot-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/acpi/boot-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/acpi/boot-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/acpi/boot-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1161 @@
 +/*
@@ -1526,8 +1526,8 @@
 +
 +	return 0;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/acpi/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/acpi/Makefile
---- pristine-linux-2.6.16.12/arch/i386/kernel/acpi/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/acpi/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/acpi/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/kernel/acpi/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/acpi/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -6,3 +6,7 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),)
  obj-y				+= cstate.o processor.o
@@ -1537,8 +1537,8 @@
 +include $(srctree)/scripts/Makefile.xen
 +obj-y := $(call cherrypickxen, $(obj-y), $(src))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/apic-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/apic-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/apic-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/apic-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/apic-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/apic-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/apic-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,140 @@
 +/*
@@ -1681,8 +1681,8 @@
 +
 +	return 0;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/asm-offsets.c tmp-linux-2.6-xen.patch/arch/i386/kernel/asm-offsets.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/asm-offsets.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/asm-offsets.c tmp-linux-2.6-xen.patch/arch/i386/kernel/asm-offsets.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/asm-offsets.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/asm-offsets.c	2006-04-05 22:43:19.000000000 +0200
 @@ -13,6 +13,7 @@
  #include <asm/fixmap.h>
@@ -1706,8 +1706,8 @@
 -	DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL));
 +	DEFINE(VSYSCALL_BASE, VSYSCALL_BASE);
  }
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/cpu/common-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/common-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/cpu/common-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/cpu/common-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/common-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/cpu/common-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/common-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,715 @@
 +#include <linux/init.h>
@@ -2425,8 +2425,8 @@
 +	per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm;
 +}
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/cpu/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/Makefile
---- pristine-linux-2.6.16.12/arch/i386/kernel/cpu/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/cpu/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/kernel/cpu/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -17,3 +17,8 @@ obj-$(CONFIG_X86_MCE)	+=	mcheck/
  
@@ -2437,8 +2437,8 @@
 +include $(srctree)/scripts/Makefile.xen
 +obj-y := $(call cherrypickxen, $(obj-y), $(src))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/cpu/mtrr/main-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/mtrr/main-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/cpu/mtrr/main-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/cpu/mtrr/main-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/mtrr/main-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/cpu/mtrr/main-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/mtrr/main-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,196 @@
 +#include <linux/init.h>
@@ -2637,8 +2637,8 @@
 +}
 +
 +subsys_initcall(mtrr_init);
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/cpu/mtrr/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/mtrr/Makefile
---- pristine-linux-2.6.16.12/arch/i386/kernel/cpu/mtrr/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/cpu/mtrr/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/mtrr/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/kernel/cpu/mtrr/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/cpu/mtrr/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -3,3 +3,10 @@ obj-y		+= amd.o
  obj-y		+= cyrix.o
@@ -2651,14 +2651,35 @@
 +obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/early_printk-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/early_printk-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/early_printk-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/early_printk-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/early_printk-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/early_printk-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/early_printk-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +#include "../../x86_64/kernel/early_printk-xen.c"
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/entry-xen.S tmp-linux-2.6-xen.patch/arch/i386/kernel/entry-xen.S
---- pristine-linux-2.6.16.12/arch/i386/kernel/entry-xen.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/entry.S tmp-linux-2.6-xen.patch/arch/i386/kernel/entry.S
+--- pristine-linux-2.6.16.13/arch/i386/kernel/entry.S	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/entry.S	2006-08-15 19:47:06.000000000 +0200
+@@ -406,7 +406,7 @@ vector=0
+ ENTRY(irq_entries_start)
+ .rept NR_IRQS
+ 	ALIGN
+-1:	pushl $vector-256
++1:	pushl $~(vector)
+ 	jmp common_interrupt
+ .data
+ 	.long 1b
+@@ -423,7 +423,7 @@ common_interrupt:
+ 
+ #define BUILD_INTERRUPT(name, nr)	\
+ ENTRY(name)				\
+-	pushl $nr-256;			\
++	pushl $~(nr);			\
+ 	SAVE_ALL			\
+ 	movl %esp,%eax;			\
+ 	call smp_/**/name;		\
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/entry-xen.S tmp-linux-2.6-xen.patch/arch/i386/kernel/entry-xen.S
+--- pristine-linux-2.6.16.13/arch/i386/kernel/entry-xen.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/entry-xen.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,876 @@
 +/*
@@ -3537,10 +3558,10 @@
 +#include "syscall_table.S"
 +
 +syscall_table_size=(.-sys_call_table)
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/fixup.c tmp-linux-2.6-xen.patch/arch/i386/kernel/fixup.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/fixup.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/fixup.c	2006-04-18 16:21:25.000000000 +0200
-@@ -0,0 +1,96 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/fixup.c tmp-linux-2.6-xen.patch/arch/i386/kernel/fixup.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/fixup.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/fixup.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,86 @@
 +/******************************************************************************
 + * fixup.c
 + * 
@@ -3627,19 +3648,9 @@
 +	return 0;
 +}
 +__initcall(fixup_init);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/head-xen.S tmp-linux-2.6-xen.patch/arch/i386/kernel/head-xen.S
---- pristine-linux-2.6.16.12/arch/i386/kernel/head-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/head-xen.S	2006-04-05 22:43:19.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/head-xen.S tmp-linux-2.6-xen.patch/arch/i386/kernel/head-xen.S
+--- pristine-linux-2.6.16.13/arch/i386/kernel/head-xen.S	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/head-xen.S	2006-08-15 18:07:17.000000000 +0200
 @@ -0,0 +1,171 @@
 +
 +
@@ -3806,14 +3817,14 @@
 +	.ascii	         "|pae_pgdir_above_4gb"
 +	.ascii	         "|supervisor_mode_kernel"
 +#ifdef CONFIG_X86_PAE
-+	.ascii	",PAE=yes"
++	.ascii	",PAE=yes[extended-cr3]"
 +#else
 +	.ascii	",PAE=no"
 +#endif
 +	.ascii	",LOADER=generic"
 +	.byte	0
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/init_task-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/init_task-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/init_task-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/init_task-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/init_task-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/init_task-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/init_task-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,51 @@
 +#include <linux/mm.h>
@@ -3867,9 +3878,9 @@
 +DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
 +#endif
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/io_apic-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/io_apic-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/io_apic-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/io_apic-xen.c	2006-04-25 11:20:48.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/io_apic-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/io_apic-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/io_apic-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/io_apic-xen.c	2006-08-15 18:04:18.000000000 +0200
 @@ -0,0 +1,2753 @@
 +/*
 + *	Intel IO-APIC support for multi-Pentium hosts.
@@ -6624,8 +6635,8 @@
 +}
 +
 +#endif /* CONFIG_ACPI */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/ioport-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/ioport-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/ioport-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/ioport-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/ioport-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/ioport-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/ioport-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,122 @@
 +/*
@@ -6750,8 +6761,22 @@
 +	set_iopl_mask(t->iopl);
 +	return 0;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/irq-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/irq-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/irq.c tmp-linux-2.6-xen.patch/arch/i386/kernel/irq.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/irq.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/irq.c	2006-08-15 19:47:06.000000000 +0200
+@@ -53,8 +53,8 @@ static union irq_ctx *softirq_ctx[NR_CPU
+  */
+ fastcall unsigned int do_IRQ(struct pt_regs *regs)
+ {	
+-	/* high bits used in ret_from_ code */
+-	int irq = regs->orig_eax & 0xff;
++	/* high bit used in ret_from_ code */
++	int irq = ~regs->orig_eax;
+ #ifdef CONFIG_4KSTACKS
+ 	union irq_ctx *curctx, *irqctx;
+ 	u32 *isp;
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/irq-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/irq-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/irq-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,306 @@
 +/*
@@ -7060,8 +7085,8 @@
 +}
 +#endif
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/ldt-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/ldt-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/ldt-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/ldt-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/ldt-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/ldt-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/ldt-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,269 @@
 +/*
@@ -7333,8 +7358,8 @@
 +	}
 +	return ret;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/Makefile
---- pristine-linux-2.6.16.12/arch/i386/kernel/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/Makefile tmp-linux-2.6-xen.patch/arch/i386/kernel/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/kernel/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -37,17 +37,26 @@ obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
  obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
@@ -7395,8 +7420,8 @@
 +obj-y := $(call cherrypickxen, $(obj-y))
 +extra-y := $(call cherrypickxen, $(extra-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/microcode-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/microcode-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/microcode-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/microcode-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/microcode-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/microcode-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/microcode-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,165 @@
 +/*
@@ -7564,8 +7589,8 @@
 +module_init(microcode_init)
 +module_exit(microcode_exit)
 +MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/mpparse-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/mpparse-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/mpparse-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/mpparse-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/mpparse-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/mpparse-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/mpparse-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1188 @@
 +/*
@@ -8756,10 +8781,10 @@
 +
 +#endif /* CONFIG_X86_IO_APIC */
 +#endif /* CONFIG_ACPI */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/pci-dma-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/pci-dma-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/pci-dma-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/pci-dma-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,344 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/pci-dma-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/pci-dma-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/pci-dma-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/pci-dma-xen.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,334 @@
 +/*
 + * Dynamic DMA mapping support.
 + *
@@ -9094,18 +9119,8 @@
 +		swiotlb_sync_single_for_device(dev, dma_handle, size, direction);
 +}
 +EXPORT_SYMBOL(dma_sync_single_for_device);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/process-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/process-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/process-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/process-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/process-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/process-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/process-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,833 @@
 +/*
@@ -9941,8 +9956,8 @@
 +		sp -= get_random_int() % 8192;
 +	return sp & ~0xf;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/quirks-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/quirks-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/quirks-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/quirks-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/quirks-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/quirks-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/quirks-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,48 @@
 +/*
@@ -9993,8 +10008,8 @@
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7525_MCH,	quirk_intel_irqbalance);
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7520_MCH,	quirk_intel_irqbalance);
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/setup-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/setup-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/setup-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/setup-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/setup-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/setup-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/setup-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1892 @@
 +/*
@@ -11889,8 +11904,8 @@
 + * c-basic-offset:8
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/smpalts.c tmp-linux-2.6-xen.patch/arch/i386/kernel/smpalts.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/smpalts.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/smpalts.c tmp-linux-2.6-xen.patch/arch/i386/kernel/smpalts.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/smpalts.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/smpalts.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,85 @@
 +#include <linux/kernel.h>
@@ -11978,8 +11993,8 @@
 +	asm volatile ("jmp 1f\n1:");
 +	mb();
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/smpboot.c tmp-linux-2.6-xen.patch/arch/i386/kernel/smpboot.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/smpboot.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/smpboot.c tmp-linux-2.6-xen.patch/arch/i386/kernel/smpboot.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/smpboot.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/smpboot.c	2006-04-05 22:43:19.000000000 +0200
 @@ -1218,6 +1218,11 @@ static void __init smp_boot_cpus(unsigne
  		if (max_cpus <= cpucount+1)
@@ -12005,10 +12020,10 @@
  	local_irq_enable();
  	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
  	/* Unleash the CPU! */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/smp-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/smp-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/smp-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/smp-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,617 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/smp-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/smp-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/smp-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/smp-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,618 @@
 +/*
 + *	Intel SMP support routines.
 + *
@@ -12453,6 +12468,7 @@
 +{ xen_tlb_flush_mask(&mm->cpu_vm_mask); }
 +void flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
 +{ xen_invlpg_mask(&vma->vm_mm->cpu_vm_mask, va); }
++EXPORT_SYMBOL(flush_tlb_page);
 +void flush_tlb_all(void)
 +{ xen_tlb_flush_all(); }
 +
@@ -12626,10 +12642,10 @@
 +	return IRQ_HANDLED;
 +}
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/swiotlb.c tmp-linux-2.6-xen.patch/arch/i386/kernel/swiotlb.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/swiotlb.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/swiotlb.c	2006-04-18 16:21:25.000000000 +0200
-@@ -0,0 +1,674 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/swiotlb.c tmp-linux-2.6-xen.patch/arch/i386/kernel/swiotlb.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/swiotlb.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/swiotlb.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,671 @@
 +/*
 + * Dynamic DMA mapping support.
 + *
@@ -12679,6 +12695,9 @@
 + */
 +#define IO_TLB_SHIFT 11
 +
++/* Width of DMA addresses in the IO TLB. 31 bits is an aacraid limitation. */
++#define IO_TLB_DMA_BITS 31
++
 +static int swiotlb_force;
 +static char *iotlb_virt_start;
 +static unsigned long iotlb_nslabs;
@@ -12688,10 +12707,16 @@
 + * swiotlb_sync_single_*, to see if the memory was in fact allocated by this
 + * API.
 + */
-+static dma_addr_t iotlb_bus_start, iotlb_bus_end, iotlb_bus_mask;
++static unsigned long iotlb_pfn_start, iotlb_pfn_end;
 +
 +/* Does the given dma address reside within the swiotlb aperture? */
-+#define in_swiotlb_aperture(a) (!(((a) ^ iotlb_bus_start) & iotlb_bus_mask))
++static inline int in_swiotlb_aperture(dma_addr_t dev_addr)
++{
++	unsigned long pfn = mfn_to_local_pfn(dev_addr >> PAGE_SHIFT);
++	return (pfn_valid(pfn)
++		&& (pfn >= iotlb_pfn_start)
++		&& (pfn < iotlb_pfn_end));
++}
 +
 +/*
 + * When the IOMMU overflows we return a fallback buffer. This sets the size.
@@ -12757,7 +12782,6 @@
 +swiotlb_init_with_default_size (size_t default_size)
 +{
 +	unsigned long i, bytes;
-+	int rc;
 +
 +	if (!iotlb_nslabs) {
 +		iotlb_nslabs = (default_size >> IO_TLB_SHIFT);
@@ -12778,10 +12802,13 @@
 +		      "Use dom0_mem Xen boot parameter to reserve\n"
 +		      "some DMA memory (e.g., dom0_mem=-128M).\n");
 +
-+	/* Hardcode 31 address bits for now: aacraid limitation. */
-+	rc = xen_create_contiguous_region(
-+		(unsigned long)iotlb_virt_start, get_order(bytes), 31);
-+	BUG_ON(rc);
++	for (i = 0; i < iotlb_nslabs; i += IO_TLB_SEGSIZE) {
++		int rc = xen_create_contiguous_region(
++			(unsigned long)iotlb_virt_start + (i << IO_TLB_SHIFT),
++			get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT),
++			IO_TLB_DMA_BITS);
++		BUG_ON(rc);
++	}
 +
 +	/*
 +	 * Allocate and initialize the free list array.  This array is used
@@ -12799,17 +12826,13 @@
 +	 */
 +	io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
 +
-+	iotlb_bus_start = virt_to_bus(iotlb_virt_start);
-+	iotlb_bus_end   = iotlb_bus_start + bytes;
-+	iotlb_bus_mask  = ~(dma_addr_t)(bytes - 1);
++	iotlb_pfn_start = __pa(iotlb_virt_start) >> PAGE_SHIFT;
++	iotlb_pfn_end   = iotlb_pfn_start + (bytes >> PAGE_SHIFT);
 +
 +	printk(KERN_INFO "Software IO TLB enabled: \n"
 +	       " Aperture:     %lu megabytes\n"
-+	       " Bus range:    0x%016lx - 0x%016lx\n"
 +	       " Kernel range: 0x%016lx - 0x%016lx\n",
 +	       bytes >> 20,
-+	       (unsigned long)iotlb_bus_start,
-+	       (unsigned long)iotlb_bus_end,
 +	       (unsigned long)iotlb_virt_start,
 +	       (unsigned long)iotlb_virt_start + bytes);
 +}
@@ -13278,7 +13301,7 @@
 +int
 +swiotlb_dma_supported (struct device *hwdev, u64 mask)
 +{
-+	return (mask >= (iotlb_bus_end - 1));
++	return (mask >= ((1UL << IO_TLB_DMA_BITS) - 1));
 +}
 +
 +EXPORT_SYMBOL(swiotlb_init);
@@ -13294,18 +13317,8 @@
 +EXPORT_SYMBOL(swiotlb_unmap_page);
 +EXPORT_SYMBOL(swiotlb_dma_mapping_error);
 +EXPORT_SYMBOL(swiotlb_dma_supported);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/sysenter.c tmp-linux-2.6-xen.patch/arch/i386/kernel/sysenter.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/sysenter.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/sysenter.c tmp-linux-2.6-xen.patch/arch/i386/kernel/sysenter.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/sysenter.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/sysenter.c	2006-04-05 22:43:19.000000000 +0200
 @@ -13,6 +13,7 @@
  #include <linux/gfp.h>
@@ -13432,10 +13445,10 @@
 +{
 +	return 0;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/time-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/time-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/time-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/time-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,1097 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/time-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/time-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/time-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/time-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,1094 @@
 +/*
 + *  linux/arch/i386/kernel/time.c
 + *
@@ -14416,12 +14429,19 @@
 +	unsigned int cpu = smp_processor_id();
 +	unsigned long j;
 +
-+	/* We must do this /before/ checking rcu_pending(). */
 +	cpu_set(cpu, nohz_cpu_mask);
++
++	/* See matching smp_mb in rcu_start_batch in rcupdate.c.  These mbs  */
++	/* ensure that if __rcu_pending (nested in rcu_needs_cpu) fetches a  */
++	/* value of rcp->cur that matches rdp->quiescbatch and allows us to  */
++	/* stop the hz timer then the cpumasks created for subsequent values */
++	/* of cur in rcu_start_batch are guaranteed to pick up the updated   */
++	/* nohz_cpu_mask and so will not depend on this cpu.                 */
++
 +	smp_mb();
 +
 +	/* Leave ourselves in 'tick mode' if rcu or softirq pending. */
-+	if (rcu_pending(cpu) || local_softirq_pending()) {
++	if (rcu_needs_cpu(cpu) || local_softirq_pending()) {
 +		cpu_clear(cpu, nohz_cpu_mask);
 +		j = jiffies + 1;
 +	} else {
@@ -14523,18 +14543,8 @@
 +	return 0;
 +}
 +__initcall(xen_sysctl_init);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/traps.c tmp-linux-2.6-xen.patch/arch/i386/kernel/traps.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/traps.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/traps.c tmp-linux-2.6-xen.patch/arch/i386/kernel/traps.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/traps.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/traps.c	2006-04-05 22:43:19.000000000 +0200
 @@ -567,18 +567,11 @@ static void mem_parity_error(unsigned ch
  
@@ -14556,8 +14566,8 @@
  }
  
  static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/traps-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/traps-xen.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/traps-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/traps-xen.c tmp-linux-2.6-xen.patch/arch/i386/kernel/traps-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/traps-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/traps-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1094 @@
 +/*
@@ -15654,18 +15664,10 @@
 +	return 0;
 +}
 +__setup("kstack=", kstack_setup);
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/vm86.c tmp-linux-2.6-xen.patch/arch/i386/kernel/vm86.c
---- pristine-linux-2.6.16.12/arch/i386/kernel/vm86.c	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/arch/i386/kernel/vm86.c	2006-04-05 22:43:19.000000000 +0200
-@@ -43,7 +43,6 @@
- #include <linux/smp_lock.h>
- #include <linux/highmem.h>
- #include <linux/ptrace.h>
--#include <linux/audit.h>
- 
- #include <asm/uaccess.h>
- #include <asm/io.h>
-@@ -98,7 +97,9 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/vm86.c tmp-linux-2.6-xen.patch/arch/i386/kernel/vm86.c
+--- pristine-linux-2.6.16.13/arch/i386/kernel/vm86.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/i386/kernel/vm86.c	2006-08-15 18:07:17.000000000 +0200
+@@ -98,7 +98,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)
  {
@@ -15675,7 +15677,7 @@
  	struct pt_regs *ret;
  	unsigned long tmp;
  
-@@ -123,7 +124,9 @@ struct pt_regs * fastcall save_v86_state
+@@ -123,12 +125,16 @@ struct pt_regs * fastcall save_v86_state
  		do_exit(SIGSEGV);
  	}
  
@@ -15685,18 +15687,24 @@
  	current->thread.esp0 = current->thread.saved_esp0;
  	current->thread.sysenter_cs = __KERNEL_CS;
  	load_esp0(tss, &current->thread);
-@@ -252,8 +255,9 @@ out:
+ 	current->thread.saved_esp0 = 0;
++#ifndef CONFIG_X86_NO_TSS
+ 	put_cpu();
++#endif
+ 
+ 	loadsegment(fs, current->thread.saved_fs);
+ 	loadsegment(gs, current->thread.saved_gs);
+@@ -252,7 +258,9 @@ out:
  
  static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk)
  {
 +#ifndef CONFIG_X86_NO_TSS
  	struct tss_struct *tss;
--	long eax;
 +#endif
+ 	long eax;
  /*
   * make sure the vm86() system call doesn't try to do anything silly
-  */
-@@ -297,7 +301,9 @@ static void do_sys_vm86(struct kernel_vm
+@@ -297,12 +305,16 @@ static void do_sys_vm86(struct kernel_vm
  	savesegment(fs, tsk->thread.saved_fs);
  	savesegment(gs, tsk->thread.saved_gs);
  
@@ -15706,30 +15714,15 @@
  	tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
  	if (cpu_has_sep)
  		tsk->thread.sysenter_cs = 0;
-@@ -307,19 +313,13 @@ static void do_sys_vm86(struct kernel_vm
+ 	load_esp0(tss, &tsk->thread);
++#ifndef CONFIG_X86_NO_TSS
+ 	put_cpu();
++#endif
+ 
  	tsk->thread.screen_bitmap = info->screen_bitmap;
  	if (info->flags & VM86_SCREEN_BITMAP)
- 		mark_screen_rdonly(tsk->mm);
--	__asm__ __volatile__("xorl %eax,%eax; movl %eax,%fs; movl %eax,%gs\n\t");
--	__asm__ __volatile__("movl %%eax, %0\n" :"=r"(eax));
--
--	/*call audit_syscall_exit since we do not exit via the normal paths */
--	if (unlikely(current->audit_context))
--		audit_syscall_exit(current, AUDITSC_RESULT(eax), eax);
--
- 	__asm__ __volatile__(
-+		"xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs\n\t"
- 		"movl %0,%%esp\n\t"
- 		"movl %1,%%ebp\n\t"
- 		"jmp resume_userspace"
- 		: /* no outputs */
--		:"r" (&info->regs), "r" (task_thread_info(tsk)));
-+		:"r" (&info->regs), "r" (task_thread_info(tsk)) : "ax");
- 	/* we never return here */
- }
- 
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/vmlinux.lds.S tmp-linux-2.6-xen.patch/arch/i386/kernel/vmlinux.lds.S
---- pristine-linux-2.6.16.12/arch/i386/kernel/vmlinux.lds.S	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/vmlinux.lds.S tmp-linux-2.6-xen.patch/arch/i386/kernel/vmlinux.lds.S
+--- pristine-linux-2.6.16.13/arch/i386/kernel/vmlinux.lds.S	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/vmlinux.lds.S	2006-04-05 22:43:19.000000000 +0200
 @@ -34,6 +34,13 @@ SECTIONS
    __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
@@ -15745,8 +15738,8 @@
    RODATA
  
    /* writeable */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/vsyscall-note-xen.S tmp-linux-2.6-xen.patch/arch/i386/kernel/vsyscall-note-xen.S
---- pristine-linux-2.6.16.12/arch/i386/kernel/vsyscall-note-xen.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/vsyscall-note-xen.S tmp-linux-2.6-xen.patch/arch/i386/kernel/vsyscall-note-xen.S
+--- pristine-linux-2.6.16.13/arch/i386/kernel/vsyscall-note-xen.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/vsyscall-note-xen.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,32 @@
 +/*
@@ -15781,8 +15774,8 @@
 +NOTE_KERNELCAP_BEGIN(1, 1)
 +NOTE_KERNELCAP(1, "nosegneg")  /* Change 1 back to 0 when glibc is fixed! */
 +NOTE_KERNELCAP_END
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/kernel/vsyscall.S tmp-linux-2.6-xen.patch/arch/i386/kernel/vsyscall.S
---- pristine-linux-2.6.16.12/arch/i386/kernel/vsyscall.S	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/kernel/vsyscall.S tmp-linux-2.6-xen.patch/arch/i386/kernel/vsyscall.S
+--- pristine-linux-2.6.16.13/arch/i386/kernel/vsyscall.S	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/kernel/vsyscall.S	2006-04-05 22:43:19.000000000 +0200
 @@ -7,9 +7,11 @@ vsyscall_int80_start:
  	.incbin "arch/i386/kernel/vsyscall-int80.so"
@@ -15796,8 +15789,8 @@
 +#endif
  
  __FINIT
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mach-xen/Makefile tmp-linux-2.6-xen.patch/arch/i386/mach-xen/Makefile
---- pristine-linux-2.6.16.12/arch/i386/mach-xen/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mach-xen/Makefile tmp-linux-2.6-xen.patch/arch/i386/mach-xen/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/mach-xen/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/mach-xen/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,5 @@
 +#
@@ -15805,8 +15798,8 @@
 +#
 +
 +obj-y				:= setup.o
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mach-xen/setup.c tmp-linux-2.6-xen.patch/arch/i386/mach-xen/setup.c
---- pristine-linux-2.6.16.12/arch/i386/mach-xen/setup.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mach-xen/setup.c tmp-linux-2.6-xen.patch/arch/i386/mach-xen/setup.c
+--- pristine-linux-2.6.16.13/arch/i386/mach-xen/setup.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/mach-xen/setup.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,37 @@
 +/*
@@ -15846,8 +15839,8 @@
 +}
 +
 +late_initcall(print_ipi_mode);
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/Makefile tmp-linux-2.6-xen.patch/arch/i386/Makefile
---- pristine-linux-2.6.16.12/arch/i386/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/Makefile tmp-linux-2.6-xen.patch/arch/i386/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -45,6 +45,11 @@ CFLAGS				+= $(shell if [ $(call cc-vers
  
@@ -15900,8 +15893,8 @@
  
  archclean:
  	$(Q)$(MAKE) $(clean)=arch/i386/boot
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/fault-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/fault-xen.c
---- pristine-linux-2.6.16.12/arch/i386/mm/fault-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/fault-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/fault-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/fault-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/mm/fault-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,617 @@
 +/*
@@ -16521,10 +16514,10 @@
 +		return;
 +	}
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/highmem-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/highmem-xen.c
---- pristine-linux-2.6.16.12/arch/i386/mm/highmem-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/mm/highmem-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,123 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/highmem-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/highmem-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/highmem-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/mm/highmem-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,133 @@
 +#include <linux/highmem.h>
 +#include <linux/module.h>
 +
@@ -16587,7 +16580,7 @@
 +
 +void kunmap_atomic(void *kvaddr, enum km_type type)
 +{
-+#ifdef CONFIG_DEBUG_HIGHMEM
++#if defined(CONFIG_DEBUG_HIGHMEM) || defined(CONFIG_XEN)
 +	unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
 +	enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
 +
@@ -16596,7 +16589,9 @@
 +		preempt_check_resched();
 +		return;
 +	}
++#endif
 +
++#if defined(CONFIG_DEBUG_HIGHMEM)
 +	if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
 +		BUG();
 +
@@ -16606,6 +16601,14 @@
 +	 */
 +	pte_clear(&init_mm, vaddr, kmap_pte-idx);
 +	__flush_tlb_one(vaddr);
++#elif defined(CONFIG_XEN)
++	/*
++	 * We must ensure there are no dangling pagetable references when
++	 * returning memory to Xen (decrease_reservation).
++	 * XXX TODO: We could make this faster by only zapping when
++	 * kmap_flush_unused is called but that is trickier and more invasive.
++	 */
++	pte_clear(&init_mm, vaddr, kmap_pte-idx);
 +#endif
 +
 +	dec_preempt_count();
@@ -16648,10 +16651,10 @@
 +EXPORT_SYMBOL(kmap_atomic);
 +EXPORT_SYMBOL(kunmap_atomic);
 +EXPORT_SYMBOL(kmap_atomic_to_page);
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/hypervisor.c tmp-linux-2.6-xen.patch/arch/i386/mm/hypervisor.c
---- pristine-linux-2.6.16.12/arch/i386/mm/hypervisor.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/mm/hypervisor.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,424 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/hypervisor.c tmp-linux-2.6-xen.patch/arch/i386/mm/hypervisor.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/hypervisor.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/mm/hypervisor.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,468 @@
 +/******************************************************************************
 + * mm/hypervisor.c
 + * 
@@ -16787,6 +16790,7 @@
 +	op.cmd = MMUEXT_TLB_FLUSH_LOCAL;
 +	BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 +}
++EXPORT_SYMBOL(xen_tlb_flush);
 +
 +void xen_invlpg(unsigned long ptr)
 +{
@@ -16795,6 +16799,7 @@
 +	op.arg1.linear_addr = ptr & PAGE_MASK;
 +	BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 +}
++EXPORT_SYMBOL(xen_invlpg);
 +
 +#ifdef CONFIG_SMP
 +
@@ -16915,6 +16920,10 @@
 +	}
 +}
 +
++/* Protected by balloon_lock. */
++#define MAX_CONTIG_ORDER 9 /* 2MB */
++static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];
++
 +/* Ensure multi-page extents are contiguous in machine memory. */
 +int xen_create_contiguous_region(
 +	unsigned long vstart, unsigned int order, unsigned int address_bits)
@@ -16923,12 +16932,22 @@
 +	pud_t         *pud; 
 +	pmd_t         *pmd;
 +	pte_t         *pte;
++	unsigned long *in_frames = discontig_frames, out_frame;
 +	unsigned long  frame, i, flags;
-+	struct xen_memory_reservation reservation = {
-+		.extent_start = &frame,
-+		.nr_extents   = 1,
-+		.extent_order = 0,
-+		.domid        = DOMID_SELF
++	long           rc;
++	int            success;
++	struct xen_memory_exchange exchange = {
++		.in = {
++			.nr_extents   = 1UL << order,
++			.extent_order = 0,
++			.domid        = DOMID_SELF
++		},
++		.out = {
++			.nr_extents   = 1,
++			.extent_order = order,
++			.address_bits = address_bits,
++			.domid        = DOMID_SELF
++		}
 +	};
 +
 +	/*
@@ -16939,68 +16958,73 @@
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
 +		return 0;
 +
++	if (order > MAX_CONTIG_ORDER)
++		return -ENOMEM;
++
++	exchange.in.extent_start  = in_frames;
++	exchange.out.extent_start = &out_frame;
++
 +	scrub_pages(vstart, 1 << order);
 +
 +	balloon_lock(flags);
 +
-+	/* 1. Zap current PTEs, giving away the underlying pages. */
-+	for (i = 0; i < (1<<order); i++) {
++	/* 1. Zap current PTEs, remembering MFNs. */
++	for (i = 0; i < (1UL<<order); i++) {
 +		pgd = pgd_offset_k(vstart + (i*PAGE_SIZE));
 +		pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
 +		pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
 +		pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
-+		frame = pte_mfn(*pte);
-+		BUG_ON(HYPERVISOR_update_va_mapping(
-+			vstart + (i*PAGE_SIZE), __pte_ma(0), 0));
++		in_frames[i] = pte_mfn(*pte);
++		if (HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE),
++						 __pte_ma(0), 0))
++			BUG();
 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i,
 +			INVALID_P2M_ENTRY);
-+		BUG_ON(HYPERVISOR_memory_op(
-+			XENMEM_decrease_reservation, &reservation) != 1);
 +	}
 +
 +	/* 2. Get a new contiguous memory extent. */
-+	reservation.extent_order = order;
-+	reservation.address_bits = address_bits;
-+	frame = __pa(vstart) >> PAGE_SHIFT;
-+	if (HYPERVISOR_memory_op(XENMEM_populate_physmap,
-+				 &reservation) != 1)
-+		goto fail;
-+
-+	/* 3. Map the new extent in place of old pages. */
-+	for (i = 0; i < (1<<order); i++) {
-+		BUG_ON(HYPERVISOR_update_va_mapping(
-+			vstart + (i*PAGE_SIZE),
-+			pfn_pte_ma(frame+i, PAGE_KERNEL), 0));
-+		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, frame+i);
++	out_frame = __pa(vstart) >> PAGE_SHIFT;
++	rc = HYPERVISOR_memory_op(XENMEM_exchange, &exchange);
++	success = (exchange.nr_exchanged == (1UL << order));
++	BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
++	BUG_ON(success && (rc != 0));
++	if (unlikely(rc == -ENOSYS)) {
++		/* Compatibility when XENMEM_exchange is unsupported. */
++		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
++					 &exchange.in) != (1UL << order))
++			BUG();
++		success = (HYPERVISOR_memory_op(XENMEM_populate_physmap,
++						&exchange.out) == 1);
++		if (!success) {
++			/* Couldn't get special memory: fall back to normal. */
++			for (i = 0; i < (1UL<<order); i++)
++				in_frames[i] = (__pa(vstart)>>PAGE_SHIFT) + i;
++			if (HYPERVISOR_memory_op(XENMEM_populate_physmap,
++						 &exchange.in) != (1UL<<order))
++				BUG();
++		}
 +	}
 +
-+	flush_tlb_all();
-+
-+	contiguous_bitmap_set(__pa(vstart) >> PAGE_SHIFT, 1UL << order);
-+
-+	balloon_unlock(flags);
-+
-+	return 0;
-+
-+ fail:
-+	reservation.extent_order = 0;
-+	reservation.address_bits = 0;
-+
-+	for (i = 0; i < (1<<order); i++) {
-+		frame = (__pa(vstart) >> PAGE_SHIFT) + i;
-+		BUG_ON(HYPERVISOR_memory_op(
-+			XENMEM_populate_physmap, &reservation) != 1);
-+		BUG_ON(HYPERVISOR_update_va_mapping(
-+			vstart + (i*PAGE_SIZE),
-+			pfn_pte_ma(frame, PAGE_KERNEL), 0));
++	/* 3. Map the new extent in place of old pages. */
++	for (i = 0; i < (1UL<<order); i++) {
++		frame = success ? (out_frame + i) : in_frames[i];
++		if (HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE),
++						 pfn_pte_ma(frame,
++							    PAGE_KERNEL),
++						 0))
++			BUG();
 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, frame);
 +	}
 +
 +	flush_tlb_all();
 +
++	if (success)
++		contiguous_bitmap_set(__pa(vstart) >> PAGE_SHIFT,
++				      1UL << order);
++
 +	balloon_unlock(flags);
 +
-+	return -ENOMEM;
++	return success ? 0 : -ENOMEM;
 +}
 +
 +void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
@@ -17009,46 +17033,79 @@
 +	pud_t         *pud; 
 +	pmd_t         *pmd;
 +	pte_t         *pte;
++	unsigned long *out_frames = discontig_frames, in_frame;
 +	unsigned long  frame, i, flags;
-+	struct xen_memory_reservation reservation = {
-+		.extent_start = &frame,
-+		.nr_extents   = 1,
-+		.extent_order = 0,
-+		.domid        = DOMID_SELF
++	long           rc;
++	int            success;
++	struct xen_memory_exchange exchange = {
++		.in = {
++			.nr_extents   = 1,
++			.extent_order = order,
++			.domid        = DOMID_SELF
++		},
++		.out = {
++			.nr_extents   = 1UL << order,
++			.extent_order = 0,
++			.domid        = DOMID_SELF
++		}
 +	};
 +
-+	if (xen_feature(XENFEAT_auto_translated_physmap))
++	if (xen_feature(XENFEAT_auto_translated_physmap) ||
++	    !test_bit(__pa(vstart) >> PAGE_SHIFT, contiguous_bitmap))
++		return;
++
++	if (order > MAX_CONTIG_ORDER)
 +		return;
 +
++	exchange.in.extent_start  = &in_frame;
++	exchange.out.extent_start = out_frames;
++
 +	scrub_pages(vstart, 1 << order);
 +
 +	balloon_lock(flags);
 +
 +	contiguous_bitmap_clear(__pa(vstart) >> PAGE_SHIFT, 1UL << order);
 +
-+	/* 1. Zap current PTEs, giving away the underlying pages. */
-+	for (i = 0; i < (1<<order); i++) {
-+		pgd = pgd_offset_k(vstart + (i*PAGE_SIZE));
-+		pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
-+		pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
-+		pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
-+		frame = pte_mfn(*pte);
-+		BUG_ON(HYPERVISOR_update_va_mapping(
-+			vstart + (i*PAGE_SIZE), __pte_ma(0), 0));
++	/* 1. Find start MFN of contiguous extent. */
++	pgd = pgd_offset_k(vstart);
++	pud = pud_offset(pgd, vstart);
++	pmd = pmd_offset(pud, vstart);
++	pte = pte_offset_kernel(pmd, vstart);
++	in_frame = pte_mfn(*pte);
++
++	/* 2. Zap current PTEs. */
++	for (i = 0; i < (1UL<<order); i++) {
++		if (HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE),
++						 __pte_ma(0), 0));
 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i,
 +			INVALID_P2M_ENTRY);
-+		BUG_ON(HYPERVISOR_memory_op(
-+			XENMEM_decrease_reservation, &reservation) != 1);
++		out_frames[i] = (__pa(vstart) >> PAGE_SHIFT) + i;
 +	}
 +
-+	/* 2. Map new pages in place of old pages. */
-+	for (i = 0; i < (1<<order); i++) {
-+		frame = (__pa(vstart) >> PAGE_SHIFT) + i;
-+		BUG_ON(HYPERVISOR_memory_op(
-+			XENMEM_populate_physmap, &reservation) != 1);
-+		BUG_ON(HYPERVISOR_update_va_mapping(
-+			vstart + (i*PAGE_SIZE),
-+			pfn_pte_ma(frame, PAGE_KERNEL), 0));
++	/* 3. Do the exchange for non-contiguous MFNs. */
++	rc = HYPERVISOR_memory_op(XENMEM_exchange, &exchange);
++	success = (exchange.nr_exchanged == 1);
++	BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
++	BUG_ON(success && (rc != 0));
++	if (rc == -ENOSYS) {
++		/* Compatibility when XENMEM_exchange is unsupported. */
++		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
++					 &exchange.in) != 1)
++			BUG();
++		if (HYPERVISOR_memory_op(XENMEM_populate_physmap,
++					 &exchange.out) != (1UL << order))
++			BUG();
++		success = 1;
++	}
++
++	/* 4. Map new pages in place of old pages. */
++	for (i = 0; i < (1UL<<order); i++) {
++		frame = success ? out_frames[i] : (in_frame + i);
++		if (HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE),
++						 pfn_pte_ma(frame,
++							    PAGE_KERNEL),
++						 0))
++			BUG();
 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, frame);
 +	}
 +
@@ -17066,20 +17123,10 @@
 +		mach_lp, (u64)entry_a | ((u64)entry_b<<32));
 +}
 +#endif
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/init-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/init-xen.c
---- pristine-linux-2.6.16.12/arch/i386/mm/init-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/mm/init-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,854 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/init-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/init-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/init-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/mm/init-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,850 @@
 +/*
 + *  linux/arch/i386/mm/init.c
 + *
@@ -17641,15 +17688,11 @@
 +
 +	kmap_init();
 +
-+	if (!xen_feature(XENFEAT_auto_translated_physmap) ||
-+	    xen_start_info->shared_info >= xen_start_info->nr_pages) {
-+		/* Switch to the real shared_info page, and clear the
-+		 * dummy page. */
-+		set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
-+		HYPERVISOR_shared_info =
-+			(shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
-+		memset(empty_zero_page, 0, sizeof(empty_zero_page));
-+	}
++	/* Switch to the real shared_info page, and clear the
++	 * dummy page. */
++	set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
++	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
++	memset(empty_zero_page, 0, sizeof(empty_zero_page));
 +
 +	/* Setup mapping of lower 1st MB */
 +	for (i = 0; i < NR_FIX_ISAMAPS; i++)
@@ -17850,7 +17893,7 @@
 +#endif
 +				0,
 +				pgd_ctor,
-+				pgd_dtor);
++				PTRS_PER_PMD == 1 ? pgd_dtor : NULL);
 +	if (!pgd_cache)
 +		panic("pgtable_cache_init(): Cannot create pgd cache");
 +}
@@ -17934,10 +17977,10 @@
 +	}
 +}
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/ioremap-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/ioremap-xen.c
---- pristine-linux-2.6.16.12/arch/i386/mm/ioremap-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/mm/ioremap-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,464 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/ioremap-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/ioremap-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/ioremap-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/mm/ioremap-xen.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,454 @@
 +/*
 + * arch/i386/mm/ioremap.c
 + *
@@ -18392,18 +18435,8 @@
 +}
 +
 +#endif /* __i386__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/Makefile tmp-linux-2.6-xen.patch/arch/i386/mm/Makefile
---- pristine-linux-2.6.16.12/arch/i386/mm/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/Makefile tmp-linux-2.6-xen.patch/arch/i386/mm/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/mm/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/mm/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -8,3 +8,11 @@ obj-$(CONFIG_NUMA) += discontig.o
  obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
@@ -18417,8 +18450,20 @@
 +
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/pgtable.c tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable.c
---- pristine-linux-2.6.16.12/arch/i386/mm/pgtable.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/pageattr.c tmp-linux-2.6-xen.patch/arch/i386/mm/pageattr.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/pageattr.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/i386/mm/pageattr.c	2006-08-15 19:47:06.000000000 +0200
+@@ -78,7 +78,7 @@ static void set_pmd_pte(pte_t *kpte, uns
+ 	unsigned long flags;
+ 
+ 	set_pte_atomic(kpte, pte); 	/* change init_mm */
+-	if (PTRS_PER_PMD > 1)
++	if (HAVE_SHARED_KERNEL_PMD)
+ 		return;
+ 
+ 	spin_lock_irqsave(&pgd_lock, flags);
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/pgtable.c tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/pgtable.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable.c	2006-04-05 22:43:19.000000000 +0200
 @@ -13,6 +13,7 @@
  #include <linux/slab.h>
@@ -18453,10 +18498,10 @@
  }
  
  pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/mm/pgtable-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable-xen.c
---- pristine-linux-2.6.16.12/arch/i386/mm/pgtable-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable-xen.c	2006-04-25 11:20:48.000000000 +0200
-@@ -0,0 +1,652 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/mm/pgtable-xen.c tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/mm/pgtable-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/i386/mm/pgtable-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,694 @@
 +/*
 + *  linux/arch/i386/mm/pgtable.c
 + */
@@ -18759,11 +18804,6 @@
 +	unsigned long flags;
 +
 +	if (PTRS_PER_PMD > 1) {
-+		if (!xen_feature(XENFEAT_pae_pgdir_above_4gb)) {
-+			int rc = xen_create_contiguous_region(
-+				(unsigned long)pgd, 0, 32);
-+			BUG_ON(rc);
-+		}
 +		if (HAVE_SHARED_KERNEL_PMD)
 +			clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
 +					swapper_pg_dir + USER_PTRS_PER_PGD,
@@ -18779,69 +18819,105 @@
 +	}
 +}
 +
++/* never called when PTRS_PER_PMD > 1 */
 +void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
 +{
 +	unsigned long flags; /* can be called from interrupt context */
 +
-+	if (PTRS_PER_PMD > 1) {
-+		if (!xen_feature(XENFEAT_pae_pgdir_above_4gb))
-+			xen_destroy_contiguous_region((unsigned long)pgd, 0);
-+	} else {
-+		spin_lock_irqsave(&pgd_lock, flags);
-+		pgd_list_del(pgd);
-+		spin_unlock_irqrestore(&pgd_lock, flags);
++	spin_lock_irqsave(&pgd_lock, flags);
++	pgd_list_del(pgd);
++	spin_unlock_irqrestore(&pgd_lock, flags);
 +
-+		pgd_test_and_unpin(pgd);
-+	}
++	pgd_test_and_unpin(pgd);
 +}
 +
 +pgd_t *pgd_alloc(struct mm_struct *mm)
 +{
 +	int i;
 +	pgd_t *pgd = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
++	pmd_t **pmd;
++	unsigned long flags;
 +
 +	pgd_test_and_unpin(pgd);
 +
 +	if (PTRS_PER_PMD == 1 || !pgd)
 +		return pgd;
 +
-+	for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
-+		pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
-+		if (!pmd)
-+			goto out_oom;
-+		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
-+	}
-+
-+	if (!HAVE_SHARED_KERNEL_PMD) {
-+		unsigned long flags;
-+
-+		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
++	if (HAVE_SHARED_KERNEL_PMD) {
++		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
 +			pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
 +			if (!pmd)
 +				goto out_oom;
 +			set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
 +		}
++		return pgd;
++	}
 +
-+		spin_lock_irqsave(&pgd_lock, flags);
-+		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
-+			unsigned long v = (unsigned long)i << PGDIR_SHIFT;
-+			pgd_t *kpgd = pgd_offset_k(v);
-+			pud_t *kpud = pud_offset(kpgd, v);
-+			pmd_t *kpmd = pmd_offset(kpud, v);
-+			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
-+			memcpy(pmd, kpmd, PAGE_SIZE);
-+			make_lowmem_page_readonly(
-+				pmd, XENFEAT_writable_page_tables);
++	/*
++	 * We can race save/restore (if we sleep during a GFP_KERNEL memory
++	 * allocation). We therefore store virtual addresses of pmds as they
++	 * do not change across save/restore, and poke the machine addresses
++	 * into the pgdir under the pgd_lock.
++	 */
++	pmd = kmalloc(PTRS_PER_PGD * sizeof(pmd_t *), GFP_KERNEL);
++	if (!pmd) {
++		kmem_cache_free(pgd_cache, pgd);
++		return NULL;
++	}
++
++	/* Allocate pmds, remember virtual addresses. */
++	for (i = 0; i < PTRS_PER_PGD; ++i) {
++		pmd[i] = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
++		if (!pmd[i])
++			goto out_oom;
++	}
++
++	spin_lock_irqsave(&pgd_lock, flags);
++
++	/* Protect against save/restore: move below 4GB under pgd_lock. */
++	if (!xen_feature(XENFEAT_pae_pgdir_above_4gb)) {
++		int rc = xen_create_contiguous_region(
++			(unsigned long)pgd, 0, 32);
++		if (rc) {
++			spin_unlock_irqrestore(&pgd_lock, flags);
++			goto out_oom;
 +		}
-+		pgd_list_add(pgd);
-+		spin_unlock_irqrestore(&pgd_lock, flags);
 +	}
 +
++	/* Copy kernel pmd contents and write-protect the new pmds. */
++	for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
++		unsigned long v = (unsigned long)i << PGDIR_SHIFT;
++		pgd_t *kpgd = pgd_offset_k(v);
++		pud_t *kpud = pud_offset(kpgd, v);
++		pmd_t *kpmd = pmd_offset(kpud, v);
++		memcpy(pmd[i], kpmd, PAGE_SIZE);
++		make_lowmem_page_readonly(
++			pmd[i], XENFEAT_writable_page_tables);
++	}
++
++	/* It is safe to poke machine addresses of pmds under the pmd_lock. */
++	for (i = 0; i < PTRS_PER_PGD; i++)
++		set_pgd(&pgd[i], __pgd(1 + __pa(pmd[i])));
++
++	/* Ensure this pgd gets picked up and pinned on save/restore. */
++	pgd_list_add(pgd);
++
++	spin_unlock_irqrestore(&pgd_lock, flags);
++
++	kfree(pmd);
++
 +	return pgd;
 +
 +out_oom:
-+	for (i--; i >= 0; i--)
-+		kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
++	if (HAVE_SHARED_KERNEL_PMD) {
++		for (i--; i >= 0; i--)
++			kmem_cache_free(pmd_cache,
++					(void *)__va(pgd_val(pgd[i])-1));
++	} else {
++		for (i--; i >= 0; i--)
++			kmem_cache_free(pmd_cache, pmd[i]);
++		kfree(pmd);
++	}
 +	kmem_cache_free(pgd_cache, pgd);
 +	return NULL;
 +}
@@ -18850,6 +18926,14 @@
 +{
 +	int i;
 +
++	/*
++	 * After this the pgd should not be pinned for the duration of this
++	 * function's execution. We should never sleep and thus never race:
++	 *  1. User pmds will not become write-protected under our feet due
++	 *     to a concurrent mm_pin_all().
++	 *  2. The machine addresses in PGD entries will not become invalid
++	 *     due to a concurrent save/restore.
++	 */
 +	pgd_test_and_unpin(pgd);
 +
 +	/* in the PAE case user pgd entries are overwritten before usage */
@@ -18858,11 +18942,13 @@
 +			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
 +			kmem_cache_free(pmd_cache, pmd);
 +		}
++
 +		if (!HAVE_SHARED_KERNEL_PMD) {
 +			unsigned long flags;
 +			spin_lock_irqsave(&pgd_lock, flags);
 +			pgd_list_del(pgd);
 +			spin_unlock_irqrestore(&pgd_lock, flags);
++
 +			for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
 +				pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
 +				make_lowmem_page_writable(
@@ -18870,8 +18956,13 @@
 +				memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
 +				kmem_cache_free(pmd_cache, pmd);
 +			}
++
++			if (!xen_feature(XENFEAT_pae_pgdir_above_4gb))
++				xen_destroy_contiguous_region(
++					(unsigned long)pgd, 0);
 +		}
 +	}
++
 +	/* in the non-PAE case, free_pgtables() clears user pgd entries */
 +	kmem_cache_free(pgd_cache, pgd);
 +}
@@ -19047,7 +19138,7 @@
 +void mm_pin(struct mm_struct *mm)
 +{
 +	if (xen_feature(XENFEAT_writable_page_tables))
-+	    return;
++		return;
 +	spin_lock(&mm->page_table_lock);
 +	__pgd_pin(mm->pgd);
 +	spin_unlock(&mm->page_table_lock);
@@ -19056,7 +19147,7 @@
 +void mm_unpin(struct mm_struct *mm)
 +{
 +	if (xen_feature(XENFEAT_writable_page_tables))
-+	    return;
++		return;
 +	spin_lock(&mm->page_table_lock);
 +	__pgd_unpin(mm->pgd);
 +	spin_unlock(&mm->page_table_lock);
@@ -19066,13 +19157,19 @@
 +{
 +	struct page *page;
 +	if (xen_feature(XENFEAT_writable_page_tables))
-+	    return;
++		return;
 +	for (page = pgd_list; page; page = (struct page *)page->index) {
 +		if (!test_bit(PG_pinned, &page->flags))
 +			__pgd_pin((pgd_t *)page_address(page));
 +	}
 +}
 +
++void _arch_dup_mmap(struct mm_struct *mm)
++{
++	if (!test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags))
++		mm_pin(mm);
++}
++
 +void _arch_exit_mmap(struct mm_struct *mm)
 +{
 +	struct task_struct *tsk = current;
@@ -19099,18 +19196,8 @@
 +	    (atomic_read(&mm->mm_count) == 1))
 +		mm_unpin(mm);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/pci/irq-xen.c tmp-linux-2.6-xen.patch/arch/i386/pci/irq-xen.c
---- pristine-linux-2.6.16.12/arch/i386/pci/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/pci/irq-xen.c tmp-linux-2.6-xen.patch/arch/i386/pci/irq-xen.c
+--- pristine-linux-2.6.16.13/arch/i386/pci/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/pci/irq-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1202 @@
 +/*
@@ -20315,8 +20402,8 @@
 +
 +	return count;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/pci/Makefile tmp-linux-2.6-xen.patch/arch/i386/pci/Makefile
---- pristine-linux-2.6.16.12/arch/i386/pci/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/pci/Makefile tmp-linux-2.6-xen.patch/arch/i386/pci/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/pci/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/pci/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -4,6 +4,10 @@ obj-$(CONFIG_PCI_BIOS)		+= pcbios.o
  obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig.o direct.o
@@ -20338,8 +20425,8 @@
 +include $(srctree)/scripts/Makefile.xen
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/pci/pcifront.c tmp-linux-2.6-xen.patch/arch/i386/pci/pcifront.c
---- pristine-linux-2.6.16.12/arch/i386/pci/pcifront.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/pci/pcifront.c tmp-linux-2.6-xen.patch/arch/i386/pci/pcifront.c
+--- pristine-linux-2.6.16.13/arch/i386/pci/pcifront.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/i386/pci/pcifront.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,55 @@
 +/*
@@ -20397,8 +20484,8 @@
 +}
 +
 +arch_initcall(pcifront_x86_stub_init);
-diff -Nurp pristine-linux-2.6.16.12/arch/i386/power/Makefile tmp-linux-2.6-xen.patch/arch/i386/power/Makefile
---- pristine-linux-2.6.16.12/arch/i386/power/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/i386/power/Makefile tmp-linux-2.6-xen.patch/arch/i386/power/Makefile
+--- pristine-linux-2.6.16.13/arch/i386/power/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/i386/power/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -1,2 +1,4 @@
 -obj-$(CONFIG_PM)		+= cpu.o
@@ -20406,8 +20493,8 @@
 +obj-$(CONFIG_SOFTWARE_SUSPEND)	+= cpu.o
 +obj-$(CONFIG_ACPI_SLEEP)	+= cpu.o
  obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/hp/sim/Makefile tmp-linux-2.6-xen.patch/arch/ia64/hp/sim/Makefile
---- pristine-linux-2.6.16.12/arch/ia64/hp/sim/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/hp/sim/Makefile tmp-linux-2.6-xen.patch/arch/ia64/hp/sim/Makefile
+--- pristine-linux-2.6.16.13/arch/ia64/hp/sim/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/hp/sim/Makefile	2006-01-05 19:06:50.000000000 +0100
 @@ -14,3 +14,5 @@ obj-$(CONFIG_HP_SIMETH)	+= simeth.o
  obj-$(CONFIG_HP_SIMSERIAL) += simserial.o
@@ -20415,9 +20502,9 @@
  obj-$(CONFIG_HP_SIMSCSI) += simscsi.o
 +obj-$(CONFIG_XEN) += simserial.o
 +obj-$(CONFIG_XEN) += hpsim_console.o
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/Kconfig tmp-linux-2.6-xen.patch/arch/ia64/Kconfig
---- pristine-linux-2.6.16.12/arch/ia64/Kconfig	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/arch/ia64/Kconfig	2006-04-11 21:49:57.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/Kconfig tmp-linux-2.6-xen.patch/arch/ia64/Kconfig
+--- pristine-linux-2.6.16.13/arch/ia64/Kconfig	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/ia64/Kconfig	2006-08-15 18:04:18.000000000 +0200
 @@ -50,6 +50,57 @@ config GENERIC_IOMAP
  	bool
  	default y
@@ -20476,8 +20563,8 @@
  config SCHED_NO_NO_OMIT_FRAME_POINTER
  	bool
  	default y
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/kernel/entry.S tmp-linux-2.6-xen.patch/arch/ia64/kernel/entry.S
---- pristine-linux-2.6.16.12/arch/ia64/kernel/entry.S	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/kernel/entry.S tmp-linux-2.6-xen.patch/arch/ia64/kernel/entry.S
+--- pristine-linux-2.6.16.13/arch/ia64/kernel/entry.S	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/kernel/entry.S	2006-04-05 22:43:19.000000000 +0200
 @@ -181,7 +181,7 @@ END(sys_clone)
   *	called.  The code starting at .map relies on this.  The rest of the code
@@ -20598,8 +20685,8 @@
  	;;
  	mov ar.unat=r9
  	br.many b7
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/kernel/head.S tmp-linux-2.6-xen.patch/arch/ia64/kernel/head.S
---- pristine-linux-2.6.16.12/arch/ia64/kernel/head.S	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/kernel/head.S tmp-linux-2.6-xen.patch/arch/ia64/kernel/head.S
+--- pristine-linux-2.6.16.13/arch/ia64/kernel/head.S	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/kernel/head.S	2006-04-05 22:43:19.000000000 +0200
 @@ -363,6 +363,12 @@ start_ap:
  	;;
@@ -20614,8 +20701,8 @@
  #ifdef CONFIG_SMP
  (isAP)	br.call.sptk.many rp=start_secondary
  .ret0:
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/kernel/pal.S tmp-linux-2.6-xen.patch/arch/ia64/kernel/pal.S
---- pristine-linux-2.6.16.12/arch/ia64/kernel/pal.S	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/kernel/pal.S tmp-linux-2.6-xen.patch/arch/ia64/kernel/pal.S
+--- pristine-linux-2.6.16.13/arch/ia64/kernel/pal.S	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/kernel/pal.S	2006-01-05 19:06:50.000000000 +0100
 @@ -16,6 +16,7 @@
  #include <asm/processor.h>
@@ -20643,8 +20730,8 @@
  
  /*
   * Make a PAL call using the stacked registers calling convention.
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/kernel/sal.c tmp-linux-2.6-xen.patch/arch/ia64/kernel/sal.c
---- pristine-linux-2.6.16.12/arch/ia64/kernel/sal.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/kernel/sal.c tmp-linux-2.6-xen.patch/arch/ia64/kernel/sal.c
+--- pristine-linux-2.6.16.13/arch/ia64/kernel/sal.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/kernel/sal.c	2006-04-05 22:43:19.000000000 +0200
 @@ -336,6 +336,9 @@ ia64_sal_init (struct ia64_sal_systab *s
  		p += SAL_DESC_SIZE(*p);
@@ -20656,8 +20743,8 @@
  	check_sal_cache_flush();
  }
  
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/kernel/setup.c tmp-linux-2.6-xen.patch/arch/ia64/kernel/setup.c
---- pristine-linux-2.6.16.12/arch/ia64/kernel/setup.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/kernel/setup.c tmp-linux-2.6-xen.patch/arch/ia64/kernel/setup.c
+--- pristine-linux-2.6.16.13/arch/ia64/kernel/setup.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/kernel/setup.c	2006-04-05 22:43:19.000000000 +0200
 @@ -61,6 +61,9 @@
  #include <asm/system.h>
@@ -20726,8 +20813,8 @@
  #endif
  
  	/* enable IA-64 Machine Check Abort Handling unless disabled */
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/Makefile tmp-linux-2.6-xen.patch/arch/ia64/Makefile
---- pristine-linux-2.6.16.12/arch/ia64/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/Makefile tmp-linux-2.6-xen.patch/arch/ia64/Makefile
+--- pristine-linux-2.6.16.13/arch/ia64/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/ia64/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -42,6 +42,12 @@ ifeq ($(call cc-version),0304)
  endif
@@ -20776,8 +20863,8 @@
  	sh $(srctree)/arch/ia64/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
  
  define archhelp
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/coreMakefile tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/coreMakefile
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/coreMakefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/coreMakefile tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/coreMakefile
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/coreMakefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/coreMakefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,26 @@
 +#
@@ -20806,8 +20893,8 @@
 +endif
 +obj-$(CONFIG_SYSFS)   += hypervisor_sysfs.o
 +obj-$(CONFIG_XEN_SYSFS) += xen_sysfs.o
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/evtchn_ia64.c tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/evtchn_ia64.c
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/evtchn_ia64.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/evtchn_ia64.c tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/evtchn_ia64.c
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/evtchn_ia64.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/evtchn_ia64.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,273 @@
 +/* NOTE: This file split off from evtchn.c because there was
@@ -21083,8 +21170,8 @@
 +    spin_lock_init(&irq_mapping_update_lock);
 +    memset(evtchns, 0, sizeof(evtchns));
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/Makefile tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/Makefile
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/Makefile tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/Makefile
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/Makefile	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,20 @@
 +
@@ -21107,8 +21194,8 @@
 +#obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
 +#obj-$(CONFIG_XEN_BLKDEV_TAP)    	+= blktap/
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/blkback.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/blkback.c.patch
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/blkback.c.patch	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/blkback.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/blkback.c.patch
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/blkback.c.patch	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/blkback.c.patch	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,57 @@
 +diff -Naur xen/blkback/blkback.c xen.patched/blkback/blkback.c
@@ -21168,8 +21255,8 @@
 + 
 + 	pending_cons = 0;
 + 	pending_prod = MAX_PENDING_REQS;
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/console.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/console.c.patch
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/console.c.patch	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/console.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/console.c.patch
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/console.c.patch	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/console.c.patch	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,18 @@
 +--- xen/console/console.c	2005-11-02 14:13:07.000000000 +0100
@@ -21190,15 +21277,15 @@
 + 	} else {
 + 		xencons_ring_register_receiver(xencons_rx);
 + 	}
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/devmem.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/devmem.c.patch
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/devmem.c.patch	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/devmem.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/devmem.c.patch
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/devmem.c.patch	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/devmem.c.patch	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,3 @@
 +diff -Naur xen/core/devmem.c xen.patched/core/devmem.c
 +--- xen/core/devmem.c	2005-09-23 10:54:50.000000000 -0600
 ++++ xen.patched/core/devmem.c	2005-09-23 10:57:51.000000000 -0600
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/gnttab.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/gnttab.c.patch
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/gnttab.c.patch	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/gnttab.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/gnttab.c.patch
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/gnttab.c.patch	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/gnttab.c.patch	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,46 @@
 +diff -Naur xen/core/gnttab.c xen.patched/core/gnttab.c
@@ -21247,8 +21334,8 @@
 + 
 + 	for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++)
 + 		gnttab_list[i] = i + 1;
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/privcmd.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/privcmd.c.patch
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/patches/privcmd.c.patch	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/privcmd.c.patch tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/privcmd.c.patch
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/patches/privcmd.c.patch	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/patches/privcmd.c.patch	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,43 @@
 +diff -Naur xen/privcmd/privcmd.c xen.patched/privcmd/privcmd.c
@@ -21294,14 +21381,14 @@
 + 
 + 	default:
 + 		ret = -EINVAL;
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/README tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/README
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/README	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/README tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/README
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/README	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/README	2006-01-05 19:06:50.000000000 +0100
 @@ -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 -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/drivers/xenia64_init.c tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/xenia64_init.c
---- pristine-linux-2.6.16.12/arch/ia64/xen/drivers/xenia64_init.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/drivers/xenia64_init.c tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/xenia64_init.c
+--- pristine-linux-2.6.16.13/arch/ia64/xen/drivers/xenia64_init.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/drivers/xenia64_init.c	2006-02-11 01:01:00.000000000 +0100
 @@ -0,0 +1,55 @@
 +#ifdef __ia64__
@@ -21359,8 +21446,8 @@
 +unsigned long mfn_to_pfn(unsigned long mfn) { return mfn; }
 +#endif
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/hypercall.S tmp-linux-2.6-xen.patch/arch/ia64/xen/hypercall.S
---- pristine-linux-2.6.16.12/arch/ia64/xen/hypercall.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/hypercall.S tmp-linux-2.6-xen.patch/arch/ia64/xen/hypercall.S
+--- pristine-linux-2.6.16.13/arch/ia64/xen/hypercall.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/hypercall.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,365 @@
 +/*
@@ -21728,8 +21815,8 @@
 +	br.ret.sptk.many rp
 +END(xen_set_eflag)
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/Makefile tmp-linux-2.6-xen.patch/arch/ia64/xen/Makefile
---- pristine-linux-2.6.16.12/arch/ia64/xen/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/Makefile tmp-linux-2.6-xen.patch/arch/ia64/xen/Makefile
+--- pristine-linux-2.6.16.13/arch/ia64/xen/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/Makefile	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,5 @@
 +#
@@ -21737,8 +21824,8 @@
 +#
 +
 +obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o xenconsole.o xen_ksyms.o
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xenconsole.c tmp-linux-2.6-xen.patch/arch/ia64/xen/xenconsole.c
---- pristine-linux-2.6.16.12/arch/ia64/xen/xenconsole.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xenconsole.c tmp-linux-2.6-xen.patch/arch/ia64/xen/xenconsole.c
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xenconsole.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xenconsole.c	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,19 @@
 +#include <linux/config.h>
@@ -21760,8 +21847,8 @@
 +#endif
 +	return -1;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xenentry.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xenentry.S
---- pristine-linux-2.6.16.12/arch/ia64/xen/xenentry.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xenentry.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xenentry.S
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xenentry.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xenentry.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,850 @@
 +/*
@@ -22614,8 +22701,8 @@
 +#else
 +END(ia64_leave_kernel)
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xenhpski.c tmp-linux-2.6-xen.patch/arch/ia64/xen/xenhpski.c
---- pristine-linux-2.6.16.12/arch/ia64/xen/xenhpski.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xenhpski.c tmp-linux-2.6-xen.patch/arch/ia64/xen/xenhpski.c
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xenhpski.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xenhpski.c	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,19 @@
 +
@@ -22637,8 +22724,8 @@
 +	return 1;
 +}
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xenivt.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xenivt.S
---- pristine-linux-2.6.16.12/arch/ia64/xen/xenivt.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xenivt.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xenivt.S
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xenivt.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xenivt.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,2032 @@
 +/*
@@ -24673,8 +24760,8 @@
 +END(dispatch_to_ia32_handler)
 +
 +#endif /* CONFIG_IA32_SUPPORT */
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xen_ksyms.c tmp-linux-2.6-xen.patch/arch/ia64/xen/xen_ksyms.c
---- pristine-linux-2.6.16.12/arch/ia64/xen/xen_ksyms.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xen_ksyms.c tmp-linux-2.6-xen.patch/arch/ia64/xen/xen_ksyms.c
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xen_ksyms.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xen_ksyms.c	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,12 @@
 +/*
@@ -24689,8 +24776,8 @@
 +
 +extern int is_running_on_xen(void);
 +EXPORT_SYMBOL(is_running_on_xen);
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xenminstate.h tmp-linux-2.6-xen.patch/arch/ia64/xen/xenminstate.h
---- pristine-linux-2.6.16.12/arch/ia64/xen/xenminstate.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xenminstate.h tmp-linux-2.6-xen.patch/arch/ia64/xen/xenminstate.h
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xenminstate.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xenminstate.h	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,367 @@
 +#include <linux/config.h>
@@ -25060,8 +25147,8 @@
 +#else
 +#define SAVE_MIN		DO_SAVE_MIN(     , mov r30=r0, )
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xenpal.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xenpal.S
---- pristine-linux-2.6.16.12/arch/ia64/xen/xenpal.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xenpal.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xenpal.S
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xenpal.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xenpal.S	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,73 @@
 +/*
@@ -25137,8 +25224,8 @@
 +	srlz.d				// seralize restoration of psr.l
 +	br.ret.sptk.many b0
 +END(xen_pal_call_static)
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen/xensetup.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xensetup.S
---- pristine-linux-2.6.16.12/arch/ia64/xen/xensetup.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen/xensetup.S tmp-linux-2.6-xen.patch/arch/ia64/xen/xensetup.S
+--- pristine-linux-2.6.16.13/arch/ia64/xen/xensetup.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen/xensetup.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,35 @@
 +/*
@@ -25176,14 +25263,14 @@
 +	ld4 r8=[r9]
 +	br.ret.sptk.many rp;;
 +END(is_running_on_xen)
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen-mkbuildtree-post tmp-linux-2.6-xen.patch/arch/ia64/xen-mkbuildtree-post
---- pristine-linux-2.6.16.12/arch/ia64/xen-mkbuildtree-post	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen-mkbuildtree-post tmp-linux-2.6-xen.patch/arch/ia64/xen-mkbuildtree-post
+--- pristine-linux-2.6.16.13/arch/ia64/xen-mkbuildtree-post	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen-mkbuildtree-post	2006-01-05 19:06:50.000000000 +0100
 @@ -0,0 +1,2 @@
 +#!/bin/bash
 +echo 'NOTHING YET IN ' ${0}
-diff -Nurp pristine-linux-2.6.16.12/arch/ia64/xen-mkbuildtree-pre tmp-linux-2.6-xen.patch/arch/ia64/xen-mkbuildtree-pre
---- pristine-linux-2.6.16.12/arch/ia64/xen-mkbuildtree-pre	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/ia64/xen-mkbuildtree-pre tmp-linux-2.6-xen.patch/arch/ia64/xen-mkbuildtree-pre
+--- pristine-linux-2.6.16.13/arch/ia64/xen-mkbuildtree-pre	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/ia64/xen-mkbuildtree-pre	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,50 @@
 +#!/bin/bash
@@ -25236,8 +25323,8 @@
 +#fi
 +#touch ia64.patch.semaphore
 +#cd ../..
-diff -Nurp pristine-linux-2.6.16.12/arch/um/kernel/physmem.c tmp-linux-2.6-xen.patch/arch/um/kernel/physmem.c
---- pristine-linux-2.6.16.12/arch/um/kernel/physmem.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/um/kernel/physmem.c tmp-linux-2.6-xen.patch/arch/um/kernel/physmem.c
+--- pristine-linux-2.6.16.13/arch/um/kernel/physmem.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/um/kernel/physmem.c	2006-04-05 22:43:19.000000000 +0200
 @@ -225,7 +225,7 @@ EXPORT_SYMBOL(physmem_forget_descriptor)
  EXPORT_SYMBOL(physmem_remove_mapping);
@@ -25257,8 +25344,8 @@
  }
  
  int is_remapped(void *virt)
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/ia32/ia32entry-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/ia32entry-xen.S
---- pristine-linux-2.6.16.12/arch/x86_64/ia32/ia32entry-xen.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/ia32/ia32entry-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/ia32entry-xen.S
+--- pristine-linux-2.6.16.13/arch/x86_64/ia32/ia32entry-xen.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/ia32entry-xen.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,721 @@
 +/*
@@ -25982,9 +26069,9 @@
 +	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
 +		.quad ni_syscall
 +	.endr
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/ia32/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/ia32/Makefile
---- pristine-linux-2.6.16.12/arch/x86_64/ia32/Makefile	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/Makefile	2006-04-05 22:43:19.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/ia32/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/ia32/Makefile
+--- pristine-linux-2.6.16.13/arch/x86_64/ia32/Makefile	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/Makefile	2006-08-15 18:04:18.000000000 +0200
 @@ -23,9 +23,25 @@ quiet_cmd_syscall = SYSCALL $@
  			   -Wl,-soname=linux-gate.so.1 -o $@ \
  			   -Wl,-T,$(filter-out FORCE,$^)
@@ -25996,11 +26083,11 @@
  
 -AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32
 -AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32
-+AFLAGS_vsyscall-sysenter.o = -m32 -Iarch/i386/kernel
-+AFLAGS_vsyscall-syscall.o = -m32 -Iarch/i386/kernel
++AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32 -Iarch/i386/kernel
++AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32 -Iarch/i386/kernel
 +
 +ifdef CONFIG_XEN
-+AFLAGS_vsyscall-int80.o = -m32 -Iarch/i386/kernel
++AFLAGS_vsyscall-int80.o = -m32 -Wa,-32 -Iarch/i386/kernel
 +CFLAGS_syscall32-xen.o += -DUSE_INT80
 +AFLAGS_syscall32_syscall-xen.o += -DUSE_INT80
 +
@@ -26013,8 +26100,8 @@
 +
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/ia32/syscall32_syscall-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/syscall32_syscall-xen.S
---- pristine-linux-2.6.16.12/arch/x86_64/ia32/syscall32_syscall-xen.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/ia32/syscall32_syscall-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/syscall32_syscall-xen.S
+--- pristine-linux-2.6.16.13/arch/x86_64/ia32/syscall32_syscall-xen.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/syscall32_syscall-xen.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,28 @@
 +/* 32bit VDSOs mapped into user space. */
@@ -26045,8 +26132,8 @@
 +syscall32_sysenter:
 +	.incbin "arch/x86_64/ia32/vsyscall-sysenter.so"
 +syscall32_sysenter_end:
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/ia32/syscall32-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/ia32/syscall32-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/ia32/syscall32-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/ia32/syscall32-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/ia32/syscall32-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/ia32/syscall32-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/syscall32-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,128 @@
 +/* Copyright 2002,2003 Andi Kleen, SuSE Labs */
@@ -26177,8 +26264,8 @@
 +	wrmsrl(MSR_CSTAR, ia32_cstar_target);
 +#endif
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/ia32/vsyscall-int80.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/vsyscall-int80.S
---- pristine-linux-2.6.16.12/arch/x86_64/ia32/vsyscall-int80.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/ia32/vsyscall-int80.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/vsyscall-int80.S
+--- pristine-linux-2.6.16.13/arch/x86_64/ia32/vsyscall-int80.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/vsyscall-int80.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,58 @@
 +/*
@@ -26239,8 +26326,8 @@
 + */
 +#define SYSCALL_ENTER_KERNEL    int $0x80
 +#include "vsyscall-sigreturn.S"
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/ia32/vsyscall-sigreturn.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/vsyscall-sigreturn.S
---- pristine-linux-2.6.16.12/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/ia32/vsyscall-sigreturn.S tmp-linux-2.6-xen.patch/arch/x86_64/ia32/vsyscall-sigreturn.S
+--- pristine-linux-2.6.16.13/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-04-05 22:43:19.000000000 +0200
 @@ -120,5 +120,5 @@ __kernel_rt_sigreturn:
  	.align 4
@@ -26249,9 +26336,9 @@
 -#include "../../i386/kernel/vsyscall-note.S"
 +#include <vsyscall-note.S>
  
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/Kconfig tmp-linux-2.6-xen.patch/arch/x86_64/Kconfig
---- pristine-linux-2.6.16.12/arch/x86_64/Kconfig	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/Kconfig	2006-04-18 16:21:25.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/Kconfig tmp-linux-2.6-xen.patch/arch/x86_64/Kconfig
+--- pristine-linux-2.6.16.13/arch/x86_64/Kconfig	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/x86_64/Kconfig	2006-08-15 18:04:18.000000000 +0200
 @@ -119,6 +119,22 @@ config GENERIC_CPU
  
  endchoice
@@ -26416,16 +26503,16 @@
 +source "drivers/xen/Kconfig"
 +
  source "lib/Kconfig"
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/acpi/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/kernel/acpi/Makefile
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/acpi/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/acpi/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/kernel/acpi/Makefile
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/acpi/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/acpi/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -6,3 +6,4 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),)
  obj-y			+= processor.o
  endif
  
 +boot-$(CONFIG_XEN)		:= ../../../i386/kernel/acpi/boot-xen.o
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/apic-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/apic-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/apic-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/apic-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/apic-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/apic-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/apic-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,198 @@
 +/*
@@ -26626,8 +26713,8 @@
 +
 +	return 0;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/asm-offsets.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/asm-offsets.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/asm-offsets.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/asm-offsets.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/asm-offsets.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/asm-offsets.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/asm-offsets.c	2006-04-05 22:43:19.000000000 +0200
 @@ -66,7 +66,9 @@ int main(void)
  	DEFINE(pbe_address, offsetof(struct pbe, address));
@@ -26639,8 +26726,8 @@
 +#endif
  	return 0;
  }
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/e820-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/e820-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/e820-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/e820-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/e820-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/e820-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/e820-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,744 @@
 +/* 
@@ -27387,8 +27474,8 @@
 +		pci_mem_start, gapstart, gapsize);
 +#endif
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/early_printk-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/early_printk-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/early_printk-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/early_printk-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/early_printk-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/early_printk-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/early_printk-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,306 @@
 +#include <linux/config.h>
@@ -27697,10 +27784,22 @@
 +} 
 +
 +__setup("earlyprintk=", setup_early_printk);
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/entry-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/entry-xen.S
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/entry-xen.S	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/entry-xen.S	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,1149 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/entry.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/entry.S
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/entry.S	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/entry.S	2006-08-15 19:47:06.000000000 +0200
+@@ -601,7 +601,7 @@ retint_kernel:	
+  */		
+ 	.macro apicinterrupt num,func
+ 	INTR_FRAME
+-	pushq $\num-256
++	pushq $~(\num)
+ 	CFI_ADJUST_CFA_OFFSET 8
+ 	interrupt \func
+ 	jmp ret_from_intr
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/entry-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/entry-xen.S
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/entry-xen.S	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/entry-xen.S	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,1141 @@
 +/*
 + *  linux/arch/x86_64/entry.S
 + *
@@ -27924,6 +28023,10 @@
 + *
 + * XXX	if we had a free scratch register we could save the RSP into the stack frame
 + *      and report it properly in ps. Unfortunately we haven't.
++ *
++ * When user can change the frames always force IRET. That is because
++ * it deals with uncanonical addresses better. SYSRET has trouble
++ * with them due to bugs in both AMD and Intel CPUs.
 + */ 			 		
 +
 +ENTRY(system_call)
@@ -27992,7 +28095,10 @@
 +	xorl %esi,%esi # oldset -> arg2
 +	call ptregscall_common
 +1:	movl $_TIF_NEED_RESCHED,%edi
-+	jmp sysret_check
++	/* Use IRET because user could have changed frame. This
++	   works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
++	cli
++	jmp int_with_check
 +	
 +badsys:
 +	movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
@@ -28018,7 +28124,8 @@
 +	call syscall_trace_leave
 +	RESTORE_TOP_OF_STACK %rbx
 +	RESTORE_REST
-+	jmp ret_from_sys_call
++	/* Use IRET because user could have changed frame */
++	jmp int_ret_from_sys_call
 +	CFI_ENDPROC
 +		
 +/* 
@@ -28152,25 +28259,9 @@
 +	CFI_ADJUST_CFA_OFFSET -8
 +	CFI_REGISTER rip, r11
 +	SAVE_REST
-+	movq %r11, %r15
-+	CFI_REGISTER rip, r15
 +	FIXUP_TOP_OF_STACK %r11
 +	call sys_execve
-+	GET_THREAD_INFO(%rcx)
-+	bt $TIF_IA32,threadinfo_flags(%rcx)
-+	CFI_REMEMBER_STATE
-+	jc exec_32bit
 +	RESTORE_TOP_OF_STACK %r11
-+	movq %r15, %r11
-+	CFI_REGISTER rip, r11
-+	RESTORE_REST
-+	pushq %r11
-+	CFI_ADJUST_CFA_OFFSET 8
-+	CFI_REL_OFFSET rip, 0
-+	ret
-+
-+exec_32bit:
-+	CFI_RESTORE_STATE
 +	movq %rax,RAX(%rsp)
 +	RESTORE_REST
 +	jmp int_ret_from_sys_call
@@ -28850,8 +28941,8 @@
 +	decl %gs:pda_irqcount
 +	ret
 +	CFI_ENDPROC
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/genapic_xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/genapic_xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/genapic_xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/genapic_xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/genapic_xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/genapic_xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/genapic_xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,162 @@
 +/*
@@ -29016,8 +29107,8 @@
 +	.cpu_mask_to_apicid = xen_cpu_mask_to_apicid,
 +	.phys_pkg_id = phys_pkg_id,
 +};
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/genapic-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/genapic-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/genapic-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/genapic-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/genapic-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/genapic-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/genapic-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,144 @@
 +/*
@@ -29164,10 +29255,10 @@
 +	xen_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 +#endif
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/head64-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head64-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/head64-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head64-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,140 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/head64-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head64-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/head64-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head64-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,159 @@
 +/*
 + *  linux/arch/x86_64/kernel/head64.c -- prepare to run common code
 + *
@@ -29185,6 +29276,7 @@
 +#include <linux/kernel.h>
 +#include <linux/string.h>
 +#include <linux/percpu.h>
++#include <linux/module.h>
 +
 +#include <asm/processor.h>
 +#include <asm/proto.h>
@@ -29262,8 +29354,16 @@
 +	boot_cpu_data.x86_mask = eax & 0xf;
 +}
 +
++#include <xen/interface/memory.h>
++unsigned long *machine_to_phys_mapping;
++EXPORT_SYMBOL(machine_to_phys_mapping);
++unsigned int machine_to_phys_order;
++EXPORT_SYMBOL(machine_to_phys_order);
++
 +void __init x86_64_start_kernel(char * real_mode_data)
 +{
++	struct xen_machphys_mapping mapping;
++	unsigned long machine_to_phys_nr_ents;
 +	char *s;
 +	int i;
 +
@@ -29275,6 +29375,16 @@
 +			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) {
++		machine_to_phys_mapping = (unsigned long *)mapping.v_start;
++		machine_to_phys_nr_ents = mapping.max_mfn + 1;
++	}
++	while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
++		machine_to_phys_order++;
++
 +#if 0
 +	for (i = 0; i < 256; i++)
 +		set_intr_gate(i, early_idt_handler);
@@ -29308,8 +29418,8 @@
 +	setup_boot_cpu_data();
 +	start_kernel();
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/head-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head-xen.S
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/head-xen.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/head-xen.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head-xen.S
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/head-xen.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/head-xen.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,156 @@
 +/*
@@ -29468,8 +29578,8 @@
 +	.ascii	         "|supervisor_mode_kernel"
 +	.ascii	",LOADER=generic"
 +	.byte	0
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/init_task.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/init_task.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/init_task.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/init_task.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/init_task.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/init_task.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/init_task.c	2006-04-05 22:43:19.000000000 +0200
 @@ -37,6 +37,8 @@ union thread_union init_thread_union 
  struct task_struct init_task = INIT_TASK(init_task);
@@ -29487,8 +29597,8 @@
 +#endif
  
  #define ALIGN_TO_4K __attribute__((section(".data.init_task")))
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/io_apic-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/io_apic-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/io_apic-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/io_apic-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/io_apic-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/io_apic-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/io_apic-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,2231 @@
 +/*
@@ -31722,10 +31832,10 @@
 +}
 +#endif
 +#endif /* !CONFIG_XEN */
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/ioport-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ioport-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/ioport-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ioport-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,58 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/ioport-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ioport-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/ioport-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ioport-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,101 @@
 +/*
 + *	linux/arch/x86_64/kernel/ioport.c
 + *
@@ -31747,6 +31857,57 @@
 +#include <linux/thread_info.h>
 +#include <xen/interface/physdev.h>
 +
++/* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
++static void set_bitmap(unsigned long *bitmap, unsigned int base, unsigned int extent, int new_value)
++{
++	int i;
++
++	if (new_value)
++		for (i = base; i < base + extent; i++)
++			__set_bit(i, bitmap);
++	else
++		for (i = base; i < base + extent; i++)
++			clear_bit(i, bitmap);
++}
++
++/*
++ * this changes the io permissions bitmap in the current task.
++ */
++asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
++{
++	struct thread_struct * t = &current->thread;
++	unsigned long *bitmap;
++	physdev_op_t op;
++
++	if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
++		return -EINVAL;
++	if (turn_on && !capable(CAP_SYS_RAWIO))
++		return -EPERM;
++
++	/*
++	 * If it's the first ioperm() call in this thread's lifetime, set the
++	 * IO bitmap up. ioperm() is much less timing critical than clone(),
++	 * this is why we delay this operation until now:
++	 */
++	if (!t->io_bitmap_ptr) {
++		bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
++		if (!bitmap)
++			return -ENOMEM;
++
++		memset(bitmap, 0xff, IO_BITMAP_BYTES);
++		t->io_bitmap_ptr = bitmap;
++
++		op.cmd = PHYSDEVOP_SET_IOBITMAP;
++		op.u.set_iobitmap.bitmap   = (char *)bitmap;
++		op.u.set_iobitmap.nr_ports = IO_BITMAP_BITS;
++		HYPERVISOR_physdev_op(&op);
++	}
++
++	set_bitmap(t->io_bitmap_ptr, from, num, !turn_on);
++
++	return 0;
++}
++
 +/*
 + * sys_iopl has to be used when you want to access the IO ports
 + * beyond the 0x3ff range: to get the full 65536 ports bitmapped
@@ -31776,16 +31937,22 @@
 +
 +	return 0;
 +}
-+
-+/*
-+ * this changes the io permissions bitmap in the current task.
-+ */
-+asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
-+{
-+  return turn_on ? sys_iopl(3, NULL) : 0;
-+}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/irq-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/irq-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/irq.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/irq.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/irq.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/irq.c	2006-08-15 19:47:06.000000000 +0200
+@@ -96,8 +96,8 @@ skip:
+  */
+ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
+ {	
+-	/* high bits used in ret_from_ code  */
+-	unsigned irq = regs->orig_rax & 0xff;
++	/* high bit used in ret_from_ code  */
++	unsigned irq = ~regs->orig_rax;
+ 
+ 	exit_idle();
+ 	irq_enter();
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/irq-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/irq-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/irq-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/irq-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,168 @@
 +/*
@@ -31956,8 +32123,8 @@
 +        printk("unexpected IRQ trap at vector %02x\n", irq);
 +}
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/ldt-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ldt-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/ldt-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/ldt-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ldt-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/ldt-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/ldt-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,282 @@
 +/*
@@ -32242,8 +32409,8 @@
 +	}
 +	return ret;
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/kernel/Makefile
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/kernel/Makefile
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -20,11 +20,13 @@ obj-$(CONFIG_MICROCODE)		+= microcode.o
  obj-$(CONFIG_X86_CPUID)		+= cpuid.o
@@ -32278,8 +32445,8 @@
 +obj-y := $(call cherrypickxen, $(obj-y))
 +extra-y := $(call cherrypickxen, $(extra-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/mpparse-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/mpparse-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/mpparse-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/mpparse-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/mpparse-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/mpparse-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/mpparse-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1005 @@
 +/*
@@ -33287,8 +33454,8 @@
 +
 +#endif /*CONFIG_X86_IO_APIC*/
 +#endif /*CONFIG_ACPI*/
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/pci-swiotlb-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/pci-swiotlb-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/pci-swiotlb-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/pci-swiotlb-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/pci-swiotlb-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/pci-swiotlb-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/pci-swiotlb-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,54 @@
 +/* Glue code to lib/swiotlb.c */
@@ -33345,10 +33512,10 @@
 +	}
 +#endif
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/process-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/process-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/process-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/process-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,810 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/process-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/process-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/process-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/process-xen.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,814 @@
 +/*
 + *  linux/arch/x86-64/kernel/process.c
 + *
@@ -33836,6 +34003,10 @@
 +	 * This is basically '__unlazy_fpu', except that we queue a
 +	 * multicall to indicate FPU task switch, rather than
 +	 * synchronously trapping to Xen.
++	 * This must be here to ensure both math_state_restore() and
++	 * kernel_fpu_begin() work consistently.
++	 * The AMD workaround requires it to be after DS reload, or
++	 * after DS has been cleared, which we do in __prepare_arch_switch.
 +	 */
 +	if (prev_p->thread_info->status & TS_USEDFPU) {
 +		__save_init_fpu(prev_p); /* _not_ save_init_fpu() */
@@ -34159,8 +34330,8 @@
 +{
 +}
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/setup64-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup64-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/setup64-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/setup64-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup64-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/setup64-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup64-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,360 @@
 +/* 
@@ -34523,10 +34694,10 @@
 +
 +	fpu_init(); 
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/setup-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/setup-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,1661 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/setup-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/setup-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/setup-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,1642 @@
 +/*
 + *  linux/arch/x86-64/kernel/setup.c
 + *
@@ -35199,13 +35370,6 @@
 +
 +	setup_xen_features();
 +
-+	if (xen_feature(XENFEAT_auto_translated_physmap) &&
-+	    xen_start_info->shared_info < xen_start_info->nr_pages) {
-+		HYPERVISOR_shared_info =
-+			(shared_info_t *)__va(xen_start_info->shared_info);
-+		memset(empty_zero_page, 0, sizeof(empty_zero_page));
-+	}
-+
 +	HYPERVISOR_vm_assist(VMASST_CMD_enable,
 +			     VMASST_TYPE_writable_pagetables);
 +
@@ -35359,14 +35523,6 @@
 +#ifdef CONFIG_XEN
 +	{
 +		int i, j, k, fpp;
-+		unsigned long va;
-+
-+		/* 'Initial mapping' of initrd must be destroyed. */
-+		for (va = xen_start_info->mod_start;
-+		     va < (xen_start_info->mod_start+xen_start_info->mod_len);
-+		     va += PAGE_SIZE) {
-+			HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
-+		}
 +
 +		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
 +			/* Make sure we have a large enough P->M table. */
@@ -35382,14 +35538,6 @@
 +				PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
 +						sizeof(unsigned long))));
 +
-+			/* Destroyed 'initial mapping' of old p2m table. */
-+			for (va = xen_start_info->mfn_list;
-+			     va < (xen_start_info->mfn_list +
-+				   (xen_start_info->nr_pages*sizeof(unsigned long)));
-+			     va += PAGE_SIZE) {
-+				HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
-+			}
-+
 +			/*
 +			 * Initialise the list of the frames that specify the
 +			 * list of frames that make up the p2m table. Used by
@@ -35687,6 +35835,10 @@
 +	if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58))
 +		set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
 +
++	/* Enable workaround for FXSAVE leak */
++	if (c->x86 >= 6)
++		set_bit(X86_FEATURE_FXSAVE_LEAK, &c->x86_capability);
++
 +	r = get_model_name(c);
 +	if (!r) { 
 +		switch (c->x86) { 
@@ -36188,9 +36340,25 @@
 +}
 +core_initcall(run_dmi_scan);
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/smp-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/smp-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/smp-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/smp-xen.c	2006-04-05 22:43:19.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/smp.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/smp.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/smp.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/smp.c	2006-08-15 19:47:06.000000000 +0200
+@@ -135,10 +135,10 @@ asmlinkage void smp_invalidate_interrupt
+ 
+ 	cpu = smp_processor_id();
+ 	/*
+-	 * orig_rax contains the interrupt vector - 256.
++	 * orig_rax contains the negated interrupt vector.
+ 	 * Use that to determine where the sender put the data.
+ 	 */
+-	sender = regs->orig_rax + 256 - INVALIDATE_TLB_VECTOR_START;
++	sender = ~regs->orig_rax - INVALIDATE_TLB_VECTOR_START;
+ 	f = &per_cpu(flush_state, sender);
+ 
+ 	if (!cpu_isset(cpu, f->flush_cpumask))
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/smp-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/smp-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/smp-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/smp-xen.c	2006-08-15 18:07:17.000000000 +0200
 @@ -0,0 +1,596 @@
 +/*
 + *	Intel SMP support routines.
@@ -36682,7 +36850,7 @@
 +{
 +	smp_stop_cpu(); 
 +	for (;;) 
-+		asm("hlt"); 
++		halt();
 +} 
 +
 +void smp_send_stop(void)
@@ -36788,8 +36956,8 @@
 +	return 0; /* Should not happen */
 +#endif
 +}
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/traps-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/traps-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/traps-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/traps-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/traps-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/traps-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/traps-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,1023 @@
 +/*
@@ -37815,8 +37983,8 @@
 +}
 +__setup("kstack=", kstack_setup);
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/vsyscall-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/vsyscall-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/vsyscall-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/vsyscall-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/vsyscall-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/vsyscall-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/vsyscall-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,239 @@
 +/*
@@ -38058,8 +38226,8 @@
 +}
 +
 +__initcall(vsyscall_init);
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/x8664_ksyms-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/x8664_ksyms-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/x8664_ksyms-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/x8664_ksyms-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/kernel/x8664_ksyms-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/x8664_ksyms-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/x8664_ksyms-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,163 @@
 +#include <linux/config.h>
@@ -38225,8 +38393,8 @@
 +
 +EXPORT_SYMBOL(load_gs_index);
 +
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/kernel/xen_entry.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/xen_entry.S
---- pristine-linux-2.6.16.12/arch/x86_64/kernel/xen_entry.S	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/kernel/xen_entry.S tmp-linux-2.6-xen.patch/arch/x86_64/kernel/xen_entry.S
+--- pristine-linux-2.6.16.13/arch/x86_64/kernel/xen_entry.S	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/kernel/xen_entry.S	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,40 @@
 +/*
@@ -38269,8 +38437,8 @@
 +VGCF_IN_SYSCALL = (1<<8)
 +        
 +	
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/Makefile
---- pristine-linux-2.6.16.12/arch/x86_64/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/Makefile
+--- pristine-linux-2.6.16.13/arch/x86_64/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -31,6 +31,10 @@ cflags-$(CONFIG_MK8) += $(call cc-option
  cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
@@ -38313,8 +38481,8 @@
  
  archclean:
  	$(Q)$(MAKE) $(clean)=$(boot)
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/mm/fault-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/mm/fault-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/mm/fault-xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/mm/fault-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/mm/fault-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/mm/fault-xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/mm/fault-xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,595 @@
 +/*
@@ -38912,10 +39080,10 @@
 +	return 0;
 +}
 +__setup("pagefaulttrace", enable_pagefaulttrace);
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/mm/init-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/mm/init-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/mm/init-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/mm/init-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,1101 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/mm/init-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/mm/init-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/mm/init-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/mm/init-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,1121 @@
 +/*
 + *  linux/arch/x86_64/mm/init.c
 + *
@@ -39578,7 +39746,34 @@
 +			set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
 +	}
 +
-+	BUG_ON(!after_bootmem && start_pfn != table_start + (tables_space >> PAGE_SHIFT));
++	if (!after_bootmem) {
++		BUG_ON(start_pfn != table_start + (tables_space>>PAGE_SHIFT));
++
++		/* Re-vector virtual addresses pointing into the initial
++		   mapping to the just-established permanent ones. */
++		xen_start_info = __va(__pa(xen_start_info));
++		xen_start_info->pt_base = (unsigned long)
++			__va(__pa(xen_start_info->pt_base));
++		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
++			phys_to_machine_mapping =
++				__va(__pa(xen_start_info->mfn_list));
++			xen_start_info->mfn_list = (unsigned long)
++				phys_to_machine_mapping;
++		}
++		if (xen_start_info->mod_start)
++			xen_start_info->mod_start = (unsigned long)
++				__va(__pa(xen_start_info->mod_start));
++
++		/* Destroy the Xen-created mappings beyond the kernel image as
++		 * well as the temporary mappings created above. Prevents
++		 * overlap with modules area (if init mapping is very big).
++		 */
++		start = PAGE_ALIGN((unsigned long)_end);
++		end   = __START_KERNEL_map + (start_pfn << PAGE_SHIFT);
++		for (; start < end; start += PAGE_SIZE)
++			WARN_ON(HYPERVISOR_update_va_mapping(
++				start, __pte_ma(0), 0));
++	}
 +
 +	__flush_tlb_all();
 +}
@@ -39664,15 +39859,11 @@
 +	free_area_init_node(0, NODE_DATA(0), zones,
 +			    __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes);
 +
-+	if (!xen_feature(XENFEAT_auto_translated_physmap) ||
-+	    xen_start_info->shared_info >= xen_start_info->nr_pages) {
-+		/* Switch to the real shared_info page, and clear the
-+		 * dummy page. */
-+		set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
-+		HYPERVISOR_shared_info =
-+			(shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
-+		memset(empty_zero_page, 0, sizeof(empty_zero_page));
-+	}
++	/* Switch to the real shared_info page, and clear the
++	 * dummy page. */
++	set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
++	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
++	memset(empty_zero_page, 0, sizeof(empty_zero_page));
 +
 +	init_mm.context.pinned = 1;
 +
@@ -39771,6 +39962,7 @@
 +void __init mem_init(void)
 +{
 +	long codesize, reservedpages, datasize, initsize;
++	unsigned long pfn;
 +
 +	contiguous_bitmap = alloc_bootmem_low_pages(
 +		(end_pfn + 2*BITS_PER_LONG) >> 3);
@@ -39799,6 +39991,12 @@
 +#else
 +	totalram_pages = free_all_bootmem();
 +#endif
++	/* XEN: init and count pages outside initial allocation. */
++	for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) {
++		ClearPageReserved(&mem_map[pfn]);
++		set_page_count(&mem_map[pfn], 1);
++		totalram_pages++;
++	}
 +	reservedpages = end_pfn - totalram_pages - e820_hole_size(0, end_pfn);
 +
 +	after_bootmem = 1;
@@ -40007,18 +40205,8 @@
 +{
 +	return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/mm/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/mm/Makefile
---- pristine-linux-2.6.16.12/arch/x86_64/mm/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/mm/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/mm/Makefile
+--- pristine-linux-2.6.16.13/arch/x86_64/mm/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/mm/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -9,3 +9,13 @@ obj-$(CONFIG_K8_NUMA) += k8topology.o
  obj-$(CONFIG_ACPI_NUMA) += srat.o
@@ -40034,10 +40222,10 @@
 +
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/mm/pageattr-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/mm/pageattr-xen.c
---- pristine-linux-2.6.16.12/arch/x86_64/mm/pageattr-xen.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/arch/x86_64/mm/pageattr-xen.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,401 @@
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/mm/pageattr-xen.c tmp-linux-2.6-xen.patch/arch/x86_64/mm/pageattr-xen.c
+--- pristine-linux-2.6.16.13/arch/x86_64/mm/pageattr-xen.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/arch/x86_64/mm/pageattr-xen.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,407 @@
 +/* 
 + * Copyright 2002 Andi Kleen, SuSE Labs. 
 + * Thanks to Ben LaHaise for precious feedback.
@@ -40170,6 +40358,12 @@
 +				  context.unpinned));
 +}
 +
++void _arch_dup_mmap(struct mm_struct *mm)
++{
++    if (!mm->context.pinned)
++        mm_pin(mm);
++}
++
 +void _arch_exit_mmap(struct mm_struct *mm)
 +{
 +    struct task_struct *tsk = current;
@@ -40439,8 +40633,8 @@
 +
 +EXPORT_SYMBOL(change_page_attr);
 +EXPORT_SYMBOL(global_flush_tlb);
-diff -Nurp pristine-linux-2.6.16.12/arch/x86_64/pci/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/pci/Makefile
---- pristine-linux-2.6.16.12/arch/x86_64/pci/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/arch/x86_64/pci/Makefile tmp-linux-2.6-xen.patch/arch/x86_64/pci/Makefile
+--- pristine-linux-2.6.16.13/arch/x86_64/pci/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/arch/x86_64/pci/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -15,10 +15,22 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
  
@@ -40465,8 +40659,8 @@
 +
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -Nurp pristine-linux-2.6.16.12/drivers/acpi/Kconfig tmp-linux-2.6-xen.patch/drivers/acpi/Kconfig
---- pristine-linux-2.6.16.12/drivers/acpi/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/acpi/Kconfig tmp-linux-2.6-xen.patch/drivers/acpi/Kconfig
+--- pristine-linux-2.6.16.13/drivers/acpi/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/acpi/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -46,7 +46,7 @@ if ACPI
  
@@ -40485,8 +40679,8 @@
  	default y
  	help
  	  The Power Management Timer is available on all ACPI-capable,
-diff -Nurp pristine-linux-2.6.16.12/drivers/acpi/tables.c tmp-linux-2.6-xen.patch/drivers/acpi/tables.c
---- pristine-linux-2.6.16.12/drivers/acpi/tables.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/acpi/tables.c tmp-linux-2.6-xen.patch/drivers/acpi/tables.c
+--- pristine-linux-2.6.16.13/drivers/acpi/tables.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/acpi/tables.c	2006-04-05 22:43:19.000000000 +0200
 @@ -572,6 +572,11 @@ static int __init acpi_table_get_sdt(str
   * 
@@ -40509,8 +40703,23 @@
  	if (!rsdp) {
  		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
  		return -ENODEV;
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/mem.c tmp-linux-2.6-xen.patch/drivers/char/mem.c
---- pristine-linux-2.6.16.12/drivers/char/mem.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/base/bus.c tmp-linux-2.6-xen.patch/drivers/base/bus.c
+--- pristine-linux-2.6.16.13/drivers/base/bus.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/drivers/base/bus.c	2006-08-15 19:47:05.000000000 +0200
+@@ -188,6 +188,11 @@ static ssize_t driver_bind(struct device
+ 		up(&dev->sem);
+ 		if (dev->parent)
+ 			up(&dev->parent->sem);
++
++		if (err > 0) 		/* success */
++			err = count;
++		else if (err == 0)	/* driver didn't accept device */
++			err = -ENODEV;
+ 	}
+ 	put_device(dev);
+ 	put_bus(bus);
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/mem.c tmp-linux-2.6-xen.patch/drivers/char/mem.c
+--- pristine-linux-2.6.16.13/drivers/char/mem.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/char/mem.c	2006-04-05 22:43:19.000000000 +0200
 @@ -108,6 +108,7 @@ static inline int valid_mmap_phys_addr_r
  }
@@ -40546,8 +40755,8 @@
  
  static struct file_operations kmem_fops = {
  	.llseek		= memory_lseek,
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/tpm/Kconfig tmp-linux-2.6-xen.patch/drivers/char/tpm/Kconfig
---- pristine-linux-2.6.16.12/drivers/char/tpm/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/tpm/Kconfig tmp-linux-2.6-xen.patch/drivers/char/tpm/Kconfig
+--- pristine-linux-2.6.16.13/drivers/char/tpm/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/char/tpm/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -22,7 +22,7 @@ config TCG_TPM
  
@@ -40583,16 +40792,16 @@
 +
  endmenu
  
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/tpm/Makefile tmp-linux-2.6-xen.patch/drivers/char/tpm/Makefile
---- pristine-linux-2.6.16.12/drivers/char/tpm/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/tpm/Makefile tmp-linux-2.6-xen.patch/drivers/char/tpm/Makefile
+--- pristine-linux-2.6.16.13/drivers/char/tpm/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/char/tpm/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -8,3 +8,4 @@ endif
  obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
  obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
  obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
 +obj-$(CONFIG_TCG_XEN) += tpm_xen.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/tpm/tpm.c tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm.c
---- pristine-linux-2.6.16.12/drivers/char/tpm/tpm.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/tpm/tpm.c tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm.c
+--- pristine-linux-2.6.16.13/drivers/char/tpm/tpm.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm.c	2006-04-05 22:43:19.000000000 +0200
 @@ -30,7 +30,8 @@
  
@@ -40705,8 +40914,8 @@
  
  	chip->dev_num = -1;
  
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/tpm/tpm.h tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm.h
---- pristine-linux-2.6.16.12/drivers/char/tpm/tpm.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/tpm/tpm.h tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm.h
+--- pristine-linux-2.6.16.13/drivers/char/tpm/tpm.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm.h	2006-04-05 22:43:19.000000000 +0200
 @@ -50,6 +50,7 @@ struct tpm_vendor_specific {
  	u8 req_complete_mask;
@@ -40736,8 +40945,8 @@
  extern int tpm_register_hardware(struct device *,
  				 struct tpm_vendor_specific *);
  extern int tpm_open(struct inode *, struct file *);
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/tpm/tpm_xen.c tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm_xen.c
---- pristine-linux-2.6.16.12/drivers/char/tpm/tpm_xen.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/tpm/tpm_xen.c tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm_xen.c
+--- pristine-linux-2.6.16.13/drivers/char/tpm/tpm_xen.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/char/tpm/tpm_xen.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,536 @@
 +/*
@@ -41276,9 +41485,9 @@
 +MODULE_DESCRIPTION("TPM Driver for XEN (shared memory)");
 +MODULE_VERSION("1.0");
 +MODULE_LICENSE("GPL");
-diff -Nurp pristine-linux-2.6.16.12/drivers/char/tty_io.c tmp-linux-2.6-xen.patch/drivers/char/tty_io.c
---- pristine-linux-2.6.16.12/drivers/char/tty_io.c	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/drivers/char/tty_io.c	2006-04-05 22:43:19.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/char/tty_io.c tmp-linux-2.6-xen.patch/drivers/char/tty_io.c
+--- pristine-linux-2.6.16.13/drivers/char/tty_io.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/drivers/char/tty_io.c	2006-08-15 18:04:18.000000000 +0200
 @@ -132,6 +132,8 @@ LIST_HEAD(tty_drivers);			/* linked list
     vt.c for deeply disgusting hack reasons */
  DECLARE_MUTEX(tty_sem);
@@ -41297,29 +41506,7 @@
  		extern struct tty_driver *console_driver;
  		driver = console_driver;
  		index = fg_console;
-@@ -2706,11 +2708,7 @@ static void __do_SAK(void *arg)
- 		}
- 		task_lock(p);
- 		if (p->files) {
--			/*
--			 * We don't take a ref to the file, so we must
--			 * hold ->file_lock instead.
--			 */
--			spin_lock(&p->files->file_lock);
-+			rcu_read_lock();
- 			fdt = files_fdtable(p->files);
- 			for (i=0; i < fdt->max_fds; i++) {
- 				filp = fcheck_files(p->files, i);
-@@ -2725,7 +2723,7 @@ static void __do_SAK(void *arg)
- 					break;
- 				}
- 			}
--			spin_unlock(&p->files->file_lock);
-+			rcu_read_unlock();
- 		}
- 		task_unlock(p);
- 	} while_each_task_pid(session, PIDTYPE_SID, p);
-@@ -3241,6 +3239,8 @@ static int __init tty_init(void)
+@@ -3241,6 +3243,8 @@ static int __init tty_init(void)
  #endif
  
  #ifdef CONFIG_VT
@@ -41328,7 +41515,7 @@
  	cdev_init(&vc0_cdev, &console_fops);
  	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
  	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
-@@ -3249,6 +3249,7 @@ static int __init tty_init(void)
+@@ -3249,6 +3253,7 @@ static int __init tty_init(void)
  	class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
  
  	vty_init();
@@ -41336,8 +41523,8 @@
  #endif
  	return 0;
  }
-diff -Nurp pristine-linux-2.6.16.12/drivers/firmware/Kconfig tmp-linux-2.6-xen.patch/drivers/firmware/Kconfig
---- pristine-linux-2.6.16.12/drivers/firmware/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/firmware/Kconfig tmp-linux-2.6-xen.patch/drivers/firmware/Kconfig
+--- pristine-linux-2.6.16.13/drivers/firmware/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/firmware/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -8,7 +8,7 @@ menu "Firmware Drivers"
  config EDD
@@ -41348,8 +41535,26 @@
  	help
  	  Say Y or M here if you want to enable BIOS Enhanced Disk Drive
  	  Services real mode BIOS calls to determine which disk
-diff -Nurp pristine-linux-2.6.16.12/drivers/Makefile tmp-linux-2.6-xen.patch/drivers/Makefile
---- pristine-linux-2.6.16.12/drivers/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/ide/ide-lib.c tmp-linux-2.6-xen.patch/drivers/ide/ide-lib.c
+--- pristine-linux-2.6.16.13/drivers/ide/ide-lib.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/drivers/ide/ide-lib.c	2006-08-15 19:47:05.000000000 +0200
+@@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *driv
+ {
+ 	u64 addr = BLK_BOUNCE_HIGH;	/* dma64_addr_t */
+ 
+-	if (!PCI_DMA_BUS_IS_PHYS) {
+-		addr = BLK_BOUNCE_ANY;
+-	} else if (on && drive->media == ide_disk) {
+-		if (HWIF(drive)->pci_dev)
++	if (on && drive->media == ide_disk) {
++		if (!PCI_DMA_BUS_IS_PHYS)
++			addr = BLK_BOUNCE_ANY;
++		else if (HWIF(drive)->pci_dev)
+ 			addr = HWIF(drive)->pci_dev->dma_mask;
+ 	}
+ 
+diff -Nurp pristine-linux-2.6.16.13/drivers/Makefile tmp-linux-2.6-xen.patch/drivers/Makefile
+--- pristine-linux-2.6.16.13/drivers/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -34,6 +34,7 @@ obj-y				+= base/ block/ misc/ mfd/ net/
  obj-$(CONFIG_NUBUS)		+= nubus/
@@ -41359,8 +41564,8 @@
  obj-$(CONFIG_IDE)		+= ide/
  obj-$(CONFIG_FC4)		+= fc4/
  obj-$(CONFIG_SCSI)		+= scsi/
-diff -Nurp pristine-linux-2.6.16.12/drivers/pci/Kconfig tmp-linux-2.6-xen.patch/drivers/pci/Kconfig
---- pristine-linux-2.6.16.12/drivers/pci/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/pci/Kconfig tmp-linux-2.6-xen.patch/drivers/pci/Kconfig
+--- pristine-linux-2.6.16.13/drivers/pci/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/pci/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -5,6 +5,7 @@ config PCI_MSI
  	bool "Message Signaled Interrupts (MSI and MSI-X)"
@@ -41370,8 +41575,8 @@
  	help
  	   This allows device drivers to enable MSI (Message Signaled
  	   Interrupts).  Message Signaled Interrupts enable a device to
-diff -Nurp pristine-linux-2.6.16.12/drivers/serial/Kconfig tmp-linux-2.6-xen.patch/drivers/serial/Kconfig
---- pristine-linux-2.6.16.12/drivers/serial/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/serial/Kconfig tmp-linux-2.6-xen.patch/drivers/serial/Kconfig
+--- pristine-linux-2.6.16.13/drivers/serial/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/serial/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -11,6 +11,7 @@ menu "Serial drivers"
  config SERIAL_8250
@@ -41381,8 +41586,8 @@
  	select SERIAL_CORE
  	---help---
  	  This selects whether you want to include the driver for the standard
-diff -Nurp pristine-linux-2.6.16.12/drivers/video/Kconfig tmp-linux-2.6-xen.patch/drivers/video/Kconfig
---- pristine-linux-2.6.16.12/drivers/video/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/video/Kconfig tmp-linux-2.6-xen.patch/drivers/video/Kconfig
+--- pristine-linux-2.6.16.13/drivers/video/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/drivers/video/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -495,7 +495,7 @@ config FB_HGA_ACCEL
  
@@ -41393,10 +41598,10 @@
  	default y
  
  config FB_SGIVW
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/balloon/balloon.c tmp-linux-2.6-xen.patch/drivers/xen/balloon/balloon.c
---- pristine-linux-2.6.16.12/drivers/xen/balloon/balloon.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/balloon/balloon.c	2006-05-09 12:45:55.000000000 +0200
-@@ -0,0 +1,592 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/balloon/balloon.c tmp-linux-2.6-xen.patch/drivers/xen/balloon/balloon.c
+--- pristine-linux-2.6.16.13/drivers/xen/balloon/balloon.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/balloon/balloon.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,582 @@
 +/******************************************************************************
 + * balloon.c
 + *
@@ -41979,26 +42184,16 @@
 +EXPORT_SYMBOL_GPL(balloon_dealloc_empty_page_range);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/balloon/Makefile tmp-linux-2.6-xen.patch/drivers/xen/balloon/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/balloon/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/balloon/Makefile tmp-linux-2.6-xen.patch/drivers/xen/balloon/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/balloon/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/balloon/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,2 @@
 +
 +obj-y += balloon.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkback/blkback.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/blkback.c
---- pristine-linux-2.6.16.12/drivers/xen/blkback/blkback.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/blkback.c	2006-04-25 11:20:48.000000000 +0200
-@@ -0,0 +1,596 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkback/blkback.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/blkback.c
+--- pristine-linux-2.6.16.13/drivers/xen/blkback/blkback.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/blkback.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,579 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/main.c
 + * 
@@ -42571,34 +42766,17 @@
 +		list_add_tail(&pending_reqs[i].free_list, &pending_free);
 +    
 +	blkif_xenbus_init();
-+	__unsafe(THIS_MODULE);
++
 +	return 0;
 +}
 +
 +module_init(blkif_init);
 +
-+static void blkif_exit(void)
-+{
-+	BUG();
-+}
-+
-+module_exit(blkif_exit);
-+
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkback/common.h tmp-linux-2.6-xen.patch/drivers/xen/blkback/common.h
---- pristine-linux-2.6.16.12/drivers/xen/blkback/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/common.h	2006-04-25 11:20:48.000000000 +0200
-@@ -0,0 +1,148 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkback/common.h tmp-linux-2.6-xen.patch/drivers/xen/blkback/common.h
+--- pristine-linux-2.6.16.13/drivers/xen/blkback/common.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/common.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,139 @@
 +/* 
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License version 2
@@ -42635,6 +42813,7 @@
 +#include <linux/slab.h>
 +#include <linux/blkdev.h>
 +#include <linux/vmalloc.h>
++#include <linux/wait.h>
 +#include <asm/io.h>
 +#include <asm/setup.h>
 +#include <asm/pgalloc.h>
@@ -42692,21 +42871,21 @@
 +	int                 st_wr_req;
 +	int                 st_oo_req;
 +
-+	struct work_struct free_work;
++	wait_queue_head_t waiting_to_free;
 +
 +	grant_handle_t shmem_handle;
 +	grant_ref_t    shmem_ref;
 +} blkif_t;
 +
-+blkif_t *alloc_blkif(domid_t domid);
-+void free_blkif_callback(blkif_t *blkif);
++blkif_t *blkif_alloc(domid_t domid);
++void blkif_free(blkif_t *blkif);
 +int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn);
 +
 +#define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
 +#define blkif_put(_b)					\
 +	do {						\
 +		if (atomic_dec_and_test(&(_b)->refcnt))	\
-+			free_blkif_callback(_b);	\
++			wake_up(&(_b)->waiting_to_free);\
 +	} while (0)
 +
 +/* Create a vbd. */
@@ -42737,20 +42916,10 @@
 +void update_blkif_status(blkif_t *blkif); 
 +
 +#endif /* __BLKIF__BACKEND__COMMON_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkback/interface.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/interface.c
---- pristine-linux-2.6.16.12/drivers/xen/blkback/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/interface.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,188 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkback/interface.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/interface.c
+--- pristine-linux-2.6.16.13/drivers/xen/blkback/interface.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/interface.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,171 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/interface.c
 + * 
@@ -42788,7 +42957,7 @@
 +
 +static kmem_cache_t *blkif_cachep;
 +
-+blkif_t *alloc_blkif(domid_t domid)
++blkif_t *blkif_alloc(domid_t domid)
 +{
 +	blkif_t *blkif;
 +
@@ -42803,6 +42972,7 @@
 +	atomic_set(&blkif->refcnt, 1);
 +	init_waitqueue_head(&blkif->wq);
 +	blkif->st_print = jiffies;
++	init_waitqueue_head(&blkif->waiting_to_free);
 +
 +	return blkif;
 +}
@@ -42897,59 +43067,41 @@
 +	return 0;
 +}
 +
-+static void free_blkif(void *arg)
++void blkif_free(blkif_t *blkif)
 +{
-+	blkif_t *blkif = (blkif_t *)arg;
++	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;
-+	}
 +
 +	vbd_free(&blkif->vbd);
 +
 +	if (blkif->blk_ring.sring) {
 +		unmap_frontend_page(blkif);
 +		free_vm_area(blkif->blk_ring_area);
-+		blkif->blk_ring.sring = NULL;
 +	}
 +
 +	kmem_cache_free(blkif_cachep, blkif);
 +}
 +
-+void free_blkif_callback(blkif_t *blkif)
-+{
-+	INIT_WORK(&blkif->free_work, free_blkif, (void *)blkif);
-+	schedule_work(&blkif->free_work);
-+}
-+
 +void __init blkif_interface_init(void)
 +{
 +	blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t), 
 +					 0, 0, NULL, NULL);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/blkback/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/blkback/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/blkback/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/blkback/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,3 @@
 +obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkbk.o
 +
 +blkbk-y	:= blkback.o xenbus.o interface.o vbd.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkback/vbd.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/vbd.c
---- pristine-linux-2.6.16.12/drivers/xen/blkback/vbd.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/vbd.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,126 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkback/vbd.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/vbd.c
+--- pristine-linux-2.6.16.13/drivers/xen/blkback/vbd.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/vbd.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,119 @@
 +/******************************************************************************
 + * blkback/vbd.c
 + * 
@@ -43007,6 +43159,7 @@
 +	       unsigned minor, int readonly)
 +{
 +	struct vbd *vbd;
++	struct block_device *bdev;
 +
 +	vbd = &blkif->vbd;
 +	vbd->handle   = handle; 
@@ -43015,15 +43168,17 @@
 +
 +	vbd->pdevice  = MKDEV(major, minor);
 +
-+	vbd->bdev = open_by_devnum(
-+		vbd->pdevice,
-+		vbd->readonly ? FMODE_READ : FMODE_WRITE);
-+	if (IS_ERR(vbd->bdev)) {
-+		DPRINTK("vbd_creat: device %08x doesn't exist.\n",
++	bdev = open_by_devnum(vbd->pdevice,
++			      vbd->readonly ? FMODE_READ : FMODE_WRITE);
++
++	if (IS_ERR(bdev)) {
++		DPRINTK("vbd_creat: device %08x could not be opened.\n",
 +			vbd->pdevice);
 +		return -ENOENT;
 +	}
 +
++	vbd->bdev = bdev;
++
 +	if (vbd->bdev->bd_disk == NULL) {
 +		DPRINTK("vbd_creat: device %08x doesn't exist.\n",
 +			vbd->pdevice);
@@ -43066,20 +43221,10 @@
 + out:
 +	return rc;
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/xenbus.c
---- pristine-linux-2.6.16.12/drivers/xen/blkback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/xenbus.c	2006-04-25 11:20:48.000000000 +0200
-@@ -0,0 +1,425 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/blkback/xenbus.c
+--- pristine-linux-2.6.16.13/drivers/xen/blkback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkback/xenbus.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,414 @@
 +/*  Xenbus code for blkif backend
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
 +    Copyright (C) 2005 XenSource Ltd
@@ -43194,7 +43339,7 @@
 +		be->blkif->status = DISCONNECTED; 
 +		if (be->blkif->xenblkd)
 +			kthread_stop(be->blkif->xenblkd);
-+		blkif_put(be->blkif);
++		blkif_free(be->blkif);
 +		be->blkif = NULL;
 +	}
 +
@@ -43226,7 +43371,7 @@
 +	be->dev = dev;
 +	dev->data = be;
 +
-+	be->blkif = alloc_blkif(dev->otherend_id);
++	be->blkif = blkif_alloc(dev->otherend_id);
 +	if (IS_ERR(be->blkif)) {
 +		err = PTR_ERR(be->blkif);
 +		be->blkif = NULL;
@@ -43494,21 +43639,10 @@
 +{
 +	xenbus_register_backend(&blkback);
 +}
-+
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkfront/blkfront.c tmp-linux-2.6-xen.patch/drivers/xen/blkfront/blkfront.c
---- pristine-linux-2.6.16.12/drivers/xen/blkfront/blkfront.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/blkfront.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,819 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkfront/blkfront.c tmp-linux-2.6-xen.patch/drivers/xen/blkfront/blkfront.c
+--- pristine-linux-2.6.16.13/drivers/xen/blkfront/blkfront.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/blkfront.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,841 @@
 +/******************************************************************************
 + * blkfront.c
 + * 
@@ -43853,9 +43987,21 @@
 +static void blkfront_closing(struct xenbus_device *dev)
 +{
 +	struct blkfront_info *info = dev->data;
++	unsigned long flags;
 +
 +	DPRINTK("blkfront_closing: %s removed\n", dev->nodename);
 +
++	if (info->rq == NULL)
++		return;
++
++	spin_lock_irqsave(&blkif_io_lock, flags);
++	/* No more blkif_request(). */
++	blk_stop_queue(info->rq);
++	/* No more gnttab callback work. */
++	gnttab_cancel_free_callback(&info->callback);
++	flush_scheduled_work();
++	spin_unlock_irqrestore(&blkif_io_lock, flags);
++
 +	xlvbd_del(info);
 +
 +	xenbus_switch_state(dev, XenbusStateClosed);
@@ -43918,7 +44064,8 @@
 +{
 +	struct blkfront_info *info = (struct blkfront_info *)arg;
 +	spin_lock_irq(&blkif_io_lock);
-+	kick_pending_request_queues(info);
++	if (info->connected == BLKIF_STATE_CONNECTED)
++		kick_pending_request_queues(info);
 +	spin_unlock_irq(&blkif_io_lock);
 +}
 +
@@ -43963,10 +44110,6 @@
 +		      command, (long)argument, inode->i_rdev);
 +
 +	switch (command) {
-+	case HDIO_GETGEO:
-+		/* return ENOSYS to use defaults */
-+		return -ENOSYS;
-+
 +	case CDROMMULTISESSION:
 +		DPRINTK("FIXME: support multisession CDs later\n");
 +		for (i = 0; i < sizeof(struct cdrom_multisession); i++)
@@ -43984,6 +44127,23 @@
 +}
 +
 +
++int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
++{
++	/* We don't have real geometry info, but let's at least return
++	   values consistent with the size of the device */
++	sector_t nsect = get_capacity(bd->bd_disk);
++	sector_t cylinders = nsect;
++
++	hg->heads = 0xff;
++	hg->sectors = 0x3f;
++	sector_div(cylinders, hg->heads * hg->sectors);
++	hg->cylinders = cylinders;
++	if ((sector_t)(hg->cylinders + 1) * hg->heads * hg->sectors < nsect)
++		hg->cylinders = 0xffff;
++	return 0;
++}
++
++
 +/*
 + * blkif_queue_request
 + *
@@ -44193,6 +44353,12 @@
 +	spin_lock_irq(&blkif_io_lock);
 +	info->connected = suspend ?
 +		BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED;
++	/* No more blkif_request(). */
++	if (info->rq)
++		blk_stop_queue(info->rq);
++	/* No more gnttab callback work. */
++	gnttab_cancel_free_callback(&info->callback);
++	flush_scheduled_work();
 +	spin_unlock_irq(&blkif_io_lock);
 +
 +	/* Free resources associated with old device channel. */
@@ -44266,17 +44432,17 @@
 +
 +	(void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
 +
-+	/* Now safe for us to use the shared ring */
 +	spin_lock_irq(&blkif_io_lock);
++
++	/* Now safe for us to use the shared ring */
 +	info->connected = BLKIF_STATE_CONNECTED;
-+	spin_unlock_irq(&blkif_io_lock);
 +
 +	/* Send off requeued requests */
 +	flush_requests(info);
 +
 +	/* Kick any other new requests queued since we resumed */
-+	spin_lock_irq(&blkif_io_lock);
 +	kick_pending_request_queues(info);
++
 +	spin_unlock_irq(&blkif_io_lock);
 +}
 +
@@ -44318,20 +44484,10 @@
 +module_exit(xlblk_exit);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkfront/block.h tmp-linux-2.6-xen.patch/drivers/xen/blkfront/block.h
---- pristine-linux-2.6.16.12/drivers/xen/blkfront/block.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/block.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,165 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkfront/block.h tmp-linux-2.6-xen.patch/drivers/xen/blkfront/block.h
+--- pristine-linux-2.6.16.13/drivers/xen/blkfront/block.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/block.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,156 @@
 +/******************************************************************************
 + * block.h
 + * 
@@ -44474,6 +44630,7 @@
 +extern int blkif_release(struct inode *inode, struct file *filep);
 +extern int blkif_ioctl(struct inode *inode, struct file *filep,
 +                       unsigned command, unsigned long argument);
++extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
 +extern int blkif_check(dev_t dev);
 +extern int blkif_revalidate(dev_t dev);
 +extern void do_blkif_request (request_queue_t *rq);
@@ -44487,18 +44644,8 @@
 +void xlvbd_del(struct blkfront_info *info);
 +
 +#endif /* __XEN_DRIVERS_BLOCK_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkfront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/blkfront/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/blkfront/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkfront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/blkfront/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/blkfront/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,5 @@
 +
@@ -44506,10 +44653,10 @@
 +
 +xenblk-objs := blkfront.o vbd.o
 +
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blkfront/vbd.c tmp-linux-2.6-xen.patch/drivers/xen/blkfront/vbd.c
---- pristine-linux-2.6.16.12/drivers/xen/blkfront/vbd.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/vbd.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,327 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blkfront/vbd.c tmp-linux-2.6-xen.patch/drivers/xen/blkfront/vbd.c
+--- pristine-linux-2.6.16.13/drivers/xen/blkfront/vbd.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blkfront/vbd.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,318 @@
 +/******************************************************************************
 + * vbd.c
 + * 
@@ -44603,6 +44750,7 @@
 +	.open = blkif_open,
 +	.release = blkif_release,
 +	.ioctl  = blkif_ioctl,
++	.getgeo = blkif_getgeo
 +};
 +
 +spinlock_t blkif_io_lock = SPIN_LOCK_UNLOCKED;
@@ -44827,20 +44975,10 @@
 +	blk_cleanup_queue(info->rq);
 +	info->rq = NULL;
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blktap/blktap.c tmp-linux-2.6-xen.patch/drivers/xen/blktap/blktap.c
---- pristine-linux-2.6.16.12/drivers/xen/blktap/blktap.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/blktap.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,910 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blktap/blktap.c tmp-linux-2.6-xen.patch/drivers/xen/blktap/blktap.c
+--- pristine-linux-2.6.16.13/drivers/xen/blktap/blktap.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/blktap.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,900 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/blktap/blktap.c
 + * 
@@ -45741,20 +45879,10 @@
 +}
 +
 +__initcall(blkif_init);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blktap/common.h tmp-linux-2.6-xen.patch/drivers/xen/blktap/common.h
---- pristine-linux-2.6.16.12/drivers/xen/blktap/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/common.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,110 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blktap/common.h tmp-linux-2.6-xen.patch/drivers/xen/blktap/common.h
+--- pristine-linux-2.6.16.13/drivers/xen/blktap/common.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/common.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,100 @@
 +
 +#ifndef __BLKIF__BACKEND__COMMON_H__
 +#define __BLKIF__BACKEND__COMMON_H__
@@ -45855,20 +45983,10 @@
 +irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs);
 +
 +#endif /* __BLKIF__BACKEND__COMMON_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blktap/interface.c tmp-linux-2.6-xen.patch/drivers/xen/blktap/interface.c
---- pristine-linux-2.6.16.12/drivers/xen/blktap/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/interface.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,146 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blktap/interface.c tmp-linux-2.6-xen.patch/drivers/xen/blktap/interface.c
+--- pristine-linux-2.6.16.13/drivers/xen/blktap/interface.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/interface.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,136 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/interface.c
 + * 
@@ -46005,27 +46123,17 @@
 +	blkif_cachep = kmem_cache_create(
 +		"blkif_cache", sizeof(blkif_t), 0, 0, NULL, NULL);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blktap/Makefile tmp-linux-2.6-xen.patch/drivers/xen/blktap/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/blktap/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blktap/Makefile tmp-linux-2.6-xen.patch/drivers/xen/blktap/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/blktap/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,3 @@
 +
 +obj-y	:= xenbus.o interface.o blktap.o 
 +
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/blktap/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/blktap/xenbus.c
---- pristine-linux-2.6.16.12/drivers/xen/blktap/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/xenbus.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,233 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/blktap/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/blktap/xenbus.c
+--- pristine-linux-2.6.16.13/drivers/xen/blktap/xenbus.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/blktap/xenbus.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,223 @@
 +/*  Xenbus code for blkif tap
 +
 +    A Warfield.
@@ -46249,26 +46357,16 @@
 +{
 +	xenbus_register_backend(&blkback);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/char/Makefile tmp-linux-2.6-xen.patch/drivers/xen/char/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/char/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/char/Makefile tmp-linux-2.6-xen.patch/drivers/xen/char/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/char/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/char/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= mem.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/char/mem.c tmp-linux-2.6-xen.patch/drivers/xen/char/mem.c
---- pristine-linux-2.6.16.12/drivers/xen/char/mem.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/char/mem.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,192 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/char/mem.c tmp-linux-2.6-xen.patch/drivers/xen/char/mem.c
+--- pristine-linux-2.6.16.13/drivers/xen/char/mem.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/char/mem.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,182 @@
 +/*
 + *  Originally from linux/drivers/char/mem.c
 + *
@@ -46451,20 +46549,10 @@
 +	.mmap		= mmap_mem,
 +	.open		= open_mem,
 +};
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/console/console.c tmp-linux-2.6-xen.patch/drivers/xen/console/console.c
---- pristine-linux-2.6.16.12/drivers/xen/console/console.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/console/console.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,648 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/console/console.c tmp-linux-2.6-xen.patch/drivers/xen/console/console.c
+--- pristine-linux-2.6.16.13/drivers/xen/console/console.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/console/console.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,638 @@
 +/******************************************************************************
 + * console.c
 + * 
@@ -47103,26 +47191,16 @@
 +module_init(xencons_init);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/console/Makefile tmp-linux-2.6-xen.patch/drivers/xen/console/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/console/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/console/Makefile tmp-linux-2.6-xen.patch/drivers/xen/console/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/console/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/console/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= console.o xencons_ring.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/console/xencons_ring.c tmp-linux-2.6-xen.patch/drivers/xen/console/xencons_ring.c
---- pristine-linux-2.6.16.12/drivers/xen/console/xencons_ring.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/console/xencons_ring.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,151 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/console/xencons_ring.c tmp-linux-2.6-xen.patch/drivers/xen/console/xencons_ring.c
+--- pristine-linux-2.6.16.13/drivers/xen/console/xencons_ring.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/console/xencons_ring.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,141 @@
 +/* 
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License version 2
@@ -47264,20 +47342,10 @@
 +{
 +	(void)xencons_ring_init();
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/evtchn.c tmp-linux-2.6-xen.patch/drivers/xen/core/evtchn.c
---- pristine-linux-2.6.16.12/drivers/xen/core/evtchn.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/evtchn.c	2006-04-28 23:38:29.000000000 +0200
-@@ -0,0 +1,869 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/evtchn.c tmp-linux-2.6-xen.patch/drivers/xen/core/evtchn.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/evtchn.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/evtchn.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,852 @@
 +/******************************************************************************
 + * evtchn.c
 + * 
@@ -47400,6 +47468,11 @@
 +
 +static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
 +{
++	int irq = evtchn_to_irq[chn];
++
++	BUG_ON(irq == -1);
++	set_native_irq_info(irq, cpumask_of_cpu(cpu));
++
 +	clear_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu_evtchn[chn]]);
 +	set_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu]);
 +	cpu_evtchn[chn] = cpu;
@@ -47407,7 +47480,12 @@
 +
 +static void init_evtchn_cpu_bindings(void)
 +{
++	int i;
++
 +	/* By default all event channels notify CPU#0. */
++	for (i = 0; i < NR_IRQS; i++)
++		set_native_irq_info(i, cpumask_of_cpu(0));
++
 +	memset(cpu_evtchn, 0, sizeof(cpu_evtchn));
 +	memset(cpu_evtchn_mask[0], ~0, sizeof(cpu_evtchn_mask[0]));
 +}
@@ -47699,25 +47777,14 @@
 +}
 +EXPORT_SYMBOL_GPL(unbind_from_irqhandler);
 +
-+#ifdef CONFIG_SMP
-+static void do_nothing_function(void *ign)
-+{
-+}
-+#endif
-+
 +/* Rebind an evtchn so that it gets delivered to a specific cpu */
 +static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 +{
 +	evtchn_op_t op = { .cmd = EVTCHNOP_bind_vcpu };
-+	int evtchn;
-+
-+	spin_lock(&irq_mapping_update_lock);
++	int evtchn = evtchn_from_irq(irq);
 +
-+	evtchn = evtchn_from_irq(irq);
-+	if (!VALID_EVTCHN(evtchn)) {
-+		spin_unlock(&irq_mapping_update_lock);
++	if (!VALID_EVTCHN(evtchn))
 +		return;
-+	}
 +
 +	/* Send future instances of this interrupt to other vcpu. */
 +	op.u.bind_vcpu.port = evtchn;
@@ -47730,21 +47797,6 @@
 +	 */
 +	if (HYPERVISOR_event_channel_op(&op) >= 0)
 +		bind_evtchn_to_cpu(evtchn, tcpu);
-+
-+	spin_unlock(&irq_mapping_update_lock);
-+
-+	/*
-+	 * Now send the new target processor a NOP IPI. When this returns, it
-+	 * will check for any pending interrupts, and so service any that got 
-+	 * delivered to the wrong processor by mistake.
-+	 * 
-+	 * XXX: The only time this is called with interrupts disabled is from
-+	 * the hotplug/hotunplug path. In that case, all cpus are stopped with 
-+	 * interrupts disabled, and the missed interrupts will be picked up
-+	 * when they start again. This is kind of a hack.
-+	 */
-+	if (!irqs_disabled())
-+		smp_call_function(do_nothing_function, NULL, 0, 0);
 +}
 +
 +
@@ -47869,8 +47921,8 @@
 +
 +	pirq_query_unmask(irq_to_pirq(irq));
 +
-+	bind_evtchn_to_cpu(evtchn, 0);
 +	evtchn_to_irq[evtchn] = irq;
++	bind_evtchn_to_cpu(evtchn, 0);
 +	irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, evtchn);
 +
 + out:
@@ -47949,6 +48001,15 @@
 +	set_affinity_irq
 +};
 +
++int irq_ignore_unhandled(unsigned int irq)
++{
++	physdev_op_t op;
++	op.cmd = PHYSDEVOP_IRQ_STATUS_QUERY;
++	op.u.irq_status_query.irq = irq;
++	(void)HYPERVISOR_physdev_op(&op);
++	return !!(op.u.irq_status_query.flags & PHYSDEVOP_IRQ_SHARED);
++}
++
 +void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
 +{
 +	int evtchn = evtchn_from_irq(i);
@@ -48137,19 +48198,9 @@
 +		irq_desc[pirq_to_irq(i)].handler = &pirq_type;
 +	}
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/features.c tmp-linux-2.6-xen.patch/drivers/xen/core/features.c
---- pristine-linux-2.6.16.12/drivers/xen/core/features.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/features.c	2006-04-28 23:38:29.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/features.c tmp-linux-2.6-xen.patch/drivers/xen/core/features.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/features.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/features.c	2006-08-15 18:04:18.000000000 +0200
 @@ -0,0 +1,30 @@
 +/******************************************************************************
 + * features.c
@@ -48181,10 +48232,10 @@
 +			xen_features[i*32+j] = !!(fi.submap & 1<<j);
 +	}
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/gnttab.c tmp-linux-2.6-xen.patch/drivers/xen/core/gnttab.c
---- pristine-linux-2.6.16.12/drivers/xen/core/gnttab.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/gnttab.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,464 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/gnttab.c tmp-linux-2.6-xen.patch/drivers/xen/core/gnttab.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/gnttab.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/gnttab.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,470 @@
 +/******************************************************************************
 + * gnttab.c
 + * 
@@ -48255,6 +48306,7 @@
 +EXPORT_SYMBOL_GPL(gnttab_claim_grant_reference);
 +EXPORT_SYMBOL_GPL(gnttab_release_grant_reference);
 +EXPORT_SYMBOL_GPL(gnttab_request_free_callback);
++EXPORT_SYMBOL_GPL(gnttab_cancel_free_callback);
 +EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access_ref);
 +EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer_ref);
 +
@@ -48546,6 +48598,21 @@
 +	spin_unlock_irqrestore(&gnttab_list_lock, flags);
 +}
 +
++void gnttab_cancel_free_callback(struct gnttab_free_callback *callback)
++{
++	struct gnttab_free_callback **pcb;
++	unsigned long flags;
++
++	spin_lock_irqsave(&gnttab_list_lock, flags);
++	for (pcb = &gnttab_free_callback_list; *pcb; pcb = &(*pcb)->next) {
++		if (*pcb == callback) {
++			*pcb = callback->next;
++			break;
++		}
++	}
++	spin_unlock_irqrestore(&gnttab_list_lock, flags);
++}
++
 +#ifndef __ia64__
 +static int map_pte_fn(pte_t *pte, struct page *pmd_page,
 +		      unsigned long addr, void *data)
@@ -48639,18 +48706,8 @@
 +}
 +
 +core_initcall(gnttab_init);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/hypervisor_sysfs.c tmp-linux-2.6-xen.patch/drivers/xen/core/hypervisor_sysfs.c
---- pristine-linux-2.6.16.12/drivers/xen/core/hypervisor_sysfs.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/hypervisor_sysfs.c tmp-linux-2.6-xen.patch/drivers/xen/core/hypervisor_sysfs.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/hypervisor_sysfs.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/core/hypervisor_sysfs.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,57 @@
 +/*
@@ -48710,8 +48767,8 @@
 +
 +device_initcall(hypervisor_subsys_init);
 +EXPORT_SYMBOL_GPL(hypervisor_subsys);
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/Makefile tmp-linux-2.6-xen.patch/drivers/xen/core/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/core/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/Makefile tmp-linux-2.6-xen.patch/drivers/xen/core/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/core/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/core/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,11 @@
 +#
@@ -48725,10 +48782,10 @@
 +obj-$(CONFIG_SMP)     += smpboot.o
 +obj-$(CONFIG_SYSFS)   += hypervisor_sysfs.o
 +obj-$(CONFIG_XEN_SYSFS) += xen_sysfs.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/reboot.c tmp-linux-2.6-xen.patch/drivers/xen/core/reboot.c
---- pristine-linux-2.6.16.12/drivers/xen/core/reboot.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/reboot.c	2006-04-11 14:38:57.000000000 +0200
-@@ -0,0 +1,381 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/reboot.c tmp-linux-2.6-xen.patch/drivers/xen/core/reboot.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/reboot.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/reboot.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,371 @@
 +#define __KERNEL_SYSCALLS__
 +#include <linux/version.h>
 +#include <linux/kernel.h>
@@ -49100,20 +49157,10 @@
 +}
 +
 +subsys_initcall(setup_shutdown_event);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/skbuff.c tmp-linux-2.6-xen.patch/drivers/xen/core/skbuff.c
---- pristine-linux-2.6.16.12/drivers/xen/core/skbuff.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/skbuff.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,144 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/skbuff.c tmp-linux-2.6-xen.patch/drivers/xen/core/skbuff.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/skbuff.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/skbuff.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,140 @@
 +
 +#include <linux/config.h>
 +#include <linux/module.h>
@@ -49237,8 +49284,14 @@
 +	for (order = 0; order <= MAX_SKBUFF_ORDER; order++) {
 +		size = PAGE_SIZE << order;
 +		sprintf(name[order], "xen-skb-%lu", size);
-+		skbuff_order_cachep[order] = kmem_cache_create(
-+			name[order], size, size, 0, skbuff_ctor, skbuff_dtor);
++		if (xen_start_info->flags & SIF_PRIVILEGED)
++			skbuff_order_cachep[order] = kmem_cache_create(
++				name[order], size, size, 0,
++				skbuff_ctor, skbuff_dtor);
++		else
++			skbuff_order_cachep[order] = kmem_cache_create(
++				name[order], size, size, 0, NULL, NULL);
++			
 +	}
 +
 +	skbuff_cachep = skbuff_order_cachep[0];
@@ -49248,20 +49301,10 @@
 +core_initcall(skbuff_init);
 +
 +EXPORT_SYMBOL(__dev_alloc_skb);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/smpboot.c tmp-linux-2.6-xen.patch/drivers/xen/core/smpboot.c
---- pristine-linux-2.6.16.12/drivers/xen/core/smpboot.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/smpboot.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,581 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/smpboot.c tmp-linux-2.6-xen.patch/drivers/xen/core/smpboot.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/smpboot.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/smpboot.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,608 @@
 +/*
 + *	Xen SMP booting functions
 + *
@@ -49361,9 +49404,8 @@
 +
 +	for (i = 0; i < NR_CPUS; i++) {
 +		rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
-+		if (rc == -ENOENT)
-+			break;
-+		cpu_set(i, cpu_possible_map);
++		if (rc >= 0)
++			cpu_set(i, cpu_possible_map);
 +	}
 +}
 +
@@ -49371,6 +49413,18 @@
 +{
 +}
 +
++static inline void
++set_cpu_sibling_map(int cpu)
++{
++	phys_proc_id[cpu] = cpu;
++	cpu_core_id[cpu]  = 0;
++
++	cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
++	cpu_core_map[cpu]    = cpumask_of_cpu(cpu);
++
++	cpu_data[cpu].booted_cores = 1;
++}
++
 +static void xen_smp_intr_init(unsigned int cpu)
 +{
 +	sprintf(resched_name[cpu], "resched%d", cpu);
@@ -49464,7 +49518,7 @@
 +	ctxt.failsafe_callback_cs  = __KERNEL_CS;
 +	ctxt.failsafe_callback_eip = (unsigned long)failsafe_callback;
 +
-+	ctxt.ctrlreg[3] = virt_to_mfn(swapper_pg_dir) << PAGE_SHIFT;
++	ctxt.ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir));
 +#else /* __x86_64__ */
 +	ctxt.user_regs.cs = __KERNEL_CS;
 +	ctxt.user_regs.esp = idle->thread.rsp0 - sizeof(struct pt_regs);
@@ -49476,7 +49530,7 @@
 +	ctxt.failsafe_callback_eip = (unsigned long)failsafe_callback;
 +	ctxt.syscall_callback_eip  = (unsigned long)system_call;
 +
-+	ctxt.ctrlreg[3] = virt_to_mfn(init_level4_pgt) << PAGE_SHIFT;
++	ctxt.ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(init_level4_pgt));
 +
 +	ctxt.gs_base_kernel = (unsigned long)(cpu_pda(vcpu));
 +#endif
@@ -49494,14 +49548,20 @@
 +	struct Xgt_desc_struct *gdt_descr;
 +#endif
 +
++	boot_cpu_data.apicid = 0;
 +	cpu_data[0] = boot_cpu_data;
 +
 +	cpu_2_logical_apicid[0] = 0;
 +	x86_cpu_to_apicid[0] = 0;
 +
 +	current_thread_info()->cpu = 0;
-+	cpu_sibling_map[0] = cpumask_of_cpu(0);
-+	cpu_core_map[0]    = cpumask_of_cpu(0);
++
++	for (cpu = 0; cpu < NR_CPUS; cpu++) {
++		cpus_clear(cpu_sibling_map[cpu]);
++		cpus_clear(cpu_core_map[cpu]);
++	}
++
++	set_cpu_sibling_map(0);
 +
 +	xen_smp_intr_init(0);
 +
@@ -49526,6 +49586,8 @@
 +			XENFEAT_writable_descriptor_tables);
 +
 +		cpu_data[cpu] = boot_cpu_data;
++		cpu_data[cpu].apicid = cpu;
++
 +		cpu_2_logical_apicid[cpu] = cpu;
 +		x86_cpu_to_apicid[cpu] = cpu;
 +
@@ -49734,6 +49796,18 @@
 +		vcpu_hotplug(i);
 +}
 +
++static void
++remove_siblinginfo(int cpu)
++{
++	phys_proc_id[cpu] = BAD_APICID;
++	cpu_core_id[cpu]  = BAD_APICID;
++
++	cpus_clear(cpu_sibling_map[cpu]);
++	cpus_clear(cpu_core_map[cpu]);
++
++	cpu_data[cpu].booted_cores = 0;
++}
++
 +int __cpu_disable(void)
 +{
 +	cpumask_t map = cpu_online_map;
@@ -49742,6 +49816,8 @@
 +	if (cpu == 0)
 +		return -EBUSY;
 +
++	remove_siblinginfo(cpu);
++
 +	cpu_clear(cpu, map);
 +	fixup_irqs(map);
 +	cpu_clear(cpu, cpu_online_map);
@@ -49813,6 +49889,10 @@
 +		prepare_for_smp();
 +#endif
 +
++	/* This must be done before setting cpu_online_map */
++	set_cpu_sibling_map(cpu);
++	wmb();
++
 +	xen_smp_intr_init(cpu);
 +	cpu_set(cpu, cpu_online_map);
 +
@@ -49833,20 +49913,10 @@
 +	return -EINVAL;
 +}
 +#endif
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/xen_proc.c tmp-linux-2.6-xen.patch/drivers/xen/core/xen_proc.c
---- pristine-linux-2.6.16.12/drivers/xen/core/xen_proc.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/core/xen_proc.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,29 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/xen_proc.c tmp-linux-2.6-xen.patch/drivers/xen/core/xen_proc.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/xen_proc.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/core/xen_proc.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,19 @@
 +
 +#include <linux/config.h>
 +#include <linux/proc_fs.h>
@@ -49866,18 +49936,8 @@
 +{
 +	remove_proc_entry(name, xen_base);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/core/xen_sysfs.c tmp-linux-2.6-xen.patch/drivers/xen/core/xen_sysfs.c
---- pristine-linux-2.6.16.12/drivers/xen/core/xen_sysfs.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/core/xen_sysfs.c tmp-linux-2.6-xen.patch/drivers/xen/core/xen_sysfs.c
+--- pristine-linux-2.6.16.13/drivers/xen/core/xen_sysfs.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/core/xen_sysfs.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,311 @@
 +/*
@@ -50191,10 +50251,10 @@
 +
 +module_init(hyper_sysfs_init);
 +module_exit(hyper_sysfs_exit);
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/evtchn/evtchn.c tmp-linux-2.6-xen.patch/drivers/xen/evtchn/evtchn.c
---- pristine-linux-2.6.16.12/drivers/xen/evtchn/evtchn.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/evtchn/evtchn.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,464 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/evtchn/evtchn.c tmp-linux-2.6-xen.patch/drivers/xen/evtchn/evtchn.c
+--- pristine-linux-2.6.16.13/drivers/xen/evtchn/evtchn.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/evtchn/evtchn.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,454 @@
 +/******************************************************************************
 + * evtchn.c
 + * 
@@ -50649,26 +50709,16 @@
 +module_exit(evtchn_cleanup);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/evtchn/Makefile tmp-linux-2.6-xen.patch/drivers/xen/evtchn/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/evtchn/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/evtchn/Makefile tmp-linux-2.6-xen.patch/drivers/xen/evtchn/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/evtchn/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/evtchn/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= evtchn.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/Kconfig tmp-linux-2.6-xen.patch/drivers/xen/Kconfig
---- pristine-linux-2.6.16.12/drivers/xen/Kconfig	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/Kconfig	2006-04-11 21:49:57.000000000 +0200
-@@ -0,0 +1,223 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/Kconfig tmp-linux-2.6-xen.patch/drivers/xen/Kconfig
+--- pristine-linux-2.6.16.13/drivers/xen/Kconfig	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/Kconfig	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,227 @@
 +#
 +# This Kconfig describe xen options
 +#
@@ -50887,13 +50937,17 @@
 +	bool
 +	default y
 +
++config HAVE_IRQ_IGNORE_UNHANDLED
++	bool
++	default y
++
 +config NO_IDLE_HZ
 +	bool
 +	default y
 +
 +endif
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/Makefile tmp-linux-2.6-xen.patch/drivers/xen/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/Makefile tmp-linux-2.6-xen.patch/drivers/xen/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,22 @@
 +
@@ -50918,10 +50972,10 @@
 +obj-$(CONFIG_XEN_PCIDEV_BACKEND)	+= pciback/
 +obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront/
 +
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netback/common.h tmp-linux-2.6-xen.patch/drivers/xen/netback/common.h
---- pristine-linux-2.6.16.12/drivers/xen/netback/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/netback/common.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,133 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netback/common.h tmp-linux-2.6-xen.patch/drivers/xen/netback/common.h
+--- pristine-linux-2.6.16.13/drivers/xen/netback/common.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/netback/common.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,123 @@
 +/******************************************************************************
 + * arch/xen/drivers/netif/backend/common.h
 + * 
@@ -50962,6 +51016,7 @@
 +#include <linux/in.h>
 +#include <linux/netdevice.h>
 +#include <linux/etherdevice.h>
++#include <linux/wait.h>
 +#include <xen/evtchn.h>
 +#include <xen/interface/io/netif.h>
 +#include <asm/io.h>
@@ -51015,7 +51070,7 @@
 +	struct net_device *dev;
 +	struct net_device_stats stats;
 +
-+	struct work_struct free_work;
++	wait_queue_head_t waiting_to_free;
 +} netif_t;
 +
 +#define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
@@ -51023,8 +51078,7 @@
 +
 +void netif_disconnect(netif_t *netif);
 +
-+netif_t *alloc_netif(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]);
-+void free_netif(netif_t *netif);
++netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]);
 +int netif_map(netif_t *netif, unsigned long tx_ring_ref,
 +	      unsigned long rx_ring_ref, unsigned int evtchn);
 +
@@ -51032,7 +51086,7 @@
 +#define netif_put(_b)						\
 +	do {							\
 +		if ( atomic_dec_and_test(&(_b)->refcnt) )	\
-+			free_netif(_b);				\
++			wake_up(&(_b)->waiting_to_free);	\
 +	} while (0)
 +
 +void netif_xenbus_init(void);
@@ -51045,20 +51099,10 @@
 +irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs);
 +
 +#endif /* __NETIF__BACKEND__COMMON_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netback/interface.c tmp-linux-2.6-xen.patch/drivers/xen/netback/interface.c
---- pristine-linux-2.6.16.12/drivers/xen/netback/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/netback/interface.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,334 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netback/interface.c tmp-linux-2.6-xen.patch/drivers/xen/netback/interface.c
+--- pristine-linux-2.6.16.13/drivers/xen/netback/interface.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/netback/interface.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,319 @@
 +/******************************************************************************
 + * arch/xen/drivers/netif/backend/interface.c
 + * 
@@ -51139,7 +51183,7 @@
 +	.set_tx_csum = ethtool_op_set_tx_csum,
 +};
 +
-+netif_t *alloc_netif(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN])
++netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN])
 +{
 +	int err = 0, i;
 +	struct net_device *dev;
@@ -51158,7 +51202,8 @@
 +	netif->domid  = domid;
 +	netif->handle = handle;
 +	netif->status = DISCONNECTED;
-+	atomic_set(&netif->refcnt, 0);
++	atomic_set(&netif->refcnt, 1);
++	init_waitqueue_head(&netif->waiting_to_free);
 +	netif->dev = dev;
 +
 +	netif->credit_bytes = netif->remaining_credit = ~0UL;
@@ -51339,9 +51384,10 @@
 +	return err;
 +}
 +
-+static void free_netif_callback(void *arg)
++static void netif_free(netif_t *netif)
 +{
-+	netif_t *netif = (netif_t *)arg;
++	atomic_dec(&netif->refcnt);
++	wait_event(netif->waiting_to_free, atomic_read(&netif->refcnt) == 0);
 +
 +	if (netif->irq)
 +		unbind_from_irqhandler(netif->irq, netif);
@@ -51357,12 +51403,6 @@
 +	free_netdev(netif->dev);
 +}
 +
-+void free_netif(netif_t *netif)
-+{
-+	INIT_WORK(&netif->free_work, free_netif_callback, (void *)netif);
-+	schedule_work(&netif->free_work);
-+}
-+
 +void netif_disconnect(netif_t *netif)
 +{
 +	switch (netif->status) {
@@ -51374,29 +51414,18 @@
 +			__netif_down(netif);
 +		rtnl_unlock();
 +		netif_put(netif);
-+		break;
++		/* fall through */
 +	case DISCONNECTED:
-+		BUG_ON(atomic_read(&netif->refcnt) != 0);
-+		free_netif(netif);
++		netif_free(netif);
 +		break;
 +	default:
 +		BUG();
 +	}
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netback/loopback.c tmp-linux-2.6-xen.patch/drivers/xen/netback/loopback.c
---- pristine-linux-2.6.16.12/drivers/xen/netback/loopback.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/netback/loopback.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,254 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netback/loopback.c tmp-linux-2.6-xen.patch/drivers/xen/netback/loopback.c
+--- pristine-linux-2.6.16.13/drivers/xen/netback/loopback.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/netback/loopback.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,244 @@
 +/******************************************************************************
 + * netback/loopback.c
 + * 
@@ -51641,18 +51670,8 @@
 +module_exit(loopback_exit);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/netback/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/netback/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/netback/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/netback/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/netback/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,5 @@
 +obj-$(CONFIG_XEN_NETDEV_BACKEND) := netbk.o
@@ -51660,10 +51679,10 @@
 +
 +netbk-y   := netback.o xenbus.o interface.o
 +netloop-y := loopback.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netback/netback.c tmp-linux-2.6-xen.patch/drivers/xen/netback/netback.c
---- pristine-linux-2.6.16.12/drivers/xen/netback/netback.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/netback/netback.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,868 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netback/netback.c tmp-linux-2.6-xen.patch/drivers/xen/netback/netback.c
+--- pristine-linux-2.6.16.13/drivers/xen/netback/netback.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/netback/netback.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,858 @@
 +/******************************************************************************
 + * drivers/xen/netback/netback.c
 + * 
@@ -51836,7 +51855,9 @@
 +		ret = skb_copy_bits(skb, -hlen, nskb->data - hlen,
 +				     skb->len + hlen);
 +		BUG_ON(ret);
++		/* Copy only the header fields we use in this driver. */
 +		nskb->dev = skb->dev;
++		nskb->ip_summed = skb->ip_summed;
 +		nskb->proto_data_valid = skb->proto_data_valid;
 +		dev_kfree_skb(skb);
 +		skb = nskb;
@@ -52116,6 +52137,9 @@
 +	dc = dealloc_cons;
 +	dp = dealloc_prod;
 +
++	/* Ensure we see all indexes enqueued by netif_idx_release(). */
++	smp_rmb();
++
 +	/*
 +	 * Free up any grants we have finished using
 +	 */
@@ -52353,7 +52377,10 @@
 +	unsigned long flags;
 +
 +	spin_lock_irqsave(&_lock, flags);
-+	dealloc_ring[MASK_PEND_IDX(dealloc_prod++)] = pending_idx;
++	dealloc_ring[MASK_PEND_IDX(dealloc_prod)] = pending_idx;
++	/* Sync with net_tx_action_dealloc: insert idx /then/ incr producer. */
++	smp_wmb();
++	dealloc_prod++;
 +	spin_unlock_irqrestore(&_lock, flags);
 +
 +	tasklet_schedule(&net_tx_tasklet);
@@ -52508,34 +52535,16 @@
 +		&netif_be_dbg);
 +#endif
 +
-+	__unsafe(THIS_MODULE);
-+
 +	return 0;
 +}
 +
-+static void netback_cleanup(void)
-+{
-+	BUG();
-+}
-+
 +module_init(netback_init);
-+module_exit(netback_cleanup);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/netback/xenbus.c
---- pristine-linux-2.6.16.12/drivers/xen/netback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/netback/xenbus.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,366 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/netback/xenbus.c
+--- pristine-linux-2.6.16.13/drivers/xen/netback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/netback/xenbus.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,355 @@
 +/*  Xenbus code for netif backend
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
 +    Copyright (C) 2005 XenSource Ltd
@@ -52710,7 +52719,7 @@
 +	if (be->netif == NULL) {
 +		u8 be_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
 +
-+		be->netif = alloc_netif(dev->otherend_id, handle, be_mac);
++		be->netif = netif_alloc(dev->otherend_id, handle, be_mac);
 +		if (IS_ERR(be->netif)) {
 +			err = PTR_ERR(be->netif);
 +			be->netif = NULL;
@@ -52891,21 +52900,10 @@
 +{
 +	xenbus_register_backend(&netback);
 +}
-+
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/net_driver_util.c tmp-linux-2.6-xen.patch/drivers/xen/net_driver_util.c
---- pristine-linux-2.6.16.12/drivers/xen/net_driver_util.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/net_driver_util.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,68 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/net_driver_util.c tmp-linux-2.6-xen.patch/drivers/xen/net_driver_util.c
+--- pristine-linux-2.6.16.13/drivers/xen/net_driver_util.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/net_driver_util.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,58 @@
 +/*****************************************************************************
 + *
 + * Utility functions for Xen network devices.
@@ -52964,28 +52962,18 @@
 +	return 0;
 +}
 +EXPORT_SYMBOL_GPL(xen_net_read_mac);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netfront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/netfront/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/netfront/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netfront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/netfront/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/netfront/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/netfront/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,4 @@
 +
 +obj-$(CONFIG_XEN_NETDEV_FRONTEND)	:= xennet.o
 +
 +xennet-objs := netfront.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/netfront/netfront.c tmp-linux-2.6-xen.patch/drivers/xen/netfront/netfront.c
---- pristine-linux-2.6.16.12/drivers/xen/netfront/netfront.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/netfront/netfront.c	2006-04-11 21:49:57.000000000 +0200
-@@ -0,0 +1,1519 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/netfront/netfront.c tmp-linux-2.6-xen.patch/drivers/xen/netfront/netfront.c
+--- pristine-linux-2.6.16.13/drivers/xen/netfront/netfront.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/netfront/netfront.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,1513 @@
 +/******************************************************************************
 + * Virtual network driver for conversing with remote driver backends.
 + * 
@@ -53466,7 +53454,7 @@
 +				printk(KERN_ALERT "network_tx_buf_gc: warning "
 +				       "-- grant still in use by backend "
 +				       "domain.\n");
-+				goto out;
++				BUG();
 +			}
 +			gnttab_end_foreign_access_ref(
 +				np->grant_tx_ref[id], GNTMAP_readonly);
@@ -53492,7 +53480,6 @@
 +		mb();
 +	} while (prod != np->tx.sring->rsp_prod);
 +
-+ out:
 +	if (np->tx_full &&
 +	    ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE)) {
 +		np->tx_full = 0;
@@ -53651,7 +53638,10 @@
 +			goto drop;
 +		skb_put(nskb, skb->len);
 +		memcpy(nskb->data, skb->data, skb->len);
++		/* Copy only the header fields we use in this driver. */
 +		nskb->dev = skb->dev;
++		nskb->ip_summed = skb->ip_summed;
++		nskb->proto_data_valid = skb->proto_data_valid;
 +		dev_kfree_skb(skb);
 +		skb = nskb;
 +	}
@@ -53883,8 +53873,11 @@
 +				skb_reserve(nskb, 2);
 +				skb_put(nskb, skb->len);
 +				memcpy(nskb->data, skb->data, skb->len);
++				/* Copy any other fields we already set up. */
 +				nskb->dev = skb->dev;
 +				nskb->ip_summed = skb->ip_summed;
++				nskb->proto_data_valid = skb->proto_data_valid;
++				nskb->proto_csum_blank = skb->proto_csum_blank;
 +			}
 +
 +			/* Reinitialise and then destroy the old skbuff. */
@@ -54494,19 +54487,8 @@
 +}
 +
 +#endif
-+
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/conf_space.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/conf_space.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/conf_space.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/conf_space.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,345 @@
 +/*
@@ -54854,8 +54836,8 @@
 +
 +	return err;
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/conf_space.h tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space.h
---- pristine-linux-2.6.16.12/drivers/xen/pciback/conf_space.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/conf_space.h tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space.h
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/conf_space.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,97 @@
 +/*
@@ -54955,8 +54937,8 @@
 +			       void *data);
 +
 +#endif				/* __XEN_PCIBACK_CONF_SPACE_H__ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/conf_space_header.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space_header.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/conf_space_header.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/conf_space_header.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space_header.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/conf_space_header.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/conf_space_header.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,267 @@
 +/*
@@ -55226,8 +55208,8 @@
 +      out:
 +	return err;
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/pciback/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/pciback/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/pciback/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,10 @@
 +obj-$(CONFIG_XEN_PCIDEV_BACKEND) += pciback.o
@@ -55240,8 +55222,8 @@
 +ifeq ($(CONFIG_XEN_PCIDEV_BE_DEBUG),y)
 +EXTRA_CFLAGS += -DDEBUG
 +endif
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/passthrough.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/passthrough.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/passthrough.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/passthrough.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/passthrough.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/passthrough.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/passthrough.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,157 @@
 +/*
@@ -55401,9 +55383,9 @@
 +	kfree(dev_data);
 +	pdev->pci_dev_data = NULL;
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/pciback.h tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback.h
---- pristine-linux-2.6.16.12/drivers/xen/pciback/pciback.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback.h	2006-04-28 23:38:29.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/pciback.h tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback.h
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/pciback.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback.h	2006-08-15 18:04:18.000000000 +0200
 @@ -0,0 +1,79 @@
 +/*
 + * PCI Backend Common Data Structures & Function Declarations
@@ -55484,8 +55466,8 @@
 +
 +extern int verbose_request;
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/pciback_ops.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback_ops.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/pciback_ops.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/pciback_ops.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback_ops.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/pciback_ops.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/pciback_ops.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,74 @@
 +/*
@@ -55562,8 +55544,8 @@
 +      out:
 +	return IRQ_HANDLED;
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/pci_stub.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/pci_stub.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/pci_stub.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/pci_stub.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/pci_stub.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/pci_stub.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/pci_stub.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,695 @@
 +/*
@@ -56261,8 +56243,8 @@
 +module_exit(pciback_cleanup);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/vpci.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/vpci.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/vpci.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/vpci.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/vpci.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/vpci.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/vpci.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,204 @@
 +/*
@@ -56469,9 +56451,9 @@
 +	kfree(vpci_dev);
 +	pdev->pci_dev_data = NULL;
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pciback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/xenbus.c
---- pristine-linux-2.6.16.12/drivers/xen/pciback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/xenbus.c	2006-04-28 23:38:29.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pciback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/pciback/xenbus.c
+--- pristine-linux-2.6.16.13/drivers/xen/pciback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/pciback/xenbus.c	2006-08-15 18:04:18.000000000 +0200
 @@ -0,0 +1,446 @@
 +/*
 + * PCI Backend Xenbus Setup - handles setup with frontend and xend
@@ -56919,8 +56901,8 @@
 +{
 +	xenbus_unregister_driver(&xenbus_pciback_driver);
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pcifront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/pcifront/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/pcifront/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pcifront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/pcifront/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/pcifront/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pcifront/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,7 @@
 +obj-y += pcifront.o
@@ -56930,8 +56912,8 @@
 +ifeq ($(CONFIG_XEN_PCIDEV_FE_DEBUG),y)
 +EXTRA_CFLAGS += -DDEBUG
 +endif
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pcifront/pci.c tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pci.c
---- pristine-linux-2.6.16.12/drivers/xen/pcifront/pci.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pcifront/pci.c tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pci.c
+--- pristine-linux-2.6.16.13/drivers/xen/pcifront/pci.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pci.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,46 @@
 +/*
@@ -56980,8 +56962,8 @@
 +
 +	spin_unlock(&pcifront_dev_lock);
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pcifront/pcifront.h tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pcifront.h
---- pristine-linux-2.6.16.12/drivers/xen/pcifront/pcifront.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pcifront/pcifront.h tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pcifront.h
+--- pristine-linux-2.6.16.13/drivers/xen/pcifront/pcifront.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pcifront.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,40 @@
 +/*
@@ -57024,8 +57006,8 @@
 +void pcifront_free_roots(struct pcifront_device *pdev);
 +
 +#endif	/* __XEN_PCIFRONT_H__ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pcifront/pci_op.c tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pci_op.c
---- pristine-linux-2.6.16.12/drivers/xen/pcifront/pci_op.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pcifront/pci_op.c tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pci_op.c
+--- pristine-linux-2.6.16.13/drivers/xen/pcifront/pci_op.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pcifront/pci_op.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,272 @@
 +/*
@@ -57300,8 +57282,8 @@
 +		kfree(bus_entry);
 +	}
 +}
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/pcifront/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/pcifront/xenbus.c
---- pristine-linux-2.6.16.12/drivers/xen/pcifront/xenbus.c	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/pcifront/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/pcifront/xenbus.c
+--- pristine-linux-2.6.16.13/drivers/xen/pcifront/xenbus.c	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/pcifront/xenbus.c	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,294 @@
 +/*
@@ -57598,16 +57580,16 @@
 +
 +/* Initialize after the Xen PCI Frontend Stub is initialized */
 +subsys_initcall(pcifront_init);
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/privcmd/Makefile tmp-linux-2.6-xen.patch/drivers/xen/privcmd/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/privcmd/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/privcmd/Makefile tmp-linux-2.6-xen.patch/drivers/xen/privcmd/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/privcmd/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/privcmd/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= privcmd.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/privcmd/privcmd.c tmp-linux-2.6-xen.patch/drivers/xen/privcmd/privcmd.c
---- pristine-linux-2.6.16.12/drivers/xen/privcmd/privcmd.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/privcmd/privcmd.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,302 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/privcmd/privcmd.c tmp-linux-2.6-xen.patch/drivers/xen/privcmd/privcmd.c
+--- pristine-linux-2.6.16.13/drivers/xen/privcmd/privcmd.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/privcmd/privcmd.c	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,285 @@
 +/******************************************************************************
 + * privcmd.c
 + * 
@@ -57671,11 +57653,11 @@
 +		__asm__ __volatile__ (
 +			"pushl %%ebx; pushl %%ecx; pushl %%edx; "
 +			"pushl %%esi; pushl %%edi; "
-+			"movl  4(%%eax),%%ebx ;"
-+			"movl  8(%%eax),%%ecx ;"
-+			"movl 12(%%eax),%%edx ;"
-+			"movl 16(%%eax),%%esi ;"
-+			"movl 20(%%eax),%%edi ;"
++			"movl  8(%%eax),%%ebx ;"
++			"movl 16(%%eax),%%ecx ;"
++			"movl 24(%%eax),%%edx ;"
++			"movl 32(%%eax),%%esi ;"
++			"movl 40(%%eax),%%edi ;"
 +			"movl   (%%eax),%%eax ;"
 +			"shll $5,%%eax ;"
 +			"addl $hypercall_page,%%eax ;"
@@ -57769,12 +57751,10 @@
 +	break;
 +
 +	case IOCTL_PRIVCMD_MMAPBATCH: {
-+		mmu_update_t u;
 +		privcmd_mmapbatch_t m;
 +		struct vm_area_struct *vma = NULL;
 +		unsigned long __user *p;
 +		unsigned long addr, mfn; 
-+		uint64_t ptep;
 +		int i;
 +
 +		if (copy_from_user(&m, udata, sizeof(m))) {
@@ -57817,15 +57797,10 @@
 +			if (ret < 0)
 +			    goto batch_err;
 +#else
-+
-+			ret = create_lookup_pte_addr(vma->vm_mm, addr, &ptep);
-+			if (ret)
-+				goto batch_err;
-+
-+			u.val = pte_val_ma(pfn_pte_ma(mfn, vma->vm_page_prot));
-+			u.ptr = ptep;
-+
-+			if (HYPERVISOR_mmu_update(&u, 1, NULL, m.dom) < 0)
++			ret = direct_remap_pfn_range(vma, addr & PAGE_MASK,
++						     mfn, PAGE_SIZE,
++						     vma->vm_page_prot, m.dom);
++			if (ret < 0)
 +				put_user(0xF0000000 | mfn, p);
 +#endif
 +		}
@@ -57836,7 +57811,7 @@
 +	batch_err:
 +		printk("batch_err ret=%d vma=%p addr=%lx "
 +		       "num=%d arr=%p %lx-%lx\n", 
-+		       ret, vma, m.addr, m.num, m.arr,
++		       ret, vma, (unsigned long)m.addr, m.num, m.arr,
 +		       vma ? vma->vm_start : 0, vma ? vma->vm_end : 0);
 +		break;
 +	}
@@ -57900,20 +57875,10 @@
 +}
 +
 +__initcall(privcmd_init);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmback/common.h tmp-linux-2.6-xen.patch/drivers/xen/tpmback/common.h
---- pristine-linux-2.6.16.12/drivers/xen/tpmback/common.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/common.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,91 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmback/common.h tmp-linux-2.6-xen.patch/drivers/xen/tpmback/common.h
+--- pristine-linux-2.6.16.13/drivers/xen/tpmback/common.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/common.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,81 @@
 +/******************************************************************************
 + * drivers/xen/tpmback/common.h
 + */
@@ -57995,20 +57960,10 @@
 +#define MMAP_VADDR(t,_req) ((t)->mmap_vstart + ((_req) * PAGE_SIZE))
 +
 +#endif /* __TPMIF__BACKEND__COMMON_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmback/interface.c tmp-linux-2.6-xen.patch/drivers/xen/tpmback/interface.c
---- pristine-linux-2.6.16.12/drivers/xen/tpmback/interface.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/interface.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,194 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmback/interface.c tmp-linux-2.6-xen.patch/drivers/xen/tpmback/interface.c
+--- pristine-linux-2.6.16.13/drivers/xen/tpmback/interface.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/interface.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,184 @@
 + /*****************************************************************************
 + * drivers/xen/tpmback/interface.c
 + *
@@ -58193,28 +58148,18 @@
 +{
 +	kmem_cache_destroy(tpmif_cachep);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/tpmback/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/tpmback/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmback/Makefile tmp-linux-2.6-xen.patch/drivers/xen/tpmback/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/tpmback/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,4 @@
 +
 +obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmbk.o
 +
 +tpmbk-y += tpmback.o interface.o xenbus.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmback/tpmback.c tmp-linux-2.6-xen.patch/drivers/xen/tpmback/tpmback.c
---- pristine-linux-2.6.16.12/drivers/xen/tpmback/tpmback.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/tpmback.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,1060 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmback/tpmback.c tmp-linux-2.6-xen.patch/drivers/xen/tpmback/tpmback.c
+--- pristine-linux-2.6.16.13/drivers/xen/tpmback/tpmback.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/tpmback.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,1050 @@
 +/******************************************************************************
 + * drivers/xen/tpmback/tpmback.c
 + *
@@ -59265,20 +59210,10 @@
 +module_exit(tpmback_exit);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/tpmback/xenbus.c
---- pristine-linux-2.6.16.12/drivers/xen/tpmback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/xenbus.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,328 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmback/xenbus.c tmp-linux-2.6-xen.patch/drivers/xen/tpmback/xenbus.c
+--- pristine-linux-2.6.16.13/drivers/xen/tpmback/xenbus.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/tpmback/xenbus.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,318 @@
 +/*  Xenbus code for tpmif backend
 +    Copyright (C) 2005 IBM Corporation
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
@@ -59597,26 +59532,16 @@
 +{
 +	xenbus_unregister_driver(&tpmback);
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmfront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/tpmfront/Makefile	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmfront/Makefile tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/tpmfront/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/Makefile	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,2 @@
 +
 +obj-$(CONFIG_XEN_TPMDEV_FRONTEND)	+= tpmfront.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmfront/tpmfront.c tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.c
---- pristine-linux-2.6.16.12/drivers/xen/tpmfront/tpmfront.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,731 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmfront/tpmfront.c tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.c
+--- pristine-linux-2.6.16.13/drivers/xen/tpmfront/tpmfront.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,721 @@
 +/*
 + * Copyright (c) 2005, IBM Corporation
 + *
@@ -60338,20 +60263,10 @@
 +module_exit(tpmif_exit);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/tpmfront/tpmfront.h tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.h
---- pristine-linux-2.6.16.12/drivers/xen/tpmfront/tpmfront.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,40 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/tpmfront/tpmfront.h tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.h
+--- pristine-linux-2.6.16.13/drivers/xen/tpmfront/tpmfront.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/tpmfront/tpmfront.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,30 @@
 +#ifndef TPM_FRONT_H
 +#define TPM_FRONT_H
 +
@@ -60382,20 +60297,10 @@
 +};
 +
 +#endif
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/util.c tmp-linux-2.6-xen.patch/drivers/xen/util.c
---- pristine-linux-2.6.16.12/drivers/xen/util.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/util.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,80 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/util.c tmp-linux-2.6-xen.patch/drivers/xen/util.c
+--- pristine-linux-2.6.16.13/drivers/xen/util.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/util.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,70 @@
 +#include <linux/config.h>
 +#include <linux/mm.h>
 +#include <linux/module.h>
@@ -60466,19 +60371,9 @@
 +	preempt_enable();
 +}
 +EXPORT_SYMBOL_GPL(unlock_vm_area);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/Makefile tmp-linux-2.6-xen.patch/drivers/xen/xenbus/Makefile
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/Makefile	2006-04-11 21:49:57.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/Makefile tmp-linux-2.6-xen.patch/drivers/xen/xenbus/Makefile
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/Makefile	2006-08-15 18:04:18.000000000 +0200
 @@ -0,0 +1,12 @@
 +obj-y	+= xenbus.o
 +obj-$(CONFIG_XEN_BACKEND) += xenbus_be.o
@@ -60492,10 +60387,10 @@
 +xenbus-objs += xenbus_xs.o
 +xenbus-objs += xenbus_probe.o
 +xenbus-objs += xenbus_dev.o
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_backend_client.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_backend_client.c
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_backend_client.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_backend_client.c	2006-05-09 12:45:55.000000000 +0200
-@@ -0,0 +1,152 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_backend_client.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_backend_client.c
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_backend_client.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_backend_client.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,142 @@
 +/******************************************************************************
 + * Backend-client-facing interface for the Xenbus driver.  In other words, the
 + * interface between the Xenbus and the device-specific code in the backend
@@ -60638,20 +60533,10 @@
 +EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_client.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_client.c
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_client.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_client.c	2006-04-11 21:49:57.000000000 +0200
-@@ -0,0 +1,284 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_client.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_client.c
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_client.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_client.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,273 @@
 +/******************************************************************************
 + * Client-facing interface for the Xenbus driver.  In other words, the
 + * interface between the Xenbus and the device-specific code, be it the
@@ -60925,21 +60810,10 @@
 +	return result;
 +}
 +EXPORT_SYMBOL_GPL(xenbus_read_driver_state);
-+
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_comms.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.c
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_comms.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.c	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,218 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_comms.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.c
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_comms.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,208 @@
 +/******************************************************************************
 + * xenbus_comms.c
 + *
@@ -61148,20 +61022,10 @@
 +
 +	return 0;
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_comms.h tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.h
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_comms.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,53 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_comms.h tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.h
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_comms.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_comms.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,43 @@
 +/*
 + * Private include for xenbus communications.
 + * 
@@ -61205,20 +61069,10 @@
 +extern wait_queue_head_t xb_waitq;
 +
 +#endif /* _XENBUS_COMMS_H */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_dev.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_dev.c
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_dev.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_dev.c	2006-04-18 16:21:25.000000000 +0200
-@@ -0,0 +1,255 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_dev.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_dev.c
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_dev.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_dev.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,245 @@
 +/*
 + * xenbus_dev.c
 + * 
@@ -61464,20 +61318,10 @@
 +}
 +
 +__initcall(xenbus_dev_init);
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_probe.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_probe.c
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_probe.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_probe.c	2006-04-18 16:21:25.000000000 +0200
-@@ -0,0 +1,1093 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_probe.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_probe.c
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_probe.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_probe.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,1082 @@
 +/******************************************************************************
 + * Talks to Xen Store to figure out what devices we have.
 + *
@@ -62560,21 +62404,10 @@
 +}
 +
 +late_initcall(wait_for_devices);
-+
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_xs.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_xs.c
---- pristine-linux-2.6.16.12/drivers/xen/xenbus/xenbus_xs.c	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_xs.c	2006-05-09 12:45:55.000000000 +0200
-@@ -0,0 +1,856 @@
+diff -Nurp pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_xs.c tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_xs.c
+--- pristine-linux-2.6.16.13/drivers/xen/xenbus/xenbus_xs.c	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/drivers/xen/xenbus/xenbus_xs.c	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,846 @@
 +/******************************************************************************
 + * xenbus_xs.c
 + *
@@ -63421,18 +63254,8 @@
 +
 +	return 0;
 +}
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/fs/Kconfig tmp-linux-2.6-xen.patch/fs/Kconfig
---- pristine-linux-2.6.16.12/fs/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/fs/Kconfig tmp-linux-2.6-xen.patch/fs/Kconfig
+--- pristine-linux-2.6.16.13/fs/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/fs/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -841,6 +841,7 @@ config TMPFS
  config HUGETLBFS
@@ -63442,8 +63265,8 @@
  
  config HUGETLB_PAGE
  	def_bool HUGETLBFS
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/a.out.h tmp-linux-2.6-xen.patch/include/asm-i386/a.out.h
---- pristine-linux-2.6.16.12/include/asm-i386/a.out.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/a.out.h tmp-linux-2.6-xen.patch/include/asm-i386/a.out.h
+--- pristine-linux-2.6.16.13/include/asm-i386/a.out.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/a.out.h	2006-04-05 22:43:19.000000000 +0200
 @@ -19,7 +19,7 @@ struct exec
  
@@ -63454,8 +63277,8 @@
  
  #endif
  
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/apic.h tmp-linux-2.6-xen.patch/include/asm-i386/apic.h
---- pristine-linux-2.6.16.12/include/asm-i386/apic.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/apic.h tmp-linux-2.6-xen.patch/include/asm-i386/apic.h
+--- pristine-linux-2.6.16.13/include/asm-i386/apic.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/apic.h	2006-04-05 22:43:19.000000000 +0200
 @@ -132,10 +132,12 @@ extern unsigned int nmi_watchdog;
  
@@ -63470,8 +63293,8 @@
  
  extern int timer_over_8254;
  
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/atomic.h tmp-linux-2.6-xen.patch/include/asm-i386/atomic.h
---- pristine-linux-2.6.16.12/include/asm-i386/atomic.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/atomic.h tmp-linux-2.6-xen.patch/include/asm-i386/atomic.h
+--- pristine-linux-2.6.16.13/include/asm-i386/atomic.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/atomic.h	2006-04-05 22:43:19.000000000 +0200
 @@ -4,18 +4,13 @@
  #include <linux/config.h>
@@ -63493,8 +63316,8 @@
  /*
   * Make sure gcc doesn't try to be clever and move things around
   * on us. We need to use _exactly_ the address the user gave us,
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/bitops.h tmp-linux-2.6-xen.patch/include/asm-i386/bitops.h
---- pristine-linux-2.6.16.12/include/asm-i386/bitops.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/bitops.h tmp-linux-2.6-xen.patch/include/asm-i386/bitops.h
+--- pristine-linux-2.6.16.13/include/asm-i386/bitops.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/bitops.h	2006-04-05 22:43:19.000000000 +0200
 @@ -7,6 +7,7 @@
  
@@ -63571,8 +63394,8 @@
  		"btcl %2,%1\n\tsbbl %0,%0"
  		:"=r" (oldbit),"+m" (ADDR)
  		:"Ir" (nr) : "memory");
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/elf.h tmp-linux-2.6-xen.patch/include/asm-i386/elf.h
---- pristine-linux-2.6.16.12/include/asm-i386/elf.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/elf.h tmp-linux-2.6-xen.patch/include/asm-i386/elf.h
+--- pristine-linux-2.6.16.13/include/asm-i386/elf.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/elf.h	2006-04-05 22:43:19.000000000 +0200
 @@ -129,11 +129,16 @@ extern int dump_task_extended_fpu (struc
  #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
@@ -63592,8 +63415,8 @@
  #define ARCH_DLINFO						\
  do {								\
  		NEW_AUX_ENT(AT_SYSINFO,	VSYSCALL_ENTRY);	\
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/fixmap.h tmp-linux-2.6-xen.patch/include/asm-i386/fixmap.h
---- pristine-linux-2.6.16.12/include/asm-i386/fixmap.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/fixmap.h tmp-linux-2.6-xen.patch/include/asm-i386/fixmap.h
+--- pristine-linux-2.6.16.13/include/asm-i386/fixmap.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/fixmap.h	2006-04-05 22:43:19.000000000 +0200
 @@ -20,7 +20,7 @@
   * Leave one empty page between vmalloc'ed areas and
@@ -63636,8 +63459,8 @@
  extern void __this_fixmap_does_not_exist(void);
  
  /*
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/futex.h tmp-linux-2.6-xen.patch/include/asm-i386/futex.h
---- pristine-linux-2.6.16.12/include/asm-i386/futex.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/futex.h tmp-linux-2.6-xen.patch/include/asm-i386/futex.h
+--- pristine-linux-2.6.16.13/include/asm-i386/futex.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/futex.h	2006-04-05 22:43:19.000000000 +0200
 @@ -28,7 +28,7 @@
  "1:	movl	%2, %0\n\
@@ -63657,8 +63480,8 @@
  					   oldval, uaddr, oparg);
  			break;
  		case FUTEX_OP_OR:
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-default/mach_traps.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-default/mach_traps.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-default/mach_traps.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-default/mach_traps.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-default/mach_traps.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-default/mach_traps.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-default/mach_traps.h	2006-04-05 22:43:19.000000000 +0200
 @@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig
  	outb(reason, 0x61);
@@ -63679,8 +63502,8 @@
  static inline unsigned char get_nmi_reason(void)
  {
  	return inb(0x61);
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/agp.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/agp.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/agp.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/agp.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/agp.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/agp.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/agp.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,37 @@
 +#ifndef AGP_H
@@ -63720,8 +63543,8 @@
 +	dma_free_coherent(NULL,PAGE_SIZE<<(order),(table),virt_to_bus(table))
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/desc.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/desc.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/desc.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/desc.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/desc.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/desc.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/desc.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,164 @@
 +#ifndef __ARCH_DESC_H
@@ -63888,8 +63711,8 @@
 +#endif /* !__ASSEMBLY__ */
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/dma-mapping.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/dma-mapping.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/dma-mapping.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/dma-mapping.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/dma-mapping.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/dma-mapping.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/dma-mapping.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,156 @@
 +#ifndef _ASM_I386_DMA_MAPPING_H
@@ -64048,8 +63871,8 @@
 +				  dma_addr_t device_addr, size_t size);
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/fixmap.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/fixmap.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/fixmap.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/fixmap.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/fixmap.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/fixmap.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/fixmap.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,156 @@
 +/*
@@ -64208,8 +64031,8 @@
 +
 +#endif /* !__ASSEMBLY__ */
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/floppy.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/floppy.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/floppy.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/floppy.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/floppy.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/floppy.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/floppy.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,147 @@
 +/*
@@ -64359,8 +64182,8 @@
 +#define EXTRA_FLOPPY_PARAMS
 +
 +#endif /* __ASM_XEN_I386_FLOPPY_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/highmem.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/highmem.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/highmem.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/highmem.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/highmem.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/highmem.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/highmem.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,81 @@
 +/*
@@ -64444,8 +64267,8 @@
 +#endif /* __KERNEL__ */
 +
 +#endif /* _ASM_HIGHMEM_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/hw_irq.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hw_irq.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/hw_irq.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/hw_irq.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hw_irq.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/hw_irq.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hw_irq.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,73 @@
 +#ifndef _ASM_HW_IRQ_H
@@ -64521,10 +64344,10 @@
 +extern void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i);
 +
 +#endif /* _ASM_HW_IRQ_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/hypercall.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypercall.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/hypercall.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypercall.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,342 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/hypercall.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypercall.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/hypercall.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypercall.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,332 @@
 +/******************************************************************************
 + * hypercall.h
 + * 
@@ -64857,18 +64680,8 @@
 +}
 +
 +#endif /* __HYPERCALL_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/hypervisor.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypervisor.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/hypervisor.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypervisor.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/hypervisor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,224 @@
 +/******************************************************************************
@@ -65095,8 +64908,8 @@
 +}
 +
 +#endif /* __HYPERVISOR_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/io.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/io.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/io.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/io.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/io.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/io.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/io.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,401 @@
 +#ifndef _ASM_IO_H
@@ -65500,8 +65313,8 @@
 +#define ARCH_HAS_DEV_MEM
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/kmap_types.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/kmap_types.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/kmap_types.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/kmap_types.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/kmap_types.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/kmap_types.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/kmap_types.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,32 @@
 +#ifndef _ASM_KMAP_TYPES_H
@@ -65536,10 +65349,10 @@
 +#undef D
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/mmu_context.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu_context.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/mmu_context.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu_context.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,105 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/mmu_context.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu_context.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/mmu_context.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu_context.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,108 @@
 +#ifndef __I386_SCHED_H
 +#define __I386_SCHED_H
 +
@@ -65593,8 +65406,7 @@
 +	struct mmuext_op _op[2], *op = _op;
 +
 +	if (likely(prev != next)) {
-+		if (!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags))
-+			mm_pin(next);
++		BUG_ON(!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags));
 +
 +		/* stop flush ipis for the previous mm */
 +		cpu_clear(cpu, prev->cpu_vm_mask);
@@ -65641,14 +65453,18 @@
 +#define deactivate_mm(tsk, mm) \
 +	asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0))
 +
-+#define activate_mm(prev, next) \
-+	switch_mm((prev),(next),NULL)
++static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
++{
++	if (!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags))
++		mm_pin(next);
++	switch_mm(prev, next, NULL);
++}
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/mmu.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/mmu.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,21 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/mmu.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/mmu.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/mmu.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,25 @@
 +#ifndef __i386_MMU_H
 +#define __i386_MMU_H
 +
@@ -65669,11 +65485,15 @@
 +extern void _arch_exit_mmap(struct mm_struct *mm);
 +#define arch_exit_mmap(_mm) _arch_exit_mmap(_mm)
 +
++/* kernel/fork.c:dup_mmap hook */
++extern void _arch_dup_mmap(struct mm_struct *mm);
++#define arch_dup_mmap(mm, oldmm) ((void)(oldmm), _arch_dup_mmap(mm))
++
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/page.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/page.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/page.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/page.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,327 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/page.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/page.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/page.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/page.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,336 @@
 +#ifndef _I386_PAGE_H
 +#define _I386_PAGE_H
 +
@@ -65743,6 +65563,10 @@
 +
 +extern unsigned long *phys_to_machine_mapping;
 +
++#undef machine_to_phys_mapping
++extern unsigned long *machine_to_phys_mapping;
++extern unsigned int   machine_to_phys_order;
++
 +static inline unsigned long pfn_to_mfn(unsigned long pfn)
 +{
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
@@ -65760,24 +65584,29 @@
 +
 +static inline unsigned long mfn_to_pfn(unsigned long mfn)
 +{
++	extern unsigned long max_mapnr;
 +	unsigned long pfn;
 +
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
 +		return mfn;
 +
-+	/*
-+	 * The array access can fail (e.g., device space beyond end of RAM).
-+	 * In such cases it doesn't matter what we return (we return garbage),
-+	 * but we must handle the fault without crashing!
-+	 */
++	if (unlikely((mfn >> machine_to_phys_order) != 0))
++		return max_mapnr;
++
++	/* The array access can fail (e.g., device space beyond end of RAM). */
 +	asm (
 +		"1:	movl %1,%0\n"
 +		"2:\n"
++		".section .fixup,\"ax\"\n"
++		"3:	movl %2,%0\n"
++		"	jmp  2b\n"
++		".previous\n"
 +		".section __ex_table,\"a\"\n"
 +		"	.align 4\n"
-+		"	.long 1b,2b\n"
++		"	.long 1b,3b\n"
 +		".previous"
-+		: "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) );
++		: "=r" (pfn)
++		: "m" (machine_to_phys_mapping[mfn]), "m" (max_mapnr) );
 +
 +	return pfn;
 +}
@@ -66001,8 +65830,8 @@
 +#include <asm-generic/page.h>
 +
 +#endif /* _I386_PAGE_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/param.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/param.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/param.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/param.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/param.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/param.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/param.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,24 @@
 +#ifndef _ASMi386_PARAM_H
@@ -66029,8 +65858,8 @@
 +#define COMMAND_LINE_SIZE 256
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pci.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pci.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pci.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pci.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pci.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pci.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pci.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,154 @@
 +#ifndef __i386_PCI_H
@@ -66187,8 +66016,8 @@
 +#define pcibios_scan_all_fns(a, b)	1
 +
 +#endif /* __i386_PCI_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgalloc.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgalloc.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgalloc.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgalloc.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgalloc.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgalloc.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgalloc.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,64 @@
 +#ifndef _I386_PGALLOC_H
@@ -66255,8 +66084,8 @@
 +#define check_pgt_cache()	do { } while (0)
 +
 +#endif /* _I386_PGALLOC_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,21 @@
 +#ifndef _I386_PGTABLE_2LEVEL_DEFS_H
@@ -66280,10 +66109,10 @@
 +#define PTRS_PER_PTE	1024
 +
 +#endif /* _I386_PGTABLE_2LEVEL_DEFS_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-2level.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-2level.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,83 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-2level.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-2level.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-2level.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,86 @@
 +#ifndef _I386_PGTABLE_2LEVEL_H
 +#define _I386_PGTABLE_2LEVEL_H
 +
@@ -66319,6 +66148,9 @@
 +
 +#define set_pmd(pmdptr, pmdval) xen_l2_entry_update((pmdptr), (pmdval))
 +
++#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
++#define pmd_clear(xp)	do { set_pmd(xp, __pmd(0)); } while (0)
++
 +#define ptep_get_and_clear(mm,addr,xp)	__pte_ma(xchg(&(xp)->pte_low, 0))
 +#define pte_same(a, b)		((a).pte_low == (b).pte_low)
 +#define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT)
@@ -66367,8 +66199,8 @@
 +#define __swp_entry_to_pte(x)		((pte_t) { (x).val })
 +
 +#endif /* _I386_PGTABLE_2LEVEL_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,25 @@
 +#ifndef _I386_PGTABLE_3LEVEL_DEFS_H
@@ -66396,10 +66228,10 @@
 +#define PTRS_PER_PTE	512
 +
 +#endif /* _I386_PGTABLE_3LEVEL_DEFS_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-3level.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable-3level.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,181 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-3level.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable-3level.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable-3level.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,195 @@
 +#ifndef _I386_PGTABLE_3LEVEL_H
 +#define _I386_PGTABLE_3LEVEL_H
 +
@@ -66509,6 +66341,20 @@
 +#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
 +			pmd_index(address))
 +
++/*
++ * For PTEs and PDEs, we must clear the P-bit first when clearing a page table
++ * entry, so clear the bottom half first and enforce ordering with a compiler
++ * barrier.
++ */
++static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
++{
++	ptep->pte_low = 0;
++	smp_wmb();
++	ptep->pte_high = 0;
++}
++
++#define pmd_clear(xp)	do { set_pmd(xp, __pmd(0)); } while (0)
++
 +static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 +{
 +	pte_t res;
@@ -66581,10 +66427,10 @@
 +#define __pmd_free_tlb(tlb, x)		do { } while (0)
 +
 +#endif /* _I386_PGTABLE_3LEVEL_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/pgtable.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,521 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/pgtable.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/pgtable.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,510 @@
 +#ifndef _I386_PGTABLE_H
 +#define _I386_PGTABLE_H
 +
@@ -66792,14 +66638,12 @@
 +extern unsigned long pg0[];
 +
 +#define pte_present(x)	((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
-+#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
 +
 +/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
 +#define pmd_none(x)	(!(unsigned long)pmd_val(x))
 +/* pmd_present doesn't just test the _PAGE_PRESENT bit since wr.p.t.
 +   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_USER & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
 +
 +
@@ -66859,16 +66703,7 @@
 +	pte_t pte;
 +	if (full) {
 +		pte = *ptep;
-+#ifdef CONFIG_X86_PAE
-+		/* Cannot do this in a single step, as the compiler may
-+		   issue the two stores in either order, but the hypervisor
-+		   must not see the high part before the low one. */
-+		ptep->pte_low = 0;
-+		barrier();
-+		ptep->pte_high = 0;
-+#else
-+		*ptep = __pte(0);
-+#endif
++		pte_clear(mm, addr, ptep);
 +	} else {
 +		pte = ptep_get_and_clear(mm, addr, ptep);
 +	}
@@ -67106,8 +66941,8 @@
 +#include <asm-generic/pgtable.h>
 +
 +#endif /* _I386_PGTABLE_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/processor.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/processor.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/processor.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/processor.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/processor.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/processor.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/processor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,753 @@
 +/*
@@ -67863,8 +67698,8 @@
 +#endif
 +
 +#endif /* __ASM_I386_PROCESSOR_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/ptrace.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/ptrace.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/ptrace.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/ptrace.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/ptrace.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/ptrace.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/ptrace.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,90 @@
 +#ifndef _I386_PTRACE_H
@@ -67957,8 +67792,8 @@
 +#endif /* __KERNEL__ */
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/scatterlist.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/scatterlist.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/scatterlist.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/scatterlist.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/scatterlist.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/scatterlist.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/scatterlist.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,22 @@
 +#ifndef _I386_SCATTERLIST_H
@@ -67983,8 +67818,8 @@
 +#define ISA_DMA_THRESHOLD (0x00ffffff)
 +
 +#endif /* !(_I386_SCATTERLIST_H) */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/segment.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/segment.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/segment.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/segment.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/segment.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/segment.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/segment.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,117 @@
 +#ifndef _ASM_SEGMENT_H
@@ -68104,8 +67939,8 @@
 +#define IDT_ENTRIES 256
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/setup.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/setup.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/setup.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/setup.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/setup.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/setup.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/setup.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,66 @@
 +/*
@@ -68174,8 +68009,8 @@
 +#endif /* __ASSEMBLY__ */
 +
 +#endif /* _i386_SETUP_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/smp.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/smp.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/smp.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/smp.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/smp.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/smp.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/smp.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,103 @@
 +#ifndef __ASM_SMP_H
@@ -68281,8 +68116,8 @@
 +
 +#endif
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/spinlock.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/spinlock.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/spinlock.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/spinlock.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/spinlock.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/spinlock.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/spinlock.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,217 @@
 +#ifndef __ASM_SPINLOCK_H
@@ -68502,8 +68337,8 @@
 +}
 +
 +#endif /* __ASM_SPINLOCK_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/swiotlb.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/swiotlb.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/swiotlb.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/swiotlb.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/swiotlb.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/swiotlb.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/swiotlb.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,43 @@
 +#ifndef _ASM_SWIOTLB_H
@@ -68549,8 +68384,8 @@
 +#endif
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/synch_bitops.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/synch_bitops.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/synch_bitops.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/synch_bitops.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/synch_bitops.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,141 @@
 +#ifndef __XEN_SYNCH_BITOPS_H__
@@ -68694,10 +68529,10 @@
 + synch_var_test_bit((nr),(addr)))
 +
 +#endif /* __XEN_SYNCH_BITOPS_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/system.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/system.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/system.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/system.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,679 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/system.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/system.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/system.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/system.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,681 @@
 +#ifndef __ASM_SYSTEM_H
 +#define __ASM_SYSTEM_H
 +
@@ -68816,10 +68651,12 @@
 +	__asm__ ( \
 +		"movl %%cr3,%0\n\t" \
 +		:"=r" (__dummy)); \
-+	machine_to_phys(__dummy); \
++	__dummy = xen_cr3_to_pfn(__dummy); \
++	mfn_to_pfn(__dummy) << PAGE_SHIFT; \
 +})
 +#define write_cr3(x) ({						\
-+	maddr_t __dummy = phys_to_machine(x);			\
++	unsigned int __dummy = pfn_to_mfn((x) >> PAGE_SHIFT);	\
++	__dummy = xen_pfn_to_cr3(__dummy);			\
 +	__asm__ __volatile__("movl %0,%%cr3": :"r" (__dummy));	\
 +})
 +
@@ -69377,8 +69214,8 @@
 +extern unsigned long arch_align_stack(unsigned long sp);
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/tlbflush.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/tlbflush.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/tlbflush.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/tlbflush.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/tlbflush.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/tlbflush.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/tlbflush.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,102 @@
 +#ifndef _I386_TLBFLUSH_H
@@ -69483,8 +69320,8 @@
 +}
 +
 +#endif /* _I386_TLBFLUSH_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/vga.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/vga.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/asm/vga.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/vga.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/vga.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/asm/vga.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/asm/vga.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,20 @@
 +/*
@@ -69507,8 +69344,8 @@
 +#define vga_writeb(x,y) (*(y) = (x))
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/irq_vectors.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/irq_vectors.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/irq_vectors.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/irq_vectors.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/irq_vectors.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/irq_vectors.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/irq_vectors.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,125 @@
 +/*
@@ -69636,8 +69473,8 @@
 +#define irq_to_dynirq(_x)	((_x) - DYNIRQ_BASE)
 +
 +#endif /* _ASM_IRQ_VECTORS_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/mach_traps.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/mach_traps.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/mach_traps.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/mach_traps.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/mach_traps.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/mach_traps.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/mach_traps.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,33 @@
 +/*
@@ -69673,10 +69510,10 @@
 +static inline void reassert_nmi(void) {}
 +
 +#endif /* !_MACH_TRAPS_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/setup_arch_post.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_post.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/setup_arch_post.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_post.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,45 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/setup_arch_post.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_post.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/setup_arch_post.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_post.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,56 @@
 +/**
 + * machine_specific_memory_setup - Hook for machine specific memory setup.
 + *
@@ -69685,6 +69522,8 @@
 + *	use of all of the static functions.
 + **/
 +
++#include <xen/interface/memory.h>
++
 +static char * __init machine_specific_memory_setup(void)
 +{
 +	unsigned long max_pfn = xen_start_info->nr_pages;
@@ -69699,18 +69538,18 @@
 +extern void failsafe_callback(void);
 +extern void nmi(void);
 +
++unsigned long *machine_to_phys_mapping;
++EXPORT_SYMBOL(machine_to_phys_mapping);
++unsigned int machine_to_phys_order;
++EXPORT_SYMBOL(machine_to_phys_order);
++
 +static void __init machine_specific_arch_setup(void)
 +{
++	struct xen_machphys_mapping mapping;
++	unsigned long machine_to_phys_nr_ents;
 +	struct xen_platform_parameters pp;
 +	struct xennmi_callback cb;
 +
-+	if (xen_feature(XENFEAT_auto_translated_physmap) &&
-+	    xen_start_info->shared_info < xen_start_info->nr_pages) {
-+		HYPERVISOR_shared_info =
-+			(shared_info_t *)__va(xen_start_info->shared_info);
-+		memset(empty_zero_page, 0, sizeof(empty_zero_page));
-+	}
-+
 +	HYPERVISOR_set_callbacks(
 +	    __KERNEL_CS, (unsigned long)hypervisor_callback,
 +	    __KERNEL_CS, (unsigned long)failsafe_callback);
@@ -69721,9 +69560,18 @@
 +	if (HYPERVISOR_xen_version(XENVER_platform_parameters,
 +				   &pp) == 0)
 +		set_fixaddr_top(pp.virt_start - PAGE_SIZE);
++
++	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) {
++		machine_to_phys_mapping = (unsigned long *)mapping.v_start;
++		machine_to_phys_nr_ents = mapping.max_mfn + 1;
++	}
++	while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
++		machine_to_phys_order++;
 +}
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/mach-xen/setup_arch_pre.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_pre.h
---- pristine-linux-2.6.16.12/include/asm-i386/mach-xen/setup_arch_pre.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/mach-xen/setup_arch_pre.h tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_pre.h
+--- pristine-linux-2.6.16.13/include/asm-i386/mach-xen/setup_arch_pre.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/mach-xen/setup_arch_pre.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,5 @@
 +/* Hook to call BIOS initialisation function */
@@ -69731,8 +69579,8 @@
 +#define ARCH_SETUP machine_specific_arch_setup();
 +
 +static void __init machine_specific_arch_setup(void);
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/page.h tmp-linux-2.6-xen.patch/include/asm-i386/page.h
---- pristine-linux-2.6.16.12/include/asm-i386/page.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/page.h tmp-linux-2.6-xen.patch/include/asm-i386/page.h
+--- pristine-linux-2.6.16.13/include/asm-i386/page.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/page.h	2006-04-05 22:43:19.000000000 +0200
 @@ -121,7 +121,7 @@ extern int page_is_ram(unsigned long pag
  
@@ -69752,8 +69600,32 @@
  #endif /* __KERNEL__ */
  
  #include <asm-generic/page.h>
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/rwsem.h tmp-linux-2.6-xen.patch/include/asm-i386/rwsem.h
---- pristine-linux-2.6.16.12/include/asm-i386/rwsem.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/pgtable-2level-defs.h tmp-linux-2.6-xen.patch/include/asm-i386/pgtable-2level-defs.h
+--- pristine-linux-2.6.16.13/include/asm-i386/pgtable-2level-defs.h	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/include/asm-i386/pgtable-2level-defs.h	2006-08-15 19:47:06.000000000 +0200
+@@ -1,6 +1,8 @@
+ #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
+ #define _I386_PGTABLE_2LEVEL_DEFS_H
+ 
++#define HAVE_SHARED_KERNEL_PMD 0
++
+ /*
+  * traditional i386 two-level paging structure:
+  */
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/pgtable-3level-defs.h tmp-linux-2.6-xen.patch/include/asm-i386/pgtable-3level-defs.h
+--- pristine-linux-2.6.16.13/include/asm-i386/pgtable-3level-defs.h	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/include/asm-i386/pgtable-3level-defs.h	2006-08-15 19:47:06.000000000 +0200
+@@ -1,6 +1,8 @@
+ #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
+ #define _I386_PGTABLE_3LEVEL_DEFS_H
+ 
++#define HAVE_SHARED_KERNEL_PMD 1
++
+ /*
+  * PGDIR_SHIFT determines what a top-level page table entry can map
+  */
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/rwsem.h tmp-linux-2.6-xen.patch/include/asm-i386/rwsem.h
+--- pristine-linux-2.6.16.13/include/asm-i386/rwsem.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/rwsem.h	2006-04-05 22:43:19.000000000 +0200
 @@ -40,6 +40,7 @@
  
@@ -69835,8 +69707,8 @@
  		: "+r"(tmp), "=m"(sem->count)
  		: "r"(sem), "m"(sem->count)
  		: "memory");
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/smp_alt.h tmp-linux-2.6-xen.patch/include/asm-i386/smp_alt.h
---- pristine-linux-2.6.16.12/include/asm-i386/smp_alt.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/smp_alt.h tmp-linux-2.6-xen.patch/include/asm-i386/smp_alt.h
+--- pristine-linux-2.6.16.13/include/asm-i386/smp_alt.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/smp_alt.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,32 @@
 +#ifndef __ASM_SMP_ALT_H__
@@ -69871,8 +69743,8 @@
 +#endif
 +
 +#endif /* __ASM_SMP_ALT_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/spinlock.h tmp-linux-2.6-xen.patch/include/asm-i386/spinlock.h
---- pristine-linux-2.6.16.12/include/asm-i386/spinlock.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/spinlock.h tmp-linux-2.6-xen.patch/include/asm-i386/spinlock.h
+--- pristine-linux-2.6.16.13/include/asm-i386/spinlock.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/spinlock.h	2006-04-05 22:43:19.000000000 +0200
 @@ -6,6 +6,7 @@
  #include <asm/page.h>
@@ -69956,8 +69828,8 @@
  				 : "=m" (rw->lock) : : "memory");
  }
  
-diff -Nurp pristine-linux-2.6.16.12/include/asm-i386/system.h tmp-linux-2.6-xen.patch/include/asm-i386/system.h
---- pristine-linux-2.6.16.12/include/asm-i386/system.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-i386/system.h tmp-linux-2.6-xen.patch/include/asm-i386/system.h
+--- pristine-linux-2.6.16.13/include/asm-i386/system.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-i386/system.h	2006-04-05 22:43:19.000000000 +0200
 @@ -5,7 +5,7 @@
  #include <linux/kernel.h>
@@ -70057,14 +69929,14 @@
  #else
  #define smp_mb()	barrier()
  #define smp_rmb()	barrier()
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/fixmap.h tmp-linux-2.6-xen.patch/include/asm-ia64/fixmap.h
---- pristine-linux-2.6.16.12/include/asm-ia64/fixmap.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/fixmap.h tmp-linux-2.6-xen.patch/include/asm-ia64/fixmap.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/fixmap.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/fixmap.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,2 @@
 +#define clear_fixmap(x)	do {} while (0)
 +#define	set_fixmap(x,y)	do {} while (0)
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/gcc_intrin.h tmp-linux-2.6-xen.patch/include/asm-ia64/gcc_intrin.h
---- pristine-linux-2.6.16.12/include/asm-ia64/gcc_intrin.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/gcc_intrin.h tmp-linux-2.6-xen.patch/include/asm-ia64/gcc_intrin.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/gcc_intrin.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/gcc_intrin.h	2006-01-05 19:06:51.000000000 +0100
 @@ -26,7 +26,7 @@ extern void ia64_bad_param_for_getreg (v
  
@@ -70255,8 +70127,8 @@
 +#define __ia64_get_psr_i()	(__ia64_getreg(_IA64_REG_PSR) & 0x4000UL)
 +
  #endif /* _ASM_IA64_GCC_INTRIN_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/hypercall.h tmp-linux-2.6-xen.patch/include/asm-ia64/hypercall.h
---- pristine-linux-2.6.16.12/include/asm-ia64/hypercall.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/hypercall.h tmp-linux-2.6-xen.patch/include/asm-ia64/hypercall.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/hypercall.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/hypercall.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,274 @@
 +/******************************************************************************
@@ -70533,8 +70405,8 @@
 +#define do_IRQ(irq, regs) __do_IRQ((irq), (regs))
 +
 +#endif /* __HYPERCALL_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/hypervisor.h tmp-linux-2.6-xen.patch/include/asm-ia64/hypervisor.h
---- pristine-linux-2.6.16.12/include/asm-ia64/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/hypervisor.h tmp-linux-2.6-xen.patch/include/asm-ia64/hypervisor.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/hypervisor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,138 @@
 +/******************************************************************************
@@ -70675,8 +70547,8 @@
 +#define pfn_pte_ma(_x,_y)	__pte_ma(0)
 +
 +#endif /* __HYPERVISOR_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/intel_intrin.h tmp-linux-2.6-xen.patch/include/asm-ia64/intel_intrin.h
---- pristine-linux-2.6.16.12/include/asm-ia64/intel_intrin.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/intel_intrin.h tmp-linux-2.6-xen.patch/include/asm-ia64/intel_intrin.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/intel_intrin.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/intel_intrin.h	2006-01-05 19:06:51.000000000 +0100
 @@ -119,10 +119,10 @@ __s64 _m64_popcnt(__s64 a);
  		 	 * intrinsic
@@ -70800,8 +70672,8 @@
 +#define __ia64_get_psr_i()	(__ia64_getreg(_IA64_REG_PSR) & 0x4000UL)
 +
  #endif /* _ASM_IA64_INTEL_INTRIN_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/meminit.h tmp-linux-2.6-xen.patch/include/asm-ia64/meminit.h
---- pristine-linux-2.6.16.12/include/asm-ia64/meminit.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/meminit.h tmp-linux-2.6-xen.patch/include/asm-ia64/meminit.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/meminit.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/meminit.h	2006-04-05 22:43:19.000000000 +0200
 @@ -17,10 +17,15 @@
   * 	- command line string
@@ -70819,8 +70691,8 @@
  
  struct rsvd_region {
  	unsigned long start;	/* virtual address of beginning of element */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/pal.h tmp-linux-2.6-xen.patch/include/asm-ia64/pal.h
---- pristine-linux-2.6.16.12/include/asm-ia64/pal.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/pal.h tmp-linux-2.6-xen.patch/include/asm-ia64/pal.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/pal.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/pal.h	2006-04-05 22:43:19.000000000 +0200
 @@ -81,6 +81,7 @@
  #ifndef __ASSEMBLY__
@@ -70830,8 +70702,8 @@
  #include <asm/fpu.h>
  
  /*
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/privop.h tmp-linux-2.6-xen.patch/include/asm-ia64/privop.h
---- pristine-linux-2.6.16.12/include/asm-ia64/privop.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/privop.h tmp-linux-2.6-xen.patch/include/asm-ia64/privop.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/privop.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/privop.h	2006-01-05 19:06:51.000000000 +0100
 @@ -0,0 +1,59 @@
 +#ifndef _ASM_IA64_PRIVOP_H
@@ -70893,8 +70765,8 @@
 +#endif /* !__ASSEMBLY */
 +
 +#endif /* _ASM_IA64_PRIVOP_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/processor.h tmp-linux-2.6-xen.patch/include/asm-ia64/processor.h
---- pristine-linux-2.6.16.12/include/asm-ia64/processor.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/processor.h tmp-linux-2.6-xen.patch/include/asm-ia64/processor.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/processor.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/processor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -19,6 +19,7 @@
  #include <asm/kregs.h>
@@ -70904,8 +70776,8 @@
  
  #define IA64_NUM_DBG_REGS	8
  /*
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/synch_bitops.h tmp-linux-2.6-xen.patch/include/asm-ia64/synch_bitops.h
---- pristine-linux-2.6.16.12/include/asm-ia64/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/synch_bitops.h tmp-linux-2.6-xen.patch/include/asm-ia64/synch_bitops.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/synch_bitops.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,61 @@
 +#ifndef __XEN_SYNCH_BITOPS_H__
@@ -70969,8 +70841,8 @@
 + synch_var_test_bit((nr),(addr)))
 +
 +#endif /* __XEN_SYNCH_BITOPS_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/system.h tmp-linux-2.6-xen.patch/include/asm-ia64/system.h
---- pristine-linux-2.6.16.12/include/asm-ia64/system.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/system.h tmp-linux-2.6-xen.patch/include/asm-ia64/system.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/system.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/system.h	2006-04-05 22:43:19.000000000 +0200
 @@ -125,7 +125,7 @@ extern struct ia64_boot_param {
  #define __local_irq_save(x)			\
@@ -70990,8 +70862,8 @@
  
  #define irqs_disabled()				\
  ({						\
-diff -Nurp pristine-linux-2.6.16.12/include/asm-ia64/xen/privop.h tmp-linux-2.6-xen.patch/include/asm-ia64/xen/privop.h
---- pristine-linux-2.6.16.12/include/asm-ia64/xen/privop.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-ia64/xen/privop.h tmp-linux-2.6-xen.patch/include/asm-ia64/xen/privop.h
+--- pristine-linux-2.6.16.13/include/asm-ia64/xen/privop.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-ia64/xen/privop.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,277 @@
 +#ifndef _ASM_IA64_XEN_PRIVOP_H
@@ -71271,8 +71143,8 @@
 +#define	ia64_pal_call_static		xen_pal_call_static
 +
 +#endif /* _ASM_IA64_XEN_PRIVOP_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-um/page.h tmp-linux-2.6-xen.patch/include/asm-um/page.h
---- pristine-linux-2.6.16.12/include/asm-um/page.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-um/page.h tmp-linux-2.6-xen.patch/include/asm-um/page.h
+--- pristine-linux-2.6.16.13/include/asm-um/page.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-um/page.h	2006-04-05 22:43:19.000000000 +0200
 @@ -118,7 +118,7 @@ extern unsigned long uml_physmem;
  extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
@@ -71283,8 +71155,8 @@
  #define HAVE_ARCH_FREE_PAGE
  
  #include <asm-generic/page.h>
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/apic.h tmp-linux-2.6-xen.patch/include/asm-x86_64/apic.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/apic.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/apic.h tmp-linux-2.6-xen.patch/include/asm-x86_64/apic.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/apic.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/apic.h	2006-04-05 22:43:19.000000000 +0200
 @@ -105,11 +105,13 @@ extern int disable_timer_pin_1;
  
@@ -71300,8 +71172,20 @@
  
  #endif /* CONFIG_X86_LOCAL_APIC */
  
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/arch_hooks.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/arch_hooks.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/arch_hooks.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/hw_irq.h tmp-linux-2.6-xen.patch/include/asm-x86_64/hw_irq.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/hw_irq.h	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/include/asm-x86_64/hw_irq.h	2006-08-15 19:47:06.000000000 +0200
+@@ -127,7 +127,7 @@ asmlinkage void IRQ_NAME(nr); \
+ __asm__( \
+ "\n.p2align\n" \
+ "IRQ" #nr "_interrupt:\n\t" \
+-	"push $" #nr "-256 ; " \
++	"push $~(" #nr ") ; " \
+ 	"jmp common_interrupt");
+ 
+ #if defined(CONFIG_X86_IO_APIC)
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/arch_hooks.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/arch_hooks.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/arch_hooks.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/arch_hooks.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,27 @@
 +#ifndef _ASM_ARCH_HOOKS_H
@@ -71331,8 +71215,8 @@
 +extern void mca_nmi_hook(void);
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/bootsetup.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/bootsetup.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/bootsetup.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/bootsetup.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/bootsetup.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/bootsetup.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/bootsetup.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,42 @@
 +
@@ -71377,8 +71261,8 @@
 +#define RAMDISK_LOAD_FLAG		0x4000	
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/desc.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/desc.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/desc.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/desc.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/desc.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/desc.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/desc.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,263 @@
 +/* Written 2000 by Andi Kleen */ 
@@ -71644,8 +71528,8 @@
 +#endif /* !__ASSEMBLY__ */
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/dma-mapping.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/dma-mapping.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/dma-mapping.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/dma-mapping.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/dma-mapping.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/dma-mapping.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/dma-mapping.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,191 @@
 +#ifndef _X8664_DMA_MAPPING_H
@@ -71839,8 +71723,8 @@
 +#endif /* _X8664_DMA_MAPPING_H */
 +
 +#include <asm-i386/mach-xen/asm/dma-mapping.h>
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/fixmap.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/fixmap.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/fixmap.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/fixmap.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/fixmap.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/fixmap.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/fixmap.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,109 @@
 +/*
@@ -71952,8 +71836,8 @@
 +}
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/floppy.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/floppy.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/floppy.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/floppy.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/floppy.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/floppy.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/floppy.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,206 @@
 +/*
@@ -72162,8 +72046,8 @@
 +#define EXTRA_FLOPPY_PARAMS
 +
 +#endif /* __ASM_XEN_X86_64_FLOPPY_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/hw_irq.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hw_irq.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/hw_irq.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/hw_irq.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hw_irq.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/hw_irq.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hw_irq.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,141 @@
 +#ifndef _ASM_HW_IRQ_H
@@ -72307,10 +72191,10 @@
 +#endif
 +
 +#endif /* _ASM_HW_IRQ_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/hypercall.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypercall.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/hypercall.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypercall.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,343 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/hypercall.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypercall.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/hypercall.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypercall.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,333 @@
 +/******************************************************************************
 + * hypercall.h
 + * 
@@ -72644,24 +72528,14 @@
 +}
 +
 +#endif /* __HYPERCALL_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/hypervisor.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypervisor.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/hypervisor.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypervisor.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/hypervisor.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/hypervisor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +#include <asm-i386/mach-xen/asm/hypervisor.h>
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/io.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/io.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/io.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/io.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/io.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/io.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/io.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,359 @@
 +#ifndef _ASM_IO_H
@@ -73023,8 +72897,8 @@
 +#define ARCH_HAS_DEV_MEM
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/irq.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/irq.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/irq.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/irq.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/irq.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/irq.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/irq.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,39 @@
 +#ifndef _ASM_IRQ_H
@@ -73066,10 +72940,10 @@
 +#define __ARCH_HAS_DO_SOFTIRQ 1
 +
 +#endif /* _ASM_IRQ_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/mmu_context.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu_context.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/mmu_context.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu_context.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,134 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/mmu_context.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu_context.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/mmu_context.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu_context.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,136 @@
 +#ifndef __X86_64_MMU_CONTEXT_H
 +#define __X86_64_MMU_CONTEXT_H
 +
@@ -73145,8 +73019,7 @@
 +	struct mmuext_op _op[3], *op = _op;
 +
 +	if (likely(prev != next)) {
-+		if (!next->context.pinned)
-+			mm_pin(next);
++		BUG_ON(!next->context.pinned);
 +
 +		/* stop flush ipis for the previous mm */
 +		clear_bit(cpu, &prev->cpu_vm_mask);
@@ -73199,15 +73072,18 @@
 +	asm volatile("movl %0,%%fs"::"r"(0));  \
 +} while(0)
 +
-+#define activate_mm(prev, next) do {		\
-+	switch_mm((prev),(next),NULL);		\
-+} while (0)
++static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
++{
++	if (!next->context.pinned)
++		mm_pin(next);
++	switch_mm(prev, next, NULL);
++}
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/mmu.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/mmu.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,33 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/mmu.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/mmu.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/mmu.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,37 @@
 +#ifndef __x86_64_MMU_H
 +#define __x86_64_MMU_H
 +
@@ -73238,11 +73114,15 @@
 +/* mm/memory.c:exit_mmap hook */
 +extern void _arch_exit_mmap(struct mm_struct *mm);
 +#define arch_exit_mmap(_mm) _arch_exit_mmap(_mm)
++
++/* kernel/fork.c:dup_mmap hook */
++extern void _arch_dup_mmap(struct mm_struct *mm);
++#define arch_dup_mmap(mm, oldmm) ((void)(oldmm), _arch_dup_mmap(mm))
 +#endif
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/msr.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/msr.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/msr.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/msr.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/msr.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/msr.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/msr.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,399 @@
 +#ifndef X86_64_MSR_H
@@ -73644,8 +73524,8 @@
 +#define MSR_P4_U2L_ESCR1 		0x3b1
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/nmi.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/nmi.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/nmi.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/nmi.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/nmi.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/nmi.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/nmi.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,75 @@
 +/*
@@ -73723,10 +73603,10 @@
 +extern int check_nmi_watchdog(void);
 + 
 +#endif /* ASM_NMI_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/page.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/page.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/page.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/page.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,318 @@
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/page.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/page.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/page.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/page.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,326 @@
 +#ifndef _X86_64_PAGE_H
 +#define _X86_64_PAGE_H
 +
@@ -73814,6 +73694,10 @@
 +
 +extern unsigned long *phys_to_machine_mapping;
 +
++#undef machine_to_phys_mapping
++extern unsigned long *machine_to_phys_mapping;
++extern unsigned int   machine_to_phys_order;
++
 +static inline unsigned long pfn_to_mfn(unsigned long pfn)
 +{
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
@@ -73836,19 +73720,23 @@
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
 +		return mfn;
 +
-+	/*
-+	 * The array access can fail (e.g., device space beyond end of RAM).
-+	 * In such cases it doesn't matter what we return (we return garbage),
-+	 * but we must handle the fault without crashing!
-+	 */
++	if (unlikely((mfn >> machine_to_phys_order) != 0))
++		return end_pfn;
++
++	/* The array access can fail (e.g., device space beyond end of RAM). */
 +	asm (
 +		"1:	movq %1,%0\n"
 +		"2:\n"
++		".section .fixup,\"ax\"\n"
++		"3:	movq %2,%0\n"
++		"	jmp  2b\n"
++		".previous\n"
 +		".section __ex_table,\"a\"\n"
 +		"	.align 8\n"
-+		"	.quad 1b,2b\n"
++		"	.quad 1b,3b\n"
 +		".previous"
-+		: "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) );
++		: "=r" (pfn)
++		: "m" (machine_to_phys_mapping[mfn]), "m" (end_pfn) );
 +
 +	return pfn;
 +}
@@ -74045,8 +73933,8 @@
 +#include <asm-generic/page.h>
 +
 +#endif /* _X86_64_PAGE_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/pci.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pci.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/pci.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/pci.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pci.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/pci.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pci.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,174 @@
 +#ifndef __x8664_PCI_H
@@ -74223,8 +74111,8 @@
 +#define pcibios_scan_all_fns(a, b)	1
 +
 +#endif /* __x8664_PCI_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/pgalloc.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pgalloc.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/pgalloc.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/pgalloc.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pgalloc.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/pgalloc.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pgalloc.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,198 @@
 +#ifndef _X86_64_PGALLOC_H
@@ -74425,8 +74313,8 @@
 +#define __pud_free_tlb(tlb,x)   pud_free((x))
 +
 +#endif /* _X86_64_PGALLOC_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/pgtable.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pgtable.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/pgtable.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/pgtable.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pgtable.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/pgtable.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/pgtable.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,560 @@
 +#ifndef _X86_64_PGTABLE_H
@@ -74989,8 +74877,8 @@
 +#include <asm-generic/pgtable.h>
 +
 +#endif /* _X86_64_PGTABLE_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/processor.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/processor.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/processor.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/processor.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/processor.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/processor.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/processor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,493 @@
 +/*
@@ -75486,8 +75374,8 @@
 +#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
 +
 +#endif /* __ASM_X86_64_PROCESSOR_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/ptrace.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/ptrace.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/ptrace.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/ptrace.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/ptrace.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/ptrace.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/ptrace.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,125 @@
 +#ifndef _X86_64_PTRACE_H
@@ -75615,8 +75503,8 @@
 +#endif
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/smp.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/smp.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/smp.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/smp.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/smp.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/smp.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/smp.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,152 @@
 +#ifndef __ASM_SMP_H
@@ -75771,14 +75659,14 @@
 +
 +#endif
 +
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/synch_bitops.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/synch_bitops.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/synch_bitops.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/synch_bitops.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/synch_bitops.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/synch_bitops.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,2 @@
 +
 +#include <asm-i386/mach-xen/asm/synch_bitops.h>
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/system.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/system.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/system.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/system.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/system.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/system.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/system.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,434 @@
 +#ifndef __ASM_SYSTEM_H
@@ -76215,8 +76103,8 @@
 +extern unsigned long arch_align_stack(unsigned long sp);
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/timer.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/timer.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/timer.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/timer.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/timer.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/timer.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/timer.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,67 @@
 +#ifndef _ASMi386_TIMER_H
@@ -76286,8 +76174,8 @@
 +extern struct init_timer_opts timer_pmtmr_init;
 +#endif
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/tlbflush.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/tlbflush.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/tlbflush.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/tlbflush.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/tlbflush.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/tlbflush.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/tlbflush.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,104 @@
 +#ifndef _X8664_TLBFLUSH_H
@@ -76394,8 +76282,8 @@
 +}
 +
 +#endif /* _X8664_TLBFLUSH_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/vga.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/vga.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/vga.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/vga.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/vga.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/vga.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/vga.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,20 @@
 +/*
@@ -76418,8 +76306,8 @@
 +#define vga_writeb(x,y) (*(y) = (x))
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/xor.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/xor.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/asm/xor.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/xor.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/xor.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/asm/xor.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/asm/xor.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,328 @@
 +/*
@@ -76750,8 +76638,8 @@
 +   We may also be able to load into the L1 only depending on how the cpu
 +   deals with a load to a line that is being prefetched.  */
 +#define XOR_SELECT_TEMPLATE(FASTEST) (&xor_block_sse)
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/irq_vectors.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/irq_vectors.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/irq_vectors.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/irq_vectors.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/irq_vectors.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/irq_vectors.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/irq_vectors.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,123 @@
 +/*
@@ -76877,8 +76765,8 @@
 +#define irq_to_dynirq(_x)	((_x) - DYNIRQ_BASE)
 +
 +#endif /* _ASM_IRQ_VECTORS_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/mach_time.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/mach_time.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/mach_time.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/mach_time.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/mach_time.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/mach_time.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/mach_time.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,122 @@
 +/*
@@ -77003,8 +76891,8 @@
 +}
 +
 +#endif /* !_MACH_TIME_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/mach_timer.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/mach_timer.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/mach_timer.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/mach_timer.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/mach_timer.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/mach_timer.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/mach_timer.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,48 @@
 +/*
@@ -77055,8 +76943,8 @@
 +}
 +
 +#endif /* !_MACH_TIMER_H */
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/setup_arch_post.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/setup_arch_post.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/setup_arch_post.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/setup_arch_post.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/setup_arch_post.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/setup_arch_post.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/setup_arch_post.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,28 @@
 +/**
@@ -77087,8 +76975,8 @@
 +	HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
 +#endif
 +}
-diff -Nurp pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/setup_arch_pre.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/setup_arch_pre.h
---- pristine-linux-2.6.16.12/include/asm-x86_64/mach-xen/setup_arch_pre.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/setup_arch_pre.h tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/setup_arch_pre.h
+--- pristine-linux-2.6.16.13/include/asm-x86_64/mach-xen/setup_arch_pre.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/asm-x86_64/mach-xen/setup_arch_pre.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,5 @@
 +/* Hook to call BIOS initialisation function */
@@ -77096,8 +76984,8 @@
 +#define ARCH_SETUP machine_specific_arch_setup();
 +
 +static void __init machine_specific_arch_setup(void);
-diff -Nurp pristine-linux-2.6.16.12/include/linux/gfp.h tmp-linux-2.6-xen.patch/include/linux/gfp.h
---- pristine-linux-2.6.16.12/include/linux/gfp.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/linux/gfp.h tmp-linux-2.6-xen.patch/include/linux/gfp.h
+--- pristine-linux-2.6.16.13/include/linux/gfp.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/linux/gfp.h	2006-04-05 22:43:19.000000000 +0200
 @@ -98,7 +98,11 @@ static inline int gfp_zone(gfp_t gfp)
   */
@@ -77112,8 +77000,8 @@
  #endif
  
  extern struct page *
-diff -Nurp pristine-linux-2.6.16.12/include/linux/highmem.h tmp-linux-2.6-xen.patch/include/linux/highmem.h
---- pristine-linux-2.6.16.12/include/linux/highmem.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/linux/highmem.h tmp-linux-2.6-xen.patch/include/linux/highmem.h
+--- pristine-linux-2.6.16.13/include/linux/highmem.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/linux/highmem.h	2006-04-05 22:43:19.000000000 +0200
 @@ -13,10 +13,16 @@
  
@@ -77132,9 +77020,25 @@
  
  static inline void *kmap(struct page *page)
  {
-diff -Nurp pristine-linux-2.6.16.12/include/linux/mm.h tmp-linux-2.6-xen.patch/include/linux/mm.h
---- pristine-linux-2.6.16.12/include/linux/mm.h	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/include/linux/mm.h	2006-05-09 12:45:55.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/linux/interrupt.h tmp-linux-2.6-xen.patch/include/linux/interrupt.h
+--- pristine-linux-2.6.16.13/include/linux/interrupt.h	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/include/linux/interrupt.h	2006-08-15 18:07:17.000000000 +0200
+@@ -58,6 +58,12 @@ extern void disable_irq(unsigned int irq
+ extern void enable_irq(unsigned int irq);
+ #endif
+ 
++#ifdef CONFIG_HAVE_IRQ_IGNORE_UNHANDLED
++int irq_ignore_unhandled(unsigned int irq);
++#else
++#define irq_ignore_unhandled(irq) 0
++#endif
++
+ #ifndef __ARCH_SET_SOFTIRQ_PENDING
+ #define set_softirq_pending(x) (local_softirq_pending() = (x))
+ #define or_softirq_pending(x)  (local_softirq_pending() |= (x))
+diff -Nurp pristine-linux-2.6.16.13/include/linux/mm.h tmp-linux-2.6-xen.patch/include/linux/mm.h
+--- pristine-linux-2.6.16.13/include/linux/mm.h	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/include/linux/mm.h	2006-08-15 18:04:18.000000000 +0200
 @@ -166,6 +166,9 @@ extern unsigned int kobjsize(const void 
  #define VM_NONLINEAR	0x00800000	/* Is non-linear (remap_file_pages) */
  #define VM_MAPPED_COPY	0x01000000	/* T if mapped copy of data (nommu mmap) */
@@ -77145,20 +77049,7 @@
  
  #ifndef VM_STACK_DEFAULT_FLAGS		/* arch can override this */
  #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
-@@ -229,9 +232,10 @@ struct page {
- 		unsigned long private;		/* Mapping-private opaque data:
- 					 	 * usually used for buffer_heads
- 						 * if PagePrivate set; used for
--						 * swp_entry_t if PageSwapCache;
-+						 * swp_entry_t if PageSwapCache.
-+						 * When page is free, this
- 						 * indicates order in the buddy
--						 * system if PG_buddy is set.
-+						 * system.
- 						 */
- 		struct address_space *mapping;	/* If low bit clear, points to
- 						 * inode address_space, or NULL.
-@@ -1012,6 +1016,13 @@ struct page *follow_page(struct vm_area_
+@@ -1012,6 +1015,13 @@ struct page *follow_page(struct vm_area_
  #define FOLL_GET	0x04	/* do get_page on page */
  #define FOLL_ANON	0x08	/* give ZERO_PAGE if no pgtable */
  
@@ -77172,8 +77063,19 @@
  #ifdef CONFIG_PROC_FS
  void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
  #else
-diff -Nurp pristine-linux-2.6.16.12/include/linux/skbuff.h tmp-linux-2.6-xen.patch/include/linux/skbuff.h
---- pristine-linux-2.6.16.12/include/linux/skbuff.h	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/linux/rcupdate.h tmp-linux-2.6-xen.patch/include/linux/rcupdate.h
+--- pristine-linux-2.6.16.13/include/linux/rcupdate.h	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/include/linux/rcupdate.h	2006-08-15 19:47:06.000000000 +0200
+@@ -134,6 +134,7 @@ static inline void rcu_bh_qsctr_inc(int 
+ }
+ 
+ extern int rcu_pending(int cpu);
++extern int rcu_needs_cpu(int cpu);
+ 
+ /**
+  * rcu_read_lock - mark the beginning of an RCU read-side critical section.
+diff -Nurp pristine-linux-2.6.16.13/include/linux/skbuff.h tmp-linux-2.6-xen.patch/include/linux/skbuff.h
+--- pristine-linux-2.6.16.13/include/linux/skbuff.h	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/include/linux/skbuff.h	2006-04-05 22:43:19.000000000 +0200
 @@ -189,6 +189,8 @@ enum {
   *	@local_df: allow local fragmentation
@@ -77217,10 +77119,10 @@
  #endif
  
  /**
-diff -Nurp pristine-linux-2.6.16.12/include/xen/balloon.h tmp-linux-2.6-xen.patch/include/xen/balloon.h
---- pristine-linux-2.6.16.12/include/xen/balloon.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/balloon.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,73 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/balloon.h tmp-linux-2.6-xen.patch/include/xen/balloon.h
+--- pristine-linux-2.6.16.13/include/xen/balloon.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/balloon.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,63 @@
 +/******************************************************************************
 + * balloon.h
 + *
@@ -77284,20 +77186,10 @@
 +#define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags)
 +
 +#endif /* __ASM_BALLOON_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/driver_util.h tmp-linux-2.6-xen.patch/include/xen/driver_util.h
---- pristine-linux-2.6.16.12/include/xen/driver_util.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/driver_util.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,26 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/driver_util.h tmp-linux-2.6-xen.patch/include/xen/driver_util.h
+--- pristine-linux-2.6.16.13/include/xen/driver_util.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/driver_util.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,16 @@
 +
 +#ifndef __ASM_XEN_DRIVER_UTIL_H__
 +#define __ASM_XEN_DRIVER_UTIL_H__
@@ -77314,20 +77206,10 @@
 +extern void unlock_vm_area(struct vm_struct *area);
 +
 +#endif /* __ASM_XEN_DRIVER_UTIL_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/evtchn.h tmp-linux-2.6-xen.patch/include/xen/evtchn.h
---- pristine-linux-2.6.16.12/include/xen/evtchn.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/evtchn.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,126 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/evtchn.h tmp-linux-2.6-xen.patch/include/xen/evtchn.h
+--- pristine-linux-2.6.16.13/include/xen/evtchn.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/evtchn.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,116 @@
 +/******************************************************************************
 + * evtchn.h
 + * 
@@ -77444,18 +77326,8 @@
 +extern void notify_remote_via_irq(int irq);
 +
 +#endif /* __ASM_EVTCHN_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/features.h tmp-linux-2.6-xen.patch/include/xen/features.h
---- pristine-linux-2.6.16.12/include/xen/features.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/features.h tmp-linux-2.6-xen.patch/include/xen/features.h
+--- pristine-linux-2.6.16.13/include/xen/features.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/features.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,20 @@
 +/******************************************************************************
@@ -77478,10 +77350,10 @@
 +#define xen_feature(flag)	(xen_features[flag])
 +
 +#endif /* __ASM_XEN_FEATURES_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/foreign_page.h tmp-linux-2.6-xen.patch/include/xen/foreign_page.h
---- pristine-linux-2.6.16.12/include/xen/foreign_page.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/foreign_page.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,40 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/foreign_page.h tmp-linux-2.6-xen.patch/include/xen/foreign_page.h
+--- pristine-linux-2.6.16.13/include/xen/foreign_page.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/foreign_page.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,30 @@
 +/******************************************************************************
 + * foreign_page.h
 + * 
@@ -77512,20 +77384,10 @@
 +	( (void (*) (struct page *)) (page)->mapping )
 +
 +#endif /* __ASM_XEN_FOREIGN_PAGE_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/gnttab.h tmp-linux-2.6-xen.patch/include/xen/gnttab.h
---- pristine-linux-2.6.16.12/include/xen/gnttab.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/gnttab.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,126 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/gnttab.h tmp-linux-2.6-xen.patch/include/xen/gnttab.h
+--- pristine-linux-2.6.16.13/include/xen/gnttab.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/gnttab.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,117 @@
 +/******************************************************************************
 + * gnttab.h
 + * 
@@ -77625,6 +77487,7 @@
 +
 +void gnttab_request_free_callback(struct gnttab_free_callback *callback,
 +				  void (*fn)(void *), void *arg, u16 count);
++void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
 +
 +void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
 +				     unsigned long frame, int readonly);
@@ -77642,18 +77505,8 @@
 +int gnttab_resume(void);
 +
 +#endif /* __ASM_GNTTAB_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/hypervisor_sysfs.h tmp-linux-2.6-xen.patch/include/xen/hypervisor_sysfs.h
---- pristine-linux-2.6.16.12/include/xen/hypervisor_sysfs.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/hypervisor_sysfs.h tmp-linux-2.6-xen.patch/include/xen/hypervisor_sysfs.h
+--- pristine-linux-2.6.16.13/include/xen/hypervisor_sysfs.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/hypervisor_sysfs.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,32 @@
 +/*
@@ -77688,8 +77541,8 @@
 +};
 +
 +#endif /* _HYP_SYSFS_H_ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/acm.h tmp-linux-2.6-xen.patch/include/xen/interface/acm.h
---- pristine-linux-2.6.16.12/include/xen/interface/acm.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/acm.h tmp-linux-2.6-xen.patch/include/xen/interface/acm.h
+--- pristine-linux-2.6.16.13/include/xen/interface/acm.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/acm.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,181 @@
 +/*
@@ -77873,8 +77726,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/acm_ops.h tmp-linux-2.6-xen.patch/include/xen/interface/acm_ops.h
---- pristine-linux-2.6.16.12/include/xen/interface/acm_ops.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/acm_ops.h tmp-linux-2.6-xen.patch/include/xen/interface/acm_ops.h
+--- pristine-linux-2.6.16.13/include/xen/interface/acm_ops.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/acm_ops.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,98 @@
 +/*
@@ -77975,8 +77828,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/arch-ia64.h tmp-linux-2.6-xen.patch/include/xen/interface/arch-ia64.h
---- pristine-linux-2.6.16.12/include/xen/interface/arch-ia64.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/arch-ia64.h tmp-linux-2.6-xen.patch/include/xen/interface/arch-ia64.h
+--- pristine-linux-2.6.16.13/include/xen/interface/arch-ia64.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/arch-ia64.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,337 @@
 +/******************************************************************************
@@ -78316,10 +78169,10 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/arch-x86_32.h tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_32.h
---- pristine-linux-2.6.16.12/include/xen/interface/arch-x86_32.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_32.h	2006-04-05 22:43:20.000000000 +0200
-@@ -0,0 +1,195 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/arch-x86_32.h tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_32.h
+--- pristine-linux-2.6.16.13/include/xen/interface/arch-x86_32.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_32.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,210 @@
 +/******************************************************************************
 + * arch-x86_32.h
 + * 
@@ -78394,16 +78247,23 @@
 + */
 +#ifdef CONFIG_X86_PAE
 +#define __HYPERVISOR_VIRT_START 0xF5800000
++#define __MACH2PHYS_VIRT_START  0xF5800000
++#define __MACH2PHYS_VIRT_END    0xF6800000
 +#else
 +#define __HYPERVISOR_VIRT_START 0xFC000000
++#define __MACH2PHYS_VIRT_START  0xFC000000
++#define __MACH2PHYS_VIRT_END    0xFC400000
 +#endif
 +
 +#ifndef HYPERVISOR_VIRT_START
 +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
 +#endif
 +
++#define MACH2PHYS_VIRT_START  mk_unsigned_long(__MACH2PHYS_VIRT_START)
++#define MACH2PHYS_VIRT_END    mk_unsigned_long(__MACH2PHYS_VIRT_END)
++#define MACH2PHYS_NR_ENTRIES  ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2)
 +#ifndef machine_to_phys_mapping
-+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
++#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
 +#endif
 +
 +/* Maximum number of virtual CPUs in multi-processor guests. */
@@ -78478,6 +78338,14 @@
 +} vcpu_guest_context_t;
 +DEFINE_GUEST_HANDLE(vcpu_guest_context_t);
 +
++/*
++ * Page-directory addresses above 4GB do not fit into architectural %cr3.
++ * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
++ * must use the following accessor macros to pack/unpack valid MFNs.
++ */
++#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
++#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
++
 +typedef struct arch_shared_info {
 +    unsigned long max_pfn;                  /* max pfn that appears in table */
 +    /* Frame containing list of mfns containing list of mfns containing p2m. */
@@ -78515,10 +78383,10 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/arch-x86_64.h tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_64.h
---- pristine-linux-2.6.16.12/include/xen/interface/arch-x86_64.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_64.h	2006-04-05 22:43:20.000000000 +0200
-@@ -0,0 +1,271 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/arch-x86_64.h tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_64.h
+--- pristine-linux-2.6.16.13/include/xen/interface/arch-x86_64.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/interface/arch-x86_64.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,278 @@
 +/******************************************************************************
 + * arch-x86_64.h
 + * 
@@ -78604,22 +78472,26 @@
 +
 +#define __HYPERVISOR_VIRT_START 0xFFFF800000000000
 +#define __HYPERVISOR_VIRT_END   0xFFFF880000000000
++#define __MACH2PHYS_VIRT_START  0xFFFF800000000000
++#define __MACH2PHYS_VIRT_END    0xFFFF804000000000
 +
 +#ifndef HYPERVISOR_VIRT_START
 +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
 +#define HYPERVISOR_VIRT_END   mk_unsigned_long(__HYPERVISOR_VIRT_END)
 +#endif
 +
++#define MACH2PHYS_VIRT_START  mk_unsigned_long(__MACH2PHYS_VIRT_START)
++#define MACH2PHYS_VIRT_END    mk_unsigned_long(__MACH2PHYS_VIRT_END)
++#define MACH2PHYS_NR_ENTRIES  ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3)
++#ifndef machine_to_phys_mapping
++#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
++#endif
++
 +/* Maximum number of virtual CPUs in multi-processor guests. */
 +#define MAX_VIRT_CPUS 32
 +
 +#ifndef __ASSEMBLY__
 +
-+/* The machine->physical mapping table starts at this address, read-only. */
-+#ifndef machine_to_phys_mapping
-+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
-+#endif
-+
 +/*
 + * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
 + *  @which == SEGBASE_*  ;  @base == 64-bit base address
@@ -78753,6 +78625,9 @@
 +} vcpu_guest_context_t;
 +DEFINE_GUEST_HANDLE(vcpu_guest_context_t);
 +
++#define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12)
++#define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12)
++
 +typedef struct arch_shared_info {
 +    unsigned long max_pfn;                  /* max pfn that appears in table */
 +    /* Frame containing list of mfns containing list of mfns containing p2m. */
@@ -78790,8 +78665,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/COPYING tmp-linux-2.6-xen.patch/include/xen/interface/COPYING
---- pristine-linux-2.6.16.12/include/xen/interface/COPYING	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/COPYING tmp-linux-2.6-xen.patch/include/xen/interface/COPYING
+--- pristine-linux-2.6.16.13/include/xen/interface/COPYING	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/COPYING	2006-01-05 19:06:54.000000000 +0100
 @@ -0,0 +1,28 @@
 +XEN NOTICE
@@ -78822,9 +78697,9 @@
 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 +DEALINGS IN THE SOFTWARE.
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/dom0_ops.h tmp-linux-2.6-xen.patch/include/xen/interface/dom0_ops.h
---- pristine-linux-2.6.16.12/include/xen/interface/dom0_ops.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/interface/dom0_ops.h	2006-04-25 11:20:48.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/dom0_ops.h tmp-linux-2.6-xen.patch/include/xen/interface/dom0_ops.h
+--- pristine-linux-2.6.16.13/include/xen/interface/dom0_ops.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/interface/dom0_ops.h	2006-08-15 18:07:17.000000000 +0200
 @@ -0,0 +1,533 @@
 +/******************************************************************************
 + * dom0_ops.h
@@ -78847,7 +78722,7 @@
 + * 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   0x03000000
++#define DOM0_INTERFACE_VERSION   0x03000001
 +
 +/************************************************************************/
 +
@@ -78855,10 +78730,10 @@
 +typedef struct dom0_getmemlist {
 +    /* IN variables. */
 +    domid_t       domain;
-+    unsigned long max_pfns;
++    uint64_t max_pfns;
 +    GUEST_HANDLE(ulong) buffer;
 +    /* OUT variables. */
-+    unsigned long num_pfns;
++    uint64_t num_pfns;
 +} dom0_getmemlist_t;
 +DEFINE_GUEST_HANDLE(dom0_getmemlist_t);
 +
@@ -78919,8 +78794,8 @@
 +#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
 +#define DOMFLAGS_SHUTDOWNSHIFT 16
 +    uint32_t flags;
-+    unsigned long tot_pages;
-+    unsigned long max_pages;
++    uint64_t tot_pages;
++    uint64_t max_pages;
 +    unsigned long shared_info_frame;       /* MFN of shared_info struct */
 +    uint64_t cpu_time;
 +    uint32_t nr_online_vcpus;     /* Number of VCPUs currently online. */
@@ -79044,8 +78919,8 @@
 +    uint32_t sockets_per_node;
 +    uint32_t nr_nodes;
 +    uint32_t cpu_khz;
-+    unsigned long total_pages;
-+    unsigned long free_pages;
++    uint64_t total_pages;
++    uint64_t free_pages;
 +    uint32_t hw_cap[8];
 +} dom0_physinfo_t;
 +DEFINE_GUEST_HANDLE(dom0_physinfo_t);
@@ -79088,7 +78963,7 @@
 +    uint32_t       op;
 +    GUEST_HANDLE(ulong) dirty_bitmap;
 +    /* IN/OUT variables. */
-+    unsigned long  pages;        /* size of buffer, updated with actual size */
++    uint64_t       pages;        /* size of buffer, updated with actual size */
 +    /* OUT variables. */
 +    dom0_shadow_control_stats_t stats;
 +} dom0_shadow_control_t;
@@ -79097,16 +78972,16 @@
 +#define DOM0_SETDOMAINMAXMEM   28
 +typedef struct dom0_setdomainmaxmem {
 +    /* IN variables. */
-+    domid_t       domain;
-+    unsigned long max_memkb;
++    domid_t  domain;
++    uint64_t max_memkb;
 +} dom0_setdomainmaxmem_t;
 +DEFINE_GUEST_HANDLE(dom0_setdomainmaxmem_t);
 +
 +#define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
 +typedef struct dom0_getpageframeinfo2 {
 +    /* IN variables. */
-+    domid_t        domain;
-+    unsigned long  num;
++    domid_t  domain;
++    uint64_t num;
 +    /* IN/OUT variables. */
 +    GUEST_HANDLE(ulong) array;
 +} dom0_getpageframeinfo2_t;
@@ -79123,11 +78998,11 @@
 +typedef struct dom0_add_memtype {
 +    /* IN variables. */
 +    unsigned long mfn;
-+    unsigned long nr_mfns;
-+    uint32_t      type;
++    uint64_t nr_mfns;
++    uint32_t type;
 +    /* OUT variables. */
-+    uint32_t      handle;
-+    uint32_t      reg;
++    uint32_t handle;
++    uint32_t reg;
 +} dom0_add_memtype_t;
 +DEFINE_GUEST_HANDLE(dom0_add_memtype_t);
 +
@@ -79153,7 +79028,7 @@
 +    uint32_t reg;
 +    /* OUT variables. */
 +    unsigned long mfn;
-+    unsigned long nr_mfns;
++    uint64_t nr_mfns;
 +    uint32_t type;
 +} dom0_read_memtype_t;
 +DEFINE_GUEST_HANDLE(dom0_read_memtype_t);
@@ -79290,7 +79165,7 @@
 +typedef struct dom0_iomem_permission {
 +    domid_t  domain;          /* domain to be affected */
 +    unsigned long first_mfn;  /* first page (physical page number) in range */
-+    unsigned long nr_mfns;    /* number of pages in range (>0) */
++    uint64_t nr_mfns;         /* number of pages in range (>0) */
 +    uint8_t allow_access;     /* allow (!0) or deny (0) access to range? */
 +} dom0_iomem_permission_t;
 +DEFINE_GUEST_HANDLE(dom0_iomem_permission_t);
@@ -79359,8 +79234,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/event_channel.h tmp-linux-2.6-xen.patch/include/xen/interface/event_channel.h
---- pristine-linux-2.6.16.12/include/xen/interface/event_channel.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/event_channel.h tmp-linux-2.6-xen.patch/include/xen/interface/event_channel.h
+--- pristine-linux-2.6.16.13/include/xen/interface/event_channel.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/event_channel.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,205 @@
 +/******************************************************************************
@@ -79568,8 +79443,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/features.h tmp-linux-2.6-xen.patch/include/xen/interface/features.h
---- pristine-linux-2.6.16.12/include/xen/interface/features.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/features.h tmp-linux-2.6-xen.patch/include/xen/interface/features.h
+--- pristine-linux-2.6.16.13/include/xen/interface/features.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/features.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,53 @@
 +/******************************************************************************
@@ -79625,8 +79500,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/grant_table.h tmp-linux-2.6-xen.patch/include/xen/interface/grant_table.h
---- pristine-linux-2.6.16.12/include/xen/interface/grant_table.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/grant_table.h tmp-linux-2.6-xen.patch/include/xen/interface/grant_table.h
+--- pristine-linux-2.6.16.13/include/xen/interface/grant_table.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/grant_table.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,311 @@
 +/******************************************************************************
@@ -79940,8 +79815,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/hvm/hvm_info_table.h tmp-linux-2.6-xen.patch/include/xen/interface/hvm/hvm_info_table.h
---- pristine-linux-2.6.16.12/include/xen/interface/hvm/hvm_info_table.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/hvm/hvm_info_table.h tmp-linux-2.6-xen.patch/include/xen/interface/hvm/hvm_info_table.h
+--- pristine-linux-2.6.16.13/include/xen/interface/hvm/hvm_info_table.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/hvm/hvm_info_table.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,24 @@
 +/******************************************************************************
@@ -79968,8 +79843,8 @@
 +};
 +
 +#endif /* __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/hvm/ioreq.h tmp-linux-2.6-xen.patch/include/xen/interface/hvm/ioreq.h
---- pristine-linux-2.6.16.12/include/xen/interface/hvm/ioreq.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/hvm/ioreq.h tmp-linux-2.6-xen.patch/include/xen/interface/hvm/ioreq.h
+--- pristine-linux-2.6.16.13/include/xen/interface/hvm/ioreq.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/hvm/ioreq.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,94 @@
 +/*
@@ -80066,8 +79941,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/hvm/vmx_assist.h tmp-linux-2.6-xen.patch/include/xen/interface/hvm/vmx_assist.h
---- pristine-linux-2.6.16.12/include/xen/interface/hvm/vmx_assist.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/hvm/vmx_assist.h tmp-linux-2.6-xen.patch/include/xen/interface/hvm/vmx_assist.h
+--- pristine-linux-2.6.16.13/include/xen/interface/hvm/vmx_assist.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/hvm/vmx_assist.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,97 @@
 +/*
@@ -80167,8 +80042,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/blkif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/blkif.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/blkif.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/blkif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/blkif.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/blkif.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/blkif.h	2006-01-05 19:06:54.000000000 +0100
 @@ -0,0 +1,85 @@
 +/******************************************************************************
@@ -80256,8 +80131,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/console.h tmp-linux-2.6-xen.patch/include/xen/interface/io/console.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/console.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/console.h tmp-linux-2.6-xen.patch/include/xen/interface/io/console.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/console.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/console.h	2006-01-05 19:06:54.000000000 +0100
 @@ -0,0 +1,33 @@
 +/******************************************************************************
@@ -80293,8 +80168,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/netif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/netif.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/netif.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/netif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/netif.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/netif.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/netif.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,84 @@
 +/******************************************************************************
@@ -80381,8 +80256,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/pciif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/pciif.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/pciif.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/pciif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/pciif.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/pciif.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/pciif.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,55 @@
 +/*
@@ -80440,8 +80315,8 @@
 +};
 +
 +#endif /* __XEN_PCI_COMMON_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/ring.h tmp-linux-2.6-xen.patch/include/xen/interface/io/ring.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/ring.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/ring.h tmp-linux-2.6-xen.patch/include/xen/interface/io/ring.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/ring.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/ring.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,265 @@
 +/******************************************************************************
@@ -80709,8 +80584,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/tpmif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/tpmif.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/tpmif.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/tpmif.h tmp-linux-2.6-xen.patch/include/xen/interface/io/tpmif.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/tpmif.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/tpmif.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,56 @@
 +/******************************************************************************
@@ -80769,8 +80644,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/xenbus.h tmp-linux-2.6-xen.patch/include/xen/interface/io/xenbus.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/xenbus.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/xenbus.h tmp-linux-2.6-xen.patch/include/xen/interface/io/xenbus.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/xenbus.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/xenbus.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,42 @@
 +/*****************************************************************************
@@ -80815,8 +80690,8 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/io/xs_wire.h tmp-linux-2.6-xen.patch/include/xen/interface/io/xs_wire.h
---- pristine-linux-2.6.16.12/include/xen/interface/io/xs_wire.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/io/xs_wire.h tmp-linux-2.6-xen.patch/include/xen/interface/io/xs_wire.h
+--- pristine-linux-2.6.16.13/include/xen/interface/io/xs_wire.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/io/xs_wire.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,97 @@
 +/*
@@ -80916,10 +80791,10 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/memory.h tmp-linux-2.6-xen.patch/include/xen/interface/memory.h
---- pristine-linux-2.6.16.12/include/xen/interface/memory.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/interface/memory.h	2006-04-05 22:43:20.000000000 +0200
-@@ -0,0 +1,155 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/memory.h tmp-linux-2.6-xen.patch/include/xen/interface/memory.h
+--- pristine-linux-2.6.16.13/include/xen/interface/memory.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/interface/memory.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,209 @@
 +/******************************************************************************
 + * memory.h
 + * 
@@ -80932,8 +80807,8 @@
 +#define __XEN_PUBLIC_MEMORY_H__
 +
 +/*
-+ * Increase or decrease the specified domain's memory reservation. Returns a
-+ * -ve errcode on failure, or the # extents successfully allocated or freed.
++ * Increase or decrease the specified domain's memory reservation. Returns the
++ * number of extents successfully allocated or freed.
 + * arg == addr of struct xen_memory_reservation.
 + */
 +#define XENMEM_increase_reservation 0
@@ -80970,11 +80845,52 @@
 +     * Unprivileged domains can specify only DOMID_SELF.
 +     */
 +    domid_t        domid;
-+
 +} xen_memory_reservation_t;
 +DEFINE_GUEST_HANDLE(xen_memory_reservation_t);
 +
 +/*
++ * An atomic exchange of memory pages. If return code is zero then
++ * @out.extent_list provides GMFNs of the newly-allocated memory.
++ * Returns zero on complete success, otherwise a negative error code.
++ * On complete success then always @nr_exchanged == @in.nr_extents.
++ * On partial success @nr_exchanged indicates how much work was done.
++ */
++#define XENMEM_exchange             11
++typedef struct xen_memory_exchange {
++    /*
++     * [IN] Details of memory extents to be exchanged (GMFN bases).
++     * Note that @in.address_bits is ignored and unused.
++     */
++    struct xen_memory_reservation in;
++
++    /*
++     * [IN/OUT] Details of new memory extents.
++     * We require that:
++     *  1. @in.domid == @out.domid
++     *  2. @in.nr_extents  << @in.extent_order == 
++     *     @out.nr_extents << @out.extent_order
++     *  3. @in.extent_start and @out.extent_start lists must not overlap
++     *  4. @out.extent_start lists GPFN bases to be populated
++     *  5. @out.extent_start is overwritten with allocated GMFN bases
++     */
++    struct xen_memory_reservation out;
++
++    /*
++     * [OUT] Number of input extents that were successfully exchanged:
++     *  1. The first @nr_exchanged input extents were successfully
++     *     deallocated.
++     *  2. The corresponding first entries in the output extent list correctly
++     *     indicate the GMFNs that were successfully exchanged.
++     *  3. All other input and output extents are untouched.
++     *  4. If not all input exents are exchanged then the return code of this
++     *     command will be non-zero.
++     *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
++     */
++    unsigned long nr_exchanged;
++} xen_memory_exchange_t;
++DEFINE_GUEST_HANDLE(xen_memory_exchange_t);
++
++/*
 + * Returns the maximum machine frame number of mapped RAM in this system.
 + * This command always succeeds (it never returns an error code).
 + * arg == NULL.
@@ -81019,6 +80935,19 @@
 +DEFINE_GUEST_HANDLE(xen_machphys_mfn_list_t);
 +
 +/*
++ * Returns the location in virtual address space of the machine_to_phys
++ * mapping table. Architectures which do not have a m2p table, or which do not
++ * map it by default into guest address space, do not implement this command.
++ * arg == addr of xen_machphys_mapping_t.
++ */
++#define XENMEM_machphys_mapping     12
++typedef struct xen_machphys_mapping {
++    unsigned long v_start, v_end; /* Start and end virtual addresses.   */
++    unsigned long max_mfn;        /* Maximum MFN that can be looked up. */
++} xen_machphys_mapping_t;
++DEFINE_GUEST_HANDLE(xen_machphys_mapping_t);
++
++/*
 + * Sets the GPFN at which a particular page appears in the specified guest's
 + * pseudophysical address space.
 + * arg == addr of xen_add_to_physmap_t.
@@ -81075,8 +81004,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/nmi.h tmp-linux-2.6-xen.patch/include/xen/interface/nmi.h
---- pristine-linux-2.6.16.12/include/xen/interface/nmi.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/nmi.h tmp-linux-2.6-xen.patch/include/xen/interface/nmi.h
+--- pristine-linux-2.6.16.13/include/xen/interface/nmi.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/nmi.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,59 @@
 +/******************************************************************************
@@ -81138,10 +81067,10 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/physdev.h tmp-linux-2.6-xen.patch/include/xen/interface/physdev.h
---- pristine-linux-2.6.16.12/include/xen/interface/physdev.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/interface/physdev.h	2006-04-05 22:43:20.000000000 +0200
-@@ -0,0 +1,71 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/physdev.h tmp-linux-2.6-xen.patch/include/xen/interface/physdev.h
+--- pristine-linux-2.6.16.13/include/xen/interface/physdev.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/interface/physdev.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,73 @@
 +
 +#ifndef __XEN_PUBLIC_PHYSDEV_H__
 +#define __XEN_PUBLIC_PHYSDEV_H__
@@ -81161,6 +81090,8 @@
 +    /* OUT */
 +/* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
 +#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
++/* IRQ shared by multiple guests? */
++#define PHYSDEVOP_IRQ_SHARED              (1<<1)
 +    uint32_t flags;
 +} physdevop_irq_status_query_t;
 +
@@ -81213,8 +81144,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/sched_ctl.h tmp-linux-2.6-xen.patch/include/xen/interface/sched_ctl.h
---- pristine-linux-2.6.16.12/include/xen/interface/sched_ctl.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/sched_ctl.h tmp-linux-2.6-xen.patch/include/xen/interface/sched_ctl.h
+--- pristine-linux-2.6.16.13/include/xen/interface/sched_ctl.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/sched_ctl.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,64 @@
 +/******************************************************************************
@@ -81281,8 +81212,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/sched.h tmp-linux-2.6-xen.patch/include/xen/interface/sched.h
---- pristine-linux-2.6.16.12/include/xen/interface/sched.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/sched.h tmp-linux-2.6-xen.patch/include/xen/interface/sched.h
+--- pristine-linux-2.6.16.13/include/xen/interface/sched.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/sched.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,87 @@
 +/******************************************************************************
@@ -81372,8 +81303,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/trace.h tmp-linux-2.6-xen.patch/include/xen/interface/trace.h
---- pristine-linux-2.6.16.12/include/xen/interface/trace.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/trace.h tmp-linux-2.6-xen.patch/include/xen/interface/trace.h
+--- pristine-linux-2.6.16.13/include/xen/interface/trace.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/trace.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,86 @@
 +/******************************************************************************
@@ -81462,8 +81393,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/vcpu.h tmp-linux-2.6-xen.patch/include/xen/interface/vcpu.h
---- pristine-linux-2.6.16.12/include/xen/interface/vcpu.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/vcpu.h tmp-linux-2.6-xen.patch/include/xen/interface/vcpu.h
+--- pristine-linux-2.6.16.13/include/xen/interface/vcpu.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/vcpu.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,119 @@
 +/******************************************************************************
@@ -81585,8 +81516,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/version.h tmp-linux-2.6-xen.patch/include/xen/interface/version.h
---- pristine-linux-2.6.16.12/include/xen/interface/version.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/version.h tmp-linux-2.6-xen.patch/include/xen/interface/version.h
+--- pristine-linux-2.6.16.13/include/xen/interface/version.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/version.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,64 @@
 +/******************************************************************************
@@ -81653,8 +81584,8 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/xen-compat.h tmp-linux-2.6-xen.patch/include/xen/interface/xen-compat.h
---- pristine-linux-2.6.16.12/include/xen/interface/xen-compat.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/xen-compat.h tmp-linux-2.6-xen.patch/include/xen/interface/xen-compat.h
+--- pristine-linux-2.6.16.13/include/xen/interface/xen-compat.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/xen-compat.h	2006-04-05 22:43:20.000000000 +0200
 @@ -0,0 +1,31 @@
 +/******************************************************************************
@@ -81688,8 +81619,8 @@
 +#endif
 +
 +#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/interface/xen.h tmp-linux-2.6-xen.patch/include/xen/interface/xen.h
---- pristine-linux-2.6.16.12/include/xen/interface/xen.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/interface/xen.h tmp-linux-2.6-xen.patch/include/xen/interface/xen.h
+--- pristine-linux-2.6.16.13/include/xen/interface/xen.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/interface/xen.h	2006-04-05 22:43:21.000000000 +0200
 @@ -0,0 +1,451 @@
 +/******************************************************************************
@@ -82143,10 +82074,10 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/net_driver_util.h tmp-linux-2.6-xen.patch/include/xen/net_driver_util.h
---- pristine-linux-2.6.16.12/include/xen/net_driver_util.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/net_driver_util.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,58 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/net_driver_util.h tmp-linux-2.6-xen.patch/include/xen/net_driver_util.h
+--- pristine-linux-2.6.16.13/include/xen/net_driver_util.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/net_driver_util.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,48 @@
 +/*****************************************************************************
 + *
 + * Utility functions for Xen network devices.
@@ -82195,18 +82126,8 @@
 +
 +
 +#endif /* _ASM_XEN_NET_DRIVER_UTIL_H */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/pcifront.h tmp-linux-2.6-xen.patch/include/xen/pcifront.h
---- pristine-linux-2.6.16.12/include/xen/pcifront.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/pcifront.h tmp-linux-2.6-xen.patch/include/xen/pcifront.h
+--- pristine-linux-2.6.16.13/include/xen/pcifront.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/pcifront.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,39 @@
 +/*
@@ -82248,10 +82169,10 @@
 +#endif /* __KERNEL__ */
 +
 +#endif /* __XEN_ASM_PCIFRONT_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/public/evtchn.h tmp-linux-2.6-xen.patch/include/xen/public/evtchn.h
---- pristine-linux-2.6.16.12/include/xen/public/evtchn.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/public/evtchn.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,101 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/public/evtchn.h tmp-linux-2.6-xen.patch/include/xen/public/evtchn.h
+--- pristine-linux-2.6.16.13/include/xen/public/evtchn.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/public/evtchn.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,91 @@
 +/******************************************************************************
 + * evtchn.h
 + * 
@@ -82343,20 +82264,10 @@
 +	_IOC(_IOC_NONE, 'E', 5, 0)
 +
 +#endif /* __LINUX_PUBLIC_EVTCHN_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/public/privcmd.h tmp-linux-2.6-xen.patch/include/xen/public/privcmd.h
---- pristine-linux-2.6.16.12/include/xen/public/privcmd.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/public/privcmd.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,94 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/public/privcmd.h tmp-linux-2.6-xen.patch/include/xen/public/privcmd.h
+--- pristine-linux-2.6.16.13/include/xen/public/privcmd.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/public/privcmd.h	2006-08-15 18:07:17.000000000 +0200
+@@ -0,0 +1,86 @@
 +/******************************************************************************
 + * privcmd.h
 + * 
@@ -82392,20 +82303,22 @@
 +#ifndef __LINUX_PUBLIC_PRIVCMD_H__
 +#define __LINUX_PUBLIC_PRIVCMD_H__
 +
++#include <linux/types.h>
++
 +#ifndef __user
 +#define __user
 +#endif
 +
 +typedef struct privcmd_hypercall
 +{
-+	unsigned long op;
-+	unsigned long arg[5];
++	__u64 op;
++	__u64 arg[5];
 +} privcmd_hypercall_t;
 +
 +typedef struct privcmd_mmap_entry {
-+	unsigned long va;
-+	unsigned long mfn;
-+	unsigned long npages;
++	__u64 va;
++	__u64 mfn;
++	__u64 npages;
 +} privcmd_mmap_entry_t; 
 +
 +typedef struct privcmd_mmap {
@@ -82417,7 +82330,7 @@
 +typedef struct privcmd_mmapbatch {
 +	int num;     /* number of pages to populate */
 +	domid_t dom; /* target domain */
-+	unsigned long addr;  /* virtual address */
++	__u64 addr;  /* virtual address */
 +	unsigned long __user *arr; /* array of mfns - top nibble set on err */
 +} privcmd_mmapbatch_t; 
 +
@@ -82441,18 +82354,8 @@
 +	_IOC(_IOC_NONE, 'P', 3, sizeof(privcmd_mmapbatch_t))
 +
 +#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/tpmfe.h tmp-linux-2.6-xen.patch/include/xen/tpmfe.h
---- pristine-linux-2.6.16.12/include/xen/tpmfe.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/tpmfe.h tmp-linux-2.6-xen.patch/include/xen/tpmfe.h
+--- pristine-linux-2.6.16.13/include/xen/tpmfe.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/tpmfe.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,40 @@
 +#ifndef TPM_FE_H
@@ -82495,10 +82398,10 @@
 +void tpm_fe_unregister_receiver(void);
 +
 +#endif
-diff -Nurp pristine-linux-2.6.16.12/include/xen/xenbus.h tmp-linux-2.6-xen.patch/include/xen/xenbus.h
---- pristine-linux-2.6.16.12/include/xen/xenbus.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/xenbus.h	2006-04-28 23:38:29.000000000 +0200
-@@ -0,0 +1,306 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/xenbus.h tmp-linux-2.6-xen.patch/include/xen/xenbus.h
+--- pristine-linux-2.6.16.13/include/xen/xenbus.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/xenbus.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,296 @@
 +/******************************************************************************
 + * xenbus.h
 + *
@@ -82795,18 +82698,8 @@
 +
 +
 +#endif /* _XEN_XENBUS_H */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/xencons.h tmp-linux-2.6-xen.patch/include/xen/xencons.h
---- pristine-linux-2.6.16.12/include/xen/xencons.h	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/include/xen/xencons.h tmp-linux-2.6-xen.patch/include/xen/xencons.h
+--- pristine-linux-2.6.16.13/include/xen/xencons.h	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/include/xen/xencons.h	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,14 @@
 +#ifndef __ASM_XENCONS_H__
@@ -82823,10 +82716,10 @@
 +int xencons_ring_send(const char *data, unsigned len);
 +
 +#endif /* __ASM_XENCONS_H__ */
-diff -Nurp pristine-linux-2.6.16.12/include/xen/xen_proc.h tmp-linux-2.6-xen.patch/include/xen/xen_proc.h
---- pristine-linux-2.6.16.12/include/xen/xen_proc.h	1970-01-01 01:00:00.000000000 +0100
-+++ tmp-linux-2.6-xen.patch/include/xen/xen_proc.h	2006-04-05 22:43:19.000000000 +0200
-@@ -0,0 +1,23 @@
+diff -Nurp pristine-linux-2.6.16.13/include/xen/xen_proc.h tmp-linux-2.6-xen.patch/include/xen/xen_proc.h
+--- pristine-linux-2.6.16.13/include/xen/xen_proc.h	1970-01-01 01:00:00.000000000 +0100
++++ tmp-linux-2.6-xen.patch/include/xen/xen_proc.h	2006-08-15 18:04:18.000000000 +0200
+@@ -0,0 +1,13 @@
 +
 +#ifndef __ASM_XEN_PROC_H__
 +#define __ASM_XEN_PROC_H__
@@ -82840,18 +82733,34 @@
 +	const char *name);
 +
 +#endif /* __ASM_XEN_PROC_H__ */
-+
-+/*
-+ * Local variables:
-+ *  c-file-style: "linux"
-+ *  indent-tabs-mode: t
-+ *  c-indent-level: 8
-+ *  c-basic-offset: 8
-+ *  tab-width: 8
-+ * End:
-+ */
-diff -Nurp pristine-linux-2.6.16.12/kernel/Kconfig.preempt tmp-linux-2.6-xen.patch/kernel/Kconfig.preempt
---- pristine-linux-2.6.16.12/kernel/Kconfig.preempt	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/kernel/fork.c tmp-linux-2.6-xen.patch/kernel/fork.c
+--- pristine-linux-2.6.16.13/kernel/fork.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/kernel/fork.c	2006-08-15 18:07:17.000000000 +0200
+@@ -274,6 +274,9 @@ static inline int dup_mmap(struct mm_str
+ 		if (retval)
+ 			goto out;
+ 	}
++#ifdef arch_dup_mmap
++	arch_dup_mmap(mm, oldmm);
++#endif
+ 	retval = 0;
+ out:
+ 	up_write(&mm->mmap_sem);
+diff -Nurp pristine-linux-2.6.16.13/kernel/irq/spurious.c tmp-linux-2.6-xen.patch/kernel/irq/spurious.c
+--- pristine-linux-2.6.16.13/kernel/irq/spurious.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/kernel/irq/spurious.c	2006-08-15 18:07:17.000000000 +0200
+@@ -137,7 +137,8 @@ void note_interrupt(unsigned int irq, ir
+ 			struct pt_regs *regs)
+ {
+ 	if (action_ret != IRQ_HANDLED) {
+-		desc->irqs_unhandled++;
++		if (!irq_ignore_unhandled(irq))
++			desc->irqs_unhandled++;
+ 		if (action_ret != IRQ_NONE)
+ 			report_bad_irq(irq, desc, action_ret);
+ 	}
+diff -Nurp pristine-linux-2.6.16.13/kernel/Kconfig.preempt tmp-linux-2.6-xen.patch/kernel/Kconfig.preempt
+--- pristine-linux-2.6.16.13/kernel/Kconfig.preempt	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/kernel/Kconfig.preempt	2006-04-05 22:43:19.000000000 +0200
 @@ -35,6 +35,7 @@ config PREEMPT_VOLUNTARY
  
@@ -82861,8 +82770,32 @@
  	help
  	  This option reduces the latency of the kernel by making
  	  all kernel code (that is not executing in a critical section)
-diff -Nurp pristine-linux-2.6.16.12/lib/Makefile tmp-linux-2.6-xen.patch/lib/Makefile
---- pristine-linux-2.6.16.12/lib/Makefile	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/kernel/rcupdate.c tmp-linux-2.6-xen.patch/kernel/rcupdate.c
+--- pristine-linux-2.6.16.13/kernel/rcupdate.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/kernel/rcupdate.c	2006-08-15 19:47:06.000000000 +0200
+@@ -485,6 +485,20 @@ int rcu_pending(int cpu)
+ 		__rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
+ }
+ 
++/*
++ * Check to see if any future RCU-related work will need to be done
++ * by the current CPU, even if none need be done immediately, returning
++ * 1 if so.  This function is part of the RCU implementation; it is -not-
++ * an exported member of the RCU API.
++ */
++int rcu_needs_cpu(int cpu)
++{
++	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
++	struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);
++
++	return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu));
++}
++
+ void rcu_check_callbacks(int cpu, int user)
+ {
+ 	if (user || 
+diff -Nurp pristine-linux-2.6.16.13/lib/Makefile tmp-linux-2.6-xen.patch/lib/Makefile
+--- pristine-linux-2.6.16.13/lib/Makefile	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/lib/Makefile	2006-04-05 22:43:19.000000000 +0200
 @@ -45,6 +45,9 @@ obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o
  obj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o
@@ -82874,8 +82807,8 @@
  
  hostprogs-y	:= gen_crc32table
  clean-files	:= crc32table.h
-diff -Nurp pristine-linux-2.6.16.12/mm/highmem.c tmp-linux-2.6-xen.patch/mm/highmem.c
---- pristine-linux-2.6.16.12/mm/highmem.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/mm/highmem.c tmp-linux-2.6-xen.patch/mm/highmem.c
+--- pristine-linux-2.6.16.13/mm/highmem.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/mm/highmem.c	2006-04-05 22:43:19.000000000 +0200
 @@ -152,6 +152,17 @@ start:
  	return vaddr;
@@ -82895,8 +82828,8 @@
  void fastcall *kmap_high(struct page *page)
  {
  	unsigned long vaddr;
-diff -Nurp pristine-linux-2.6.16.12/mm/Kconfig tmp-linux-2.6-xen.patch/mm/Kconfig
---- pristine-linux-2.6.16.12/mm/Kconfig	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/mm/Kconfig tmp-linux-2.6-xen.patch/mm/Kconfig
+--- pristine-linux-2.6.16.13/mm/Kconfig	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/mm/Kconfig	2006-04-05 22:43:19.000000000 +0200
 @@ -126,11 +126,14 @@ comment "Memory hotplug is currently inc
  # Default to 4 for wider testing, though 8 might be more appropriate.
@@ -82913,8 +82846,8 @@
  	default "4"
  
  #
-diff -Nurp pristine-linux-2.6.16.12/mm/memory.c tmp-linux-2.6-xen.patch/mm/memory.c
---- pristine-linux-2.6.16.12/mm/memory.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/mm/memory.c tmp-linux-2.6-xen.patch/mm/memory.c
+--- pristine-linux-2.6.16.13/mm/memory.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/mm/memory.c	2006-04-05 22:43:19.000000000 +0200
 @@ -405,7 +405,8 @@ struct page *vm_normal_page(struct vm_ar
  	 * Remove this test eventually!
@@ -83053,8 +82986,8 @@
  /*
   * handle_pte_fault chooses page fault handler according to an entry
   * which was read non-atomically.  Before making any commitment, on
-diff -Nurp pristine-linux-2.6.16.12/mm/mmap.c tmp-linux-2.6-xen.patch/mm/mmap.c
---- pristine-linux-2.6.16.12/mm/mmap.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/mm/mmap.c tmp-linux-2.6-xen.patch/mm/mmap.c
+--- pristine-linux-2.6.16.13/mm/mmap.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/mm/mmap.c	2006-04-05 22:43:19.000000000 +0200
 @@ -1937,6 +1937,10 @@ void exit_mmap(struct mm_struct *mm)
  	unsigned long nr_accounted = 0;
@@ -83067,86 +83000,10 @@
  	lru_add_drain();
  	flush_cache_mm(mm);
  	tlb = tlb_gather_mmu(mm, 1);
-diff -Nurp pristine-linux-2.6.16.12/mm/page_alloc.c tmp-linux-2.6-xen.patch/mm/page_alloc.c
---- pristine-linux-2.6.16.12/mm/page_alloc.c	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/mm/page_alloc.c	2006-04-05 22:43:19.000000000 +0200
-@@ -153,8 +153,7 @@ static void bad_page(struct page *page)
- 			1 << PG_reclaim |
- 			1 << PG_slab    |
- 			1 << PG_swapcache |
--			1 << PG_writeback |
--			1 << PG_buddy );
-+			1 << PG_writeback );
- 	set_page_count(page, 0);
- 	reset_page_mapcount(page);
- 	page->mapping = NULL;
-@@ -225,12 +224,12 @@ static inline unsigned long page_order(s
- 
- static inline void set_page_order(struct page *page, int order) {
- 	set_page_private(page, order);
--	__SetPageBuddy(page);
-+	__SetPagePrivate(page);
- }
- 
- static inline void rmv_page_order(struct page *page)
- {
--	__ClearPageBuddy(page);
-+	__ClearPagePrivate(page);
- 	set_page_private(page, 0);
- }
- 
-@@ -269,13 +268,11 @@ __find_combined_index(unsigned long page
-  * This function checks whether a page is free && is the buddy
-  * we can do coalesce a page and its buddy if
-  * (a) the buddy is not in a hole &&
-- * (b) the buddy is in the buddy system &&
-- * (c) a page and its buddy have the same order.
-- *
-- * For recording whether a page is in the buddy system, we use PG_buddy.
-- * Setting, clearing, and testing PG_buddy is serialized by zone->lock.
-+ * (b) the buddy is free &&
-+ * (c) the buddy is on the buddy system &&
-+ * (d) a page and its buddy have the same order.
-+ * for recording page's order, we use page_private(page) and PG_private.
-  *
-- * For recording page's order, we use page_private(page).
-  */
- static inline int page_is_buddy(struct page *page, int order)
- {
-@@ -284,10 +281,10 @@ static inline int page_is_buddy(struct p
- 		return 0;
- #endif
- 
--	if (PageBuddy(page) && page_order(page) == order) {
--		BUG_ON(page_count(page) != 0);
-+       if (PagePrivate(page)           &&
-+           (page_order(page) == order) &&
-+            page_count(page) == 0)
-                return 1;
--	}
-        return 0;
- }
- 
-@@ -304,7 +301,7 @@ static inline int page_is_buddy(struct p
-  * as necessary, plus some accounting needed to play nicely with other
-  * parts of the VM system.
-  * At each level, we keep a list of pages, which are heads of continuous
-- * free pages of length of (1 << order) and marked with PG_buddy. Page's
-+ * free pages of length of (1 << order) and marked with PG_Private.Page's
-  * order is recorded in page_private(page) field.
-  * So when we are allocating or freeing one, we can derive the state of the
-  * other.  That is, if we allocate a small block, and both were   
-@@ -367,8 +364,7 @@ static inline int free_pages_check(struc
- 			1 << PG_slab	|
- 			1 << PG_swapcache |
- 			1 << PG_writeback |
--			1 << PG_reserved |
--			1 << PG_buddy ))))
-+			1 << PG_reserved ))))
- 		bad_page(page);
- 	if (PageDirty(page))
- 		__ClearPageDirty(page);
-@@ -422,7 +418,8 @@ static void __free_pages_ok(struct page 
+diff -Nurp pristine-linux-2.6.16.13/mm/page_alloc.c tmp-linux-2.6-xen.patch/mm/page_alloc.c
+--- pristine-linux-2.6.16.13/mm/page_alloc.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/mm/page_alloc.c	2006-08-15 18:04:18.000000000 +0200
+@@ -422,7 +422,8 @@ static void __free_pages_ok(struct page 
  	int i;
  	int reserved = 0;
  
@@ -83156,17 +83013,7 @@
  	if (!PageHighMem(page))
  		mutex_debug_check_no_locks_freed(page_address(page),
  						 PAGE_SIZE<<order);
-@@ -526,8 +523,7 @@ static int prep_new_page(struct page *pa
- 			1 << PG_slab    |
- 			1 << PG_swapcache |
- 			1 << PG_writeback |
--			1 << PG_reserved |
--			1 << PG_buddy ))))
-+			1 << PG_reserved ))))
- 		bad_page(page);
- 
- 	/*
-@@ -716,7 +712,8 @@ static void fastcall free_hot_cold_page(
+@@ -716,7 +717,8 @@ static void fastcall free_hot_cold_page(
  	struct per_cpu_pages *pcp;
  	unsigned long flags;
  
@@ -83176,9 +83023,9 @@
  
  	if (PageAnon(page))
  		page->mapping = NULL;
-diff -Nurp pristine-linux-2.6.16.12/net/core/dev.c tmp-linux-2.6-xen.patch/net/core/dev.c
---- pristine-linux-2.6.16.12/net/core/dev.c	2006-05-01 21:14:26.000000000 +0200
-+++ tmp-linux-2.6-xen.patch/net/core/dev.c	2006-04-25 11:20:48.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/net/core/dev.c tmp-linux-2.6-xen.patch/net/core/dev.c
+--- pristine-linux-2.6.16.13/net/core/dev.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/net/core/dev.c	2006-08-15 18:04:18.000000000 +0200
 @@ -116,6 +116,12 @@
  #endif	/* CONFIG_NET_RADIO */
  #include <asm/current.h>
@@ -83269,19 +83116,6 @@
  	list_for_each_entry_rcu(ptype, &ptype_all, list) {
  		if (!ptype->dev || ptype->dev == skb->dev) {
  			if (pt_prev) 
-@@ -2932,11 +2994,11 @@ void netdev_run_todo(void)
- 
- 		switch(dev->reg_state) {
- 		case NETREG_REGISTERING:
--			dev->reg_state = NETREG_REGISTERED;
- 			err = netdev_register_sysfs(dev);
- 			if (err)
- 				printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
- 				       dev->name, err);
-+			dev->reg_state = NETREG_REGISTERED;
- 			break;
- 
- 		case NETREG_UNREGISTERING:
 @@ -3300,6 +3362,7 @@ EXPORT_SYMBOL(unregister_netdevice_notif
  EXPORT_SYMBOL(net_enable_timestamp);
  EXPORT_SYMBOL(net_disable_timestamp);
@@ -83290,8 +83124,8 @@
  
  #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
  EXPORT_SYMBOL(br_handle_frame_hook);
-diff -Nurp pristine-linux-2.6.16.12/net/core/skbuff.c tmp-linux-2.6-xen.patch/net/core/skbuff.c
---- pristine-linux-2.6.16.12/net/core/skbuff.c	2006-05-01 21:14:26.000000000 +0200
+diff -Nurp pristine-linux-2.6.16.13/net/core/skbuff.c tmp-linux-2.6-xen.patch/net/core/skbuff.c
+--- pristine-linux-2.6.16.13/net/core/skbuff.c	2006-05-02 23:38:44.000000000 +0200
 +++ tmp-linux-2.6-xen.patch/net/core/skbuff.c	2006-04-05 22:43:19.000000000 +0200
 @@ -132,6 +132,7 @@ void skb_under_panic(struct sk_buff *skb
   *	Buffers may only be allocated from interrupts using a @gfp_mask of
@@ -83378,8 +83212,72 @@
  	C(pkt_type);
  	C(ip_summed);
  	C(priority);
-diff -Nurp pristine-linux-2.6.16.12/scripts/Makefile.xen tmp-linux-2.6-xen.patch/scripts/Makefile.xen
---- pristine-linux-2.6.16.12/scripts/Makefile.xen	1970-01-01 01:00:00.000000000 +0100
+diff -Nurp pristine-linux-2.6.16.13/net/ipv4/netfilter/ip_nat_proto_tcp.c tmp-linux-2.6-xen.patch/net/ipv4/netfilter/ip_nat_proto_tcp.c
+--- pristine-linux-2.6.16.13/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-08-15 19:47:06.000000000 +0200
+@@ -129,10 +129,14 @@ tcp_manip_pkt(struct sk_buff **pskb,
+ 	if (hdrsize < sizeof(*hdr))
+ 		return 1;
+ 
+-	hdr->check = ip_nat_cheat_check(~oldip, newip,
++	if ((*pskb)->proto_csum_blank) {
++		hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
++	} else {
++		hdr->check = ip_nat_cheat_check(~oldip, newip,
+ 					ip_nat_cheat_check(oldport ^ 0xFFFF,
+ 							   newport,
+ 							   hdr->check));
++	}
+ 	return 1;
+ }
+ 
+diff -Nurp pristine-linux-2.6.16.13/net/ipv4/netfilter/ip_nat_proto_udp.c tmp-linux-2.6-xen.patch/net/ipv4/netfilter/ip_nat_proto_udp.c
+--- pristine-linux-2.6.16.13/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-08-15 19:47:06.000000000 +0200
+@@ -113,11 +113,16 @@ udp_manip_pkt(struct sk_buff **pskb,
+ 		newport = tuple->dst.u.udp.port;
+ 		portptr = &hdr->dest;
+ 	}
+-	if (hdr->check) /* 0 is a special case meaning no checksum */
+-		hdr->check = ip_nat_cheat_check(~oldip, newip,
++	if (hdr->check) { /* 0 is a special case meaning no checksum */
++		if ((*pskb)->proto_csum_blank) {
++			hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
++		} else {
++			hdr->check = ip_nat_cheat_check(~oldip, newip,
+ 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
+ 							   newport,
+ 							   hdr->check));
++		}
++	}
+ 	*portptr = newport;
+ 	return 1;
+ }
+diff -Nurp pristine-linux-2.6.16.13/net/ipv4/xfrm4_output.c tmp-linux-2.6-xen.patch/net/ipv4/xfrm4_output.c
+--- pristine-linux-2.6.16.13/net/ipv4/xfrm4_output.c	2006-05-02 23:38:44.000000000 +0200
++++ tmp-linux-2.6-xen.patch/net/ipv4/xfrm4_output.c	2006-08-15 19:47:06.000000000 +0200
+@@ -17,6 +17,8 @@
+ #include <net/xfrm.h>
+ #include <net/icmp.h>
+ 
++extern int skb_checksum_setup(struct sk_buff *skb);
++
+ /* Add encapsulation header.
+  *
+  * In transport mode, the IP header will be moved forward to make space
+@@ -103,6 +105,10 @@ static int xfrm4_output_one(struct sk_bu
+ 	struct xfrm_state *x = dst->xfrm;
+ 	int err;
+ 	
++	err = skb_checksum_setup(skb);
++	if (err)
++		goto error_nolock;
++
+ 	if (skb->ip_summed == CHECKSUM_HW) {
+ 		err = skb_checksum_help(skb, 0);
+ 		if (err)
+diff -Nurp pristine-linux-2.6.16.13/scripts/Makefile.xen tmp-linux-2.6-xen.patch/scripts/Makefile.xen
+--- pristine-linux-2.6.16.13/scripts/Makefile.xen	1970-01-01 01:00:00.000000000 +0100
 +++ tmp-linux-2.6-xen.patch/scripts/Makefile.xen	2006-04-05 22:43:19.000000000 +0200
 @@ -0,0 +1,14 @@
 +



More information about the Kernel-svn-changes mailing list