[kernel] r6197 - in dists/trunk/linux-2.6/debian: arch/amd64 arch/i386 patches patches/series

Bastian Blank waldi at costa.debian.org
Fri Mar 17 20:46:33 UTC 2006


Author: waldi
Date: Fri Mar 17 20:46:01 2006
New Revision: 6197

Added:
   dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21966.patch
      - copied, changed from r6033, dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21940.patch
Removed:
   dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21940.patch
   dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21966-update.patch
Modified:
   dists/trunk/linux-2.6/debian/arch/amd64/defines
   dists/trunk/linux-2.6/debian/arch/i386/defines
   dists/trunk/linux-2.6/debian/patches/series/0experimental.1-extra
Log:
* debian/arch/amd64/defines,
  debian/arch/i386/defines: Reenable xen.
* debian/patches/series/0experimental.1-extra
  - Use new xen patch.
  - Use wildcards.
* debian/patches/xen-tree-merge-21940.patch,
  debian/patches/xen-tree-merge-21966-update.patch: Remove.
* debian/patches/xen-tree-merge-21966.patch: Add.


Modified: dists/trunk/linux-2.6/debian/arch/amd64/defines
==============================================================================
--- dists/trunk/linux-2.6/debian/arch/amd64/defines	(original)
+++ dists/trunk/linux-2.6/debian/arch/amd64/defines	Fri Mar 17 20:46:01 2006
@@ -9,7 +9,7 @@
 kernel-header-dirs: x86_64
 subarches:
  vserver
-# xen
+ xen
 
 [image]
 depends: e2fsprogs (>= 1.35-7)

Modified: dists/trunk/linux-2.6/debian/arch/i386/defines
==============================================================================
--- dists/trunk/linux-2.6/debian/arch/i386/defines	(original)
+++ dists/trunk/linux-2.6/debian/arch/i386/defines	Fri Mar 17 20:46:01 2006
@@ -9,7 +9,7 @@
 kernel-header-dirs: i386
 subarches:
  vserver
-# xen
+ xen
 
 [image]
 suggests: grub | lilo (>= 19.1)

Modified: dists/trunk/linux-2.6/debian/patches/series/0experimental.1-extra
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/0experimental.1-extra	(original)
+++ dists/trunk/linux-2.6/debian/patches/series/0experimental.1-extra	Fri Mar 17 20:46:01 2006
@@ -2,6 +2,6 @@
 + arm-nslu2-maclist.patch arm armeb
 + vserver-version.patch *_vserver
 + vserver-vs2.0.2-rc12.patch *_vserver
-+ xen-tree-merge-21940.patch amd64_xen i386_xen
++ xen-tree-merge-21966.patch *_xen
 + mips-tulip.patch mipsel
 + mips-tulip_dc21143.patch mipsel

Copied: dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21966.patch (from r6033, dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21940.patch)
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21940.patch	(original)
+++ dists/trunk/linux-2.6/debian/patches/xen-tree-merge-21966.patch	Fri Mar 17 20:46:01 2006
@@ -1,32 +1,8 @@
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/boot-xen/Makefile linux-2.6-merge.hg/arch/i386/boot-xen/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/boot-xen/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/boot-xen/Makefile	2006-02-18 12:03:32.000000000 +0000
-@@ -0,0 +1,21 @@
-+
-+OBJCOPYFLAGS := -g --strip-unneeded
-+
-+vmlinuz: vmlinux-stripped FORCE
-+	$(call if_changed,gzip)
-+
-+vmlinux-stripped: vmlinux FORCE
-+	$(call if_changed,objcopy)
-+
-+INSTALL_ROOT := $(patsubst %/boot,%,$(INSTALL_PATH))
-+
-+XINSTALL_NAME ?= $(KERNELRELEASE)
-+install:
-+	mkdir -p $(INSTALL_ROOT)/boot
-+	ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
-+	rm -f $(INSTALL_ROOT)/boot/vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-+	install -m0644 vmlinuz $(INSTALL_ROOT)/boot/vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-+	install -m0644 vmlinux $(INSTALL_ROOT)/boot/vmlinux-syms-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-+	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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/Kconfig linux-2.6-merge.hg/arch/i386/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/Kconfig	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/Kconfig	2006-02-27 15:49:39.000000000 +0000
-@@ -58,6 +58,15 @@
+diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
+index 5b1a7d4..6a4988c 100644
+--- a/arch/i386/Kconfig
++++ b/arch/i386/Kconfig
+@@ -58,6 +58,15 @@ config X86_PC
  	help
  	  Choose this option if your computer is a standard PC or compatible.
  
@@ -42,7 +18,7 @@
  config X86_ELAN
  	bool "AMD Elan"
  	help
-@@ -159,6 +168,7 @@
+@@ -159,6 +168,7 @@ source "arch/i386/Kconfig.cpu"
  
  config HPET_TIMER
  	bool "HPET Timer Support"
@@ -50,7 +26,7 @@
  	help
  	  This enables the use of the HPET for the kernel's internal timer.
  	  HPET is the next generation timer replacing legacy 8254s.
-@@ -202,6 +212,19 @@
+@@ -202,6 +212,19 @@ config SMP
  
  	  If you don't know what to do here, say N.
  
@@ -70,7 +46,7 @@
  config NR_CPUS
  	int "Maximum number of CPUs (2-255)"
  	range 2 255
-@@ -218,7 +241,7 @@
+@@ -218,7 +241,7 @@ config NR_CPUS
  
  config SCHED_SMT
  	bool "SMT (Hyperthreading) scheduler support"
@@ -79,7 +55,7 @@
  	default off
  	help
  	  SMT scheduler support improves the CPU scheduler's decision making
-@@ -230,7 +253,7 @@
+@@ -230,7 +253,7 @@ source "kernel/Kconfig.preempt"
  
  config X86_UP_APIC
  	bool "Local APIC support on uniprocessors"
@@ -88,7 +64,7 @@
  	help
  	  A local APIC (Advanced Programmable Interrupt Controller) is an
  	  integrated interrupt controller in the CPU. If you have a single-CPU
-@@ -255,12 +278,12 @@
+@@ -255,12 +278,12 @@ config X86_UP_IOAPIC
  
  config X86_LOCAL_APIC
  	bool
@@ -103,7 +79,7 @@
  	default y
  
  config X86_VISWS_APIC
-@@ -268,9 +291,14 @@
+@@ -268,9 +291,14 @@ config X86_VISWS_APIC
  	depends on X86_VISWS
  	default y
  
@@ -119,7 +95,7 @@
  	---help---
  	  Machine Check Exception support allows the processor to notify the
  	  kernel if it detects a problem (e.g. overheating, component failure).
-@@ -360,6 +388,7 @@
+@@ -360,6 +388,7 @@ config X86_REBOOTFIXUPS
  
  config MICROCODE
  	tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
@@ -127,7 +103,7 @@
  	---help---
  	  If you say Y here and also to "/dev file system support" in the
  	  'File systems' section, you will be able to update the microcode on
-@@ -377,6 +406,7 @@
+@@ -377,6 +406,7 @@ config MICROCODE
  
  config X86_MSR
  	tristate "/dev/cpu/*/msr - Model-specific register support"
@@ -135,7 +111,7 @@
  	help
  	  This device gives privileged processes access to the x86
  	  Model-Specific Registers (MSRs).  It is a character device with
-@@ -392,6 +422,10 @@
+@@ -392,6 +422,10 @@ config X86_CPUID
  	  with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
  	  /dev/cpu/31/cpuid.
  
@@ -146,7 +122,7 @@
  source "drivers/firmware/Kconfig"
  
  choice
-@@ -560,7 +594,7 @@
+@@ -560,7 +594,7 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
  
  config HIGHPTE
  	bool "Allocate 3rd-level pagetables from highmem"
@@ -155,7 +131,7 @@
  	help
  	  The VM uses one page table entry for each page of physical memory.
  	  For systems with a lot of RAM, this can be wasteful of precious
-@@ -569,6 +603,7 @@
+@@ -569,6 +603,7 @@ config HIGHPTE
  
  config MATH_EMULATION
  	bool "Math emulation"
@@ -163,7 +139,7 @@
  	---help---
  	  Linux can emulate a math coprocessor (used for floating point
  	  operations) if you don't have one. 486DX and Pentium processors have
-@@ -594,6 +629,8 @@
+@@ -594,6 +629,8 @@ config MATH_EMULATION
  
  config MTRR
  	bool "MTRR (Memory Type Range Register) support"
@@ -172,7 +148,7 @@
  	---help---
  	  On Intel P6 family processors (Pentium Pro, Pentium II and later)
  	  the Memory Type Range Registers (MTRRs) may be used to control
-@@ -628,7 +665,7 @@
+@@ -628,7 +665,7 @@ config MTRR
  
  config EFI
  	bool "Boot from EFI support (EXPERIMENTAL)"
@@ -181,7 +157,7 @@
  	default n
  	---help---
  	This enables the the kernel to boot on EFI platforms using
-@@ -646,7 +683,7 @@
+@@ -646,7 +683,7 @@ config EFI
  
  config IRQBALANCE
   	bool "Enable kernel irq balancing"
@@ -190,7 +166,7 @@
  	default y
  	help
   	  The default yes will allow the kernel to do irq load balancing.
-@@ -689,7 +726,7 @@
+@@ -689,7 +726,7 @@ source kernel/Kconfig.hz
  
  config KEXEC
  	bool "kexec system call (EXPERIMENTAL)"
@@ -199,7 +175,7 @@
  	help
  	  kexec is a system call that implements the ability to shutdown your
  	  current kernel, and to start another kernel.  It is like a reboot
-@@ -743,6 +780,7 @@
+@@ -743,6 +780,7 @@ config HOTPLUG_CPU
  config DOUBLEFAULT
  	default y
  	bool "Enable doublefault exception handler" if EMBEDDED
@@ -207,7 +183,7 @@
  	help
            This option allows trapping of rare doublefault exceptions that
            would otherwise cause a system to silently reboot. Disabling this
-@@ -753,18 +791,20 @@
+@@ -753,18 +791,20 @@ endmenu
  
  
  menu "Power management options (ACPI, APM)"
@@ -231,7 +207,7 @@
  	---help---
  	  APM is a BIOS specification for saving power using several different
  	  techniques. This is mostly useful for battery powered laptops with
-@@ -949,6 +989,7 @@
+@@ -949,6 +989,7 @@ choice
  
  config PCI_GOBIOS
  	bool "BIOS"
@@ -239,7 +215,7 @@
  
  config PCI_GOMMCONFIG
  	bool "MMConfig"
-@@ -956,6 +997,13 @@
+@@ -956,6 +997,13 @@ config PCI_GOMMCONFIG
  config PCI_GODIRECT
  	bool "Direct"
  
@@ -253,7 +229,7 @@
  config PCI_GOANY
  	bool "Any"
  
-@@ -963,7 +1011,7 @@
+@@ -963,7 +1011,7 @@ endchoice
  
  config PCI_BIOS
  	bool
@@ -262,7 +238,7 @@
  	default y
  
  config PCI_DIRECT
-@@ -976,6 +1024,18 @@
+@@ -976,6 +1024,18 @@ config PCI_MMCONFIG
  	depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
  	default y
  
@@ -281,7 +257,7 @@
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
-@@ -986,7 +1046,7 @@
+@@ -986,7 +1046,7 @@ config ISA_DMA_API
  
  config ISA
  	bool "ISA support"
@@ -290,7 +266,7 @@
  	help
  	  Find out whether you have ISA slots on your motherboard.  ISA is the
  	  name of a bus system, i.e. the way the CPU talks to the other stuff
-@@ -1013,7 +1073,7 @@
+@@ -1013,7 +1073,7 @@ config EISA
  source "drivers/eisa/Kconfig"
  
  config MCA
@@ -299,7 +275,7 @@
  	default y if X86_VOYAGER
  	help
  	  MicroChannel Architecture is found in some IBM PS/2 machines and
-@@ -1056,7 +1116,9 @@
+@@ -1056,7 +1116,9 @@ source "fs/Kconfig"
  menu "Instrumentation Support"
  	depends on EXPERIMENTAL
  
@@ -309,7 +285,7 @@
  
  config KPROBES
  	bool "Kprobes (EXPERIMENTAL)"
-@@ -1075,6 +1137,8 @@
+@@ -1075,6 +1137,8 @@ source "security/Kconfig"
  
  source "crypto/Kconfig"
  
@@ -318,7 +294,7 @@
  source "lib/Kconfig"
  
  #
-@@ -1100,7 +1164,7 @@
+@@ -1100,7 +1164,7 @@ config X86_SMP
  
  config X86_HT
  	bool
@@ -327,7 +303,7 @@
  	default y
  
  config X86_BIOS_REBOOT
-@@ -1113,6 +1177,21 @@
+@@ -1113,6 +1177,21 @@ config X86_TRAMPOLINE
  	depends on X86_SMP || (X86_VOYAGER && SMP)
  	default y
  
@@ -349,10 +325,11 @@
  config KTIME_SCALAR
  	bool
  	default y
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/Kconfig.cpu linux-2.6-merge.hg/arch/i386/Kconfig.cpu
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/Kconfig.cpu	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/Kconfig.cpu	2006-02-21 16:06:09.000000000 +0000
-@@ -251,7 +251,7 @@
+diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu
+index 79603b3..a52d7d4 100644
+--- a/arch/i386/Kconfig.cpu
++++ b/arch/i386/Kconfig.cpu
+@@ -251,7 +251,7 @@ config X86_PPRO_FENCE
  
  config X86_F00F_BUG
  	bool
@@ -361,10 +338,163 @@
  	default y
  
  config X86_WP_WORKS_OK
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/acpi/boot-xen.c linux-2.6-merge.hg/arch/i386/kernel/acpi/boot-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/acpi/boot-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/acpi/boot-xen.c	2006-02-27 15:49:39.000000000 +0000
-@@ -0,0 +1,1161 @@
+diff --git a/arch/i386/Makefile b/arch/i386/Makefile
+index 36bef65..757acb8 100644
+--- a/arch/i386/Makefile
++++ b/arch/i386/Makefile
+@@ -68,6 +68,10 @@ mcore-$(CONFIG_X86_BIGSMP)	:= mach-defau
+ mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit
+ mcore-$(CONFIG_X86_SUMMIT)  := mach-default
+ 
++# Xen subarch support
++mflags-$(CONFIG_X86_XEN)	:= -Iinclude/asm-i386/mach-xen
++mcore-$(CONFIG_X86_XEN)		:= mach-xen
++
+ # generic subarchitecture
+ mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic
+ mcore-$(CONFIG_X86_GENERICARCH) := mach-default
+@@ -96,12 +100,25 @@ drivers-$(CONFIG_PM)			+= arch/i386/powe
+ 
+ CFLAGS += $(mflags-y)
+ AFLAGS += $(mflags-y)
++CPPFLAGS += $(mflags-y)
+ 
+ boot := arch/i386/boot
+ 
+ .PHONY: zImage bzImage compressed zlilo bzlilo \
+ 	zdisk bzdisk fdimage fdimage144 fdimage288 install
+ 
++ifdef CONFIG_XEN
++head-y := arch/i386/kernel/head-xen.o arch/i386/kernel/init_task-xen.o
++boot := arch/i386/boot-xen
++.PHONY: vmlinuz
++all: vmlinuz
++
++vmlinuz: vmlinux
++	$(Q)$(MAKE) $(build)=$(boot) $@
++
++install:
++	$(Q)$(MAKE) $(build)=$(boot) XENGUEST=$(XENGUEST) $@
++else
+ all: bzImage
+ 
+ # KBUILD_IMAGE specify target image being built
+@@ -124,6 +141,7 @@ fdimage fdimage144 fdimage288: vmlinux
+ 
+ install:
+ 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
++endif
+ 
+ archclean:
+ 	$(Q)$(MAKE) $(clean)=arch/i386/boot
+diff --git a/arch/i386/boot-xen/Makefile b/arch/i386/boot-xen/Makefile
+new file mode 100644
+index 0000000..bf15a77
+--- /dev/null
++++ b/arch/i386/boot-xen/Makefile
+@@ -0,0 +1,21 @@
++
++OBJCOPYFLAGS := -g --strip-unneeded
++
++vmlinuz: vmlinux-stripped FORCE
++	$(call if_changed,gzip)
++
++vmlinux-stripped: vmlinux FORCE
++	$(call if_changed,objcopy)
++
++INSTALL_ROOT := $(patsubst %/boot,%,$(INSTALL_PATH))
++
++XINSTALL_NAME ?= $(KERNELRELEASE)
++install:
++	mkdir -p $(INSTALL_ROOT)/boot
++	ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
++	rm -f $(INSTALL_ROOT)/boot/vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
++	install -m0644 vmlinuz $(INSTALL_ROOT)/boot/vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
++	install -m0644 vmlinux $(INSTALL_ROOT)/boot/vmlinux-syms-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
++	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 --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
+index 65656c0..5661a9b 100644
+--- a/arch/i386/kernel/Makefile
++++ b/arch/i386/kernel/Makefile
+@@ -37,17 +37,26 @@ obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
+ obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
+ obj-$(CONFIG_VM86)		+= vm86.o
+ obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
++obj-$(CONFIG_SMP_ALTERNATIVES)	+= smpalts.o
+ 
+ EXTRA_AFLAGS   := -traditional
+ 
+ obj-$(CONFIG_SCx200)		+= scx200.o
+ 
++ifdef CONFIG_XEN
++vsyscall_note := vsyscall-note-xen.o
++else
++vsyscall_note := vsyscall-note.o
++endif
++
++VSYSCALL_TYPES-y			:= int80
++VSYSCALL_TYPES-$(CONFIG_X86_SYSENTER)	+= sysenter
+ # vsyscall.o contains the vsyscall DSO images as __initdata.
+ # We must build both images before we can assemble it.
+ # Note: kbuild does not track this dependency due to usage of .incbin
+-$(obj)/vsyscall.o: $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so
+-targets += $(foreach F,int80 sysenter,vsyscall-$F.o vsyscall-$F.so)
+-targets += vsyscall-note.o vsyscall.lds
++$(obj)/vsyscall.o: $(foreach F,$(VSYSCALL_TYPES-y),$(obj)/vsyscall-$F.so)
++targets += $(foreach F,$(VSYSCALL_TYPES-y),vsyscall-$F.o vsyscall-$F.so)
++targets += $(vsyscall_note) vsyscall.lds
+ 
+ # The DSO images are built using a special linker script.
+ quiet_cmd_syscall = SYSCALL $@
+@@ -62,7 +71,7 @@ SYSCFLAGS_vsyscall-int80.so	= $(vsyscall
+ 
+ $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
+ $(obj)/vsyscall-%.so: $(src)/vsyscall.lds \
+-		      $(obj)/vsyscall-%.o $(obj)/vsyscall-note.o FORCE
++		      $(obj)/vsyscall-%.o $(obj)/$(vsyscall_note) FORCE
+ 	$(call if_changed,syscall)
+ 
+ # We also create a special relocatable object that should mirror the symbol
+@@ -74,5 +83,18 @@ $(obj)/built-in.o: ld_flags += -R $(obj)
+ 
+ SYSCFLAGS_vsyscall-syms.o = -r
+ $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
+-			$(obj)/vsyscall-sysenter.o $(obj)/vsyscall-note.o FORCE
++			$(foreach F,$(VSYSCALL_TYPES-y),$(obj)/vsyscall-$F.o) \
++			$(obj)/$(vsyscall_note) FORCE
+ 	$(call if_changed,syscall)
++
++ifdef CONFIG_XEN
++include $(srctree)/scripts/Makefile.xen
++
++obj-y += fixup.o
++microcode-$(subst m,y,$(CONFIG_MICROCODE)) := microcode-xen.o
++n-obj-xen := i8259.o timers/ reboot.o smpboot.o trampoline.o
++
++obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
++obj-y := $(call cherrypickxen, $(obj-y))
++extra-y := $(call cherrypickxen, $(extra-y))
++endif
+diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile
+index 7e9ac99..fa783e6 100644
+--- a/arch/i386/kernel/acpi/Makefile
++++ b/arch/i386/kernel/acpi/Makefile
+@@ -6,3 +6,7 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),)
+ obj-y				+= cstate.o processor.o
+ endif
+ 
++ifdef CONFIG_XEN
++include $(srctree)/scripts/Makefile.xen
++obj-y := $(call cherrypickxen, $(obj-y), $(src))
++endif
+diff --git a/arch/i386/kernel/acpi/boot-xen.c b/arch/i386/kernel/acpi/boot-xen.c
+new file mode 100644
+index 0000000..29b491e
+--- /dev/null
++++ b/arch/i386/kernel/acpi/boot-xen.c
+@@ -0,0 +1,1163 @@
 +/*
 + *  boot.c - Architecture-Specific Low-Level ACPI Boot Support
 + *
@@ -411,6 +541,8 @@
 +extern int gsi_irq_sharing(int gsi);
 +#include <asm/proto.h>
 +
++static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return 0; }
++
 +#else				/* X86 */
 +
 +#ifdef	CONFIG_X86_LOCAL_APIC
@@ -1526,20 +1658,11 @@
 +
 +	return 0;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/acpi/Makefile linux-2.6-merge.hg/arch/i386/kernel/acpi/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/acpi/Makefile	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/acpi/Makefile	2006-02-11 17:24:45.000000000 +0000
-@@ -6,3 +6,7 @@
- obj-y				+= cstate.o processor.o
- endif
- 
-+ifdef CONFIG_XEN
-+include $(srctree)/scripts/Makefile.xen
-+obj-y := $(call cherrypickxen, $(obj-y), $(src))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/apic-xen.c linux-2.6-merge.hg/arch/i386/kernel/apic-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/apic-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/apic-xen.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/i386/kernel/apic-xen.c b/arch/i386/kernel/apic-xen.c
+new file mode 100644
+index 0000000..07a0994
+--- /dev/null
++++ b/arch/i386/kernel/apic-xen.c
 @@ -0,0 +1,140 @@
 +/*
 + *	Local APIC handling, local APIC timers
@@ -1681,9 +1804,10 @@
 +
 +	return 0;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/asm-offsets.c linux-2.6-merge.hg/arch/i386/kernel/asm-offsets.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/asm-offsets.c	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/asm-offsets.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/asm-offsets.c b/arch/i386/kernel/asm-offsets.c
+index 36d66e2..3c4a0f4 100644
+--- a/arch/i386/kernel/asm-offsets.c
++++ b/arch/i386/kernel/asm-offsets.c
 @@ -13,6 +13,7 @@
  #include <asm/fixmap.h>
  #include <asm/processor.h>
@@ -1692,7 +1816,7 @@
  
  #define DEFINE(sym, val) \
          asm volatile("\n->" #sym " %0 " #val : : "i" (val))
-@@ -63,10 +64,12 @@
+@@ -63,10 +64,12 @@ void foo(void)
  	OFFSET(pbe_orig_address, pbe, orig_address);
  	OFFSET(pbe_next, pbe, next);
  
@@ -1706,9 +1830,24 @@
 -	DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL));
 +	DEFINE(VSYSCALL_BASE, VSYSCALL_BASE);
  }
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/common-xen.c linux-2.6-merge.hg/arch/i386/kernel/cpu/common-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/common-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/cpu/common-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/cpu/Makefile b/arch/i386/kernel/cpu/Makefile
+index 010aecf..753f1d7 100644
+--- a/arch/i386/kernel/cpu/Makefile
++++ b/arch/i386/kernel/cpu/Makefile
+@@ -17,3 +17,8 @@ obj-$(CONFIG_X86_MCE)	+=	mcheck/
+ 
+ obj-$(CONFIG_MTRR)	+= 	mtrr/
+ obj-$(CONFIG_CPU_FREQ)	+=	cpufreq/
++
++ifdef CONFIG_XEN
++include $(srctree)/scripts/Makefile.xen
++obj-y := $(call cherrypickxen, $(obj-y), $(src))
++endif
+diff --git a/arch/i386/kernel/cpu/common-xen.c b/arch/i386/kernel/cpu/common-xen.c
+new file mode 100644
+index 0000000..2fc25e8
+--- /dev/null
++++ b/arch/i386/kernel/cpu/common-xen.c
 @@ -0,0 +1,723 @@
 +#include <linux/init.h>
 +#include <linux/string.h>
@@ -2433,10 +2572,11 @@
 +	per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm;
 +}
 +#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/cpufreq/Kconfig linux-2.6-merge.hg/arch/i386/kernel/cpu/cpufreq/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/cpufreq/Kconfig	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/cpu/cpufreq/Kconfig	2006-02-11 17:24:45.000000000 +0000
-@@ -158,7 +158,7 @@
+diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig
+index 26892d2..be1850c 100644
+--- a/arch/i386/kernel/cpu/cpufreq/Kconfig
++++ b/arch/i386/kernel/cpu/cpufreq/Kconfig
+@@ -158,7 +158,7 @@ config X86_SPEEDSTEP_ICH
  config X86_SPEEDSTEP_SMI
  	tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)"
  	select CPU_FREQ_TABLE
@@ -2445,21 +2585,26 @@
  	help
  	  This adds the CPUFreq driver for certain mobile Intel Pentium III
  	  (Coppermine), all mobile Intel Pentium III-M (Tualatin)  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/Makefile linux-2.6-merge.hg/arch/i386/kernel/cpu/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/Makefile	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/cpu/Makefile	2006-02-11 17:24:45.000000000 +0000
-@@ -17,3 +17,8 @@
+diff --git a/arch/i386/kernel/cpu/mtrr/Makefile b/arch/i386/kernel/cpu/mtrr/Makefile
+index a25b701..06df4fe 100644
+--- a/arch/i386/kernel/cpu/mtrr/Makefile
++++ b/arch/i386/kernel/cpu/mtrr/Makefile
+@@ -3,3 +3,10 @@ obj-y		+= amd.o
+ obj-y		+= cyrix.o
+ obj-y		+= centaur.o
  
- obj-$(CONFIG_MTRR)	+= 	mtrr/
- obj-$(CONFIG_CPU_FREQ)	+=	cpufreq/
-+
 +ifdef CONFIG_XEN
 +include $(srctree)/scripts/Makefile.xen
-+obj-y := $(call cherrypickxen, $(obj-y), $(src))
++n-obj-xen := generic.o state.o amd.o cyrix.o centaur.o
++
++obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
++obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/mtrr/main-xen.c linux-2.6-merge.hg/arch/i386/kernel/cpu/mtrr/main-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/mtrr/main-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/cpu/mtrr/main-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/cpu/mtrr/main-xen.c b/arch/i386/kernel/cpu/mtrr/main-xen.c
+new file mode 100644
+index 0000000..407cc78
+--- /dev/null
++++ b/arch/i386/kernel/cpu/mtrr/main-xen.c
 @@ -0,0 +1,187 @@
 +#include <linux/init.h>
 +#include <linux/proc_fs.h>
@@ -2648,29 +2793,19 @@
 +}
 +
 +subsys_initcall(mtrr_init);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/mtrr/Makefile linux-2.6-merge.hg/arch/i386/kernel/cpu/mtrr/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/cpu/mtrr/Makefile	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/cpu/mtrr/Makefile	2006-02-11 17:24:45.000000000 +0000
-@@ -3,3 +3,10 @@
- obj-y		+= cyrix.o
- obj-y		+= centaur.o
- 
-+ifdef CONFIG_XEN
-+include $(srctree)/scripts/Makefile.xen
-+n-obj-xen := generic.o state.o amd.o cyrix.o centaur.o
-+
-+obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
-+obj-y := $(call cherrypickxen, $(obj-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/early_printk-xen.c linux-2.6-merge.hg/arch/i386/kernel/early_printk-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/early_printk-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/early_printk-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/early_printk-xen.c b/arch/i386/kernel/early_printk-xen.c
+new file mode 100644
+index 0000000..7a5d206
+--- /dev/null
++++ b/arch/i386/kernel/early_printk-xen.c
 @@ -0,0 +1,2 @@
 +
 +#include "../../x86_64/kernel/early_printk-xen.c"
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/entry-xen.S linux-2.6-merge.hg/arch/i386/kernel/entry-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/entry-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/entry-xen.S	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/i386/kernel/entry-xen.S b/arch/i386/kernel/entry-xen.S
+new file mode 100644
+index 0000000..a86e8f5
+--- /dev/null
++++ b/arch/i386/kernel/entry-xen.S
 @@ -0,0 +1,857 @@
 +/*
 + *  linux/arch/i386/entry.S
@@ -3234,7 +3369,7 @@
 +	jmp  ret_from_intr
 +
 +        ALIGN
-+restore_all_enable_events:  
++restore_all_enable_events:
 +	XEN_LOCKED_UNBLOCK_EVENTS(%esi)
 +scrit:	/**** START OF CRITICAL REGION ****/
 +	XEN_TEST_PENDING(%esi)
@@ -3251,7 +3386,7 @@
 +# registers are in each frame. We do this quickly using the lookup table
 +# 'critical_fixup_table'. For each byte offset in the critical region, it
 +# provides the number of bytes which have already been popped from the
-+# interrupted stack frame. 
++# interrupted stack frame.
 +critical_region_fixup:
 +	addl $critical_fixup_table-scrit,%eax
 +	movzbl (%eax),%eax		# %eax contains num bytes popped
@@ -3529,9 +3664,11 @@
 +#include "syscall_table.S"
 +
 +syscall_table_size=(.-sys_call_table)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/fixup.c linux-2.6-merge.hg/arch/i386/kernel/fixup.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/fixup.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/fixup.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/fixup.c b/arch/i386/kernel/fixup.c
+new file mode 100644
+index 0000000..5188b23
+--- /dev/null
++++ b/arch/i386/kernel/fixup.c
 @@ -0,0 +1,95 @@
 +/******************************************************************************
 + * fixup.c
@@ -3628,10 +3765,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/head-xen.S linux-2.6-merge.hg/arch/i386/kernel/head-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/head-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/head-xen.S	2006-02-27 15:49:39.000000000 +0000
-@@ -0,0 +1,173 @@
+diff --git a/arch/i386/kernel/head-xen.S b/arch/i386/kernel/head-xen.S
+new file mode 100644
+index 0000000..3032a00
+--- /dev/null
++++ b/arch/i386/kernel/head-xen.S
+@@ -0,0 +1,171 @@
 +
 +
 +.text
@@ -3664,8 +3803,6 @@
 +	/* Set up the stack pointer */
 +	movl $(init_thread_union+THREAD_SIZE),%esp
 +
-+checkCPUtype:
-+
 +	/* get vendor info */
 +	xorl %eax,%eax			# call CPUID with 0 -> return vendor ID
 +	cpuid
@@ -3805,9 +3942,11 @@
 +#endif
 +	.ascii	",LOADER=generic"
 +	.byte	0
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/init_task-xen.c linux-2.6-merge.hg/arch/i386/kernel/init_task-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/init_task-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/init_task-xen.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/i386/kernel/init_task-xen.c b/arch/i386/kernel/init_task-xen.c
+new file mode 100644
+index 0000000..c4da1cc
+--- /dev/null
++++ b/arch/i386/kernel/init_task-xen.c
 @@ -0,0 +1,51 @@
 +#include <linux/mm.h>
 +#include <linux/module.h>
@@ -3860,9 +3999,11 @@
 +DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
 +#endif
 +
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/io_apic-xen.c linux-2.6-merge.hg/arch/i386/kernel/io_apic-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/io_apic-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/io_apic-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/io_apic-xen.c b/arch/i386/kernel/io_apic-xen.c
+new file mode 100644
+index 0000000..53704a5
+--- /dev/null
++++ b/arch/i386/kernel/io_apic-xen.c
 @@ -0,0 +1,2730 @@
 +/*
 + *	Intel IO-APIC support for multi-Pentium hosts.
@@ -3927,8 +4068,8 @@
 +	int ret;
 +
 +	op.cmd = PHYSDEVOP_APIC_READ;
-+	op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid;
-+	op.u.apic_op.offset = reg;
++	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
++	op.u.apic_op.reg = reg;
 +	ret = HYPERVISOR_physdev_op(&op);
 +	if (ret)
 +		return ret;
@@ -3940,8 +4081,8 @@
 +	physdev_op_t op;
 +
 +	op.cmd = PHYSDEVOP_APIC_WRITE;
-+	op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid;
-+	op.u.apic_op.offset = reg;
++	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
++	op.u.apic_op.reg = reg;
 +	op.u.apic_op.value = value;
 +	HYPERVISOR_physdev_op(&op);
 +}
@@ -6594,9 +6735,11 @@
 +}
 +
 +#endif /* CONFIG_ACPI */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/ioport-xen.c linux-2.6-merge.hg/arch/i386/kernel/ioport-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/ioport-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/ioport-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/ioport-xen.c b/arch/i386/kernel/ioport-xen.c
+new file mode 100644
+index 0000000..fe395b1
+--- /dev/null
++++ b/arch/i386/kernel/ioport-xen.c
 @@ -0,0 +1,122 @@
 +/*
 + *	linux/arch/i386/kernel/ioport.c
@@ -6720,9 +6863,11 @@
 +	set_iopl_mask(t->iopl);
 +	return 0;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/irq-xen.c linux-2.6-merge.hg/arch/i386/kernel/irq-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/irq-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/irq-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/irq-xen.c b/arch/i386/kernel/irq-xen.c
+new file mode 100644
+index 0000000..d4b9753
+--- /dev/null
++++ b/arch/i386/kernel/irq-xen.c
 @@ -0,0 +1,306 @@
 +/*
 + *	linux/arch/i386/kernel/irq.c
@@ -7030,9 +7175,11 @@
 +}
 +#endif
 +
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/ldt-xen.c linux-2.6-merge.hg/arch/i386/kernel/ldt-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/ldt-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/ldt-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/ldt-xen.c b/arch/i386/kernel/ldt-xen.c
+new file mode 100644
+index 0000000..06970d9
+--- /dev/null
++++ b/arch/i386/kernel/ldt-xen.c
 @@ -0,0 +1,269 @@
 +/*
 + * linux/kernel/ldt.c
@@ -7303,71 +7450,11 @@
 +	}
 +	return ret;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/Makefile linux-2.6-merge.hg/arch/i386/kernel/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/Makefile	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/Makefile	2006-02-27 15:49:39.000000000 +0000
-@@ -37,17 +37,26 @@
- obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
- obj-$(CONFIG_VM86)		+= vm86.o
- obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
-+obj-$(CONFIG_SMP_ALTERNATIVES)	+= smpalts.o
- 
- EXTRA_AFLAGS   := -traditional
- 
- obj-$(CONFIG_SCx200)		+= scx200.o
- 
-+ifdef CONFIG_XEN
-+vsyscall_note := vsyscall-note-xen.o
-+else
-+vsyscall_note := vsyscall-note.o
-+endif
-+
-+VSYSCALL_TYPES-y			:= int80
-+VSYSCALL_TYPES-$(CONFIG_X86_SYSENTER)	+= sysenter
- # vsyscall.o contains the vsyscall DSO images as __initdata.
- # We must build both images before we can assemble it.
- # Note: kbuild does not track this dependency due to usage of .incbin
--$(obj)/vsyscall.o: $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so
--targets += $(foreach F,int80 sysenter,vsyscall-$F.o vsyscall-$F.so)
--targets += vsyscall-note.o vsyscall.lds
-+$(obj)/vsyscall.o: $(foreach F,$(VSYSCALL_TYPES-y),$(obj)/vsyscall-$F.so)
-+targets += $(foreach F,$(VSYSCALL_TYPES-y),vsyscall-$F.o vsyscall-$F.so)
-+targets += $(vsyscall_note) vsyscall.lds
- 
- # The DSO images are built using a special linker script.
- quiet_cmd_syscall = SYSCALL $@
-@@ -62,7 +71,7 @@
- 
- $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
- $(obj)/vsyscall-%.so: $(src)/vsyscall.lds \
--		      $(obj)/vsyscall-%.o $(obj)/vsyscall-note.o FORCE
-+		      $(obj)/vsyscall-%.o $(obj)/$(vsyscall_note) FORCE
- 	$(call if_changed,syscall)
- 
- # We also create a special relocatable object that should mirror the symbol
-@@ -74,5 +83,18 @@
- 
- SYSCFLAGS_vsyscall-syms.o = -r
- $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
--			$(obj)/vsyscall-sysenter.o $(obj)/vsyscall-note.o FORCE
-+			$(foreach F,$(VSYSCALL_TYPES-y),$(obj)/vsyscall-$F.o) \
-+			$(obj)/$(vsyscall_note) FORCE
- 	$(call if_changed,syscall)
-+
-+ifdef CONFIG_XEN
-+include $(srctree)/scripts/Makefile.xen
-+
-+obj-y += fixup.o
-+microcode-$(subst m,y,$(CONFIG_MICROCODE)) := microcode-xen.o
-+n-obj-xen := i8259.o timers/ reboot.o smpboot.o trampoline.o
-+
-+obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
-+obj-y := $(call cherrypickxen, $(obj-y))
-+extra-y := $(call cherrypickxen, $(extra-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/microcode-xen.c linux-2.6-merge.hg/arch/i386/kernel/microcode-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/microcode-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/microcode-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/microcode-xen.c b/arch/i386/kernel/microcode-xen.c
+new file mode 100644
+index 0000000..a0e1487
+--- /dev/null
++++ b/arch/i386/kernel/microcode-xen.c
 @@ -0,0 +1,164 @@
 +/*
 + *	Intel CPU Microcode Update Driver for Linux
@@ -7533,9 +7620,11 @@
 +module_init(microcode_init)
 +module_exit(microcode_exit)
 +MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/mpparse-xen.c linux-2.6-merge.hg/arch/i386/kernel/mpparse-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/mpparse-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/mpparse-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/mpparse-xen.c b/arch/i386/kernel/mpparse-xen.c
+new file mode 100644
+index 0000000..f5daedb
+--- /dev/null
++++ b/arch/i386/kernel/mpparse-xen.c
 @@ -0,0 +1,1188 @@
 +/*
 + *	Intel Multiprocessor Specification 1.1 and 1.4
@@ -8725,9 +8814,11 @@
 +
 +#endif /* CONFIG_X86_IO_APIC */
 +#endif /* CONFIG_ACPI */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/pci-dma-xen.c linux-2.6-merge.hg/arch/i386/kernel/pci-dma-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/pci-dma-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/pci-dma-xen.c	2006-02-18 12:03:32.000000000 +0000
+diff --git a/arch/i386/kernel/pci-dma-xen.c b/arch/i386/kernel/pci-dma-xen.c
+new file mode 100644
+index 0000000..a707f24
+--- /dev/null
++++ b/arch/i386/kernel/pci-dma-xen.c
 @@ -0,0 +1,326 @@
 +/*
 + * Dynamic DMA mapping support.
@@ -9055,9 +9146,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/process-xen.c linux-2.6-merge.hg/arch/i386/kernel/process-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/process-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/process-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/process-xen.c b/arch/i386/kernel/process-xen.c
+new file mode 100644
+index 0000000..47cde96
+--- /dev/null
++++ b/arch/i386/kernel/process-xen.c
 @@ -0,0 +1,833 @@
 +/*
 + *  linux/arch/i386/kernel/process.c
@@ -9168,9 +9261,9 @@
 +{
 +	local_irq_disable();
 +
-+	if (need_resched()) {
++	if (need_resched())
 +		local_irq_enable();
-+	} else {
++	else {
 +		clear_thread_flag(TIF_POLLING_NRFLAG);
 +		smp_mb__after_clear_bit();
 +		stop_hz_timer();
@@ -9892,9 +9985,11 @@
 +		sp -= get_random_int() % 8192;
 +	return sp & ~0xf;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/quirks-xen.c linux-2.6-merge.hg/arch/i386/kernel/quirks-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/quirks-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/quirks-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/quirks-xen.c b/arch/i386/kernel/quirks-xen.c
+new file mode 100644
+index 0000000..39d9ed1
+--- /dev/null
++++ b/arch/i386/kernel/quirks-xen.c
 @@ -0,0 +1,48 @@
 +/*
 + * This file contains work-arounds for x86 and x86_64 platform bugs.
@@ -9944,9 +10039,11 @@
 +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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/setup-xen.c linux-2.6-merge.hg/arch/i386/kernel/setup-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/setup-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/setup-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/setup-xen.c b/arch/i386/kernel/setup-xen.c
+new file mode 100644
+index 0000000..5368d2f
+--- /dev/null
++++ b/arch/i386/kernel/setup-xen.c
 @@ -0,0 +1,1874 @@
 +/*
 + *  linux/arch/i386/kernel/setup.c
@@ -11822,125 +11919,11 @@
 + * c-basic-offset:8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/smpalts.c linux-2.6-merge.hg/arch/i386/kernel/smpalts.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/smpalts.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/smpalts.c	2006-02-11 17:24:45.000000000 +0000
-@@ -0,0 +1,85 @@
-+#include <linux/kernel.h>
-+#include <asm/system.h>
-+#include <asm/smp_alt.h>
-+#include <asm/processor.h>
-+#include <asm/string.h>
-+
-+struct smp_replacement_record {
-+	unsigned char targ_size;
-+	unsigned char smp1_size;
-+	unsigned char smp2_size;
-+	unsigned char up_size;
-+	unsigned char feature;
-+	unsigned char data[0];
-+};
-+
-+struct smp_alternative_record {
-+	void *targ_start;
-+	struct smp_replacement_record *repl;
-+};
-+
-+extern struct smp_alternative_record __start_smp_alternatives_table,
-+  __stop_smp_alternatives_table;
-+extern unsigned long __init_begin, __init_end;
-+
-+void prepare_for_smp(void)
-+{
-+	struct smp_alternative_record *r;
-+	printk(KERN_INFO "Enabling SMP...\n");
-+	for (r = &__start_smp_alternatives_table;
-+	     r != &__stop_smp_alternatives_table;
-+	     r++) {
-+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
-+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
-+		BUG_ON(r->repl->targ_size < r->repl->up_size);
-+               if (system_state == SYSTEM_RUNNING &&
-+                   r->targ_start >= (void *)&__init_begin &&
-+                   r->targ_start < (void *)&__init_end)
-+                       continue;
-+		if (r->repl->feature != (unsigned char)-1 &&
-+		    boot_cpu_has(r->repl->feature)) {
-+			memcpy(r->targ_start,
-+			       r->repl->data + r->repl->smp1_size,
-+			       r->repl->smp2_size);
-+			memset(r->targ_start + r->repl->smp2_size,
-+			       0x90,
-+			       r->repl->targ_size - r->repl->smp2_size);
-+		} else {
-+			memcpy(r->targ_start,
-+			       r->repl->data,
-+			       r->repl->smp1_size);
-+			memset(r->targ_start + r->repl->smp1_size,
-+			       0x90,
-+			       r->repl->targ_size - r->repl->smp1_size);
-+		}
-+	}
-+	/* Paranoia */
-+	asm volatile ("jmp 1f\n1:");
-+	mb();
-+}
-+
-+void unprepare_for_smp(void)
-+{
-+	struct smp_alternative_record *r;
-+	printk(KERN_INFO "Disabling SMP...\n");
-+	for (r = &__start_smp_alternatives_table;
-+	     r != &__stop_smp_alternatives_table;
-+	     r++) {
-+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
-+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
-+		BUG_ON(r->repl->targ_size < r->repl->up_size);
-+               if (system_state == SYSTEM_RUNNING &&
-+                   r->targ_start >= (void *)&__init_begin &&
-+                   r->targ_start < (void *)&__init_end)
-+                       continue;
-+		memcpy(r->targ_start,
-+		       r->repl->data + r->repl->smp1_size + r->repl->smp2_size,
-+		       r->repl->up_size);
-+		memset(r->targ_start + r->repl->up_size,
-+		       0x90,
-+		       r->repl->targ_size - r->repl->up_size);
-+	}
-+	/* Paranoia */
-+	asm volatile ("jmp 1f\n1:");
-+	mb();
-+}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/smpboot.c linux-2.6-merge.hg/arch/i386/kernel/smpboot.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/smpboot.c	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/smpboot.c	2006-02-27 15:49:39.000000000 +0000
-@@ -1208,6 +1208,11 @@
- 		if (max_cpus <= cpucount+1)
- 			continue;
- 
-+#ifdef CONFIG_SMP_ALTERNATIVES
-+		if (kicked == 1)
-+			prepare_for_smp();
-+#endif
-+
- 		if (((cpu = alloc_cpu_id()) <= 0) || do_boot_cpu(apicid, cpu))
- 			printk("CPU #%d not responding - cannot use it.\n",
- 								apicid);
-@@ -1386,6 +1391,11 @@
- 		return -EIO;
- 	}
- 
-+#ifdef CONFIG_SMP_ALTERNATIVES
-+	if (num_online_cpus() == 1)
-+		prepare_for_smp();
-+#endif
-+
- 	local_irq_enable();
- 	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
- 	/* Unleash the CPU! */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/smp-xen.c linux-2.6-merge.hg/arch/i386/kernel/smp-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/smp-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/smp-xen.c	2006-02-11 17:24:45.000000000 +0000
+diff --git a/arch/i386/kernel/smp-xen.c b/arch/i386/kernel/smp-xen.c
+new file mode 100644
+index 0000000..6fc6f03
+--- /dev/null
++++ b/arch/i386/kernel/smp-xen.c
 @@ -0,0 +1,617 @@
 +/*
 + *	Intel SMP support routines.
@@ -12559,9 +12542,130 @@
 +	return IRQ_HANDLED;
 +}
 +
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/swiotlb.c linux-2.6-merge.hg/arch/i386/kernel/swiotlb.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/swiotlb.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/swiotlb.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/i386/kernel/smpalts.c b/arch/i386/kernel/smpalts.c
+new file mode 100644
+index 0000000..5a32e54
+--- /dev/null
++++ b/arch/i386/kernel/smpalts.c
+@@ -0,0 +1,85 @@
++#include <linux/kernel.h>
++#include <asm/system.h>
++#include <asm/smp_alt.h>
++#include <asm/processor.h>
++#include <asm/string.h>
++
++struct smp_replacement_record {
++	unsigned char targ_size;
++	unsigned char smp1_size;
++	unsigned char smp2_size;
++	unsigned char up_size;
++	unsigned char feature;
++	unsigned char data[0];
++};
++
++struct smp_alternative_record {
++	void *targ_start;
++	struct smp_replacement_record *repl;
++};
++
++extern struct smp_alternative_record __start_smp_alternatives_table,
++  __stop_smp_alternatives_table;
++extern unsigned long __init_begin, __init_end;
++
++void prepare_for_smp(void)
++{
++	struct smp_alternative_record *r;
++	printk(KERN_INFO "Enabling SMP...\n");
++	for (r = &__start_smp_alternatives_table;
++	     r != &__stop_smp_alternatives_table;
++	     r++) {
++		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
++		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
++		BUG_ON(r->repl->targ_size < r->repl->up_size);
++               if (system_state == SYSTEM_RUNNING &&
++                   r->targ_start >= (void *)&__init_begin &&
++                   r->targ_start < (void *)&__init_end)
++                       continue;
++		if (r->repl->feature != (unsigned char)-1 &&
++		    boot_cpu_has(r->repl->feature)) {
++			memcpy(r->targ_start,
++			       r->repl->data + r->repl->smp1_size,
++			       r->repl->smp2_size);
++			memset(r->targ_start + r->repl->smp2_size,
++			       0x90,
++			       r->repl->targ_size - r->repl->smp2_size);
++		} else {
++			memcpy(r->targ_start,
++			       r->repl->data,
++			       r->repl->smp1_size);
++			memset(r->targ_start + r->repl->smp1_size,
++			       0x90,
++			       r->repl->targ_size - r->repl->smp1_size);
++		}
++	}
++	/* Paranoia */
++	asm volatile ("jmp 1f\n1:");
++	mb();
++}
++
++void unprepare_for_smp(void)
++{
++	struct smp_alternative_record *r;
++	printk(KERN_INFO "Disabling SMP...\n");
++	for (r = &__start_smp_alternatives_table;
++	     r != &__stop_smp_alternatives_table;
++	     r++) {
++		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
++		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
++		BUG_ON(r->repl->targ_size < r->repl->up_size);
++               if (system_state == SYSTEM_RUNNING &&
++                   r->targ_start >= (void *)&__init_begin &&
++                   r->targ_start < (void *)&__init_end)
++                       continue;
++		memcpy(r->targ_start,
++		       r->repl->data + r->repl->smp1_size + r->repl->smp2_size,
++		       r->repl->up_size);
++		memset(r->targ_start + r->repl->up_size,
++		       0x90,
++		       r->repl->targ_size - r->repl->up_size);
++	}
++	/* Paranoia */
++	asm volatile ("jmp 1f\n1:");
++	mb();
++}
+diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
+index eba7f53..378708c 100644
+--- a/arch/i386/kernel/smpboot.c
++++ b/arch/i386/kernel/smpboot.c
+@@ -1208,6 +1208,11 @@ static void __init smp_boot_cpus(unsigne
+ 		if (max_cpus <= cpucount+1)
+ 			continue;
+ 
++#ifdef CONFIG_SMP_ALTERNATIVES
++		if (kicked == 1)
++			prepare_for_smp();
++#endif
++
+ 		if (((cpu = alloc_cpu_id()) <= 0) || do_boot_cpu(apicid, cpu))
+ 			printk("CPU #%d not responding - cannot use it.\n",
+ 								apicid);
+@@ -1386,6 +1391,11 @@ int __devinit __cpu_up(unsigned int cpu)
+ 		return -EIO;
+ 	}
+ 
++#ifdef CONFIG_SMP_ALTERNATIVES
++	if (num_online_cpus() == 1)
++		prepare_for_smp();
++#endif
++
+ 	local_irq_enable();
+ 	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
+ 	/* Unleash the CPU! */
+diff --git a/arch/i386/kernel/swiotlb.c b/arch/i386/kernel/swiotlb.c
+new file mode 100644
+index 0000000..e493e34
+--- /dev/null
++++ b/arch/i386/kernel/swiotlb.c
 @@ -0,0 +1,674 @@
 +/*
 + * Dynamic DMA mapping support.
@@ -13237,9 +13341,10 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/sysenter.c linux-2.6-merge.hg/arch/i386/kernel/sysenter.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/sysenter.c	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/sysenter.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c
+index 0bada18..99193bb 100644
+--- a/arch/i386/kernel/sysenter.c
++++ b/arch/i386/kernel/sysenter.c
 @@ -13,6 +13,7 @@
  #include <linux/gfp.h>
  #include <linux/string.h>
@@ -13248,7 +13353,7 @@
  
  #include <asm/cpufeature.h>
  #include <asm/msr.h>
-@@ -23,6 +24,7 @@
+@@ -23,6 +24,7 @@ extern asmlinkage void sysenter_entry(vo
  
  void enable_sep_cpu(void)
  {
@@ -13256,7 +13361,7 @@
  	int cpu = get_cpu();
  	struct tss_struct *tss = &per_cpu(init_tss, cpu);
  
-@@ -37,6 +39,7 @@
+@@ -37,6 +39,7 @@ void enable_sep_cpu(void)
  	wrmsr(MSR_IA32_SYSENTER_ESP, tss->esp1, 0);
  	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0);
  	put_cpu();	
@@ -13264,7 +13369,7 @@
  }
  
  /*
-@@ -45,23 +48,90 @@
+@@ -45,23 +48,90 @@ void enable_sep_cpu(void)
   */
  extern const char vsyscall_int80_start, vsyscall_int80_end;
  extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
@@ -13365,10 +13470,12 @@
 +{
 +	return 0;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/time-xen.c linux-2.6-merge.hg/arch/i386/kernel/time-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/time-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/time-xen.c	2006-02-27 15:49:39.000000000 +0000
-@@ -0,0 +1,1141 @@
+diff --git a/arch/i386/kernel/time-xen.c b/arch/i386/kernel/time-xen.c
+new file mode 100644
+index 0000000..39cf69d
+--- /dev/null
++++ b/arch/i386/kernel/time-xen.c
+@@ -0,0 +1,1137 @@
 +/*
 + *  linux/arch/i386/kernel/time.c
 + *
@@ -13531,13 +13638,12 @@
 +static void delay_tsc(unsigned long loops)
 +{
 +	unsigned long bclock, now;
-+	
++
 +	rdtscl(bclock);
-+	do
-+	{
++	do {
 +		rep_nop();
 +		rdtscl(now);
-+	} while ((now-bclock) < loops);
++	} while ((now - bclock) < loops);
 +}
 +
 +static struct timer_opts timer_tsc = {
@@ -13558,7 +13664,7 @@
 +	u32 tmp1, tmp2;
 +#endif
 +
-+	if ( shift < 0 )
++	if (shift < 0)
 +		delta >>= -shift;
 +	else
 +		delta <<= shift;
@@ -13597,7 +13703,7 @@
 +	struct vcpu_time_info *info;
 +	info = &HYPERVISOR_shared_info->vcpu_info[0].time;
 +	do_div(__cpu_khz, info->tsc_to_system_mul);
-+	if ( info->tsc_shift < 0 )
++	if (info->tsc_shift < 0)
 +		cpu_khz = __cpu_khz << -info->tsc_shift;
 +	else
 +		cpu_khz = __cpu_khz >> info->tsc_shift;
@@ -13655,8 +13761,7 @@
 +		shadow_tv.tv_sec  = s->wc_sec;
 +		shadow_tv.tv_nsec = s->wc_nsec;
 +		rmb();
-+	}
-+	while ((s->wc_version & 1) | (shadow_tv_version ^ s->wc_version));
++	} while ((s->wc_version & 1) | (shadow_tv_version ^ s->wc_version));
 +
 +	if (!independent_wallclock)
 +		__update_wallclock(shadow_tv.tv_sec, shadow_tv.tv_nsec);
@@ -13683,8 +13788,7 @@
 +		dst->tsc_to_nsec_mul   = src->tsc_to_system_mul;
 +		dst->tsc_shift         = src->tsc_shift;
 +		rmb();
-+	}
-+	while ((src->version & 1) | (dst->version ^ src->version));
++	} while ((src->version & 1) | (dst->version ^ src->version));
 +
 +	dst->tsc_to_usec_mul = dst->tsc_to_nsec_mul / 1000;
 +}
@@ -13695,7 +13799,7 @@
 +	struct shadow_time_info *dst;
 +
 +	src = &HYPERVISOR_shared_info->vcpu_info[cpu].time;
-+	dst = &per_cpu(shadow_time, cpu); 
++	dst = &per_cpu(shadow_time, cpu);
 +
 +	return (dst->version == src->version);
 +}
@@ -13827,7 +13931,7 @@
 +	 * overflows. If that were to happen then our shadow time values would
 +	 * be stale, so we can retry with fresh ones.
 +	 */
-+	for ( ; ; ) {
++	for (;;) {
 +		nsec = tv->tv_nsec - get_nsec_offset(shadow);
 +		if (time_values_up_to_date(cpu))
 +			break;
@@ -14011,7 +14115,7 @@
 +		get_time_values_from_xen();
 +
 +		/* Obtain a consistent snapshot of elapsed wallclock cycles. */
-+		delta = delta_cpu = 
++		delta = delta_cpu =
 +			shadow->system_timestamp + get_nsec_offset(shadow);
 +		delta     -= processed_system_time;
 +		delta_cpu -= per_cpu(processed_system_time, cpu);
@@ -14030,8 +14134,7 @@
 +				per_cpu(processed_blocked_time, cpu);
 +			barrier();
 +		} while (sched_time != runstate->state_entry_time);
-+	}
-+	while (!time_values_up_to_date(cpu));
++	} while (!time_values_up_to_date(cpu));
 +
 +	if ((unlikely(delta < -1000000LL) || unlikely(delta_cpu < 0))
 +	    && printk_ratelimit()) {
@@ -14383,7 +14486,7 @@
 +}
 +
 +/* Convert jiffies to system time. */
-+static inline u64 jiffies_to_st(unsigned long j) 
++static inline u64 jiffies_to_st(unsigned long j)
 +{
 +	unsigned long seq;
 +	long delta;
@@ -14394,7 +14497,7 @@
 +		delta = j - jiffies;
 +		/* NB. The next check can trigger in some wrap-around cases,
 +		 * but that's ok: we'll just end up with a shorter timeout. */
-+		if (delta < 1) 
++		if (delta < 1)
 +			delta = 1;
 +		st = processed_system_time + (delta * (u64)NS_PER_TICK);
 +	} while (read_seqretry(&xtime_lock, seq));
@@ -14410,7 +14513,7 @@
 +{
 +	unsigned int cpu = smp_processor_id();
 +	unsigned long j;
-+	
++
 +	/* We must do this /before/ checking rcu_pending(). */
 +	cpu_set(cpu, nohz_cpu_mask);
 +	smp_mb();
@@ -14457,7 +14560,7 @@
 +	do {
 +		seq = read_seqbegin(&xtime_lock);
 +		/* Use cpu0 timestamp: cpu's shadow is not initialised yet. */
-+		per_cpu(processed_system_time, cpu) = 
++		per_cpu(processed_system_time, cpu) =
 +			per_cpu(shadow_time, 0).system_timestamp;
 +		init_missing_ticks_accounting(cpu);
 +	} while (read_seqretry(&xtime_lock, seq));
@@ -14510,32 +14613,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/traps.c linux-2.6-merge.hg/arch/i386/kernel/traps.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/traps.c	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/traps.c	2006-02-18 12:03:32.000000000 +0000
-@@ -567,18 +567,11 @@
- 
- static void io_check_error(unsigned char reason, struct pt_regs * regs)
- {
--	unsigned long i;
--
- 	printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
- 	show_registers(regs);
- 
- 	/* Re-enable the IOCK line, wait for a few seconds */
--	reason = (reason & 0xf) | 8;
--	outb(reason, 0x61);
--	i = 2000;
--	while (--i) udelay(1000);
--	reason &= ~8;
--	outb(reason, 0x61);
-+	clear_io_check_error(reason);
- }
- 
- static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/traps-xen.c linux-2.6-merge.hg/arch/i386/kernel/traps-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/traps-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/traps-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/kernel/traps-xen.c b/arch/i386/kernel/traps-xen.c
+new file mode 100644
+index 0000000..1c4a427
+--- /dev/null
++++ b/arch/i386/kernel/traps-xen.c
 @@ -0,0 +1,1094 @@
 +/*
 + *  linux/arch/i386/traps.c
@@ -15631,9 +15713,34 @@
 +	return 0;
 +}
 +__setup("kstack=", kstack_setup);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vm86.c linux-2.6-merge.hg/arch/i386/kernel/vm86.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vm86.c	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/vm86.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
+index b814dbd..85d4645 100644
+--- a/arch/i386/kernel/traps.c
++++ b/arch/i386/kernel/traps.c
+@@ -567,18 +567,11 @@ static void mem_parity_error(unsigned ch
+ 
+ static void io_check_error(unsigned char reason, struct pt_regs * regs)
+ {
+-	unsigned long i;
+-
+ 	printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
+ 	show_registers(regs);
+ 
+ 	/* Re-enable the IOCK line, wait for a few seconds */
+-	reason = (reason & 0xf) | 8;
+-	outb(reason, 0x61);
+-	i = 2000;
+-	while (--i) udelay(1000);
+-	reason &= ~8;
+-	outb(reason, 0x61);
++	clear_io_check_error(reason);
+ }
+ 
+ static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
+diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c
+index f51c894..da2d48e 100644
+--- a/arch/i386/kernel/vm86.c
++++ b/arch/i386/kernel/vm86.c
 @@ -97,7 +97,9 @@
  struct pt_regs * FASTCALL(save_v86_state(struct kernel_vm86_regs * regs));
  struct pt_regs * fastcall save_v86_state(struct kernel_vm86_regs * regs)
@@ -15644,7 +15751,7 @@
  	struct pt_regs *ret;
  	unsigned long tmp;
  
-@@ -122,7 +124,9 @@
+@@ -122,7 +124,9 @@ struct pt_regs * fastcall save_v86_state
  		do_exit(SIGSEGV);
  	}
  
@@ -15654,7 +15761,7 @@
  	current->thread.esp0 = current->thread.saved_esp0;
  	current->thread.sysenter_cs = __KERNEL_CS;
  	load_esp0(tss, &current->thread);
-@@ -251,7 +255,9 @@
+@@ -251,7 +255,9 @@ out:
  
  static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk)
  {
@@ -15664,7 +15771,7 @@
  /*
   * make sure the vm86() system call doesn't try to do anything silly
   */
-@@ -295,7 +301,9 @@
+@@ -295,7 +301,9 @@ static void do_sys_vm86(struct kernel_vm
  	savesegment(fs, tsk->thread.saved_fs);
  	savesegment(gs, tsk->thread.saved_gs);
  
@@ -15674,10 +15781,11 @@
  	tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
  	if (cpu_has_sep)
  		tsk->thread.sysenter_cs = 0;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vmlinux.lds.S linux-2.6-merge.hg/arch/i386/kernel/vmlinux.lds.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vmlinux.lds.S	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/vmlinux.lds.S	2006-02-11 17:24:46.000000000 +0000
-@@ -34,6 +34,13 @@
+diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
+index 4710195..5db6e08 100644
+--- a/arch/i386/kernel/vmlinux.lds.S
++++ b/arch/i386/kernel/vmlinux.lds.S
+@@ -34,6 +34,13 @@ SECTIONS
    __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
    __stop___ex_table = .;
  
@@ -15691,9 +15799,11 @@
    RODATA
  
    /* writeable */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vsyscall-note-xen.S linux-2.6-merge.hg/arch/i386/kernel/vsyscall-note-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vsyscall-note-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/vsyscall-note-xen.S	2006-02-11 17:24:46.000000000 +0000
+diff --git a/arch/i386/kernel/vsyscall-note-xen.S b/arch/i386/kernel/vsyscall-note-xen.S
+new file mode 100644
+index 0000000..c2d6dbf
+--- /dev/null
++++ b/arch/i386/kernel/vsyscall-note-xen.S
 @@ -0,0 +1,32 @@
 +/*
 + * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
@@ -15727,10 +15837,11 @@
 +NOTE_KERNELCAP_BEGIN(1, 1)
 +NOTE_KERNELCAP(1, "nosegneg")  /* Change 1 back to 0 when glibc is fixed! */
 +NOTE_KERNELCAP_END
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vsyscall.S linux-2.6-merge.hg/arch/i386/kernel/vsyscall.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/kernel/vsyscall.S	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/kernel/vsyscall.S	2006-02-21 16:06:09.000000000 +0000
-@@ -7,9 +7,11 @@
+diff --git a/arch/i386/kernel/vsyscall.S b/arch/i386/kernel/vsyscall.S
+index b403890..432aa46 100644
+--- a/arch/i386/kernel/vsyscall.S
++++ b/arch/i386/kernel/vsyscall.S
+@@ -7,9 +7,11 @@ vsyscall_int80_start:
  	.incbin "arch/i386/kernel/vsyscall-int80.so"
  vsyscall_int80_end:
  
@@ -15742,18 +15853,22 @@
 +#endif
  
  __FINIT
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mach-xen/Makefile linux-2.6-merge.hg/arch/i386/mach-xen/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mach-xen/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mach-xen/Makefile	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/mach-xen/Makefile b/arch/i386/mach-xen/Makefile
+new file mode 100644
+index 0000000..012fe34
+--- /dev/null
++++ b/arch/i386/mach-xen/Makefile
 @@ -0,0 +1,5 @@
 +#
 +# Makefile for the linux kernel.
 +#
 +
 +obj-y				:= setup.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mach-xen/setup.c linux-2.6-merge.hg/arch/i386/mach-xen/setup.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mach-xen/setup.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mach-xen/setup.c	2006-02-11 17:24:46.000000000 +0000
+diff --git a/arch/i386/mach-xen/setup.c b/arch/i386/mach-xen/setup.c
+new file mode 100644
+index 0000000..c78032b
+--- /dev/null
++++ b/arch/i386/mach-xen/setup.c
 @@ -0,0 +1,37 @@
 +/*
 + *	Machine specific setup for generic
@@ -15792,57 +15907,27 @@
 +}
 +
 +late_initcall(print_ipi_mode);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/Makefile linux-2.6-merge.hg/arch/i386/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/Makefile	2006-02-27 15:51:13.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/Makefile	2006-02-18 12:03:32.000000000 +0000
-@@ -68,6 +68,10 @@
- mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit
- mcore-$(CONFIG_X86_SUMMIT)  := mach-default
- 
-+# Xen subarch support
-+mflags-$(CONFIG_X86_XEN)	:= -Iinclude/asm-i386/mach-xen
-+mcore-$(CONFIG_X86_XEN)		:= mach-xen
+diff --git a/arch/i386/mm/Makefile b/arch/i386/mm/Makefile
+index 80908b5..2b33b20 100644
+--- a/arch/i386/mm/Makefile
++++ b/arch/i386/mm/Makefile
+@@ -8,3 +8,11 @@ obj-$(CONFIG_NUMA) += discontig.o
+ obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
+ obj-$(CONFIG_HIGHMEM) += highmem.o
+ obj-$(CONFIG_BOOT_IOREMAP) += boot_ioremap.o
 +
- # generic subarchitecture
- mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic
- mcore-$(CONFIG_X86_GENERICARCH) := mach-default
-@@ -96,12 +100,25 @@
- 
- CFLAGS += $(mflags-y)
- AFLAGS += $(mflags-y)
-+CPPFLAGS += $(mflags-y)
- 
- boot := arch/i386/boot
- 
- .PHONY: zImage bzImage compressed zlilo bzlilo \
- 	zdisk bzdisk fdimage fdimage144 fdimage288 install
- 
 +ifdef CONFIG_XEN
-+head-y := arch/i386/kernel/head-xen.o arch/i386/kernel/init_task-xen.o
-+boot := arch/i386/boot-xen
-+.PHONY: vmlinuz
-+all: vmlinuz
++include $(srctree)/scripts/Makefile.xen
 +
-+vmlinuz: vmlinux
-+	$(Q)$(MAKE) $(build)=$(boot) $@
++obj-y		+= hypervisor.o
 +
-+install:
-+	$(Q)$(MAKE) $(build)=$(boot) XENGUEST=$(XENGUEST) $@
-+else
- all: bzImage
- 
- # KBUILD_IMAGE specify target image being built
-@@ -124,6 +141,7 @@
- 
- install:
- 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
++obj-y := $(call cherrypickxen, $(obj-y))
 +endif
- 
- archclean:
- 	$(Q)$(MAKE) $(clean)=arch/i386/boot
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/fault-xen.c linux-2.6-merge.hg/arch/i386/mm/fault-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/fault-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/fault-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/mm/fault-xen.c b/arch/i386/mm/fault-xen.c
+new file mode 100644
+index 0000000..308c0bb
+--- /dev/null
++++ b/arch/i386/mm/fault-xen.c
 @@ -0,0 +1,617 @@
 +/*
 + *  linux/arch/i386/mm/fault.c
@@ -16461,9 +16546,11 @@
 +		return;
 +	}
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/highmem-xen.c linux-2.6-merge.hg/arch/i386/mm/highmem-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/highmem-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/highmem-xen.c	2006-02-11 17:24:46.000000000 +0000
+diff --git a/arch/i386/mm/highmem-xen.c b/arch/i386/mm/highmem-xen.c
+new file mode 100644
+index 0000000..2a9ce1c
+--- /dev/null
++++ b/arch/i386/mm/highmem-xen.c
 @@ -0,0 +1,123 @@
 +#include <linux/highmem.h>
 +#include <linux/module.h>
@@ -16588,9 +16675,11 @@
 +EXPORT_SYMBOL(kmap_atomic);
 +EXPORT_SYMBOL(kunmap_atomic);
 +EXPORT_SYMBOL(kmap_atomic_to_page);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/hypervisor.c linux-2.6-merge.hg/arch/i386/mm/hypervisor.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/hypervisor.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/hypervisor.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/mm/hypervisor.c b/arch/i386/mm/hypervisor.c
+new file mode 100644
+index 0000000..cfc359e
+--- /dev/null
++++ b/arch/i386/mm/hypervisor.c
 @@ -0,0 +1,471 @@
 +/******************************************************************************
 + * mm/hypervisor.c
@@ -17063,9 +17152,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/init-xen.c linux-2.6-merge.hg/arch/i386/mm/init-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/init-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/init-xen.c	2006-02-27 15:49:39.000000000 +0000
+diff --git a/arch/i386/mm/init-xen.c b/arch/i386/mm/init-xen.c
+new file mode 100644
+index 0000000..b490dbd
+--- /dev/null
++++ b/arch/i386/mm/init-xen.c
 @@ -0,0 +1,846 @@
 +/*
 + *  linux/arch/i386/mm/init.c
@@ -17913,9 +18004,11 @@
 +	}
 +}
 +#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/ioremap-xen.c linux-2.6-merge.hg/arch/i386/mm/ioremap-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/ioremap-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/ioremap-xen.c	2006-02-11 17:24:46.000000000 +0000
+diff --git a/arch/i386/mm/ioremap-xen.c b/arch/i386/mm/ioremap-xen.c
+new file mode 100644
+index 0000000..a9a32ba
+--- /dev/null
++++ b/arch/i386/mm/ioremap-xen.c
 @@ -0,0 +1,462 @@
 +/*
 + * arch/i386/mm/ioremap.c
@@ -18379,60 +18472,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/Makefile linux-2.6-merge.hg/arch/i386/mm/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/Makefile	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/Makefile	2006-02-11 17:24:46.000000000 +0000
-@@ -8,3 +8,11 @@
- obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
- obj-$(CONFIG_HIGHMEM) += highmem.o
- obj-$(CONFIG_BOOT_IOREMAP) += boot_ioremap.o
-+
-+ifdef CONFIG_XEN
-+include $(srctree)/scripts/Makefile.xen
-+
-+obj-y		+= hypervisor.o
-+
-+obj-y := $(call cherrypickxen, $(obj-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/pgtable.c linux-2.6-merge.hg/arch/i386/mm/pgtable.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/pgtable.c	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/pgtable.c	2006-02-27 15:49:40.000000000 +0000
-@@ -13,6 +13,7 @@
- #include <linux/slab.h>
- #include <linux/pagemap.h>
- #include <linux/spinlock.h>
-+#include <linux/module.h>
- 
- #include <asm/system.h>
- #include <asm/pgtable.h>
-@@ -138,6 +139,10 @@
- 	__flush_tlb_one(vaddr);
- }
- 
-+static int nr_fixmaps = 0;
-+unsigned long __FIXADDR_TOP = 0xfffff000;
-+EXPORT_SYMBOL(__FIXADDR_TOP);
-+
- void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
- {
- 	unsigned long address = __fix_to_virt(idx);
-@@ -147,6 +152,13 @@
- 		return;
- 	}
- 	set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
-+	nr_fixmaps++;
-+}
-+
-+void set_fixaddr_top(unsigned long top)
-+{
-+	BUG_ON(nr_fixmaps > 0);
-+	__FIXADDR_TOP = top - PAGE_SIZE;
- }
- 
- pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/pgtable-xen.c linux-2.6-merge.hg/arch/i386/mm/pgtable-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/mm/pgtable-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/mm/pgtable-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/i386/mm/pgtable-xen.c b/arch/i386/mm/pgtable-xen.c
+new file mode 100644
+index 0000000..c2d97b5
+--- /dev/null
++++ b/arch/i386/mm/pgtable-xen.c
 @@ -0,0 +1,646 @@
 +/*
 + *  linux/arch/i386/mm/pgtable.c
@@ -19080,9 +19124,72 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/pci/irq-xen.c linux-2.6-merge.hg/arch/i386/pci/irq-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/pci/irq-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/pci/irq-xen.c	2006-02-11 17:24:46.000000000 +0000
+diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
+index 9db3242..8b2e540 100644
+--- a/arch/i386/mm/pgtable.c
++++ b/arch/i386/mm/pgtable.c
+@@ -13,6 +13,7 @@
+ #include <linux/slab.h>
+ #include <linux/pagemap.h>
+ #include <linux/spinlock.h>
++#include <linux/module.h>
+ 
+ #include <asm/system.h>
+ #include <asm/pgtable.h>
+@@ -138,6 +139,10 @@ void set_pmd_pfn(unsigned long vaddr, un
+ 	__flush_tlb_one(vaddr);
+ }
+ 
++static int nr_fixmaps = 0;
++unsigned long __FIXADDR_TOP = 0xfffff000;
++EXPORT_SYMBOL(__FIXADDR_TOP);
++
+ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
+ {
+ 	unsigned long address = __fix_to_virt(idx);
+@@ -147,6 +152,13 @@ void __set_fixmap (enum fixed_addresses 
+ 		return;
+ 	}
+ 	set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
++	nr_fixmaps++;
++}
++
++void set_fixaddr_top(unsigned long top)
++{
++	BUG_ON(nr_fixmaps > 0);
++	__FIXADDR_TOP = top - PAGE_SIZE;
+ }
+ 
+ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
+diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile
+index 5461d4d..6d72b4e 100644
+--- a/arch/i386/pci/Makefile
++++ b/arch/i386/pci/Makefile
+@@ -4,6 +4,10 @@ obj-$(CONFIG_PCI_BIOS)		+= pcbios.o
+ obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig.o direct.o
+ obj-$(CONFIG_PCI_DIRECT)	+= direct.o
+ 
++# pcifront should be after pcbios.o, mmconfig.o, and direct.o as it should only
++# take over if direct access to the PCI bus is unavailable
++obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront.o
++
+ pci-y				:= fixup.o
+ pci-$(CONFIG_ACPI)		+= acpi.o
+ pci-y				+= legacy.o irq.o
+@@ -12,3 +16,8 @@ pci-$(CONFIG_X86_VISWS)		:= visws.o fixu
+ pci-$(CONFIG_X86_NUMAQ)		:= numa.o irq.o
+ 
+ obj-y				+= $(pci-y) common.o
++
++ifdef CONFIG_XEN
++include $(srctree)/scripts/Makefile.xen
++obj-y := $(call cherrypickxen, $(obj-y))
++endif
+diff --git a/arch/i386/pci/irq-xen.c b/arch/i386/pci/irq-xen.c
+new file mode 100644
+index 0000000..80e0b18
+--- /dev/null
++++ b/arch/i386/pci/irq-xen.c
 @@ -0,0 +1,1202 @@
 +/*
 + *	Low-Level PCI Support for PC -- Routing of Interrupts
@@ -20286,32 +20393,11 @@
 +
 +	return count;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/pci/Makefile linux-2.6-merge.hg/arch/i386/pci/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/pci/Makefile	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/pci/Makefile	2006-02-21 16:06:09.000000000 +0000
-@@ -4,6 +4,10 @@
- obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig.o direct.o
- obj-$(CONFIG_PCI_DIRECT)	+= direct.o
- 
-+# pcifront should be after pcbios.o, mmconfig.o, and direct.o as it should only
-+# take over if direct access to the PCI bus is unavailable
-+obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront.o
-+
- pci-y				:= fixup.o
- pci-$(CONFIG_ACPI)		+= acpi.o
- pci-y				+= legacy.o irq.o
-@@ -12,3 +16,8 @@
- pci-$(CONFIG_X86_NUMAQ)		:= numa.o irq.o
- 
- obj-y				+= $(pci-y) common.o
-+
-+ifdef CONFIG_XEN
-+include $(srctree)/scripts/Makefile.xen
-+obj-y := $(call cherrypickxen, $(obj-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/pci/pcifront.c linux-2.6-merge.hg/arch/i386/pci/pcifront.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/pci/pcifront.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/pci/pcifront.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/i386/pci/pcifront.c b/arch/i386/pci/pcifront.c
+new file mode 100644
+index 0000000..7009115
+--- /dev/null
++++ b/arch/i386/pci/pcifront.c
 @@ -0,0 +1,55 @@
 +/*
 + * PCI Frontend Stub - puts some "dummy" functions in to the Linux x86 PCI core
@@ -20368,260 +20454,5259 @@
 +}
 +
 +arch_initcall(pcifront_x86_stub_init);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/power/Makefile linux-2.6-merge.hg/arch/i386/power/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/i386/power/Makefile	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/i386/power/Makefile	2006-02-11 17:24:46.000000000 +0000
+diff --git a/arch/i386/power/Makefile b/arch/i386/power/Makefile
+index 8cfa4e8..e74fee6 100644
+--- a/arch/i386/power/Makefile
++++ b/arch/i386/power/Makefile
 @@ -1,2 +1,4 @@
 -obj-$(CONFIG_PM)		+= cpu.o
 +obj-$(CONFIG_PM_LEGACY)		+= cpu.o
 +obj-$(CONFIG_SOFTWARE_SUSPEND)	+= cpu.o
 +obj-$(CONFIG_ACPI_SLEEP)	+= cpu.o
  obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/um/kernel/physmem.c linux-2.6-merge.hg/arch/um/kernel/physmem.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/um/kernel/physmem.c	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/um/kernel/physmem.c	2006-02-11 17:24:57.000000000 +0000
-@@ -225,7 +225,7 @@
- EXPORT_SYMBOL(physmem_remove_mapping);
- EXPORT_SYMBOL(physmem_subst_mapping);
+diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
+index a85ea9d..cea9e5c 100644
+--- a/arch/ia64/Kconfig
++++ b/arch/ia64/Kconfig
+@@ -50,6 +50,53 @@ config GENERIC_IOMAP
+ 	bool
+ 	default y
  
--void arch_free_page(struct page *page, int order)
-+int arch_free_page(struct page *page, int order)
- {
- 	void *virt;
- 	int i;
-@@ -234,6 +234,8 @@
- 		virt = __va(page_to_phys(page + i));
- 		physmem_remove_mapping(virt);
++config XEN
++	bool
++	default y
++	help
++	  Enable Xen hypervisor support.  Resulting kernel runs
++	  both as a guest OS on Xen and natively on hardware.
++
++config ARCH_XEN
++	bool
++	default y
++	help
++	  TEMP ONLY. Needs to be on for drivers/xen to build.
++
++config XEN_PRIVILEGED_GUEST
++	bool "Privileged Guest"
++	default n
++	help
++	  Used in drivers/xen/privcmd.c.  Should go away?
++
++config XEN_BLKDEV_GRANT
++	depends on XEN
++	bool
++	default y
++
++config XEN_BLKDEV_FRONTEND
++	depends on XEN
++	bool
++	default y
++
++config XEN_BLKDEV_BACKEND
++	depends on XEN
++	bool
++	default y
++
++config XEN_VT
++	bool "Override for turning on CONFIG_VT for domU"
++	default y
++	help
++	  Hack to turn off CONFIG_VT for domU
++
++config VT
++	bool
++	default y if XEN && XEN_VT
++	default n if XEN && !XEN_VT
++	help
++	  Hack to turn off CONFIG_VT for domU
++
+ config SCHED_NO_NO_OMIT_FRAME_POINTER
+ 	bool
+ 	default y
+diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
+index f722e1a..172b4cf 100644
+--- a/arch/ia64/Makefile
++++ b/arch/ia64/Makefile
+@@ -52,9 +52,15 @@ core-$(CONFIG_IA64_GENERIC) 	+= arch/ia6
+ core-$(CONFIG_IA64_HP_ZX1)	+= arch/ia64/dig/
+ core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/
+ core-$(CONFIG_IA64_SGI_SN2)	+= arch/ia64/sn/
++core-$(CONFIG_XEN)		+= arch/ia64/xen/
+ 
+ drivers-$(CONFIG_PCI)		+= arch/ia64/pci/
++ifneq ($(CONFIG_XEN),y)
+ drivers-$(CONFIG_IA64_HP_SIM)	+= arch/ia64/hp/sim/
++endif
++ifneq ($(CONFIG_IA64_GENERIC),y)
++drivers-$(CONFIG_XEN)		+= arch/ia64/hp/sim/
++endif
+ drivers-$(CONFIG_IA64_HP_ZX1)	+= arch/ia64/hp/common/ arch/ia64/hp/zx1/
+ drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/
+ drivers-$(CONFIG_IA64_GENERIC)	+= arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/
+@@ -68,6 +74,8 @@ all: compressed unwcheck
+ 
+ compressed: vmlinux.gz
+ 
++vmlinuz: vmlinux.gz
++
+ vmlinux.gz: vmlinux
+ 	$(Q)$(MAKE) $(build)=$(boot) $@
+ 
+@@ -82,7 +90,7 @@ CLEAN_FILES += vmlinux.gz bootloader
+ boot:	lib/lib.a vmlinux
+ 	$(Q)$(MAKE) $(build)=$(boot) $@
+ 
+-install: vmlinux.gz
++install:
+ 	sh $(srctree)/arch/ia64/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
+ 
+ define archhelp
+diff --git a/arch/ia64/hp/sim/Makefile b/arch/ia64/hp/sim/Makefile
+index d10da47..b0916cd 100644
+--- a/arch/ia64/hp/sim/Makefile
++++ b/arch/ia64/hp/sim/Makefile
+@@ -14,3 +14,5 @@ obj-$(CONFIG_HP_SIMETH)	+= simeth.o
+ obj-$(CONFIG_HP_SIMSERIAL) += simserial.o
+ obj-$(CONFIG_HP_SIMSERIAL_CONSOLE) += hpsim_console.o
+ obj-$(CONFIG_HP_SIMSCSI) += simscsi.o
++obj-$(CONFIG_XEN) += simserial.o
++obj-$(CONFIG_XEN) += hpsim_console.o
+diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
+index 930fdfc..67738bb 100644
+--- a/arch/ia64/kernel/entry.S
++++ b/arch/ia64/kernel/entry.S
+@@ -181,7 +181,7 @@ END(sys_clone)
+  *	called.  The code starting at .map relies on this.  The rest of the code
+  *	doesn't care about the interrupt masking status.
+  */
+-GLOBAL_ENTRY(ia64_switch_to)
++GLOBAL_ENTRY(__ia64_switch_to)
+ 	.prologue
+ 	alloc r16=ar.pfs,1,0,0,0
+ 	DO_SAVE_SWITCH_STACK
+@@ -235,7 +235,7 @@ GLOBAL_ENTRY(ia64_switch_to)
+ 	;;
+ 	srlz.d
+ 	br.cond.sptk .done
+-END(ia64_switch_to)
++END(__ia64_switch_to)
+ 
+ /*
+  * Note that interrupts are enabled during save_switch_stack and load_switch_stack.  This
+@@ -376,7 +376,7 @@ END(save_switch_stack)
+  *	- b7 holds address to return to
+  *	- must not touch r8-r11
+  */
+-ENTRY(load_switch_stack)
++GLOBAL_ENTRY(load_switch_stack)
+ 	.prologue
+ 	.altrp b7
+ 
+@@ -511,7 +511,7 @@ END(clone)
+ 	 * because some system calls (such as ia64_execve) directly
+ 	 * manipulate ar.pfs.
+ 	 */
+-GLOBAL_ENTRY(ia64_trace_syscall)
++GLOBAL_ENTRY(__ia64_trace_syscall)
+ 	PT_REGS_UNWIND_INFO(0)
+ 	/*
+ 	 * We need to preserve the scratch registers f6-f11 in case the system
+@@ -583,7 +583,7 @@ strace_error:
+ (p6)	mov r10=-1
+ (p6)	mov r8=r9
+ 	br.cond.sptk .strace_save_retval
+-END(ia64_trace_syscall)
++END(__ia64_trace_syscall)
+ 
+ 	/*
+ 	 * When traced and returning from sigreturn, we invoke syscall_trace but then
+@@ -636,8 +636,11 @@ GLOBAL_ENTRY(ia64_ret_from_syscall)
+ 	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
+ 	mov r10=r0				// clear error indication in r10
+ (p7)	br.cond.spnt handle_syscall_error	// handle potential syscall failure
++	;;
++	// don't fall through, ia64_leave_syscall may be #define'd
++	br.cond.sptk.few ia64_leave_syscall
++	;;
+ END(ia64_ret_from_syscall)
+-	// fall through
+ /*
+  * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
+  *	need to switch to bank 0 and doesn't restore the scratch registers.
+@@ -682,7 +685,7 @@ END(ia64_ret_from_syscall)
+  *	      ar.csd: cleared
+  *	      ar.ssd: cleared
+  */
+-ENTRY(ia64_leave_syscall)
++GLOBAL_ENTRY(__ia64_leave_syscall)
+ 	PT_REGS_UNWIND_INFO(0)
+ 	/*
+ 	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
+@@ -790,7 +793,7 @@ ENTRY(ia64_leave_syscall)
+ 	mov.m ar.ssd=r0			// M2   clear ar.ssd
+ 	mov f11=f0			// F    clear f11
+ 	br.cond.sptk.many rbs_switch	// B
+-END(ia64_leave_syscall)
++END(__ia64_leave_syscall)
+ 
+ #ifdef CONFIG_IA32_SUPPORT
+ GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
+@@ -802,10 +805,13 @@ GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
+ 	st8.spill [r2]=r8	// store return value in slot for r8 and set unat bit
+ 	.mem.offset 8,0
+ 	st8.spill [r3]=r0	// clear error indication in slot for r10 and set unat bit
++	;;
++	// don't fall through, ia64_leave_kernel may be #define'd
++	br.cond.sptk.few ia64_leave_kernel
++	;;
+ END(ia64_ret_from_ia32_execve)
+-	// fall through
+ #endif /* CONFIG_IA32_SUPPORT */
+-GLOBAL_ENTRY(ia64_leave_kernel)
++GLOBAL_ENTRY(__ia64_leave_kernel)
+ 	PT_REGS_UNWIND_INFO(0)
+ 	/*
+ 	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
+@@ -1150,7 +1156,7 @@ skip_rbs_switch:
+ 	ld8 r10=[r3]
+ 	br.cond.sptk.many .work_processed_syscall	// re-check
+ 
+-END(ia64_leave_kernel)
++END(__ia64_leave_kernel)
+ 
+ ENTRY(handle_syscall_error)
+ 	/*
+@@ -1190,7 +1196,7 @@ END(ia64_invoke_schedule_tail)
+ 	 * be set up by the caller.  We declare 8 input registers so the system call
+ 	 * args get preserved, in case we need to restart a system call.
+ 	 */
+-ENTRY(notify_resume_user)
++GLOBAL_ENTRY(notify_resume_user)
+ 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
+ 	alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
+ 	mov r9=ar.unat
+@@ -1278,7 +1284,7 @@ ENTRY(sys_rt_sigreturn)
+ 	adds sp=16,sp
+ 	;;
+ 	ld8 r9=[sp]				// load new ar.unat
+-	mov.sptk b7=r8,ia64_leave_kernel
++	mov.sptk b7=r8,__ia64_leave_kernel
+ 	;;
+ 	mov ar.unat=r9
+ 	br.many b7
+diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
+index f1778a8..9fae5fb 100644
+--- a/arch/ia64/kernel/head.S
++++ b/arch/ia64/kernel/head.S
+@@ -363,6 +363,12 @@ start_ap:
+ 	;;
+ (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
+ 
++#ifdef CONFIG_XEN
++	//  Note: isBP is used by the subprogram.
++	br.call.sptk.many rp=early_xen_setup
++	;;
++#endif
++
+ #ifdef CONFIG_SMP
+ (isAP)	br.call.sptk.many rp=start_secondary
+ .ret0:
+diff --git a/arch/ia64/kernel/pal.S b/arch/ia64/kernel/pal.S
+index 5018c7f..7bc41ea 100644
+--- a/arch/ia64/kernel/pal.S
++++ b/arch/ia64/kernel/pal.S
+@@ -16,6 +16,7 @@
+ #include <asm/processor.h>
+ 
+ 	.data
++	.globl pal_entry_point
+ pal_entry_point:
+ 	data8 ia64_pal_default_handler
+ 	.text
+@@ -53,7 +54,7 @@ END(ia64_pal_default_handler)
+  * in4	       1 ==> clear psr.ic,  0 ==> don't clear psr.ic
+  *
+  */
+-GLOBAL_ENTRY(ia64_pal_call_static)
++GLOBAL_ENTRY(__ia64_pal_call_static)
+ 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
+ 	alloc loc1 = ar.pfs,5,5,0,0
+ 	movl loc2 = pal_entry_point
+@@ -90,7 +91,7 @@ GLOBAL_ENTRY(ia64_pal_call_static)
+ 	;;
+ 	srlz.d				// seralize restoration of psr.l
+ 	br.ret.sptk.many b0
+-END(ia64_pal_call_static)
++END(__ia64_pal_call_static)
+ 
+ /*
+  * Make a PAL call using the stacked registers calling convention.
+diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
+index 056f7a6..a798e50 100644
+--- a/arch/ia64/kernel/sal.c
++++ b/arch/ia64/kernel/sal.c
+@@ -336,6 +336,9 @@ ia64_sal_init (struct ia64_sal_systab *s
+ 		p += SAL_DESC_SIZE(*p);
  	}
+ 
++#ifdef CONFIG_XEN
++	if (!running_on_xen)
++#endif
+ 	check_sal_cache_flush();
+ }
+ 
+diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
+index 3258e09..e478453 100644
+--- a/arch/ia64/kernel/setup.c
++++ b/arch/ia64/kernel/setup.c
+@@ -61,6 +61,9 @@
+ #include <asm/system.h>
+ #include <asm/unistd.h>
+ #include <asm/system.h>
++#ifdef CONFIG_XEN
++#include <asm/hypervisor.h>
++#endif
+ 
+ #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
+ # error "struct cpuinfo_ia64 too big!"
+@@ -243,6 +246,14 @@ reserve_memory (void)
+ 	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
+ 	n++;
+ 
++#ifdef CONFIG_XEN
++	if (running_on_xen) {
++		rsvd_region[n].start = (unsigned long)__va((HYPERVISOR_shared_info->arch.start_info_pfn << PAGE_SHIFT));
++		rsvd_region[n].end   = rsvd_region[n].start + PAGE_SIZE;
++		n++;
++ 	}
++#endif
 +
-+	return 0;
+ #ifdef CONFIG_BLK_DEV_INITRD
+ 	if (ia64_boot_param->initrd_start) {
+ 		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
+@@ -260,6 +271,7 @@ reserve_memory (void)
+ 	n++;
+ 
+ 	num_rsvd_regions = n;
++	BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n);
+ 
+ 	sort_regions(rsvd_region, num_rsvd_regions);
  }
+@@ -333,6 +345,10 @@ early_console_setup (char *cmdline)
+ {
+ 	int earlycons = 0;
  
- int is_remapped(void *virt)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/ia32entry-xen.S linux-2.6-merge.hg/arch/x86_64/ia32/ia32entry-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/ia32entry-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/ia32/ia32entry-xen.S	2006-02-18 12:03:34.000000000 +0000
-@@ -0,0 +1,721 @@
-+/*
-+ * Compatibility mode system call entry point for x86-64. 
-+ * 		
-+ * Copyright 2000-2002 Andi Kleen, SuSE Labs.
-+ */		 
++#ifdef CONFIG_XEN
++	if (!early_xen_console_setup(cmdline))
++		earlycons++;
++#endif
+ #ifdef CONFIG_SERIAL_SGI_L1_CONSOLE
+ 	{
+ 		extern int sn_serial_console_early_setup(void);
+diff --git a/arch/ia64/xen/Makefile b/arch/ia64/xen/Makefile
+new file mode 100644
+index 0000000..8a83e57
+--- /dev/null
++++ b/arch/ia64/xen/Makefile
+@@ -0,0 +1,5 @@
++#
++# Makefile for Xen components
++#
 +
-+#include <asm/dwarf2.h>
-+#include <asm/calling.h>
-+#include <asm/asm-offsets.h>
-+#include <asm/current.h>
-+#include <asm/errno.h>
-+#include <asm/ia32_unistd.h>	
-+#include <asm/thread_info.h>	
-+#include <asm/segment.h>
-+#include <asm/vsyscall32.h>
-+#include <linux/linkage.h>
++obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o xenconsole.o xen_ksyms.o
+diff --git a/arch/ia64/xen/drivers/Makefile b/arch/ia64/xen/drivers/Makefile
+new file mode 100644
+index 0000000..57394ea
+--- /dev/null
++++ b/arch/ia64/xen/drivers/Makefile
+@@ -0,0 +1,20 @@
 +
-+#define __XEN_X86_64 1
-+	
-+	.macro IA32_ARG_FIXUP noebp=0
-+	movl	%edi,%r8d
-+	.if \noebp
-+	.else
-+	movl	%ebp,%r9d
-+	.endif
-+	xchg	%ecx,%esi
-+	movl	%ebx,%edi
-+	movl	%edx,%edx	/* zero extension */
-+	.endm 
++obj-y   += util.o
 +
-+	/* clobbers %eax */	
-+	.macro  CLEAR_RREGS
-+	xorl 	%eax,%eax
-+	movq	%rax,R11(%rsp)
-+	movq	%rax,R10(%rsp)
-+	movq	%rax,R9(%rsp)
-+	movq	%rax,R8(%rsp)
-+	.endm
++obj-y	+= core/
++obj-y	+= console/
++obj-y	+= evtchn/
++#obj-y	+= balloon/
++obj-y	+= privcmd/
++obj-y	+= blkback/
++#obj-y	+= netback/
++obj-y	+= blkfront/
++obj-y	+= xenbus/
++#obj-y	+= netfront/
++#obj-$(CONFIG_XEN_PRIVILEGED_GUEST)	+= privcmd/
++#obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
++#obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
++#obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
++#obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
++#obj-$(CONFIG_XEN_BLKDEV_TAP)    	+= blktap/
++
+diff --git a/arch/ia64/xen/drivers/README b/arch/ia64/xen/drivers/README
+new file mode 100644
+index 0000000..33aecaa
+--- /dev/null
++++ b/arch/ia64/xen/drivers/README
+@@ -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 --git a/arch/ia64/xen/drivers/coreMakefile b/arch/ia64/xen/drivers/coreMakefile
+new file mode 100644
+index 0000000..40c4f13
+--- /dev/null
++++ b/arch/ia64/xen/drivers/coreMakefile
+@@ -0,0 +1,24 @@
++#
++# Makefile for the linux kernel.
++#
 +
-+#if defined (__XEN_X86_64)
-+#include "../kernel/xen_entry.S"
-+		
-+#define	__swapgs
-+#define __cli
-+#define __sti	
-+#else
-+/*
-+ * Use the native instructions
-+ */	
-+#define	__swapgs	swapgs
-+#define __cli		cli
-+#define __sti		sti	
-+#endif			
++XENARCH	:= $(subst ",,$(CONFIG_XENARCH))
 +
-+	.macro CFI_STARTPROC32 simple
-+	CFI_STARTPROC	\simple
-+	CFI_UNDEFINED	r8
-+	CFI_UNDEFINED	r9
-+	CFI_UNDEFINED	r10
-+	CFI_UNDEFINED	r11
-+	CFI_UNDEFINED	r12
-+	CFI_UNDEFINED	r13
-+	CFI_UNDEFINED	r14
-+	CFI_UNDEFINED	r15
-+	.endm
++CPPFLAGS_vmlinux.lds += -U$(XENARCH)
 +
-+/*
-+ * 32bit SYSENTER instruction entry.
-+ *
-+ * Arguments:
-+ * %eax	System call number.
-+ * %ebx Arg1
-+ * %ecx Arg2
-+ * %edx Arg3
-+ * %esi Arg4
-+ * %edi Arg5
-+ * %ebp user stack
-+ * 0(%ebp) Arg6	
-+ * 	
-+ * Interrupts off.
-+ *	
-+ * This is purely a fast path. For anything complicated we use the int 0x80
-+ * path below.	Set up a complete hardware stack frame to share code
-+ * with the int 0x80 path.
-+ */ 	
-+ENTRY(ia32_sysenter_target)
-+	CFI_STARTPROC32	simple
-+	CFI_DEF_CFA	rsp,0
-+	CFI_REGISTER	rsp,rbp
-+	__swapgs 
-+	movq	%gs:pda_kernelstack, %rsp
-+	addq	$(PDA_STACKOFFSET),%rsp
-+	XEN_UNBLOCK_EVENTS(%r11)	
-+	__sti
-+ 	movl	%ebp,%ebp		/* zero extension */
-+	pushq	$__USER32_DS
-+	CFI_ADJUST_CFA_OFFSET 8
-+	/*CFI_REL_OFFSET ss,0*/
-+	pushq	%rbp
-+	CFI_ADJUST_CFA_OFFSET 8
-+	CFI_REL_OFFSET rsp,0
-+	pushfq
-+	CFI_ADJUST_CFA_OFFSET 8
-+	/*CFI_REL_OFFSET rflags,0*/
-+	movl	$VSYSCALL32_SYSEXIT, %r10d
-+	CFI_REGISTER rip,r10
-+	pushq	$__USER32_CS
-+	CFI_ADJUST_CFA_OFFSET 8
-+	/*CFI_REL_OFFSET cs,0*/
-+	movl	%eax, %eax
-+	pushq	%r10
-+	CFI_ADJUST_CFA_OFFSET 8
-+	CFI_REL_OFFSET rip,0
-+	pushq	%rax
-+	CFI_ADJUST_CFA_OFFSET 8
-+	cld
-+	SAVE_ARGS 0,0,1
-+ 	/* no need to do an access_ok check here because rbp has been
-+ 	   32bit zero extended */ 
-+1:	movl	(%rbp),%r9d
-+ 	.section __ex_table,"a"
-+ 	.quad 1b,ia32_badarg
-+ 	.previous	
-+	GET_THREAD_INFO(%r10)
-+	orl    $TS_COMPAT,threadinfo_status(%r10)
-+	testl  $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
-+	CFI_REMEMBER_STATE
-+	jnz  sysenter_tracesys
-+sysenter_do_call:	
-+	cmpl	$(IA32_NR_syscalls),%eax
-+	jae	ia32_badsys
-+	IA32_ARG_FIXUP 1
-+	call	*ia32_sys_call_table(,%rax,8)
-+	movq	%rax,RAX-ARGOFFSET(%rsp)
-+	GET_THREAD_INFO(%r10)
-+	XEN_BLOCK_EVENTS(%r11)	
-+	__cli
-+	testl	$_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
-+	jnz	int_ret_from_sys_call
-+	andl    $~TS_COMPAT,threadinfo_status(%r10)
-+	/* clear IF, that popfq doesn't enable interrupts early */
-+	andl  $~0x200,EFLAGS-R11(%rsp) 
-+	RESTORE_ARGS 1,24,1,1,1,1
-+	popfq
-+	CFI_ADJUST_CFA_OFFSET -8
-+	/*CFI_RESTORE rflags*/
-+	popq	%rcx				/* User %esp */
-+	CFI_ADJUST_CFA_OFFSET -8
-+	CFI_REGISTER rsp,rcx
-+	movl	$VSYSCALL32_SYSEXIT,%edx	/* User %eip */
-+	CFI_REGISTER rip,rdx
-+	__swapgs
-+	XEN_UNBLOCK_EVENTS(%r11)		
-+	__sti		/* sti only takes effect after the next instruction */
-+	/* sysexit */
-+	.byte	0xf, 0x35  /* TBD */
++$(obj)/vmlinux.lds.S:
++	@ln -fsn $(srctree)/arch/$(XENARCH)/kernel/vmlinux.lds.S $@
 +
-+sysenter_tracesys:
-+	CFI_RESTORE_STATE
-+	SAVE_REST
-+	CLEAR_RREGS
-+	movq	$-ENOSYS,RAX(%rsp)	/* really needed? */
-+	movq	%rsp,%rdi        /* &pt_regs -> arg1 */
-+	call	syscall_trace_enter
-+	LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
-+	RESTORE_REST
-+	movl	%ebp, %ebp
-+	/* no need to do an access_ok check here because rbp has been
-+	   32bit zero extended */ 
-+1:	movl	(%rbp),%r9d
-+	.section __ex_table,"a"
-+	.quad 1b,ia32_badarg
-+	.previous
-+	jmp	sysenter_do_call
-+	CFI_ENDPROC
++
++obj-y   := gnttab.o
++obj-$(CONFIG_PROC_FS) += xen_proc.o
++
++ifeq ($(ARCH),ia64)
++obj-y   += evtchn_ia64.o
++obj-y   += xenia64_init.o
++else
++extra-y += vmlinux.lds
++obj-y   += reboot.o evtchn.o fixup.o 
++obj-$(CONFIG_SMP)     += smp.o		# setup_profiling_timer def'd in ia64
++obj-$(CONFIG_NET)     += skbuff.o	# until networking is up on ia64
++endif
+diff --git a/arch/ia64/xen/drivers/evtchn_ia64.c b/arch/ia64/xen/drivers/evtchn_ia64.c
+new file mode 100644
+index 0000000..fa753e5
+--- /dev/null
++++ b/arch/ia64/xen/drivers/evtchn_ia64.c
+@@ -0,0 +1,273 @@
++/* NOTE: This file split off from evtchn.c because there was
++   some discussion that the mechanism is sufficiently different.
++   It may be possible to merge it back in the future... djm */
++#include <linux/config.h>
++#include <linux/kernel.h>
++#include <asm/hw_irq.h>
++#include <xen/evtchn.h>
++
++#define MAX_EVTCHN 1024
++
++/* Xen will never allocate port zero for any purpose. */
++#define VALID_EVTCHN(_chn) (((_chn) != 0) && ((_chn) < MAX_EVTCHN))
++
++/* Binding types. Hey, only IRQT_VIRQ and IRQT_EVTCHN are supported now
++ * for XEN/IA64 - ktian1
++ */
++enum { IRQT_UNBOUND, IRQT_PIRQ, IRQT_VIRQ, IRQT_IPI, IRQT_EVTCHN };
++
++/* Constructor for packed IRQ information. */
++#define mk_irq_info(type, index, evtchn)				\
++	(((u32)(type) << 24) | ((u32)(index) << 16) | (u32)(evtchn))
++/* Convenient shorthand for packed representation of an unbound IRQ. */
++#define IRQ_UNBOUND	mk_irq_info(IRQT_UNBOUND, 0, 0)
++/* Accessor macros for packed IRQ information. */
++#define evtchn_from_irq(irq) ((u16)(irq_info[irq]))
++#define index_from_irq(irq)  ((u8)(irq_info[irq] >> 16))
++#define type_from_irq(irq)   ((u8)(irq_info[irq] >> 24))
++
++/* Packed IRQ information: binding type, sub-type index, and event channel. */
++static u32 irq_info[NR_IRQS];
++
++/* One note for XEN/IA64 is that we have all event channels bound to one
++ * physical irq vector. So we always mean evtchn vector identical to 'irq'
++ * vector in this context. - ktian1
++ */
++static struct {
++	irqreturn_t (*handler)(int, void *, struct pt_regs *);
++	void *dev_id;
++	char opened;	/* Whether allocated */
++} evtchns[MAX_EVTCHN];
 +
 +/*
-+ * 32bit SYSCALL instruction entry.
-+ *
-+ * Arguments:
-+ * %eax	System call number.
-+ * %ebx Arg1
-+ * %ecx return EIP 
-+ * %edx Arg3
-+ * %esi Arg4
-+ * %edi Arg5
-+ * %ebp Arg2    [note: not saved in the stack frame, should not be touched]
-+ * %esp user stack 
-+ * 0(%esp) Arg6
-+ * 	
-+ * Interrupts off.
-+ *	
-+ * This is purely a fast path. For anything complicated we use the int 0x80
-+ * path below.	Set up a complete hardware stack frame to share code
-+ * with the int 0x80 path.	
-+ */ 	
-+ENTRY(ia32_cstar_target)
-+	CFI_STARTPROC32	simple
-+	CFI_DEF_CFA	rsp,0
-+	CFI_REGISTER	rip,rcx
-+	/*CFI_REGISTER	rflags,r11*/
-+	__swapgs
-+	movl	%esp,%r8d
-+	CFI_REGISTER	rsp,r8
-+	movq	%gs:pda_kernelstack,%rsp
-+	XEN_UNBLOCK_EVENTS(%r11)	
-+	__sti
-+	SAVE_ARGS 8,1,1
-+	movl 	%eax,%eax	/* zero extension */
-+	movq	%rax,ORIG_RAX-ARGOFFSET(%rsp)
-+	movq	%rcx,RIP-ARGOFFSET(%rsp)
-+	CFI_REL_OFFSET rip,RIP-ARGOFFSET
-+	movq	%rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
-+	movl	%ebp,%ecx
-+	movq	$__USER32_CS,CS-ARGOFFSET(%rsp)
-+	movq	$__USER32_DS,SS-ARGOFFSET(%rsp)
-+	movq	%r11,EFLAGS-ARGOFFSET(%rsp)
-+	/*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
-+	movq	%r8,RSP-ARGOFFSET(%rsp)	
-+	CFI_REL_OFFSET rsp,RSP-ARGOFFSET
++ * This lock protects updates to the following mapping and reference-count
++ * arrays. The lock does not need to be acquired to read the mapping tables.
++ */
++static spinlock_t irq_mapping_update_lock;
++
++void mask_evtchn(int port)
++{
++	shared_info_t *s = HYPERVISOR_shared_info;
++	synch_set_bit(port, &s->evtchn_mask[0]);
++}
++EXPORT_SYMBOL(mask_evtchn);
++
++void unmask_evtchn(int port)
++{
++	shared_info_t *s = HYPERVISOR_shared_info;
++	unsigned int cpu = smp_processor_id();
++	vcpu_info_t *vcpu_info = &s->vcpu_info[cpu];
++
++#if 0	// FIXME: diverged from x86 evtchn.c
++	/* Slow path (hypercall) if this is a non-local port. */
++	if (unlikely(cpu != cpu_from_evtchn(port))) {
++		evtchn_op_t op = { .cmd = EVTCHNOP_unmask,
++				   .u.unmask.port = port };
++		(void)HYPERVISOR_event_channel_op(&op);
++		return;
++	}
++#endif
++
++	synch_clear_bit(port, &s->evtchn_mask[0]);
++
++	/*
++	 * The following is basically the equivalent of 'hw_resend_irq'. Just
++	 * like a real IO-APIC we 'lose the interrupt edge' if the channel is
++	 * masked.
++	 */
++	if (synch_test_bit(port, &s->evtchn_pending[0]) && 
++	    !synch_test_and_set_bit(port / BITS_PER_LONG,
++				    &vcpu_info->evtchn_pending_sel)) {
++		vcpu_info->evtchn_upcall_pending = 1;
++		if (!vcpu_info->evtchn_upcall_mask)
++			force_evtchn_callback();
++	}
++}
++EXPORT_SYMBOL(unmask_evtchn);
++
++
++#define unbound_irq(e) (VALID_EVTCHN(e) && (!evtchns[(e)].opened))
++int bind_virq_to_irqhandler(
++	unsigned int virq,
++	unsigned int cpu,
++	irqreturn_t (*handler)(int, void *, struct pt_regs *),
++	unsigned long irqflags,
++	const char *devname,
++	void *dev_id)
++{
++    evtchn_op_t op;
++    int evtchn;
++
++    spin_lock(&irq_mapping_update_lock);
++
++    op.cmd = EVTCHNOP_bind_virq;
++    op.u.bind_virq.virq = virq;
++    op.u.bind_virq.vcpu = cpu;
++    BUG_ON(HYPERVISOR_event_channel_op(&op) != 0 );
++    evtchn = op.u.bind_virq.port;
++
++    if (!unbound_irq(evtchn)) {
++        evtchn = -EINVAL;
++        goto out;
++    }
++
++    evtchns[evtchn].handler = handler;
++    evtchns[evtchn].dev_id = dev_id;
++    evtchns[evtchn].opened = 1;
++    irq_info[evtchn] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
++
++    unmask_evtchn(evtchn);
++out:
++    spin_unlock(&irq_mapping_update_lock);
++    return evtchn;
++}
++
++int bind_evtchn_to_irqhandler(unsigned int evtchn,
++                   irqreturn_t (*handler)(int, void *, struct pt_regs *),
++                   unsigned long irqflags, const char * devname, void *dev_id)
++{
++    spin_lock(&irq_mapping_update_lock);
++
++    if (!unbound_irq(evtchn)) {
++	evtchn = -EINVAL;
++	goto out;
++    }
++
++    evtchns[evtchn].handler = handler;
++    evtchns[evtchn].dev_id = dev_id;
++    evtchns[evtchn].opened = 1;
++    irq_info[evtchn] = mk_irq_info(IRQT_EVTCHN, 0, evtchn);
++
++    unmask_evtchn(evtchn);
++out:
++    spin_unlock(&irq_mapping_update_lock);
++    return evtchn;
++}
++
++int bind_ipi_to_irqhandler(
++	unsigned int ipi,
++	unsigned int cpu,
++	irqreturn_t (*handler)(int, void *, struct pt_regs *),
++	unsigned long irqflags,
++	const char *devname,
++	void *dev_id)
++{
++    printk("%s is called which has not been supported now...?\n", __FUNCTION__);
++    while(1);
++}
++
++void unbind_from_irqhandler(unsigned int irq, void *dev_id)
++{
++    evtchn_op_t op;
++    int evtchn = evtchn_from_irq(irq);
++
++    spin_lock(&irq_mapping_update_lock);
++
++    if (unbound_irq(irq))
++        goto out;
++
++    op.cmd = EVTCHNOP_close;
++    op.u.close.port = evtchn;
++    BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
++
++    switch (type_from_irq(irq)) {
++	case IRQT_VIRQ:
++	    /* Add smp stuff later... */
++	    break;
++	case IRQT_IPI:
++	    /* Add smp stuff later... */
++	    break;
++	default:
++	    break;
++    }
++
++    mask_evtchn(evtchn);
++    evtchns[evtchn].handler = NULL;
++    evtchns[evtchn].opened = 0;
++
++out:
++    spin_unlock(&irq_mapping_update_lock);
++}
++
++void notify_remote_via_irq(int irq)
++{
++	int evtchn = evtchn_from_irq(irq);
++
++	if (!unbound_irq(evtchn))
++		notify_remote_via_evtchn(evtchn);
++}
++
++irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs)
++{
++    unsigned long  l1, l2;
++    unsigned int   l1i, l2i, port;
++    irqreturn_t (*handler)(int, void *, struct pt_regs *);
++    shared_info_t *s = HYPERVISOR_shared_info;
++    vcpu_info_t   *vcpu_info = &s->vcpu_info[smp_processor_id()];
++
++    vcpu_info->evtchn_upcall_mask = 1;
++    vcpu_info->evtchn_upcall_pending = 0;
++
++    /* NB. No need for a barrier here -- XCHG is a barrier on x86. */
++    l1 = xchg(&vcpu_info->evtchn_pending_sel, 0);
++    while ( l1 != 0 )
++    {
++        l1i = __ffs(l1);
++        l1 &= ~(1UL << l1i);
++
++        while ( (l2 = s->evtchn_pending[l1i] & ~s->evtchn_mask[l1i]) != 0 )
++        {
++            l2i = __ffs(l2);
++            l2 &= ~(1UL << l2i);
++
++            port = (l1i * BITS_PER_LONG) + l2i;
++            if ( (handler = evtchns[port].handler) != NULL )
++	    {
++		clear_evtchn(port);
++                handler(port, evtchns[port].dev_id, regs);
++	    }
++            else
++	    {
++                evtchn_device_upcall(port);
++	    }
++        }
++    }
++    vcpu_info->evtchn_upcall_mask = 0;
++    return IRQ_HANDLED;
++}
++
++void force_evtchn_callback(void)
++{
++	//(void)HYPERVISOR_xen_version(0, NULL);
++}
++
++static struct irqaction evtchn_irqaction = {
++	.handler =	evtchn_interrupt,
++	.flags =	SA_INTERRUPT,
++	.name =		"xen-event-channel"
++};
++
++int evtchn_irq = 0xe9;
++void __init evtchn_init(void)
++{
++    shared_info_t *s = HYPERVISOR_shared_info;
++    vcpu_info_t   *vcpu_info = &s->vcpu_info[smp_processor_id()];
++
++#if 0
++    int ret;
++    irq = assign_irq_vector(AUTO_ASSIGN);
++    ret = request_irq(irq, evtchn_interrupt, 0, "xen-event-channel", NULL);
++    if (ret < 0)
++    {
++	printk("xen-event-channel unable to get irq %d (%d)\n", irq, ret);
++	return;
++    }
++#endif
++    register_percpu_irq(evtchn_irq, &evtchn_irqaction);
++
++    vcpu_info->arch.evtchn_vector = evtchn_irq;
++    printk("xen-event-channel using irq %d\n", evtchn_irq);
++
++    spin_lock_init(&irq_mapping_update_lock);
++    memset(evtchns, 0, sizeof(evtchns));
++}
+diff --git a/arch/ia64/xen/drivers/patches/blkback.c.patch b/arch/ia64/xen/drivers/patches/blkback.c.patch
+new file mode 100644
+index 0000000..0554403
+--- /dev/null
++++ b/arch/ia64/xen/drivers/patches/blkback.c.patch
+@@ -0,0 +1,57 @@
++diff -Naur xen/blkback/blkback.c xen.patched/blkback/blkback.c
++--- xen/blkback/blkback.c	2005-09-23 10:54:50.000000000 -0600
+++++ xen.patched/blkback/blkback.c	2005-09-23 10:57:51.000000000 -0600
++@@ -30,10 +30,16 @@
++ static unsigned long mmap_vstart;
++ #define MMAP_PAGES						\
++ 	(MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST)
+++#ifdef __ia64__
+++static void *pending_vaddrs[MMAP_PAGES];
+++#define MMAP_VADDR(_idx, _i) \
+++	(unsigned long)(pending_vaddrs[((_idx) * BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
+++#else
++ #define MMAP_VADDR(_req,_seg)						\
++ 	(mmap_vstart +							\
++ 	 ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) +	\
++ 	 ((_seg) * PAGE_SIZE))
+++#endif
++ 
++ /*
++  * Each outstanding request that we've passed to the lower device layers has a 
++@@ -377,9 +383,13 @@
++ 			goto bad_descriptor;
++ 		}
++ 
+++#ifdef __ia64__
+++		MMAP_VADDR(pending_idx,i) = gnttab_map_vaddr(map[i]);
+++#else
++ 		phys_to_machine_mapping[__pa(MMAP_VADDR(
++ 			pending_idx, i)) >> PAGE_SHIFT] =
++ 			FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
+++#endif
++ 
++ 		pending_handle(pending_idx, i) = map[i].handle;
++ 	}
++@@ -500,9 +510,22 @@
++ 
++ 	blkif_interface_init();
++ 
+++#ifdef __ia64__
+++    {
+++	extern unsigned long alloc_empty_foreign_map_page_range(unsigned long pages);
+++	int i;
+++
+++	mmap_vstart =  alloc_empty_foreign_map_page_range(MMAP_PAGES);
+++	printk("Allocated mmap_vstart: 0x%lx\n", mmap_vstart);
+++	for(i = 0; i < MMAP_PAGES; i++)
+++	    pending_vaddrs[i] = mmap_vstart + (i << PAGE_SHIFT);
+++	BUG_ON(mmap_vstart == NULL);
+++    }
+++#else
++ 	page = balloon_alloc_empty_page_range(MMAP_PAGES);
++ 	BUG_ON(page == NULL);
++ 	mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
+++#endif
++ 
++ 	pending_cons = 0;
++ 	pending_prod = MAX_PENDING_REQS;
+diff --git a/arch/ia64/xen/drivers/patches/console.c.patch b/arch/ia64/xen/drivers/patches/console.c.patch
+new file mode 100644
+index 0000000..71d655d
+--- /dev/null
++++ b/arch/ia64/xen/drivers/patches/console.c.patch
+@@ -0,0 +1,18 @@
++--- xen/console/console.c	2005-11-02 14:13:07.000000000 +0100
+++++ xen.patched/console/console.c	2005-11-02 14:21:20.000000000 +0100
++@@ -768,9 +771,15 @@
++ #endif
++ 
++ 	if (xen_start_info->flags & SIF_INITDOMAIN) {
+++#ifdef __ia64__
+++		xencons_priv_irq = bind_virq_to_evtchn(VIRQ_CONSOLE);
+++		bind_evtchn_to_irqhandler(xencons_priv_irq,
+++				xencons_priv_interrupt, 0, "console", NULL);
+++#else
++ 		xencons_priv_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
++ 		(void)request_irq(xencons_priv_irq,
++ 				  xencons_priv_interrupt, 0, "console", NULL);
+++#endif
++ 	} else {
++ 		xencons_ring_register_receiver(xencons_rx);
++ 	}
+diff --git a/arch/ia64/xen/drivers/patches/devmem.c.patch b/arch/ia64/xen/drivers/patches/devmem.c.patch
+new file mode 100644
+index 0000000..9242964
+--- /dev/null
++++ b/arch/ia64/xen/drivers/patches/devmem.c.patch
+@@ -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 --git a/arch/ia64/xen/drivers/patches/gnttab.c.patch b/arch/ia64/xen/drivers/patches/gnttab.c.patch
+new file mode 100644
+index 0000000..90272db
+--- /dev/null
++++ b/arch/ia64/xen/drivers/patches/gnttab.c.patch
+@@ -0,0 +1,46 @@
++diff -Naur xen/core/gnttab.c xen.patched/core/gnttab.c
++--- xen/core/gnttab.c	2005-09-23 10:54:50.000000000 -0600
+++++ xen.patched/core/gnttab.c	2005-09-23 10:57:51.000000000 -0600
++@@ -346,6 +350,10 @@
++ 	if ( hypercall.op != __HYPERVISOR_grant_table_op )
++ 		return -ENOSYS;
++ 
+++
+++#ifdef __ia64__
+++	ret = HYPERVISOR_grant_table_op(hypercall.arg[0], (void *)hypercall.arg[1], hypercall.arg[2]);
+++#else
++ 	/* hypercall-invoking asm taken from privcmd.c */
++ 	__asm__ __volatile__ (
++ 		"pushl %%ebx; pushl %%ecx; pushl %%edx; "
++@@ -359,6 +367,7 @@
++ 		TRAP_INSTR "; "
++ 		"popl %%edi; popl %%esi; popl %%edx; popl %%ecx; popl %%ebx"
++ 		: "=a" (ret) : "0" (&hypercall) : "memory" );
+++#endif
++ 
++ 	return ret;
++ }
++@@ -423,8 +432,13 @@
++ 	BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1));
++ 	BUG_ON(setup.status != 0);
++ 
+++#ifdef __ia64__
+++	shared = __va(frames[0] << PAGE_SHIFT);
+++	printk("grant table at %p\n", shared);
+++#else
++ 	for (i = 0; i < NR_GRANT_FRAMES; i++)
++ 		set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
+++#endif
++ 
++ 	return 0;
++ }
++@@ -450,7 +466,9 @@
++ 
++ 	BUG_ON(gnttab_resume());
++ 
+++#ifndef __ia64__
++ 	shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
+++#endif
++ 
++ 	for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++)
++ 		gnttab_list[i] = i + 1;
+diff --git a/arch/ia64/xen/drivers/patches/privcmd.c.patch b/arch/ia64/xen/drivers/patches/privcmd.c.patch
+new file mode 100644
+index 0000000..347ffa7
+--- /dev/null
++++ b/arch/ia64/xen/drivers/patches/privcmd.c.patch
+@@ -0,0 +1,43 @@
++diff -Naur xen/privcmd/privcmd.c xen.patched/privcmd/privcmd.c
++--- xen/privcmd/privcmd.c	2005-09-23 10:54:50.000000000 -0600
+++++ xen.patched/privcmd/privcmd.c	2005-09-23 10:57:51.000000000 -0600
++@@ -180,6 +183,15 @@
++ 		for (i = 0; i < m.num; i++, addr += PAGE_SIZE, p++) {
++ 			if (get_user(mfn, p))
++ 				return -EFAULT;
+++#ifdef __ia64__
+++			ret = remap_pfn_range(vma,
+++					      addr&PAGE_MASK,
+++					      mfn,
+++					      1<<PAGE_SHIFT,
+++					      vma->vm_page_prot);
+++			if (ret < 0)
+++			    goto batch_err;
+++#else
++ 
++ 			ret = create_lookup_pte_addr(vma->vm_mm, addr, &ptep);
++ 			if (ret)
++@@ -190,6 +202,7 @@
++ 
++ 			if (HYPERVISOR_mmu_update(&u, 1, NULL, m.dom) < 0)
++ 				put_user(0xF0000000 | mfn, p);
+++#endif
++ 		}
++ 
++ 		ret = 0;
++@@ -205,6 +218,7 @@
++ 	break;
++ #endif
++ 
+++#ifndef __ia64__
++ 	case IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN: {
++ 		unsigned long m2pv = (unsigned long)machine_to_phys_mapping;
++ 		pgd_t *pgd = pgd_offset_k(m2pv);
++@@ -216,6 +230,7 @@
++ 			-EFAULT: 0;
++ 	}
++ 	break;
+++#endif
++ 
++ 	default:
++ 		ret = -EINVAL;
+diff --git a/arch/ia64/xen/drivers/xenia64_init.c b/arch/ia64/xen/drivers/xenia64_init.c
+new file mode 100644
+index 0000000..8d441df
+--- /dev/null
++++ b/arch/ia64/xen/drivers/xenia64_init.c
+@@ -0,0 +1,55 @@
++#ifdef __ia64__
++#include <linux/config.h>
++#include <linux/module.h>
++#include <linux/efi.h>
++#include <asm/sal.h>
++#include <asm/hypervisor.h>
++/* #include <asm-xen/evtchn.h> */
++#include <linux/vmalloc.h>
++
++shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)0xf100000000000000;
++EXPORT_SYMBOL(HYPERVISOR_shared_info);
++
++static int initialized;
++start_info_t *xen_start_info;
++
++int xen_init(void)
++{
++	shared_info_t *s = HYPERVISOR_shared_info;
++
++	if (initialized)
++		return running_on_xen ? 0 : -1;
++
++	if (!running_on_xen)
++		return -1;
++
++	xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
++	xen_start_info->flags = s->arch.flags;
++	printk("Running on Xen! start_info_pfn=0x%lx nr_pages=%d flags=0x%x\n",
++		s->arch.start_info_pfn, xen_start_info->nr_pages,
++		xen_start_info->flags);
++
++	evtchn_init();
++	initialized = 1;
++	return 0;
++}
++
++/* We just need a range of legal va here, though finally identity
++ * mapped one is instead used for gnttab mapping.
++ */
++unsigned long alloc_empty_foreign_map_page_range(unsigned long pages)
++{
++	struct vm_struct *vma;
++
++	if ( (vma = get_vm_area(PAGE_SIZE * pages, VM_ALLOC)) == NULL )
++		return NULL;
++
++	return (unsigned long)vma->addr;
++}
++
++#if 0
++/* These should be define'd but some drivers use them without
++ * a convenient arch include */
++unsigned long mfn_to_pfn(unsigned long mfn) { return mfn; }
++#endif
++#endif
+diff --git a/arch/ia64/xen/hypercall.S b/arch/ia64/xen/hypercall.S
+new file mode 100644
+index 0000000..6fb0a90
+--- /dev/null
++++ b/arch/ia64/xen/hypercall.S
+@@ -0,0 +1,323 @@
++/*
++ * Support routines for Xen hypercalls
++ *
++ * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer at hp.com>
++ */
++
++#include <linux/config.h>
++#include <asm/processor.h>
++#include <asm/asmmacro.h>
++
++GLOBAL_ENTRY(xen_get_ivr)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov r8=cr.ivr;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_GET_IVR
++	;;
++	st8 [r9]=r10
++	br.ret.sptk.many rp
++	;;
++END(xen_get_ivr)
++
++GLOBAL_ENTRY(xen_get_tpr)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov r8=cr.tpr;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_GET_TPR
++	;;
++	st8 [r9]=r10
++	br.ret.sptk.many rp
++	;;
++END(xen_get_tpr)
++
++GLOBAL_ENTRY(xen_set_tpr)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov cr.tpr=r32;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	mov r8=r32
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_SET_TPR
++	;;
++	st8 [r9]=r10
++	br.ret.sptk.many rp
++	;;
++END(xen_set_tpr)
++
++GLOBAL_ENTRY(xen_eoi)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov cr.eoi=r0;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	mov r8=r32
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_EOI
++	;;
++	st8 [r9]=r10
++	br.ret.sptk.many rp
++	;;
++END(xen_eoi)
++
++GLOBAL_ENTRY(xen_thash)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	thash r8=r32;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	mov r8=r32
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_THASH
++	;;
++	st8 [r9]=r10
++	;;
++	br.ret.sptk.many rp
++	;;
++END(xen_thash)
++
++GLOBAL_ENTRY(xen_set_itm)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov cr.itm=r32;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	mov r8=r32
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_SET_ITM
++	;;
++	st8 [r9]=r10
++	;;
++	br.ret.sptk.many rp
++	;;
++END(xen_set_itm)
++
++GLOBAL_ENTRY(xen_ptcga)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	ptc.ga r32,r33;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r11=XSI_PSR_IC
++	mov r8=r32
++	mov r9=r33
++	;;
++	ld8 r10=[r11]
++	;;
++	st8 [r11]=r0
++	;;
++	XEN_HYPER_PTC_GA
++	;;
++	st8 [r11]=r10
++	;;
++	br.ret.sptk.many rp
++	;;
++END(xen_ptcga)
++
++GLOBAL_ENTRY(xen_get_rr)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov r8=rr[r32];;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r9=XSI_PSR_IC
++	mov r8=r32
++	;;
++	ld8 r10=[r9]
++	;;
++	st8 [r9]=r0
++	;;
++	XEN_HYPER_GET_RR
++	;;
++	st8 [r9]=r10
++	;;
++	br.ret.sptk.many rp
++	;;
++END(xen_get_rr)
++
++GLOBAL_ENTRY(xen_set_rr)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov rr[r32]=r33;;
++(p7)	br.ret.sptk.many rp
++	;;
++	movl r11=XSI_PSR_IC
++	mov r8=r32
++	mov r9=r33
++	;;
++	ld8 r10=[r11]
++	;;
++	st8 [r11]=r0
++	;;
++	XEN_HYPER_SET_RR
++	;;
++	st8 [r11]=r10
++	;;
++	br.ret.sptk.many rp
++	;;
++END(xen_set_rr)
++
++GLOBAL_ENTRY(xen_set_kr)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.ne p7,p0=r8,r0;;
++(p7)	br.cond.spnt.few 1f;
++	;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar0=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar1=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar2=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar3=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar4=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar5=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar6=r9
++(p7)	br.ret.sptk.many rp;;
++	cmp.eq p7,p0=r8,r0
++	adds r8=-1,r8;;
++(p7)	mov ar7=r9
++(p7)	br.ret.sptk.many rp;;
++
++1:	movl r11=XSI_PSR_IC
++	mov r8=r32
++	mov r9=r33
++	;;
++	ld8 r10=[r11]
++	;;
++	st8 [r11]=r0
++	;;
++	XEN_HYPER_SET_KR
++	;;
++	st8 [r11]=r10
++	;;
++	br.ret.sptk.many rp
++	;;
++END(xen_set_rr)
++
++GLOBAL_ENTRY(xen_fc)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	fc r32;;
++(p7)	br.ret.sptk.many rp
++	;;
++	ptc.e r96		// this is a "privified" fc r32
++	;;
++	br.ret.sptk.many rp
++END(xen_fc)
++
++GLOBAL_ENTRY(xen_get_cpuid)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov r8=cpuid[r32];;
++(p7)	br.ret.sptk.many rp
++	;;
++	mov r72=rr[r32]		// this is a "privified" mov r8=cpuid[r32]
++	;;
++	br.ret.sptk.many rp
++END(xen_get_cpuid)
++
++GLOBAL_ENTRY(xen_get_pmd)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov r8=pmd[r32];;
++(p7)	br.ret.sptk.many rp
++	;;
++	mov r72=pmc[r32] 	// this is a "privified" mov r8=pmd[r32]
++	;;
++	br.ret.sptk.many rp
++END(xen_get_pmd)
++
++#ifdef CONFIG_IA32_SUPPORT
++GLOBAL_ENTRY(xen_get_eflag)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov r8=ar24;;
++(p7)	br.ret.sptk.many rp
++	;;
++	mov ar24=r72		// this is a "privified" mov r8=ar.eflg
++	;;
++	br.ret.sptk.many rp
++END(xen_get_eflag)
++// some bits aren't set if pl!=0, see SDM vol1 3.1.8
++GLOBAL_ENTRY(xen_set_eflag)
++	movl r8=running_on_xen;;
++	ld4 r8=[r8];;
++	cmp.eq p7,p0=r8,r0;;
++(p7)	mov ar24=r32
++(p7)	br.ret.sptk.many rp
++	;;
++	// FIXME: this remains no-op'd because it generates
++	// a privileged register (general exception) trap rather than
++	// a privileged operation fault
++	//mov ar24=r32
++	;;
++	br.ret.sptk.many rp
++END(xen_get_eflag)
++#endif
+diff --git a/arch/ia64/xen/xen_ksyms.c b/arch/ia64/xen/xen_ksyms.c
+new file mode 100644
+index 0000000..83cff0b
+--- /dev/null
++++ b/arch/ia64/xen/xen_ksyms.c
+@@ -0,0 +1,12 @@
++/*
++ * Architecture-specific kernel symbols
++ *
++ * Don't put any exports here unless it's defined in an assembler file.
++ * All other exports should be put directly after the definition.
++ */
++
++#include <linux/config.h>
++#include <linux/module.h>
++
++extern int is_running_on_xen(void);
++EXPORT_SYMBOL(is_running_on_xen);
+diff --git a/arch/ia64/xen/xenconsole.c b/arch/ia64/xen/xenconsole.c
+new file mode 100644
+index 0000000..e7010d9
+--- /dev/null
++++ b/arch/ia64/xen/xenconsole.c
+@@ -0,0 +1,19 @@
++#include <linux/config.h>
++#include <linux/console.h>
++
++int
++early_xen_console_setup (char *cmdline)
++{
++#ifdef CONFIG_XEN
++#ifndef CONFIG_IA64_HP_SIM
++	extern int running_on_xen;
++	if (running_on_xen) {
++		extern struct console hpsim_cons;
++		hpsim_cons.flags |= CON_BOOT;
++		register_console(&hpsim_cons);
++		return 0;
++	}
++#endif
++#endif
++	return -1;
++}
+diff --git a/arch/ia64/xen/xenentry.S b/arch/ia64/xen/xenentry.S
+new file mode 100644
+index 0000000..0d1ded9
+--- /dev/null
++++ b/arch/ia64/xen/xenentry.S
+@@ -0,0 +1,850 @@
++/*
++ * ia64/xen/entry.S
++ *
++ * Alternate kernel routines for Xen.  Heavily leveraged from
++ *   ia64/kernel/entry.S
++ *
++ * Copyright (C) 2005 Hewlett-Packard Co
++ *	Dan Magenheimer <dan.magenheimer at .hp.com>
++ */
++
++#include <linux/config.h>
++
++#include <asm/asmmacro.h>
++#include <asm/cache.h>
++#include <asm/errno.h>
++#include <asm/kregs.h>
++#include <asm/asm-offsets.h>
++#include <asm/pgtable.h>
++#include <asm/percpu.h>
++#include <asm/processor.h>
++#include <asm/thread_info.h>
++#include <asm/unistd.h>
++
++#ifdef CONFIG_XEN
++#include "xenminstate.h"
++#else
++#include "minstate.h"
++#endif
++
++/*
++ * prev_task <- ia64_switch_to(struct task_struct *next)
++ *	With Ingo's new scheduler, interrupts are disabled when this routine gets
++ *	called.  The code starting at .map relies on this.  The rest of the code
++ *	doesn't care about the interrupt masking status.
++ */
++#ifdef CONFIG_XEN
++GLOBAL_ENTRY(xen_switch_to)
++	.prologue
++	alloc r16=ar.pfs,1,0,0,0
++	movl r22=running_on_xen;;
++	ld4 r22=[r22];;
++	cmp.eq p7,p0=r22,r0
++(p7)	br.cond.sptk.many __ia64_switch_to;;
++#else
++GLOBAL_ENTRY(ia64_switch_to)
++	.prologue
++	alloc r16=ar.pfs,1,0,0,0
++#endif
++	DO_SAVE_SWITCH_STACK
++	.body
++
++	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
++	movl r25=init_task
++	mov r27=IA64_KR(CURRENT_STACK)
++	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
++	dep r20=0,in0,61,3		// physical address of "next"
++	;;
++	st8 [r22]=sp			// save kernel stack pointer of old task
++	shr.u r26=r20,IA64_GRANULE_SHIFT
++	cmp.eq p7,p6=r25,in0
++	;;
++#ifdef CONFIG_XEN
++	movl r8=XSI_PSR_IC
++	;;
++	st4 [r8]=r0	// force psr.ic off for hyperprivop(s)
++	;;
++#endif
++	/*
++	 * If we've already mapped this task's page, we can skip doing it again.
++	 */
++(p6)	cmp.eq p7,p6=r26,r27
++(p6)	br.cond.dpnt .map
++	;;
++.done:
++#ifdef CONFIG_XEN
++	// psr.ic already off
++	// update "current" application register
++	mov r8=IA64_KR_CURRENT
++	mov r9=in0;;
++	XEN_HYPER_SET_KR
++	ld8 sp=[r21]			// load kernel stack pointer of new task
++	movl r27=XSI_PSR_IC
++	mov r8=1
++	;;
++	st4 [r27]=r8			// psr.ic back on
++	;;
++#else
++(p6)	ssm psr.ic			// if we had to map, reenable the psr.ic bit FIRST!!!
++	;;
++(p6)	srlz.d
++	ld8 sp=[r21]			// load kernel stack pointer of new task
++	mov IA64_KR(CURRENT)=in0	// update "current" application register
++#endif
++	mov r8=r13			// return pointer to previously running task
++	mov r13=in0			// set "current" pointer
++	;;
++	DO_LOAD_SWITCH_STACK
++
++#ifdef CONFIG_SMP
++	sync.i				// ensure "fc"s done by this CPU are visible on other CPUs
++#endif
++	br.ret.sptk.many rp		// boogie on out in new context
++
++.map:
++#ifdef CONFIG_XEN
++	// psr.ic already off
++#else
++	rsm psr.ic			// interrupts (psr.i) are already disabled here
++#endif
++	movl r25=PAGE_KERNEL
++	;;
++	srlz.d
++	or r23=r25,r20			// construct PA | page properties
++	mov r25=IA64_GRANULE_SHIFT<<2
++	;;
++#ifdef CONFIG_XEN
++	movl r8=XSI_ITIR
++	;;
++	st8 [r8]=r25
++	;;
++	movl r8=XSI_IFA
++	;;
++	st8 [r8]=in0			 // VA of next task...
++	;;
++	mov r25=IA64_TR_CURRENT_STACK
++	// remember last page we mapped...
++	mov r8=IA64_KR_CURRENT_STACK
++	mov r9=r26;;
++	XEN_HYPER_SET_KR;;
++#else
++	mov cr.itir=r25
++	mov cr.ifa=in0			// VA of next task...
++	;;
++	mov r25=IA64_TR_CURRENT_STACK
++	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
++#endif
++	;;
++	itr.d dtr[r25]=r23		// wire in new mapping...
++	br.cond.sptk .done
++#ifdef CONFIG_XEN
++END(xen_switch_to)
++#else
++END(ia64_switch_to)
++#endif
++
++	/*
++	 * Invoke a system call, but do some tracing before and after the call.
++	 * We MUST preserve the current register frame throughout this routine
++	 * because some system calls (such as ia64_execve) directly
++	 * manipulate ar.pfs.
++	 */
++#ifdef CONFIG_XEN
++GLOBAL_ENTRY(xen_trace_syscall)
++	PT_REGS_UNWIND_INFO(0)
++	movl r16=running_on_xen;;
++	ld4 r16=[r16];;
++	cmp.eq p7,p0=r16,r0
++(p7)	br.cond.sptk.many __ia64_trace_syscall;;
++#else
++GLOBAL_ENTRY(ia64_trace_syscall)
++	PT_REGS_UNWIND_INFO(0)
++#endif
++	/*
++	 * We need to preserve the scratch registers f6-f11 in case the system
++	 * call is sigreturn.
++	 */
++	adds r16=PT(F6)+16,sp
++	adds r17=PT(F7)+16,sp
++	;;
++ 	stf.spill [r16]=f6,32
++ 	stf.spill [r17]=f7,32
++	;;
++ 	stf.spill [r16]=f8,32
++ 	stf.spill [r17]=f9,32
++	;;
++ 	stf.spill [r16]=f10
++ 	stf.spill [r17]=f11
++	br.call.sptk.many rp=syscall_trace_enter // give parent a chance to catch syscall args
++	adds r16=PT(F6)+16,sp
++	adds r17=PT(F7)+16,sp
++	;;
++	ldf.fill f6=[r16],32
++	ldf.fill f7=[r17],32
++	;;
++	ldf.fill f8=[r16],32
++	ldf.fill f9=[r17],32
++	;;
++	ldf.fill f10=[r16]
++	ldf.fill f11=[r17]
++	// the syscall number may have changed, so re-load it and re-calculate the
++	// syscall entry-point:
++	adds r15=PT(R15)+16,sp			// r15 = &pt_regs.r15 (syscall #)
++	;;
++	ld8 r15=[r15]
++	mov r3=NR_syscalls - 1
++	;;
++	adds r15=-1024,r15
++	movl r16=sys_call_table
++	;;
++	shladd r20=r15,3,r16			// r20 = sys_call_table + 8*(syscall-1024)
++	cmp.leu p6,p7=r15,r3
++	;;
++(p6)	ld8 r20=[r20]				// load address of syscall entry point
++(p7)	movl r20=sys_ni_syscall
++	;;
++	mov b6=r20
++	br.call.sptk.many rp=b6			// do the syscall
++.strace_check_retval:
++	cmp.lt p6,p0=r8,r0			// syscall failed?
++	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
++	adds r3=PT(R10)+16,sp			// r3 = &pt_regs.r10
++	mov r10=0
++(p6)	br.cond.sptk strace_error		// syscall failed ->
++	;;					// avoid RAW on r10
++.strace_save_retval:
++.mem.offset 0,0; st8.spill [r2]=r8		// store return value in slot for r8
++.mem.offset 8,0; st8.spill [r3]=r10		// clear error indication in slot for r10
++	br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
++.ret3:	br.cond.sptk .work_pending_syscall_end
++
++strace_error:
++	ld8 r3=[r2]				// load pt_regs.r8
++	sub r9=0,r8				// negate return value to get errno value
++	;;
++	cmp.ne p6,p0=r3,r0			// is pt_regs.r8!=0?
++	adds r3=16,r2				// r3=&pt_regs.r10
++	;;
++(p6)	mov r10=-1
++(p6)	mov r8=r9
++	br.cond.sptk .strace_save_retval
++#ifdef CONFIG_XEN
++END(xen_trace_syscall)
++#else
++END(ia64_trace_syscall)
++#endif
++
++/*
++ * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
++ *	need to switch to bank 0 and doesn't restore the scratch registers.
++ *	To avoid leaking kernel bits, the scratch registers are set to
++ *	the following known-to-be-safe values:
++ *
++ *		  r1: restored (global pointer)
++ *		  r2: cleared
++ *		  r3: 1 (when returning to user-level)
++ *	      r8-r11: restored (syscall return value(s))
++ *		 r12: restored (user-level stack pointer)
++ *		 r13: restored (user-level thread pointer)
++ *		 r14: cleared
++ *		 r15: restored (syscall #)
++ *	     r16-r17: cleared
++ *		 r18: user-level b6
++ *		 r19: cleared
++ *		 r20: user-level ar.fpsr
++ *		 r21: user-level b0
++ *		 r22: cleared
++ *		 r23: user-level ar.bspstore
++ *		 r24: user-level ar.rnat
++ *		 r25: user-level ar.unat
++ *		 r26: user-level ar.pfs
++ *		 r27: user-level ar.rsc
++ *		 r28: user-level ip
++ *		 r29: user-level psr
++ *		 r30: user-level cfm
++ *		 r31: user-level pr
++ *	      f6-f11: cleared
++ *		  pr: restored (user-level pr)
++ *		  b0: restored (user-level rp)
++ *	          b6: restored
++ *		  b7: cleared
++ *	     ar.unat: restored (user-level ar.unat)
++ *	      ar.pfs: restored (user-level ar.pfs)
++ *	      ar.rsc: restored (user-level ar.rsc)
++ *	     ar.rnat: restored (user-level ar.rnat)
++ *	 ar.bspstore: restored (user-level ar.bspstore)
++ *	     ar.fpsr: restored (user-level ar.fpsr)
++ *	      ar.ccv: cleared
++ *	      ar.csd: cleared
++ *	      ar.ssd: cleared
++ */
++#ifdef CONFIG_XEN
++GLOBAL_ENTRY(xen_leave_syscall)
++	PT_REGS_UNWIND_INFO(0)
++	movl r22=running_on_xen;;
++	ld4 r22=[r22];;
++	cmp.eq p7,p0=r22,r0
++(p7)	br.cond.sptk.many __ia64_leave_syscall;;
++#else
++ENTRY(ia64_leave_syscall)
++	PT_REGS_UNWIND_INFO(0)
++#endif
++	/*
++	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
++	 * user- or fsys-mode, hence we disable interrupts early on.
++	 *
++	 * p6 controls whether current_thread_info()->flags needs to be check for
++	 * extra work.  We always check for extra work when returning to user-level.
++	 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
++	 * is 0.  After extra work processing has been completed, execution
++	 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
++	 * needs to be redone.
++	 */
++#ifdef CONFIG_PREEMPT
++	rsm psr.i				// disable interrupts
++	cmp.eq pLvSys,p0=r0,r0			// pLvSys=1: leave from syscall
++(pKStk) adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
++	;;
++	.pred.rel.mutex pUStk,pKStk
++(pKStk) ld4 r21=[r20]			// r21 <- preempt_count
++(pUStk)	mov r21=0			// r21 <- 0
++	;;
++	cmp.eq p6,p0=r21,r0		// p6 <- pUStk || (preempt_count == 0)
++#else /* !CONFIG_PREEMPT */
++#ifdef CONFIG_XEN
++	movl r2=XSI_PSR_I
++	;;
++(pUStk)	st4 [r2]=r0
++#else
++(pUStk)	rsm psr.i
++#endif
++	cmp.eq pLvSys,p0=r0,r0		// pLvSys=1: leave from syscall
++(pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
++#endif
++.work_processed_syscall:
++	adds r2=PT(LOADRS)+16,r12
++	adds r3=PT(AR_BSPSTORE)+16,r12
++	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
++	;;
++(p6)	ld4 r31=[r18]				// load current_thread_info()->flags
++	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
++	mov b7=r0		// clear b7
++	;;
++	ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE)	// load ar.bspstore (may be garbage)
++	ld8 r18=[r2],PT(R9)-PT(B6)		// load b6
++(p6)	and r15=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
++	;;
++	mov r16=ar.bsp				// M2  get existing backing store pointer
++(p6)	cmp4.ne.unc p6,p0=r15, r0		// any special work pending?
++(p6)	br.cond.spnt .work_pending_syscall
++	;;
++	// start restoring the state saved on the kernel stack (struct pt_regs):
++	ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
++	ld8 r11=[r3],PT(CR_IIP)-PT(R11)
++	mov f6=f0		// clear f6
++	;;
++	invala			// M0|1 invalidate ALAT
++#ifdef CONFIG_XEN
++	movl r29=XSI_PSR_IC
++	;;
++	st8	[r29]=r0	// note: clears both vpsr.i and vpsr.ic!
++	;;
++#else
++	rsm psr.i | psr.ic	// M2 initiate turning off of interrupt and interruption collection
++#endif
++	mov f9=f0		// clear f9
++
++	ld8 r29=[r2],16		// load cr.ipsr
++	ld8 r28=[r3],16			// load cr.iip
++	mov f8=f0		// clear f8
++	;;
++	ld8 r30=[r2],16		// M0|1 load cr.ifs
++	mov.m ar.ssd=r0		// M2 clear ar.ssd
++	cmp.eq p9,p0=r0,r0	// set p9 to indicate that we should restore cr.ifs
++	;;
++	ld8 r25=[r3],16		// M0|1 load ar.unat
++	mov.m ar.csd=r0		// M2 clear ar.csd
++	mov r22=r0		// clear r22
++	;;
++	ld8 r26=[r2],PT(B0)-PT(AR_PFS)	// M0|1 load ar.pfs
++(pKStk)	mov r22=psr		// M2 read PSR now that interrupts are disabled
++	mov f10=f0		// clear f10
++	;;
++	ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // load b0
++	ld8 r27=[r3],PT(PR)-PT(AR_RSC)	// load ar.rsc
++	mov f11=f0		// clear f11
++	;;
++	ld8 r24=[r2],PT(AR_FPSR)-PT(AR_RNAT)	// load ar.rnat (may be garbage)
++	ld8 r31=[r3],PT(R1)-PT(PR)		// load predicates
++(pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
++	;;
++	ld8 r20=[r2],PT(R12)-PT(AR_FPSR)	// load ar.fpsr
++	ld8.fill r1=[r3],16	// load r1
++(pUStk) mov r17=1
++	;;
++	srlz.d			// M0  ensure interruption collection is off
++	ld8.fill r13=[r3],16
++	mov f7=f0		// clear f7
++	;;
++	ld8.fill r12=[r2]	// restore r12 (sp)
++	ld8.fill r15=[r3]	// restore r15
++	addl r3=THIS_CPU(ia64_phys_stacked_size_p8),r0
++	;;
++(pUStk)	ld4 r3=[r3]		// r3 = cpu_data->phys_stacked_size_p8
++(pUStk) st1 [r14]=r17
++	mov b6=r18		// I0  restore b6
++	;;
++	mov r14=r0		// clear r14
++	shr.u r18=r19,16	// I0|1 get byte size of existing "dirty" partition
++(pKStk) br.cond.dpnt.many skip_rbs_switch
++
++	mov.m ar.ccv=r0		// clear ar.ccv
++(pNonSys) br.cond.dpnt.many dont_preserve_current_frame
++	br.cond.sptk.many rbs_switch
++#ifdef CONFIG_XEN
++END(xen_leave_syscall)
++#else
++END(ia64_leave_syscall)
++#endif
++
++#ifdef CONFIG_XEN
++GLOBAL_ENTRY(xen_leave_kernel)
++	PT_REGS_UNWIND_INFO(0)
++	movl r22=running_on_xen;;
++	ld4 r22=[r22];;
++	cmp.eq p7,p0=r22,r0
++(p7)	br.cond.sptk.many __ia64_leave_kernel;;
++#else
++GLOBAL_ENTRY(ia64_leave_kernel)
++	PT_REGS_UNWIND_INFO(0)
++#endif
++	/*
++	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
++	 * user- or fsys-mode, hence we disable interrupts early on.
++	 *
++	 * p6 controls whether current_thread_info()->flags needs to be check for
++	 * extra work.  We always check for extra work when returning to user-level.
++	 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
++	 * is 0.  After extra work processing has been completed, execution
++	 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
++	 * needs to be redone.
++	 */
++#ifdef CONFIG_PREEMPT
++	rsm psr.i				// disable interrupts
++	cmp.eq p0,pLvSys=r0,r0			// pLvSys=0: leave from kernel
++(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
++	;;
++	.pred.rel.mutex pUStk,pKStk
++(pKStk)	ld4 r21=[r20]			// r21 <- preempt_count
++(pUStk)	mov r21=0			// r21 <- 0
++	;;
++	cmp.eq p6,p0=r21,r0		// p6 <- pUStk || (preempt_count == 0)
++#else
++#ifdef CONFIG_XEN
++(pUStk)	movl r17=XSI_PSR_I
++	;;
++(pUStk)	st4 [r17]=r0
++	;;
++#else
++(pUStk)	rsm psr.i
++#endif
++	cmp.eq p0,pLvSys=r0,r0		// pLvSys=0: leave from kernel
++(pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
++#endif
++.work_processed_kernel:
++	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
++	;;
++(p6)	ld4 r31=[r17]				// load current_thread_info()->flags
++	adds r21=PT(PR)+16,r12
++	;;
++
++	lfetch [r21],PT(CR_IPSR)-PT(PR)
++	adds r2=PT(B6)+16,r12
++	adds r3=PT(R16)+16,r12
++	;;
++	lfetch [r21]
++	ld8 r28=[r2],8		// load b6
++	adds r29=PT(R24)+16,r12
++
++	ld8.fill r16=[r3],PT(AR_CSD)-PT(R16)
++	adds r30=PT(AR_CCV)+16,r12
++(p6)	and r19=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
++	;;
++	ld8.fill r24=[r29]
++	ld8 r15=[r30]		// load ar.ccv
++(p6)	cmp4.ne.unc p6,p0=r19, r0		// any special work pending?
++	;;
++	ld8 r29=[r2],16		// load b7
++	ld8 r30=[r3],16		// load ar.csd
++(p6)	br.cond.spnt .work_pending
++	;;
++	ld8 r31=[r2],16		// load ar.ssd
++	ld8.fill r8=[r3],16
++	;;
++	ld8.fill r9=[r2],16
++	ld8.fill r10=[r3],PT(R17)-PT(R10)
++	;;
++	ld8.fill r11=[r2],PT(R18)-PT(R11)
++	ld8.fill r17=[r3],16
++	;;
++	ld8.fill r18=[r2],16
++	ld8.fill r19=[r3],16
++	;;
++	ld8.fill r20=[r2],16
++	ld8.fill r21=[r3],16
++	mov ar.csd=r30
++	mov ar.ssd=r31
++	;;
++#ifdef CONFIG_XEN
++	movl r22=XSI_PSR_IC
++	;;
++	st8 [r22]=r0		// note: clears both vpsr.i and vpsr.ic!
++	;;
++#else
++	rsm psr.i | psr.ic	// initiate turning off of interrupt and interruption collection
++#endif
++	invala			// invalidate ALAT
++	;;
++	ld8.fill r22=[r2],24
++	ld8.fill r23=[r3],24
++	mov b6=r28
++	;;
++	ld8.fill r25=[r2],16
++	ld8.fill r26=[r3],16
++	mov b7=r29
++	;;
++	ld8.fill r27=[r2],16
++	ld8.fill r28=[r3],16
++	;;
++	ld8.fill r29=[r2],16
++	ld8.fill r30=[r3],24
++	;;
++	ld8.fill r31=[r2],PT(F9)-PT(R31)
++	adds r3=PT(F10)-PT(F6),r3
++	;;
++	ldf.fill f9=[r2],PT(F6)-PT(F9)
++	ldf.fill f10=[r3],PT(F8)-PT(F10)
++	;;
++	ldf.fill f6=[r2],PT(F7)-PT(F6)
++	;;
++	ldf.fill f7=[r2],PT(F11)-PT(F7)
++	ldf.fill f8=[r3],32
++	;;
++	srlz.i			// ensure interruption collection is off
++	mov ar.ccv=r15
++	;;
++	ldf.fill f11=[r2]
++#ifdef CONFIG_XEN
++	;;
++	// r16-r31 all now hold bank1 values
++	movl r2=XSI_BANK1_R16
++	movl r3=XSI_BANK1_R16+8
++	;;
++	st8.spill [r2]=r16,16
++	st8.spill [r3]=r17,16
++	;;
++	st8.spill [r2]=r18,16
++	st8.spill [r3]=r19,16
++	;;
++	st8.spill [r2]=r20,16
++	st8.spill [r3]=r21,16
++	;;
++	st8.spill [r2]=r22,16
++	st8.spill [r3]=r23,16
++	;;
++	st8.spill [r2]=r24,16
++	st8.spill [r3]=r25,16
++	;;
++	st8.spill [r2]=r26,16
++	st8.spill [r3]=r27,16
++	;;
++	st8.spill [r2]=r28,16
++	st8.spill [r3]=r29,16
++	;;
++	st8.spill [r2]=r30,16
++	st8.spill [r3]=r31,16
++	;;
++	movl r2=XSI_BANKNUM;;
++	st4 [r2]=r0;
++#else
++	bsw.0			// switch back to bank 0 (no stop bit required beforehand...)
++#endif
++	;;
++(pUStk)	mov r18=IA64_KR(CURRENT)// M2 (12 cycle read latency)
++	adds r16=PT(CR_IPSR)+16,r12
++	adds r17=PT(CR_IIP)+16,r12
++
++(pKStk)	mov r22=psr		// M2 read PSR now that interrupts are disabled
++	nop.i 0
++	nop.i 0
++	;;
++	ld8 r29=[r16],16	// load cr.ipsr
++	ld8 r28=[r17],16	// load cr.iip
++	;;
++	ld8 r30=[r16],16	// load cr.ifs
++	ld8 r25=[r17],16	// load ar.unat
++	;;
++	ld8 r26=[r16],16	// load ar.pfs
++	ld8 r27=[r17],16	// load ar.rsc
++	cmp.eq p9,p0=r0,r0	// set p9 to indicate that we should restore cr.ifs
++	;;
++	ld8 r24=[r16],16	// load ar.rnat (may be garbage)
++	ld8 r23=[r17],16	// load ar.bspstore (may be garbage)
++	;;
++	ld8 r31=[r16],16	// load predicates
++	ld8 r21=[r17],16	// load b0
++	;;
++	ld8 r19=[r16],16	// load ar.rsc value for "loadrs"
++	ld8.fill r1=[r17],16	// load r1
++	;;
++	ld8.fill r12=[r16],16
++	ld8.fill r13=[r17],16
++(pUStk)	adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18
++	;;
++	ld8 r20=[r16],16	// ar.fpsr
++	ld8.fill r15=[r17],16
++	;;
++	ld8.fill r14=[r16],16
++	ld8.fill r2=[r17]
++(pUStk)	mov r17=1
++	;;
++	ld8.fill r3=[r16]
++(pUStk)	st1 [r18]=r17		// restore current->thread.on_ustack
++	shr.u r18=r19,16	// get byte size of existing "dirty" partition
++	;;
++	mov r16=ar.bsp		// get existing backing store pointer
++	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
++	;;
++	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
++(pKStk)	br.cond.dpnt skip_rbs_switch
++
++	/*
++	 * Restore user backing store.
++	 *
++	 * NOTE: alloc, loadrs, and cover can't be predicated.
++	 */
++(pNonSys) br.cond.dpnt dont_preserve_current_frame
++
++rbs_switch:
++#ifdef CONFIG_XEN
++	XEN_HYPER_COVER;
++#else
++	cover				// add current frame into dirty partition and set cr.ifs
++#endif
++	;;
++	mov r19=ar.bsp			// get new backing store pointer
++	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
++	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
++	;;
++	sub r19=r19,r16			// calculate total byte size of dirty partition
++	add r18=64,r18			// don't force in0-in7 into memory...
++	;;
++	shl r19=r19,16			// shift size of dirty partition into loadrs position
++	;;
++dont_preserve_current_frame:
++	/*
++	 * To prevent leaking bits between the kernel and user-space,
++	 * we must clear the stacked registers in the "invalid" partition here.
++	 * Not pretty, but at least it's fast (3.34 registers/cycle on Itanium,
++	 * 5 registers/cycle on McKinley).
++	 */
++#	define pRecurse	p6
++#	define pReturn	p7
++#ifdef CONFIG_ITANIUM
++#	define Nregs	10
++#else
++#	define Nregs	14
++#endif
++	alloc loc0=ar.pfs,2,Nregs-2,2,0
++	shr.u loc1=r18,9		// RNaTslots <= floor(dirtySize / (64*8))
++	sub r17=r17,r18			// r17 = (physStackedSize + 8) - dirtySize
++	;;
++	mov ar.rsc=r19			// load ar.rsc to be used for "loadrs"
++	shladd in0=loc1,3,r17
++	mov in1=0
++	;;
++	TEXT_ALIGN(32)
++rse_clear_invalid:
++#ifdef CONFIG_ITANIUM
++	// cycle 0
++ { .mii
++	alloc loc0=ar.pfs,2,Nregs-2,2,0
++	cmp.lt pRecurse,p0=Nregs*8,in0	// if more than Nregs regs left to clear, (re)curse
++	add out0=-Nregs*8,in0
++}{ .mfb
++	add out1=1,in1			// increment recursion count
++	nop.f 0
++	nop.b 0				// can't do br.call here because of alloc (WAW on CFM)
++	;;
++}{ .mfi	// cycle 1
++	mov loc1=0
++	nop.f 0
++	mov loc2=0
++}{ .mib
++	mov loc3=0
++	mov loc4=0
++(pRecurse) br.call.sptk.many b0=rse_clear_invalid
++
++}{ .mfi	// cycle 2
++	mov loc5=0
++	nop.f 0
++	cmp.ne pReturn,p0=r0,in1	// if recursion count != 0, we need to do a br.ret
++}{ .mib
++	mov loc6=0
++	mov loc7=0
++(pReturn) br.ret.sptk.many b0
++}
++#else /* !CONFIG_ITANIUM */
++	alloc loc0=ar.pfs,2,Nregs-2,2,0
++	cmp.lt pRecurse,p0=Nregs*8,in0	// if more than Nregs regs left to clear, (re)curse
++	add out0=-Nregs*8,in0
++	add out1=1,in1			// increment recursion count
++	mov loc1=0
++	mov loc2=0
++	;;
++	mov loc3=0
++	mov loc4=0
++	mov loc5=0
++	mov loc6=0
++	mov loc7=0
++(pRecurse) br.call.sptk.few b0=rse_clear_invalid
++	;;
++	mov loc8=0
++	mov loc9=0
++	cmp.ne pReturn,p0=r0,in1	// if recursion count != 0, we need to do a br.ret
++	mov loc10=0
++	mov loc11=0
++(pReturn) br.ret.sptk.many b0
++#endif /* !CONFIG_ITANIUM */
++#	undef pRecurse
++#	undef pReturn
++	;;
++	alloc r17=ar.pfs,0,0,0,0	// drop current register frame
++	;;
++	loadrs
++	;;
++skip_rbs_switch:
++	mov ar.unat=r25		// M2
++(pKStk)	extr.u r22=r22,21,1	// I0 extract current value of psr.pp from r22
++(pLvSys)mov r19=r0		// A  clear r19 for leave_syscall, no-op otherwise
++	;;
++(pUStk)	mov ar.bspstore=r23	// M2
++(pKStk)	dep r29=r22,r29,21,1	// I0 update ipsr.pp with psr.pp
++(pLvSys)mov r16=r0		// A  clear r16 for leave_syscall, no-op otherwise
++	;;
++#ifdef CONFIG_XEN
++	movl r25=XSI_IPSR
++	;;
++	st8[r25]=r29,XSI_IFS-XSI_IPSR
++	;;
++#else
++	mov cr.ipsr=r29		// M2
++#endif
++	mov ar.pfs=r26		// I0
++(pLvSys)mov r17=r0		// A  clear r17 for leave_syscall, no-op otherwise
++
++#ifdef CONFIG_XEN
++(p9)	st8 [r25]=r30
++	;;
++	adds r25=XSI_IIP-XSI_IFS,r25
++	;;
++#else
++(p9)	mov cr.ifs=r30		// M2
++#endif
++	mov b0=r21		// I0
++(pLvSys)mov r18=r0		// A  clear r18 for leave_syscall, no-op otherwise
++
++	mov ar.fpsr=r20		// M2
++#ifdef CONFIG_XEN
++	st8	[r25]=r28
++#else
++	mov cr.iip=r28		// M2
++#endif
++	nop 0
++	;;
++(pUStk)	mov ar.rnat=r24		// M2 must happen with RSE in lazy mode
++	nop 0
++(pLvSys)mov r2=r0
++
++	mov ar.rsc=r27		// M2
++	mov pr=r31,-1		// I0
++#ifdef CONFIG_XEN
++	;;
++	XEN_HYPER_RFI;
++#else
++	rfi			// B
++#endif
++
++	/*
++	 * On entry:
++	 *	r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
++	 *	r31 = current->thread_info->flags
++	 * On exit:
++	 *	p6 = TRUE if work-pending-check needs to be redone
++	 */
++.work_pending_syscall:
++	add r2=-8,r2
++	add r3=-8,r3
++	;;
++	st8 [r2]=r8
++	st8 [r3]=r10
++.work_pending:
++	tbit.nz p6,p0=r31,TIF_SIGDELAYED		// signal delayed from  MCA/INIT/NMI/PMI context?
++(p6)	br.cond.sptk.few .sigdelayed
++	;;
++	tbit.z p6,p0=r31,TIF_NEED_RESCHED		// current_thread_info()->need_resched==0?
++(p6)	br.cond.sptk.few .notify
++#ifdef CONFIG_PREEMPT
++(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1
++	;;
++(pKStk) st4 [r20]=r21
++	ssm psr.i		// enable interrupts
++#endif
++	br.call.spnt.many rp=schedule
++.ret9:	cmp.eq p6,p0=r0,r0				// p6 <- 1
++#ifdef CONFIG_XEN
++	movl r2=XSI_PSR_I
++	;;
++	st4 [r2]=r0
++#else
++	rsm psr.i		// disable interrupts
++#endif
++	;;
++#ifdef CONFIG_PREEMPT
++(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
++	;;
++(pKStk)	st4 [r20]=r0		// preempt_count() <- 0
++#endif
++(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
++	br.cond.sptk.many .work_processed_kernel	// re-check
++
++.notify:
++(pUStk)	br.call.spnt.many rp=notify_resume_user
++.ret10:	cmp.ne p6,p0=r0,r0				// p6 <- 0
++(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
++	br.cond.sptk.many .work_processed_kernel	// don't re-check
++
++// There is a delayed signal that was detected in MCA/INIT/NMI/PMI context where
++// it could not be delivered.  Deliver it now.  The signal might be for us and
++// may set TIF_SIGPENDING, so redrive ia64_leave_* after processing the delayed
++// signal.
++
++.sigdelayed:
++	br.call.sptk.many rp=do_sigdelayed
++	cmp.eq p6,p0=r0,r0				// p6 <- 1, always re-check
++(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
++	br.cond.sptk.many .work_processed_kernel	// re-check
++
++.work_pending_syscall_end:
++	adds r2=PT(R8)+16,r12
++	adds r3=PT(R10)+16,r12
++	;;
++	ld8 r8=[r2]
++	ld8 r10=[r3]
++	br.cond.sptk.many .work_processed_syscall	// re-check
++
++#ifdef CONFIG_XEN
++END(xen_leave_kernel)
++#else
++END(ia64_leave_kernel)
++#endif
+diff --git a/arch/ia64/xen/xenhpski.c b/arch/ia64/xen/xenhpski.c
+new file mode 100644
+index 0000000..3bc6cdb
+--- /dev/null
++++ b/arch/ia64/xen/xenhpski.c
+@@ -0,0 +1,19 @@
++
++extern unsigned long xen_get_cpuid(int);
++
++int
++running_on_sim(void)
++{
++	int i;
++	long cpuid[6];
++
++	for (i = 0; i < 5; ++i)
++		cpuid[i] = xen_get_cpuid(i);
++	if ((cpuid[0] & 0xff) != 'H') return 0;
++	if ((cpuid[3] & 0xff) != 0x4) return 0;
++	if (((cpuid[3] >> 8) & 0xff) != 0x0) return 0;
++	if (((cpuid[3] >> 16) & 0xff) != 0x0) return 0;
++	if (((cpuid[3] >> 24) & 0x7) != 0x7) return 0;
++	return 1;
++}
++
+diff --git a/arch/ia64/xen/xenivt.S b/arch/ia64/xen/xenivt.S
+new file mode 100644
+index 0000000..d53b52a
+--- /dev/null
++++ b/arch/ia64/xen/xenivt.S
+@@ -0,0 +1,2044 @@
++/*
++ * arch/ia64/xen/ivt.S
++ *
++ * Copyright (C) 2005 Hewlett-Packard Co
++ *	Dan Magenheimer <dan.magenheimer at hp.com>
++ */
++/*
++ * This file defines the interruption vector table used by the CPU.
++ * It does not include one entry per possible cause of interruption.
++ *
++ * The first 20 entries of the table contain 64 bundles each while the
++ * remaining 48 entries contain only 16 bundles each.
++ *
++ * The 64 bundles are used to allow inlining the whole handler for critical
++ * interruptions like TLB misses.
++ *
++ *  For each entry, the comment is as follows:
++ *
++ *		// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
++ *  entry offset ----/     /         /                  /          /
++ *  entry number ---------/         /                  /          /
++ *  size of the entry -------------/                  /          /
++ *  vector name -------------------------------------/          /
++ *  interruptions triggering this vector ----------------------/
++ *
++ * The table is 32KB in size and must be aligned on 32KB boundary.
++ * (The CPU ignores the 15 lower bits of the address)
++ *
++ * Table is based upon EAS2.6 (Oct 1999)
++ */
++
++#include <linux/config.h>
++
++#include <asm/asmmacro.h>
++#include <asm/break.h>
++#include <asm/ia32.h>
++#include <asm/kregs.h>
++#include <asm/asm-offsets.h>
++#include <asm/pgtable.h>
++#include <asm/processor.h>
++#include <asm/ptrace.h>
++#include <asm/system.h>
++#include <asm/thread_info.h>
++#include <asm/unistd.h>
++#include <asm/errno.h>
++
++#ifdef CONFIG_XEN
++#define ia64_ivt xen_ivt
++#endif
++
++#if 1
++# define PSR_DEFAULT_BITS	psr.ac
++#else
++# define PSR_DEFAULT_BITS	0
++#endif
++
++#if 0
++  /*
++   * This lets you track the last eight faults that occurred on the CPU.  Make sure ar.k2 isn't
++   * needed for something else before enabling this...
++   */
++# define DBG_FAULT(i)	mov r16=ar.k2;;	shl r16=r16,8;;	add r16=(i),r16;;mov ar.k2=r16
++#else
++# define DBG_FAULT(i)
++#endif
++
++#define MINSTATE_VIRT	/* needed by minstate.h */
++#include "xenminstate.h"
++
++#define FAULT(n)									\
++	mov r31=pr;									\
++	mov r19=n;;			/* prepare to save predicates */		\
++	br.sptk.many dispatch_to_fault_handler
++
++	.section .text.ivt,"ax"
++
++	.align 32768	// align on 32KB boundary
++	.global ia64_ivt
++ia64_ivt:
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x0000 Entry 0 (size 64 bundles) VHPT Translation (8,20,47)
++ENTRY(vhpt_miss)
++	DBG_FAULT(0)
++	/*
++	 * The VHPT vector is invoked when the TLB entry for the virtual page table
++	 * is missing.  This happens only as a result of a previous
++	 * (the "original") TLB miss, which may either be caused by an instruction
++	 * fetch or a data access (or non-access).
++	 *
++	 * What we do here is normal TLB miss handing for the _original_ miss, followed
++	 * by inserting the TLB entry for the virtual page table page that the VHPT
++	 * walker was attempting to access.  The latter gets inserted as long
++	 * as both L1 and L2 have valid mappings for the faulting address.
++	 * The TLB entry for the original miss gets inserted only if
++	 * the L3 entry indicates that the page is present.
++	 *
++	 * do_page_fault gets invoked in the following cases:
++	 *	- the faulting virtual address uses unimplemented address bits
++	 *	- the faulting virtual address has no L1, L2, or L3 mapping
++	 */
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++#ifdef CONFIG_HUGETLB_PAGE
++	movl r18=PAGE_SHIFT
++	movl r25=XSI_ITIR
++	;;
++	ld8 r25=[r25]
++#endif
++	;;
++#else
++	mov r16=cr.ifa				// get address that caused the TLB miss
++#ifdef CONFIG_HUGETLB_PAGE
++	movl r18=PAGE_SHIFT
++	mov r25=cr.itir
++#endif
++#endif
++	;;
++#ifdef CONFIG_XEN
++	XEN_HYPER_RSM_PSR_DT;
++#else
++	rsm psr.dt				// use physical addressing for data
++#endif
++	mov r31=pr				// save the predicate registers
++	mov r19=IA64_KR(PT_BASE)		// get page table base address
++	shl r21=r16,3				// shift bit 60 into sign bit
++	shr.u r17=r16,61			// get the region number into r17
++	;;
++	shr r22=r21,3
++#ifdef CONFIG_HUGETLB_PAGE
++	extr.u r26=r25,2,6
++	;;
++	cmp.ne p8,p0=r18,r26
++	sub r27=r26,r18
++	;;
++(p8)	dep r25=r18,r25,2,6
++(p8)	shr r22=r22,r27
++#endif
++	;;
++	cmp.eq p6,p7=5,r17			// is IFA pointing into to region 5?
++	shr.u r18=r22,PGDIR_SHIFT		// get bits 33-63 of the faulting address
++	;;
++(p7)	dep r17=r17,r19,(PAGE_SHIFT-3),3	// put region number bits in place
++
++	srlz.d
++	LOAD_PHYSICAL(p6, r19, swapper_pg_dir)	// region 5 is rooted at swapper_pg_dir
++
++	.pred.rel "mutex", p6, p7
++(p6)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT
++(p7)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT-3
++	;;
++(p6)	dep r17=r18,r19,3,(PAGE_SHIFT-3)	// r17=PTA + IFA(33,42)*8
++(p7)	dep r17=r18,r17,3,(PAGE_SHIFT-6)	// r17=PTA + (((IFA(61,63) << 7) | IFA(33,39))*8)
++	cmp.eq p7,p6=0,r21			// unused address bits all zeroes?
++	shr.u r18=r22,PMD_SHIFT			// shift L2 index into position
++	;;
++	ld8 r17=[r17]				// fetch the L1 entry (may be 0)
++	;;
++(p7)	cmp.eq p6,p7=r17,r0			// was L1 entry NULL?
++	dep r17=r18,r17,3,(PAGE_SHIFT-3)	// compute address of L2 page table entry
++	;;
++(p7)	ld8 r20=[r17]				// fetch the L2 entry (may be 0)
++	shr.u r19=r22,PAGE_SHIFT		// shift L3 index into position
++	;;
++(p7)	cmp.eq.or.andcm p6,p7=r20,r0		// was L2 entry NULL?
++	dep r21=r19,r20,3,(PAGE_SHIFT-3)	// compute address of L3 page table entry
++	;;
++#ifdef CONFIG_XEN
++(p7)	ld8 r18=[r21]				// read the L3 PTE
++	movl r19=XSI_ISR
++	;;
++	ld8 r19=[r19]
++	;;
++(p7)	tbit.z p6,p7=r18,_PAGE_P_BIT		// page present bit cleared?
++	movl r22=XSI_IHA
++	;;
++	ld8 r22=[r22]
++	;;
++#else
++(p7)	ld8 r18=[r21]				// read the L3 PTE
++	mov r19=cr.isr				// cr.isr bit 0 tells us if this is an insn miss
++	;;
++(p7)	tbit.z p6,p7=r18,_PAGE_P_BIT		// page present bit cleared?
++	mov r22=cr.iha				// get the VHPT address that caused the TLB miss
++	;;					// avoid RAW on p7
++#endif
++(p7)	tbit.nz.unc p10,p11=r19,32		// is it an instruction TLB miss?
++	dep r23=0,r20,0,PAGE_SHIFT		// clear low bits to get page address
++	;;
++#ifdef CONFIG_XEN
++	mov r24=r8
++	mov r8=r18
++	;;
++(p10)	XEN_HYPER_ITC_D
++	;;
++(p11)	XEN_HYPER_ITC_I
++	;;
++	mov r8=r24
++	;;
++(p6)	br.cond.spnt.many page_fault		// handle bad address/page not present (page fault)
++	;;
++	movl r24=XSI_IFA
++	;;
++	st8 [r24]=r22
++	;;
++#else
++(p10)	itc.i r18				// insert the instruction TLB entry
++(p11)	itc.d r18				// insert the data TLB entry
++(p6)	br.cond.spnt.many page_fault		// handle bad address/page not present (page fault)
++	mov cr.ifa=r22
++#endif
++
++#ifdef CONFIG_HUGETLB_PAGE
++(p8)	mov cr.itir=r25				// change to default page-size for VHPT
++#endif
++
++	/*
++	 * Now compute and insert the TLB entry for the virtual page table.  We never
++	 * execute in a page table page so there is no need to set the exception deferral
++	 * bit.
++	 */
++	adds r24=__DIRTY_BITS_NO_ED|_PAGE_PL_0|_PAGE_AR_RW,r23
++	;;
++#ifdef CONFIG_XEN
++(p7)	mov r25=r8
++(p7)	mov r8=r24
++	;;
++(p7)	XEN_HYPER_ITC_D
++	;;
++(p7)	mov r8=r25
++	;;
++#else
++(p7)	itc.d r24
++#endif
++	;;
++#ifdef CONFIG_SMP
++	/*
++	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
++	 * cannot possibly affect the following loads:
++	 */
++	dv_serialize_data
++
++	/*
++	 * Re-check L2 and L3 pagetable.  If they changed, we may have received a ptc.g
++	 * between reading the pagetable and the "itc".  If so, flush the entry we
++	 * inserted and retry.
++	 */
++	ld8 r25=[r21]				// read L3 PTE again
++	ld8 r26=[r17]				// read L2 entry again
++	;;
++	cmp.ne p6,p7=r26,r20			// did L2 entry change
++	mov r27=PAGE_SHIFT<<2
++	;;
++(p6)	ptc.l r22,r27				// purge PTE page translation
++(p7)	cmp.ne.or.andcm p6,p7=r25,r18		// did L3 PTE change
++	;;
++(p6)	ptc.l r16,r27				// purge translation
++#endif
++
++	mov pr=r31,-1				// restore predicate registers
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(vhpt_miss)
++
++	.org ia64_ivt+0x400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x0400 Entry 1 (size 64 bundles) ITLB (21)
++ENTRY(itlb_miss)
++	DBG_FAULT(1)
++	/*
++	 * The ITLB handler accesses the L3 PTE via the virtually mapped linear
++	 * page table.  If a nested TLB miss occurs, we switch into physical
++	 * mode, walk the page table, and then re-execute the L3 PTE read
++	 * and go on normally after that.
++	 */
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++#else
++	mov r16=cr.ifa				// get virtual address
++#endif
++	mov r29=b0				// save b0
++	mov r31=pr				// save predicates
++.itlb_fault:
++#ifdef CONFIG_XEN
++	movl r17=XSI_IHA
++	;;
++	ld8 r17=[r17]				// get virtual address of L3 PTE
++#else
++	mov r17=cr.iha				// get virtual address of L3 PTE
++#endif
++	movl r30=1f				// load nested fault continuation point
++	;;
++1:	ld8 r18=[r17]				// read L3 PTE
++	;;
++	mov b0=r29
++	tbit.z p6,p0=r18,_PAGE_P_BIT		// page present bit cleared?
++(p6)	br.cond.spnt page_fault
++	;;
++#ifdef CONFIG_XEN
++	mov r19=r8
++	mov r8=r18
++	;;
++	XEN_HYPER_ITC_I
++	;;
++	mov r8=r19
++#else
++	itc.i r18
++#endif
++	;;
++#ifdef CONFIG_SMP
++	/*
++	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
++	 * cannot possibly affect the following loads:
++	 */
++	dv_serialize_data
++
++	ld8 r19=[r17]				// read L3 PTE again and see if same
++	mov r20=PAGE_SHIFT<<2			// setup page size for purge
++	;;
++	cmp.ne p7,p0=r18,r19
++	;;
++(p7)	ptc.l r16,r20
++#endif
++	mov pr=r31,-1
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(itlb_miss)
++
++	.org ia64_ivt+0x0800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
++ENTRY(dtlb_miss)
++	DBG_FAULT(2)
++	/*
++	 * The DTLB handler accesses the L3 PTE via the virtually mapped linear
++	 * page table.  If a nested TLB miss occurs, we switch into physical
++	 * mode, walk the page table, and then re-execute the L3 PTE read
++	 * and go on normally after that.
++	 */
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++#else
++	mov r16=cr.ifa				// get virtual address
++#endif
++	mov r29=b0				// save b0
++	mov r31=pr				// save predicates
++dtlb_fault:
++#ifdef CONFIG_XEN
++	movl r17=XSI_IHA
++	;;
++	ld8 r17=[r17]				// get virtual address of L3 PTE
++#else
++	mov r17=cr.iha				// get virtual address of L3 PTE
++#endif
++	movl r30=1f				// load nested fault continuation point
++	;;
++1:	ld8 r18=[r17]				// read L3 PTE
++	;;
++	mov b0=r29
++	tbit.z p6,p0=r18,_PAGE_P_BIT		// page present bit cleared?
++(p6)	br.cond.spnt page_fault
++	;;
++#ifdef CONFIG_XEN
++	mov r19=r8
++	mov r8=r18
++	;;
++	XEN_HYPER_ITC_D
++	;;
++	mov r8=r19
++	;;
++#else
++	itc.d r18
++#endif
++	;;
++#ifdef CONFIG_SMP
++	/*
++	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
++	 * cannot possibly affect the following loads:
++	 */
++	dv_serialize_data
++
++	ld8 r19=[r17]				// read L3 PTE again and see if same
++	mov r20=PAGE_SHIFT<<2			// setup page size for purge
++	;;
++	cmp.ne p7,p0=r18,r19
++	;;
++(p7)	ptc.l r16,r20
++#endif
++	mov pr=r31,-1
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(dtlb_miss)
++
++	.org ia64_ivt+0x0c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
++ENTRY(alt_itlb_miss)
++	DBG_FAULT(3)
++#ifdef CONFIG_XEN
++	movl r31=XSI_IPSR
++	;;
++	ld8 r21=[r31],XSI_IFA-XSI_IPSR	// get ipsr, point to ifa
++	movl r17=PAGE_KERNEL
++	;;
++	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
++	;;
++	ld8 r16=[r31]		// get ifa
++	mov r31=pr
++	;;
++#else
++	mov r16=cr.ifa		// get address that caused the TLB miss
++	movl r17=PAGE_KERNEL
++	mov r21=cr.ipsr
++	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
++	mov r31=pr
++	;;
++#endif
++#ifdef CONFIG_DISABLE_VHPT
++	shr.u r22=r16,61			// get the region number into r21
++	;;
++	cmp.gt p8,p0=6,r22			// user mode
++	;;
++#ifndef CONFIG_XEN
++(p8)	thash r17=r16
++	;;
++(p8)	mov cr.iha=r17
++#endif
++(p8)	mov r29=b0				// save b0
++(p8)	br.cond.dptk .itlb_fault
++#endif
++	extr.u r23=r21,IA64_PSR_CPL0_BIT,2	// extract psr.cpl
++	and r19=r19,r16		// clear ed, reserved bits, and PTE control bits
++	shr.u r18=r16,57	// move address bit 61 to bit 4
++	;;
++	andcm r18=0x10,r18	// bit 4=~address-bit(61)
++	cmp.ne p8,p0=r0,r23	// psr.cpl != 0?
++	or r19=r17,r19		// insert PTE control bits into r19
++	;;
++	or r19=r19,r18		// set bit 4 (uncached) if the access was to region 6
++(p8)	br.cond.spnt page_fault
++	;;
++#ifdef CONFIG_XEN
++	mov r18=r8
++	mov r8=r19
++	;;
++	XEN_HYPER_ITC_I
++	;;
++	mov r8=r18
++	;;
++	mov pr=r31,-1
++	;;
++	XEN_HYPER_RFI;
++#else
++	itc.i r19		// insert the TLB entry
++	mov pr=r31,-1
++	rfi
++#endif
++END(alt_itlb_miss)
++
++	.org ia64_ivt+0x1000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
++ENTRY(alt_dtlb_miss)
++	DBG_FAULT(4)
++#ifdef CONFIG_XEN
++	movl r31=XSI_IPSR
++	;;
++	ld8 r21=[r31],XSI_ISR-XSI_IPSR	// get ipsr, point to isr
++	movl r17=PAGE_KERNEL
++	;;
++	ld8 r20=[r31],XSI_IFA-XSI_ISR	// get isr, point to ifa
++	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
++	;;
++	ld8 r16=[r31]		// get ifa
++	mov r31=pr
++	;;
++#else
++	mov r16=cr.ifa		// get address that caused the TLB miss
++	movl r17=PAGE_KERNEL
++	mov r20=cr.isr
++	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
++	mov r21=cr.ipsr
++	mov r31=pr
++	;;
++#endif
++#ifdef CONFIG_DISABLE_VHPT
++	shr.u r22=r16,61			// get the region number into r21
++	;;
++	cmp.gt p8,p0=6,r22			// access to region 0-5
++	;;
++#ifndef CONFIG_XEN
++(p8)	thash r17=r16
++	;;
++(p8)	mov cr.iha=r17
++#endif
++(p8)	mov r29=b0				// save b0
++(p8)	br.cond.dptk dtlb_fault
++#endif
++	extr.u r23=r21,IA64_PSR_CPL0_BIT,2	// extract psr.cpl
++	and r22=IA64_ISR_CODE_MASK,r20		// get the isr.code field
++	tbit.nz p6,p7=r20,IA64_ISR_SP_BIT	// is speculation bit on?
++	shr.u r18=r16,57			// move address bit 61 to bit 4
++	and r19=r19,r16				// clear ed, reserved bits, and PTE control bits
++	tbit.nz p9,p0=r20,IA64_ISR_NA_BIT	// is non-access bit on?
++	;;
++	andcm r18=0x10,r18	// bit 4=~address-bit(61)
++	cmp.ne p8,p0=r0,r23
++(p9)	cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22	// check isr.code field
++(p8)	br.cond.spnt page_fault
++
++	dep r21=-1,r21,IA64_PSR_ED_BIT,1
++	or r19=r19,r17		// insert PTE control bits into r19
++	;;
++	or r19=r19,r18		// set bit 4 (uncached) if the access was to region 6
++(p6)	mov cr.ipsr=r21
++	;;
++#ifdef CONFIG_XEN
++(p7)	mov r18=r8
++(p7)	mov r8=r19
++	;;
++(p7)	XEN_HYPER_ITC_D
++	;;
++(p7)	mov r8=r18
++	;;
++	mov pr=r31,-1
++	;;
++	XEN_HYPER_RFI;
++#else
++(p7)	itc.d r19		// insert the TLB entry
++	mov pr=r31,-1
++	rfi
++#endif
++END(alt_dtlb_miss)
++
++	.org ia64_ivt+0x1400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x1400 Entry 5 (size 64 bundles) Data nested TLB (6,45)
++ENTRY(nested_dtlb_miss)
++	/*
++	 * In the absence of kernel bugs, we get here when the virtually mapped linear
++	 * page table is accessed non-speculatively (e.g., in the Dirty-bit, Instruction
++	 * Access-bit, or Data Access-bit faults).  If the DTLB entry for the virtual page
++	 * table is missing, a nested TLB miss fault is triggered and control is
++	 * transferred to this point.  When this happens, we lookup the pte for the
++	 * faulting address by walking the page table in physical mode and return to the
++	 * continuation point passed in register r30 (or call page_fault if the address is
++	 * not mapped).
++	 *
++	 * Input:	r16:	faulting address
++	 *		r29:	saved b0
++	 *		r30:	continuation address
++	 *		r31:	saved pr
++	 *
++	 * Output:	r17:	physical address of L3 PTE of faulting address
++	 *		r29:	saved b0
++	 *		r30:	continuation address
++	 *		r31:	saved pr
++	 *
++	 * Clobbered:	b0, r18, r19, r21, psr.dt (cleared)
++	 */
++#ifdef CONFIG_XEN
++	XEN_HYPER_RSM_PSR_DT;
++#else
++	rsm psr.dt				// switch to using physical data addressing
++#endif
++	mov r19=IA64_KR(PT_BASE)		// get the page table base address
++	shl r21=r16,3				// shift bit 60 into sign bit
++	;;
++	shr.u r17=r16,61			// get the region number into r17
++	;;
++	cmp.eq p6,p7=5,r17			// is faulting address in region 5?
++	shr.u r18=r16,PGDIR_SHIFT		// get bits 33-63 of faulting address
++	;;
++(p7)	dep r17=r17,r19,(PAGE_SHIFT-3),3	// put region number bits in place
++
++	srlz.d
++	LOAD_PHYSICAL(p6, r19, swapper_pg_dir)	// region 5 is rooted at swapper_pg_dir
++
++	.pred.rel "mutex", p6, p7
++(p6)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT
++(p7)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT-3
++	;;
++(p6)	dep r17=r18,r19,3,(PAGE_SHIFT-3)	// r17=PTA + IFA(33,42)*8
++(p7)	dep r17=r18,r17,3,(PAGE_SHIFT-6)	// r17=PTA + (((IFA(61,63) << 7) | IFA(33,39))*8)
++	cmp.eq p7,p6=0,r21			// unused address bits all zeroes?
++	shr.u r18=r16,PMD_SHIFT			// shift L2 index into position
++	;;
++	ld8 r17=[r17]				// fetch the L1 entry (may be 0)
++	;;
++(p7)	cmp.eq p6,p7=r17,r0			// was L1 entry NULL?
++	dep r17=r18,r17,3,(PAGE_SHIFT-3)	// compute address of L2 page table entry
++	;;
++(p7)	ld8 r17=[r17]				// fetch the L2 entry (may be 0)
++	shr.u r19=r16,PAGE_SHIFT		// shift L3 index into position
++	;;
++(p7)	cmp.eq.or.andcm p6,p7=r17,r0		// was L2 entry NULL?
++	dep r17=r19,r17,3,(PAGE_SHIFT-3)	// compute address of L3 page table entry
++(p6)	br.cond.spnt page_fault
++	mov b0=r30
++	br.sptk.many b0				// return to continuation point
++END(nested_dtlb_miss)
++
++	.org ia64_ivt+0x1800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
++ENTRY(ikey_miss)
++	DBG_FAULT(6)
++	FAULT(6)
++END(ikey_miss)
++
++	//-----------------------------------------------------------------------------------
++	// call do_page_fault (predicates are in r31, psr.dt may be off, r16 is faulting address)
++ENTRY(page_fault)
++#ifdef CONFIG_XEN
++	XEN_HYPER_SSM_PSR_DT;
++#else
++	ssm psr.dt
++	;;
++	srlz.i
++#endif
++	;;
++	SAVE_MIN_WITH_COVER
++	alloc r15=ar.pfs,0,0,3,0
++#ifdef CONFIG_XEN
++	movl r3=XSI_ISR
++	;;
++	ld8 out1=[r3],XSI_IFA-XSI_ISR		// get vcr.isr, point to ifa
++	;;
++	ld8 out0=[r3]				// get vcr.ifa
++	mov r14=1
++	;;
++	add r3=XSI_PSR_IC-XSI_IFA, r3		// point to vpsr.ic
++	;;
++	st4 [r3]=r14				// vpsr.ic = 1
++	adds r3=8,r2				// set up second base pointer
++	;;
++#else
++	mov out0=cr.ifa
++	mov out1=cr.isr
++	adds r3=8,r2				// set up second base pointer
++	;;
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i					// guarantee that interruption collectin is on
++	;;
++#endif
++#ifdef CONFIG_XEN
++	br.cond.sptk.many	xen_page_fault
++	;;
++done_xen_page_fault:
++#endif
++(p15)	ssm psr.i				// restore psr.i
++	movl r14=ia64_leave_kernel
++	;;
++	SAVE_REST
++	mov rp=r14
++	;;
++	adds out2=16,r12			// out2 = pointer to pt_regs
++	br.call.sptk.many b6=ia64_do_page_fault	// ignore return address
++END(page_fault)
++
++	.org ia64_ivt+0x1c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
++ENTRY(dkey_miss)
++	DBG_FAULT(7)
++	FAULT(7)
++#ifdef CONFIG_XEN
++	// Leaving this code inline above results in an IVT section overflow
++	// There is no particular reason for this code to be here...
++xen_page_fault:
++(p15)	movl r3=XSI_PSR_I
++	;;
++(p15)	st4 [r3]=r14,XSI_PEND-XSI_PSR_I		// if (p15) vpsr.i = 1
++	mov r14=r0
++	;;
++(p15)	ld4 r14=[r3]				// if (pending_interrupts)
++	adds r3=8,r2				// re-set up second base pointer
++	;;
++(p15)	cmp.ne	p15,p0=r14,r0
++	;;
++	br.cond.sptk.many done_xen_page_fault
++	;;
++#endif
++END(dkey_miss)
++
++	.org ia64_ivt+0x2000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
++ENTRY(dirty_bit)
++	DBG_FAULT(8)
++	/*
++	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
++	 * update both the page-table and the TLB entry.  To efficiently access the PTE,
++	 * we address it through the virtual page table.  Most likely, the TLB entry for
++	 * the relevant virtual page table page is still present in the TLB so we can
++	 * normally do this without additional TLB misses.  In case the necessary virtual
++	 * page table TLB entry isn't present, we take a nested TLB miss hit where we look
++	 * up the physical address of the L3 PTE and then continue at label 1 below.
++	 */
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++	;;
++#else
++	mov r16=cr.ifa				// get the address that caused the fault
++#endif
++	movl r30=1f				// load continuation point in case of nested fault
++	;;
++#ifdef CONFIG_XEN
++#if 1
++	mov r18=r8;
++	mov r8=r16;
++	XEN_HYPER_THASH;;
++	mov r17=r8;
++	mov r8=r18;;
++#else
++	tak r17=r80				// "privified" thash
++#endif
++#else
++	thash r17=r16				// compute virtual address of L3 PTE
++#endif
++	mov r29=b0				// save b0 in case of nested fault
++	mov r31=pr				// save pr
++#ifdef CONFIG_SMP
++	mov r28=ar.ccv				// save ar.ccv
++	;;
++1:	ld8 r18=[r17]
++	;;					// avoid RAW on r18
++	mov ar.ccv=r18				// set compare value for cmpxchg
++	or r25=_PAGE_D|_PAGE_A,r18		// set the dirty and accessed bits
++	;;
++	cmpxchg8.acq r26=[r17],r25,ar.ccv
++	mov r24=PAGE_SHIFT<<2
++	;;
++	cmp.eq p6,p7=r26,r18
++	;;
++(p6)	itc.d r25				// install updated PTE
++	;;
++	/*
++	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
++	 * cannot possibly affect the following loads:
++	 */
++	dv_serialize_data
++
++	ld8 r18=[r17]				// read PTE again
++	;;
++	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
++	;;
++(p7)	ptc.l r16,r24
++	mov b0=r29				// restore b0
++	mov ar.ccv=r28
++#else
++	;;
++1:	ld8 r18=[r17]
++	;;					// avoid RAW on r18
++	or r18=_PAGE_D|_PAGE_A,r18		// set the dirty and accessed bits
++	mov b0=r29				// restore b0
++	;;
++	st8 [r17]=r18				// store back updated PTE
++	itc.d r18				// install updated PTE
++#endif
++	mov pr=r31,-1				// restore pr
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(dirty_bit)
++
++	.org ia64_ivt+0x2400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
++ENTRY(iaccess_bit)
++	DBG_FAULT(9)
++	// Like Entry 8, except for instruction access
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++	;;
++#else
++	mov r16=cr.ifa				// get the address that caused the fault
++#endif
++	movl r30=1f				// load continuation point in case of nested fault
++	mov r31=pr				// save predicates
++#ifdef CONFIG_ITANIUM
++	/*
++	 * Erratum 10 (IFA may contain incorrect address) has "NoFix" status.
++	 */
++	mov r17=cr.ipsr
++	;;
++	mov r18=cr.iip
++	tbit.z p6,p0=r17,IA64_PSR_IS_BIT	// IA64 instruction set?
++	;;
++(p6)	mov r16=r18				// if so, use cr.iip instead of cr.ifa
++#endif /* CONFIG_ITANIUM */
++	;;
++#ifdef CONFIG_XEN
++#if 1
++	mov r18=r8;
++	mov r8=r16;
++	XEN_HYPER_THASH;;
++	mov r17=r8;
++	mov r8=r18;;
++#else
++	tak r17=r80				// "privified" thash
++#endif
++#else
++	thash r17=r16				// compute virtual address of L3 PTE
++#endif
++	mov r29=b0				// save b0 in case of nested fault)
++#ifdef CONFIG_SMP
++	mov r28=ar.ccv				// save ar.ccv
++	;;
++1:	ld8 r18=[r17]
++	;;
++	mov ar.ccv=r18				// set compare value for cmpxchg
++	or r25=_PAGE_A,r18			// set the accessed bit
++	;;
++	cmpxchg8.acq r26=[r17],r25,ar.ccv
++	mov r24=PAGE_SHIFT<<2
++	;;
++	cmp.eq p6,p7=r26,r18
++	;;
++#ifdef CONFIG_XEN
++	mov r26=r8
++	mov r8=r25
++	;;
++(p6)	XEN_HYPER_ITC_I
++	;;
++	mov r8=r26
++	;;
++#else
++(p6)	itc.i r25				// install updated PTE
++#endif
++	;;
++	/*
++	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
++	 * cannot possibly affect the following loads:
++	 */
++	dv_serialize_data
++
++	ld8 r18=[r17]				// read PTE again
++	;;
++	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
++	;;
++(p7)	ptc.l r16,r24
++	mov b0=r29				// restore b0
++	mov ar.ccv=r28
++#else /* !CONFIG_SMP */
++	;;
++1:	ld8 r18=[r17]
++	;;
++	or r18=_PAGE_A,r18			// set the accessed bit
++	mov b0=r29				// restore b0
++	;;
++	st8 [r17]=r18				// store back updated PTE
++	itc.i r18				// install updated PTE
++#endif /* !CONFIG_SMP */
++	mov pr=r31,-1
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(iaccess_bit)
++
++	.org ia64_ivt+0x2800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
++ENTRY(daccess_bit)
++	DBG_FAULT(10)
++	// Like Entry 8, except for data access
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++	;;
++#else
++	mov r16=cr.ifa				// get the address that caused the fault
++#endif
++	movl r30=1f				// load continuation point in case of nested fault
++	;;
++#ifdef CONFIG_XEN
++#if 1
++	mov r18=r8;
++	mov r8=r16;
++	XEN_HYPER_THASH;;
++	mov r17=r8;
++	mov r8=r18;;
++#else
++	tak r17=r80				// "privified" thash
++#endif
++#else
++	thash r17=r16				// compute virtual address of L3 PTE
++#endif
++	mov r31=pr
++	mov r29=b0				// save b0 in case of nested fault)
++#ifdef CONFIG_SMP
++	mov r28=ar.ccv				// save ar.ccv
++	;;
++1:	ld8 r18=[r17]
++	;;					// avoid RAW on r18
++	mov ar.ccv=r18				// set compare value for cmpxchg
++	or r25=_PAGE_A,r18			// set the dirty bit
++	;;
++	cmpxchg8.acq r26=[r17],r25,ar.ccv
++	mov r24=PAGE_SHIFT<<2
++	;;
++	cmp.eq p6,p7=r26,r18
++	;;
++#ifdef CONFIG_XEN
++	mov r26=r8
++	mov r8=r25
++	;;
++(p6)	XEN_HYPER_ITC_D
++	;;
++	mov r8=r26
++	;;
++#else
++(p6)	itc.d r25				// install updated PTE
++#endif
++	/*
++	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
++	 * cannot possibly affect the following loads:
++	 */
++	dv_serialize_data
++	;;
++	ld8 r18=[r17]				// read PTE again
++	;;
++	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
++	;;
++(p7)	ptc.l r16,r24
++	mov ar.ccv=r28
++#else
++	;;
++1:	ld8 r18=[r17]
++	;;					// avoid RAW on r18
++	or r18=_PAGE_A,r18			// set the accessed bit
++	;;
++	st8 [r17]=r18				// store back updated PTE
++	itc.d r18				// install updated PTE
++#endif
++	mov b0=r29				// restore b0
++	mov pr=r31,-1
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(daccess_bit)
++
++	.org ia64_ivt+0x2c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x2c00 Entry 11 (size 64 bundles) Break instruction (33)
++ENTRY(break_fault)
++	/*
++	 * The streamlined system call entry/exit paths only save/restore the initial part
++	 * of pt_regs.  This implies that the callers of system-calls must adhere to the
++	 * normal procedure calling conventions.
++	 *
++	 *   Registers to be saved & restored:
++	 *	CR registers: cr.ipsr, cr.iip, cr.ifs
++	 *	AR registers: ar.unat, ar.pfs, ar.rsc, ar.rnat, ar.bspstore, ar.fpsr
++	 * 	others: pr, b0, b6, loadrs, r1, r11, r12, r13, r15
++	 *   Registers to be restored only:
++	 * 	r8-r11: output value from the system call.
++	 *
++	 * During system call exit, scratch registers (including r15) are modified/cleared
++	 * to prevent leaking bits from kernel to user level.
++	 */
++	DBG_FAULT(11)
++	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
++#ifdef CONFIG_XEN
++	movl r31=XSI_IPSR
++	;;
++	ld8 r29=[r31],XSI_IIP-XSI_IPSR		// get ipsr, point to iip
++	mov r18=__IA64_BREAK_SYSCALL
++	mov r21=ar.fpsr
++	;;
++	ld8 r28=[r31],XSI_IIM-XSI_IIP		// get iip, point to iim
++	mov r19=b6
++	mov r25=ar.unat
++	;;
++	ld8 r17=[r31]				// get iim
++	mov r27=ar.rsc
++	mov r26=ar.pfs
++	;;
++#else
++	mov r17=cr.iim
++	mov r18=__IA64_BREAK_SYSCALL
++	mov r21=ar.fpsr
++	mov r29=cr.ipsr
++	mov r19=b6
++	mov r25=ar.unat
++	mov r27=ar.rsc
++	mov r26=ar.pfs
++	mov r28=cr.iip
++#endif
++	mov r31=pr				// prepare to save predicates
++	mov r20=r1
++	;;
++	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
++	cmp.eq p0,p7=r18,r17			// is this a system call? (p7 <- false, if so)
++(p7)	br.cond.spnt non_syscall
++	;;
++	ld1 r17=[r16]				// load current->thread.on_ustack flag
++	st1 [r16]=r0				// clear current->thread.on_ustack flag
++	add r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16	// set r1 for MINSTATE_START_SAVE_MIN_VIRT
++	;;
++	invala
++
++	/* adjust return address so we skip over the break instruction: */
++
++	extr.u r8=r29,41,2			// extract ei field from cr.ipsr
++	;;
++	cmp.eq p6,p7=2,r8			// isr.ei==2?
++	mov r2=r1				// setup r2 for ia64_syscall_setup
++	;;
++(p6)	mov r8=0				// clear ei to 0
++(p6)	adds r28=16,r28				// switch cr.iip to next bundle cr.ipsr.ei wrapped
++(p7)	adds r8=1,r8				// increment ei to next slot
++	;;
++	cmp.eq pKStk,pUStk=r0,r17		// are we in kernel mode already?
++	dep r29=r8,r29,41,2			// insert new ei into cr.ipsr
++	;;
++
++	// switch from user to kernel RBS:
++	MINSTATE_START_SAVE_MIN_VIRT
++	br.call.sptk.many b7=ia64_syscall_setup
++	;;
++#ifdef CONFIG_XEN
++	mov r2=b0; br.call.sptk b0=xen_bsw1;; mov b0=r2;;
++#else
++	MINSTATE_END_SAVE_MIN_VIRT		// switch to bank 1
++#endif
++#ifdef CONFIG_XEN
++	movl r3=XSI_PSR_IC
++	mov r16=1
++	;;
++#if 1
++	st4 [r3]=r16,XSI_PSR_I-XSI_PSR_IC	// vpsr.ic = 1
++	;;
++(p15)	st4 [r3]=r16,XSI_PEND-XSI_PSR_I		// if (p15) vpsr.i = 1
++	mov r16=r0
++	;;
++(p15)	ld4 r16=[r3]				// if (pending_interrupts)
++	;;
++	cmp.ne	p6,p0=r16,r0
++	;;
++(p6)	ssm	psr.i				//   do a real ssm psr.i
++	;;
++#else
++//	st4 [r3]=r16,XSI_PSR_I-XSI_PSR_IC	// vpsr.ic = 1
++	adds r3=XSI_PSR_I-XSI_PSR_IC,r3		// SKIP vpsr.ic = 1
++	;;
++(p15)	st4 [r3]=r16,XSI_PEND-XSI_PSR_I		// if (p15) vpsr.i = 1
++	mov r16=r0
++	;;
++(p15)	ld4 r16=[r3]				// if (pending_interrupts)
++	;;
++	cmp.ne	p6,p0=r16,r0
++	;;
++//(p6)	ssm	psr.i				//   do a real ssm psr.i
++//(p6)	XEN_HYPER_SSM_I;
++(p6)	break 0x7;
++	;;
++#endif
++	mov r3=NR_syscalls - 1
++	;;
++#else
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i					// guarantee that interruption collection is on
++	mov r3=NR_syscalls - 1
++	;;
++(p15)	ssm psr.i				// restore psr.i
++#endif
++	// p10==true means out registers are more than 8 or r15's Nat is true
++(p10)	br.cond.spnt.many ia64_ret_from_syscall
++	;;
++	movl r16=sys_call_table
++
++	adds r15=-1024,r15			// r15 contains the syscall number---subtract 1024
++	movl r2=ia64_ret_from_syscall
++	;;
++	shladd r20=r15,3,r16			// r20 = sys_call_table + 8*(syscall-1024)
++	cmp.leu p6,p7=r15,r3			// (syscall > 0 && syscall < 1024 + NR_syscalls) ?
++	mov rp=r2				// set the real return addr
++	;;
++(p6)	ld8 r20=[r20]				// load address of syscall entry point
++(p7)	movl r20=sys_ni_syscall
++
++	add r2=TI_FLAGS+IA64_TASK_SIZE,r13
++	;;
++	ld4 r2=[r2]				// r2 = current_thread_info()->flags
++	;;
++	and r2=_TIF_SYSCALL_TRACEAUDIT,r2	// mask trace or audit
++	;;
++	cmp.eq p8,p0=r2,r0
++	mov b6=r20
++	;;
++(p8)	br.call.sptk.many b6=b6			// ignore this return addr
++	br.cond.sptk ia64_trace_syscall
++	// NOT REACHED
++END(break_fault)
++
++	.org ia64_ivt+0x3000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x3000 Entry 12 (size 64 bundles) External Interrupt (4)
++ENTRY(interrupt)
++	DBG_FAULT(12)
++	mov r31=pr		// prepare to save predicates
++	;;
++	SAVE_MIN_WITH_COVER	// uses r31; defines r2 and r3
++#ifdef CONFIG_XEN
++	movl r3=XSI_PSR_IC
++	mov r14=1
++	;;
++	st4 [r3]=r14
++#else
++	ssm psr.ic | PSR_DEFAULT_BITS
++#endif
++	;;
++	adds r3=8,r2		// set up second base pointer for SAVE_REST
++	srlz.i			// ensure everybody knows psr.ic is back on
++	;;
++	SAVE_REST
++	;;
++	alloc r14=ar.pfs,0,0,2,0 // must be first in an insn group
++#ifdef CONFIG_XEN
++	;;
++	br.call.sptk.many rp=xen_get_ivr
++	;;
++	mov out0=r8		// pass cr.ivr as first arg
++#else
++	mov out0=cr.ivr		// pass cr.ivr as first arg
++#endif
++	add out1=16,sp		// pass pointer to pt_regs as second arg
++	;;
++	srlz.d			// make sure we see the effect of cr.ivr
++	movl r14=ia64_leave_kernel
++	;;
++	mov rp=r14
++	br.call.sptk.many b6=ia64_handle_irq
++END(interrupt)
++
++	.org ia64_ivt+0x3400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x3400 Entry 13 (size 64 bundles) Reserved
++	DBG_FAULT(13)
++	FAULT(13)
++
++	.org ia64_ivt+0x3800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x3800 Entry 14 (size 64 bundles) Reserved
++	DBG_FAULT(14)
++	FAULT(14)
++
++	/*
++	 * There is no particular reason for this code to be here, other than that
++	 * there happens to be space here that would go unused otherwise.  If this
++	 * fault ever gets "unreserved", simply moved the following code to a more
++	 * suitable spot...
++	 *
++	 * ia64_syscall_setup() is a separate subroutine so that it can
++	 *	allocate stacked registers so it can safely demine any
++	 *	potential NaT values from the input registers.
++	 *
++	 * On entry:
++	 *	- executing on bank 0 or bank 1 register set (doesn't matter)
++	 *	-  r1: stack pointer
++	 *	-  r2: current task pointer
++	 *	-  r3: preserved
++	 *	- r11: original contents (saved ar.pfs to be saved)
++	 *	- r12: original contents (sp to be saved)
++	 *	- r13: original contents (tp to be saved)
++	 *	- r15: original contents (syscall # to be saved)
++	 *	- r18: saved bsp (after switching to kernel stack)
++	 *	- r19: saved b6
++	 *	- r20: saved r1 (gp)
++	 *	- r21: saved ar.fpsr
++	 *	- r22: kernel's register backing store base (krbs_base)
++	 *	- r23: saved ar.bspstore
++	 *	- r24: saved ar.rnat
++	 *	- r25: saved ar.unat
++	 *	- r26: saved ar.pfs
++	 *	- r27: saved ar.rsc
++	 *	- r28: saved cr.iip
++	 *	- r29: saved cr.ipsr
++	 *	- r31: saved pr
++	 *	-  b0: original contents (to be saved)
++	 * On exit:
++	 *	- executing on bank 1 registers
++	 *	- psr.ic enabled, interrupts restored
++	 *	-  p10: TRUE if syscall is invoked with more than 8 out
++	 *		registers or r15's Nat is true
++	 *	-  r1: kernel's gp
++	 *	-  r3: preserved (same as on entry)
++	 *	-  r8: -EINVAL if p10 is true
++	 *	- r12: points to kernel stack
++	 *	- r13: points to current task
++	 *	- p15: TRUE if interrupts need to be re-enabled
++	 *	- ar.fpsr: set to kernel settings
++	 */
++#ifndef CONFIG_XEN
++GLOBAL_ENTRY(ia64_syscall_setup)
++#if PT(B6) != 0
++# error This code assumes that b6 is the first field in pt_regs.
++#endif
++	st8 [r1]=r19				// save b6
++	add r16=PT(CR_IPSR),r1			// initialize first base pointer
++	add r17=PT(R11),r1			// initialize second base pointer
++	;;
++	alloc r19=ar.pfs,8,0,0,0		// ensure in0-in7 are writable
++	st8 [r16]=r29,PT(AR_PFS)-PT(CR_IPSR)	// save cr.ipsr
++	tnat.nz p8,p0=in0
++
++	st8.spill [r17]=r11,PT(CR_IIP)-PT(R11)	// save r11
++	tnat.nz p9,p0=in1
++(pKStk)	mov r18=r0				// make sure r18 isn't NaT
++	;;
++
++	st8 [r16]=r26,PT(CR_IFS)-PT(AR_PFS)	// save ar.pfs
++	st8 [r17]=r28,PT(AR_UNAT)-PT(CR_IIP)	// save cr.iip
++	mov r28=b0				// save b0 (2 cyc)
++	;;
++
++	st8 [r17]=r25,PT(AR_RSC)-PT(AR_UNAT)	// save ar.unat
++	dep r19=0,r19,38,26			// clear all bits but 0..37 [I0]
++(p8)	mov in0=-1
++	;;
++
++	st8 [r16]=r19,PT(AR_RNAT)-PT(CR_IFS)	// store ar.pfs.pfm in cr.ifs
++	extr.u r11=r19,7,7	// I0		// get sol of ar.pfs
++	and r8=0x7f,r19		// A		// get sof of ar.pfs
++
++	st8 [r17]=r27,PT(AR_BSPSTORE)-PT(AR_RSC)// save ar.rsc
++	tbit.nz p15,p0=r29,IA64_PSR_I_BIT // I0
++(p9)	mov in1=-1
++	;;
++
++(pUStk) sub r18=r18,r22				// r18=RSE.ndirty*8
++	tnat.nz p10,p0=in2
++	add r11=8,r11
++	;;
++(pKStk) adds r16=PT(PR)-PT(AR_RNAT),r16		// skip over ar_rnat field
++(pKStk) adds r17=PT(B0)-PT(AR_BSPSTORE),r17	// skip over ar_bspstore field
++	tnat.nz p11,p0=in3
++	;;
++(p10)	mov in2=-1
++	tnat.nz p12,p0=in4				// [I0]
++(p11)	mov in3=-1
++	;;
++(pUStk) st8 [r16]=r24,PT(PR)-PT(AR_RNAT)	// save ar.rnat
++(pUStk) st8 [r17]=r23,PT(B0)-PT(AR_BSPSTORE)	// save ar.bspstore
++	shl r18=r18,16				// compute ar.rsc to be used for "loadrs"
++	;;
++	st8 [r16]=r31,PT(LOADRS)-PT(PR)		// save predicates
++	st8 [r17]=r28,PT(R1)-PT(B0)		// save b0
++	tnat.nz p13,p0=in5				// [I0]
++	;;
++	st8 [r16]=r18,PT(R12)-PT(LOADRS)	// save ar.rsc value for "loadrs"
++	st8.spill [r17]=r20,PT(R13)-PT(R1)	// save original r1
++(p12)	mov in4=-1
++	;;
++
++.mem.offset 0,0; st8.spill [r16]=r12,PT(AR_FPSR)-PT(R12)	// save r12
++.mem.offset 8,0; st8.spill [r17]=r13,PT(R15)-PT(R13)		// save r13
++(p13)	mov in5=-1
++	;;
++	st8 [r16]=r21,PT(R8)-PT(AR_FPSR)	// save ar.fpsr
++	tnat.nz p14,p0=in6
++	cmp.lt p10,p9=r11,r8	// frame size can't be more than local+8
++	;;
++	stf8 [r16]=f1		// ensure pt_regs.r8 != 0 (see handle_syscall_error)
++(p9)	tnat.nz p10,p0=r15
++	adds r12=-16,r1		// switch to kernel memory stack (with 16 bytes of scratch)
++
++	st8.spill [r17]=r15			// save r15
++	tnat.nz p8,p0=in7
++	nop.i 0
++
++	mov r13=r2				// establish `current'
++	movl r1=__gp				// establish kernel global pointer
++	;;
++(p14)	mov in6=-1
++(p8)	mov in7=-1
++	nop.i 0
++
++	cmp.eq pSys,pNonSys=r0,r0		// set pSys=1, pNonSys=0
++	movl r17=FPSR_DEFAULT
++	;;
++	mov.m ar.fpsr=r17			// set ar.fpsr to kernel default value
++(p10)	mov r8=-EINVAL
++	br.ret.sptk.many b7
++END(ia64_syscall_setup)
++#endif
++
++	.org ia64_ivt+0x3c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x3c00 Entry 15 (size 64 bundles) Reserved
++	DBG_FAULT(15)
++	FAULT(15)
++
++	/*
++	 * Squatting in this space ...
++	 *
++	 * This special case dispatcher for illegal operation faults allows preserved
++	 * registers to be modified through a callback function (asm only) that is handed
++	 * back from the fault handler in r8. Up to three arguments can be passed to the
++	 * callback function by returning an aggregate with the callback as its first
++	 * element, followed by the arguments.
++	 */
++ENTRY(dispatch_illegal_op_fault)
++	SAVE_MIN_WITH_COVER
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i		// guarantee that interruption collection is on
++	;;
++(p15)	ssm psr.i	// restore psr.i
++	adds r3=8,r2	// set up second base pointer for SAVE_REST
++	;;
++	alloc r14=ar.pfs,0,0,1,0	// must be first in insn group
++	mov out0=ar.ec
++	;;
++	SAVE_REST
++	;;
++	br.call.sptk.many rp=ia64_illegal_op_fault
++.ret0:	;;
++	alloc r14=ar.pfs,0,0,3,0	// must be first in insn group
++	mov out0=r9
++	mov out1=r10
++	mov out2=r11
++	movl r15=ia64_leave_kernel
++	;;
++	mov rp=r15
++	mov b6=r8
++	;;
++	cmp.ne p6,p0=0,r8
++(p6)	br.call.dpnt.many b6=b6		// call returns to ia64_leave_kernel
++	br.sptk.many ia64_leave_kernel
++END(dispatch_illegal_op_fault)
++
++	.org ia64_ivt+0x4000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x4000 Entry 16 (size 64 bundles) Reserved
++	DBG_FAULT(16)
++	FAULT(16)
++
++	.org ia64_ivt+0x4400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x4400 Entry 17 (size 64 bundles) Reserved
++	DBG_FAULT(17)
++	FAULT(17)
++
++ENTRY(non_syscall)
++	SAVE_MIN_WITH_COVER
++
++	// There is no particular reason for this code to be here, other than that
++	// there happens to be space here that would go unused otherwise.  If this
++	// fault ever gets "unreserved", simply moved the following code to a more
++	// suitable spot...
++
++	alloc r14=ar.pfs,0,0,2,0
++	mov out0=cr.iim
++	add out1=16,sp
++	adds r3=8,r2			// set up second base pointer for SAVE_REST
++
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i				// guarantee that interruption collection is on
++	;;
++(p15)	ssm psr.i			// restore psr.i
++	movl r15=ia64_leave_kernel
++	;;
++	SAVE_REST
++	mov rp=r15
++	;;
++	br.call.sptk.many b6=ia64_bad_break	// avoid WAW on CFM and ignore return addr
++END(non_syscall)
++
++	.org ia64_ivt+0x4800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x4800 Entry 18 (size 64 bundles) Reserved
++	DBG_FAULT(18)
++	FAULT(18)
++
++	/*
++	 * There is no particular reason for this code to be here, other than that
++	 * there happens to be space here that would go unused otherwise.  If this
++	 * fault ever gets "unreserved", simply moved the following code to a more
++	 * suitable spot...
++	 */
++
++ENTRY(dispatch_unaligned_handler)
++	SAVE_MIN_WITH_COVER
++	;;
++	alloc r14=ar.pfs,0,0,2,0		// now it's safe (must be first in insn group!)
++	mov out0=cr.ifa
++	adds out1=16,sp
++
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i					// guarantee that interruption collection is on
++	;;
++(p15)	ssm psr.i				// restore psr.i
++	adds r3=8,r2				// set up second base pointer
++	;;
++	SAVE_REST
++	movl r14=ia64_leave_kernel
++	;;
++	mov rp=r14
++	br.sptk.many ia64_prepare_handle_unaligned
++END(dispatch_unaligned_handler)
++
++	.org ia64_ivt+0x4c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x4c00 Entry 19 (size 64 bundles) Reserved
++	DBG_FAULT(19)
++	FAULT(19)
++
++	/*
++	 * There is no particular reason for this code to be here, other than that
++	 * there happens to be space here that would go unused otherwise.  If this
++	 * fault ever gets "unreserved", simply moved the following code to a more
++	 * suitable spot...
++	 */
++
++ENTRY(dispatch_to_fault_handler)
++	/*
++	 * Input:
++	 *	psr.ic:	off
++	 *	r19:	fault vector number (e.g., 24 for General Exception)
++	 *	r31:	contains saved predicates (pr)
++	 */
++	SAVE_MIN_WITH_COVER_R19
++	alloc r14=ar.pfs,0,0,5,0
++	mov out0=r15
++#ifdef CONFIG_XEN
++	movl out1=XSI_ISR
++	;;
++	adds out2=XSI_IFA-XSI_ISR,out1
++	adds out3=XSI_IIM-XSI_ISR,out1
++	adds out4=XSI_ITIR-XSI_ISR,out1
++	;;
++	ld8 out1=[out1]
++	ld8 out2=[out2]
++	ld8 out3=[out4]
++	ld8 out4=[out4]
++	;;
++#else
++	mov out1=cr.isr
++	mov out2=cr.ifa
++	mov out3=cr.iim
++	mov out4=cr.itir
++	;;
++#endif
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i					// guarantee that interruption collection is on
++	;;
++(p15)	ssm psr.i				// restore psr.i
++	adds r3=8,r2				// set up second base pointer for SAVE_REST
++	;;
++	SAVE_REST
++	movl r14=ia64_leave_kernel
++	;;
++	mov rp=r14
++	br.call.sptk.many b6=ia64_fault
++END(dispatch_to_fault_handler)
++
++//
++// --- End of long entries, Beginning of short entries
++//
++
++	.org ia64_ivt+0x5000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49)
++ENTRY(page_not_present)
++	DBG_FAULT(20)
++	mov r16=cr.ifa
++	rsm psr.dt
++	/*
++	 * The Linux page fault handler doesn't expect non-present pages to be in
++	 * the TLB.  Flush the existing entry now, so we meet that expectation.
++	 */
++	mov r17=PAGE_SHIFT<<2
++	;;
++	ptc.l r16,r17
++	;;
++	mov r31=pr
++	srlz.d
++	br.sptk.many page_fault
++END(page_not_present)
++
++	.org ia64_ivt+0x5100
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52)
++ENTRY(key_permission)
++	DBG_FAULT(21)
++	mov r16=cr.ifa
++	rsm psr.dt
++	mov r31=pr
++	;;
++	srlz.d
++	br.sptk.many page_fault
++END(key_permission)
++
++	.org ia64_ivt+0x5200
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
++ENTRY(iaccess_rights)
++	DBG_FAULT(22)
++	mov r16=cr.ifa
++	rsm psr.dt
++	mov r31=pr
++	;;
++	srlz.d
++	br.sptk.many page_fault
++END(iaccess_rights)
++
++	.org ia64_ivt+0x5300
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
++ENTRY(daccess_rights)
++	DBG_FAULT(23)
++#ifdef CONFIG_XEN
++	movl r16=XSI_IFA
++	;;
++	ld8 r16=[r16]
++	;;
++	XEN_HYPER_RSM_PSR_DT;
++#else
++	mov r16=cr.ifa
++	rsm psr.dt
++#endif
++	mov r31=pr
++	;;
++	srlz.d
++	br.sptk.many page_fault
++END(daccess_rights)
++
++	.org ia64_ivt+0x5400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5400 Entry 24 (size 16 bundles) General Exception (5,32,34,36,38,39)
++ENTRY(general_exception)
++	DBG_FAULT(24)
++	mov r16=cr.isr
++	mov r31=pr
++	;;
++	cmp4.eq p6,p0=0,r16
++(p6)	br.sptk.many dispatch_illegal_op_fault
++	;;
++	mov r19=24		// fault number
++	br.sptk.many dispatch_to_fault_handler
++END(general_exception)
++
++	.org ia64_ivt+0x5500
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
++ENTRY(disabled_fp_reg)
++	DBG_FAULT(25)
++	rsm psr.dfh		// ensure we can access fph
++	;;
++	srlz.d
++	mov r31=pr
++	mov r19=25
++	br.sptk.many dispatch_to_fault_handler
++END(disabled_fp_reg)
++
++	.org ia64_ivt+0x5600
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
++ENTRY(nat_consumption)
++	DBG_FAULT(26)
++	FAULT(26)
++END(nat_consumption)
++
++	.org ia64_ivt+0x5700
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5700 Entry 27 (size 16 bundles) Speculation (40)
++ENTRY(speculation_vector)
++	DBG_FAULT(27)
++	/*
++	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
++	 * this part of the architecture is not implemented in hardware on some CPUs, such
++	 * as Itanium.  Thus, in general we need to emulate the behavior.  IIM contains
++	 * the relative target (not yet sign extended).  So after sign extending it we
++	 * simply add it to IIP.  We also need to reset the EI field of the IPSR to zero,
++	 * i.e., the slot to restart into.
++	 *
++	 * cr.imm contains zero_ext(imm21)
++	 */
++	mov r18=cr.iim
++	;;
++	mov r17=cr.iip
++	shl r18=r18,43			// put sign bit in position (43=64-21)
++	;;
++
++	mov r16=cr.ipsr
++	shr r18=r18,39			// sign extend (39=43-4)
++	;;
++
++	add r17=r17,r18			// now add the offset
++	;;
++	mov cr.iip=r17
++	dep r16=0,r16,41,2		// clear EI
++	;;
++
++	mov cr.ipsr=r16
++	;;
++
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++END(speculation_vector)
++
++	.org ia64_ivt+0x5800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5800 Entry 28 (size 16 bundles) Reserved
++	DBG_FAULT(28)
++	FAULT(28)
++
++	.org ia64_ivt+0x5900
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
++ENTRY(debug_vector)
++	DBG_FAULT(29)
++	FAULT(29)
++END(debug_vector)
++
++	.org ia64_ivt+0x5a00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
++ENTRY(unaligned_access)
++	DBG_FAULT(30)
++	mov r16=cr.ipsr
++	mov r31=pr		// prepare to save predicates
++	;;
++	br.sptk.many dispatch_unaligned_handler
++END(unaligned_access)
++
++	.org ia64_ivt+0x5b00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
++ENTRY(unsupported_data_reference)
++	DBG_FAULT(31)
++	FAULT(31)
++END(unsupported_data_reference)
++
++	.org ia64_ivt+0x5c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64)
++ENTRY(floating_point_fault)
++	DBG_FAULT(32)
++	FAULT(32)
++END(floating_point_fault)
++
++	.org ia64_ivt+0x5d00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
++ENTRY(floating_point_trap)
++	DBG_FAULT(33)
++	FAULT(33)
++END(floating_point_trap)
++
++	.org ia64_ivt+0x5e00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
++ENTRY(lower_privilege_trap)
++	DBG_FAULT(34)
++	FAULT(34)
++END(lower_privilege_trap)
++
++	.org ia64_ivt+0x5f00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
++ENTRY(taken_branch_trap)
++	DBG_FAULT(35)
++	FAULT(35)
++END(taken_branch_trap)
++
++	.org ia64_ivt+0x6000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
++ENTRY(single_step_trap)
++	DBG_FAULT(36)
++	FAULT(36)
++END(single_step_trap)
++
++	.org ia64_ivt+0x6100
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6100 Entry 37 (size 16 bundles) Reserved
++	DBG_FAULT(37)
++	FAULT(37)
++
++	.org ia64_ivt+0x6200
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6200 Entry 38 (size 16 bundles) Reserved
++	DBG_FAULT(38)
++	FAULT(38)
++
++	.org ia64_ivt+0x6300
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6300 Entry 39 (size 16 bundles) Reserved
++	DBG_FAULT(39)
++	FAULT(39)
++
++	.org ia64_ivt+0x6400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6400 Entry 40 (size 16 bundles) Reserved
++	DBG_FAULT(40)
++	FAULT(40)
++
++	.org ia64_ivt+0x6500
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6500 Entry 41 (size 16 bundles) Reserved
++	DBG_FAULT(41)
++	FAULT(41)
++
++	.org ia64_ivt+0x6600
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6600 Entry 42 (size 16 bundles) Reserved
++	DBG_FAULT(42)
++	FAULT(42)
++
++	.org ia64_ivt+0x6700
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6700 Entry 43 (size 16 bundles) Reserved
++	DBG_FAULT(43)
++	FAULT(43)
++
++	.org ia64_ivt+0x6800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6800 Entry 44 (size 16 bundles) Reserved
++	DBG_FAULT(44)
++	FAULT(44)
++
++	.org ia64_ivt+0x6900
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6900 Entry 45 (size 16 bundles) IA-32 Exeception (17,18,29,41,42,43,44,58,60,61,62,72,73,75,76,77)
++ENTRY(ia32_exception)
++	DBG_FAULT(45)
++	FAULT(45)
++END(ia32_exception)
++
++	.org ia64_ivt+0x6a00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
++ENTRY(ia32_intercept)
++	DBG_FAULT(46)
++#ifdef	CONFIG_IA32_SUPPORT
++	mov r31=pr
++	mov r16=cr.isr
++	;;
++	extr.u r17=r16,16,8	// get ISR.code
++	mov r18=ar.eflag
++	mov r19=cr.iim		// old eflag value
++	;;
++	cmp.ne p6,p0=2,r17
++(p6)	br.cond.spnt 1f		// not a system flag fault
++	xor r16=r18,r19
++	;;
++	extr.u r17=r16,18,1	// get the eflags.ac bit
++	;;
++	cmp.eq p6,p0=0,r17
++(p6)	br.cond.spnt 1f		// eflags.ac bit didn't change
++	;;
++	mov pr=r31,-1		// restore predicate registers
++#ifdef CONFIG_XEN
++	XEN_HYPER_RFI;
++#else
++	rfi
++#endif
++
++1:
++#endif	// CONFIG_IA32_SUPPORT
++	FAULT(46)
++END(ia32_intercept)
++
++	.org ia64_ivt+0x6b00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
++ENTRY(ia32_interrupt)
++	DBG_FAULT(47)
++#ifdef CONFIG_IA32_SUPPORT
++	mov r31=pr
++	br.sptk.many dispatch_to_ia32_handler
++#else
++	FAULT(47)
++#endif
++END(ia32_interrupt)
++
++	.org ia64_ivt+0x6c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6c00 Entry 48 (size 16 bundles) Reserved
++	DBG_FAULT(48)
++	FAULT(48)
++
++	.org ia64_ivt+0x6d00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6d00 Entry 49 (size 16 bundles) Reserved
++	DBG_FAULT(49)
++	FAULT(49)
++
++	.org ia64_ivt+0x6e00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6e00 Entry 50 (size 16 bundles) Reserved
++	DBG_FAULT(50)
++	FAULT(50)
++
++	.org ia64_ivt+0x6f00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x6f00 Entry 51 (size 16 bundles) Reserved
++	DBG_FAULT(51)
++	FAULT(51)
++
++	.org ia64_ivt+0x7000
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7000 Entry 52 (size 16 bundles) Reserved
++	DBG_FAULT(52)
++	FAULT(52)
++
++	.org ia64_ivt+0x7100
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7100 Entry 53 (size 16 bundles) Reserved
++	DBG_FAULT(53)
++	FAULT(53)
++
++	.org ia64_ivt+0x7200
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7200 Entry 54 (size 16 bundles) Reserved
++	DBG_FAULT(54)
++	FAULT(54)
++
++	.org ia64_ivt+0x7300
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7300 Entry 55 (size 16 bundles) Reserved
++	DBG_FAULT(55)
++	FAULT(55)
++
++	.org ia64_ivt+0x7400
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7400 Entry 56 (size 16 bundles) Reserved
++	DBG_FAULT(56)
++	FAULT(56)
++
++	.org ia64_ivt+0x7500
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7500 Entry 57 (size 16 bundles) Reserved
++	DBG_FAULT(57)
++	FAULT(57)
++
++	.org ia64_ivt+0x7600
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7600 Entry 58 (size 16 bundles) Reserved
++	DBG_FAULT(58)
++	FAULT(58)
++
++	.org ia64_ivt+0x7700
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7700 Entry 59 (size 16 bundles) Reserved
++	DBG_FAULT(59)
++	FAULT(59)
++
++	.org ia64_ivt+0x7800
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7800 Entry 60 (size 16 bundles) Reserved
++	DBG_FAULT(60)
++	FAULT(60)
++
++	.org ia64_ivt+0x7900
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7900 Entry 61 (size 16 bundles) Reserved
++	DBG_FAULT(61)
++	FAULT(61)
++
++	.org ia64_ivt+0x7a00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7a00 Entry 62 (size 16 bundles) Reserved
++	DBG_FAULT(62)
++	FAULT(62)
++
++	.org ia64_ivt+0x7b00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7b00 Entry 63 (size 16 bundles) Reserved
++	DBG_FAULT(63)
++	FAULT(63)
++
++	.org ia64_ivt+0x7c00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7c00 Entry 64 (size 16 bundles) Reserved
++	DBG_FAULT(64)
++	FAULT(64)
++
++	.org ia64_ivt+0x7d00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7d00 Entry 65 (size 16 bundles) Reserved
++	DBG_FAULT(65)
++	FAULT(65)
++
++	.org ia64_ivt+0x7e00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7e00 Entry 66 (size 16 bundles) Reserved
++	DBG_FAULT(66)
++	FAULT(66)
++
++#ifdef CONFIG_XEN
++	/*
++	 * There is no particular reason for this code to be here, other than that
++	 * there happens to be space here that would go unused otherwise.  If this
++	 * fault ever gets "unreserved", simply moved the following code to a more
++	 * suitable spot...
++	 */
++
++GLOBAL_ENTRY(xen_bsw1)
++	/* FIXME: THIS CODE IS NOT NaT SAFE! */
++	movl r30=XSI_BANKNUM;
++	mov r31=1;;
++	st4 [r30]=r31;
++	movl r30=XSI_BANK1_R16;
++	movl r31=XSI_BANK1_R16+8;;
++	ld8 r16=[r30],16; ld8 r17=[r31],16;;
++	ld8 r18=[r30],16; ld8 r19=[r31],16;;
++	ld8 r20=[r30],16; ld8 r21=[r31],16;;
++	ld8 r22=[r30],16; ld8 r23=[r31],16;;
++	ld8 r24=[r30],16; ld8 r25=[r31],16;;
++	ld8 r26=[r30],16; ld8 r27=[r31],16;;
++	ld8 r28=[r30],16; ld8 r29=[r31],16;;
++	ld8 r30=[r30]; ld8 r31=[r31];;
++	br.ret.sptk.many b0
++#endif
++
++	.org ia64_ivt+0x7f00
++/////////////////////////////////////////////////////////////////////////////////////////
++// 0x7f00 Entry 67 (size 16 bundles) Reserved
++	DBG_FAULT(67)
++	FAULT(67)
++
++#ifdef CONFIG_IA32_SUPPORT
++
++	/*
++	 * There is no particular reason for this code to be here, other than that
++	 * there happens to be space here that would go unused otherwise.  If this
++	 * fault ever gets "unreserved", simply moved the following code to a more
++	 * suitable spot...
++	 */
++
++	// IA32 interrupt entry point
++
++ENTRY(dispatch_to_ia32_handler)
++	SAVE_MIN
++	;;
++	mov r14=cr.isr
++	ssm psr.ic | PSR_DEFAULT_BITS
++	;;
++	srlz.i					// guarantee that interruption collection is on
++	;;
++(p15)	ssm psr.i
++	adds r3=8,r2		// Base pointer for SAVE_REST
++	;;
++	SAVE_REST
++	;;
++	mov r15=0x80
++	shr r14=r14,16		// Get interrupt number
++	;;
++	cmp.ne p6,p0=r14,r15
++(p6)	br.call.dpnt.many b6=non_ia32_syscall
++
++	adds r14=IA64_PT_REGS_R8_OFFSET + 16,sp	// 16 byte hole per SW conventions
++	adds r15=IA64_PT_REGS_R1_OFFSET + 16,sp
++	;;
++	cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0
++	ld8 r8=[r14]		// get r8
++	;;
++	st8 [r15]=r8		// save original EAX in r1 (IA32 procs don't use the GP)
++	;;
++	alloc r15=ar.pfs,0,0,6,0	// must first in an insn group
++	;;
++	ld4 r8=[r14],8		// r8 == eax (syscall number)
++	mov r15=IA32_NR_syscalls
++	;;
++	cmp.ltu.unc p6,p7=r8,r15
++	ld4 out1=[r14],8	// r9 == ecx
++	;;
++	ld4 out2=[r14],8	// r10 == edx
++	;;
++	ld4 out0=[r14]		// r11 == ebx
++	adds r14=(IA64_PT_REGS_R13_OFFSET) + 16,sp
++	;;
++	ld4 out5=[r14],PT(R14)-PT(R13)	// r13 == ebp
++	;;
++	ld4 out3=[r14],PT(R15)-PT(R14)	// r14 == esi
++	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
++	;;
++	ld4 out4=[r14]		// r15 == edi
++	movl r16=ia32_syscall_table
++	;;
++(p6)	shladd r16=r8,3,r16	// force ni_syscall if not valid syscall number
++	ld4 r2=[r2]		// r2 = current_thread_info()->flags
++	;;
++	ld8 r16=[r16]
++	and r2=_TIF_SYSCALL_TRACEAUDIT,r2	// mask trace or audit
++	;;
++	mov b6=r16
++	movl r15=ia32_ret_from_syscall
++	cmp.eq p8,p0=r2,r0
++	;;
++	mov rp=r15
++(p8)	br.call.sptk.many b6=b6
++	br.cond.sptk ia32_trace_syscall
++
++non_ia32_syscall:
++	alloc r15=ar.pfs,0,0,2,0
++	mov out0=r14				// interrupt #
++	add out1=16,sp				// pointer to pt_regs
++	;;			// avoid WAW on CFM
++	br.call.sptk.many rp=ia32_bad_interrupt
++.ret1:	movl r15=ia64_leave_kernel
++	;;
++	mov rp=r15
++	br.ret.sptk.many rp
++END(dispatch_to_ia32_handler)
++
++#endif /* CONFIG_IA32_SUPPORT */
+diff --git a/arch/ia64/xen/xenminstate.h b/arch/ia64/xen/xenminstate.h
+new file mode 100644
+index 0000000..c6df57e
+--- /dev/null
++++ b/arch/ia64/xen/xenminstate.h
+@@ -0,0 +1,367 @@
++#include <linux/config.h>
++
++#include <asm/cache.h>
++
++#ifdef CONFIG_XEN
++#include "../kernel/entry.h"
++#else
++#include "entry.h"
++#endif
++
++/*
++ * For ivt.s we want to access the stack virtually so we don't have to disable translation
++ * on interrupts.
++ *
++ *  On entry:
++ *	r1:	pointer to current task (ar.k6)
++ */
++#define MINSTATE_START_SAVE_MIN_VIRT								\
++(pUStk)	mov ar.rsc=0;		/* set enforced lazy mode, pl 0, little-endian, loadrs=0 */	\
++	;;											\
++(pUStk)	mov.m r24=ar.rnat;									\
++(pUStk)	addl r22=IA64_RBS_OFFSET,r1;			/* compute base of RBS */		\
++(pKStk) mov r1=sp;					/* get sp  */				\
++	;;											\
++(pUStk) lfetch.fault.excl.nt1 [r22];								\
++(pUStk)	addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;	/* compute base of memory stack */	\
++(pUStk)	mov r23=ar.bspstore;				/* save ar.bspstore */			\
++	;;											\
++(pUStk)	mov ar.bspstore=r22;				/* switch to kernel RBS */		\
++(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;			/* if in kernel mode, use sp (r12) */	\
++	;;											\
++(pUStk)	mov r18=ar.bsp;										\
++(pUStk)	mov ar.rsc=0x3;		/* set eager mode, pl 0, little-endian, loadrs=0 */		\
++
++#define MINSTATE_END_SAVE_MIN_VIRT								\
++	bsw.1;			/* switch back to bank 1 (must be last in insn group) */	\
++	;;
++
++/*
++ * For mca_asm.S we want to access the stack physically since the state is saved before we
++ * go virtual and don't want to destroy the iip or ipsr.
++ */
++#define MINSTATE_START_SAVE_MIN_PHYS								\
++(pKStk) mov r3=IA64_KR(PER_CPU_DATA);;								\
++(pKStk) addl r3=THIS_CPU(ia64_mca_data),r3;;							\
++(pKStk) ld8 r3 = [r3];;										\
++(pKStk) addl r3=IA64_MCA_CPU_INIT_STACK_OFFSET,r3;;						\
++(pKStk) addl sp=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r3;						\
++(pUStk)	mov ar.rsc=0;		/* set enforced lazy mode, pl 0, little-endian, loadrs=0 */	\
++(pUStk)	addl r22=IA64_RBS_OFFSET,r1;		/* compute base of register backing store */	\
++	;;											\
++(pUStk)	mov r24=ar.rnat;									\
++(pUStk)	addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;	/* compute base of memory stack */	\
++(pUStk)	mov r23=ar.bspstore;				/* save ar.bspstore */			\
++(pUStk)	dep r22=-1,r22,61,3;			/* compute kernel virtual addr of RBS */	\
++	;;											\
++(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;		/* if in kernel mode, use sp (r12) */		\
++(pUStk)	mov ar.bspstore=r22;			/* switch to kernel RBS */			\
++	;;											\
++(pUStk)	mov r18=ar.bsp;										\
++(pUStk)	mov ar.rsc=0x3;		/* set eager mode, pl 0, little-endian, loadrs=0 */		\
++
++#define MINSTATE_END_SAVE_MIN_PHYS								\
++	dep r12=-1,r12,61,3;		/* make sp a kernel virtual address */			\
++	;;
++
++#ifdef MINSTATE_VIRT
++# define MINSTATE_GET_CURRENT(reg)	mov reg=IA64_KR(CURRENT)
++# define MINSTATE_START_SAVE_MIN	MINSTATE_START_SAVE_MIN_VIRT
++# define MINSTATE_END_SAVE_MIN		MINSTATE_END_SAVE_MIN_VIRT
++#endif
++
++#ifdef MINSTATE_PHYS
++# define MINSTATE_GET_CURRENT(reg)	mov reg=IA64_KR(CURRENT);; tpa reg=reg
++# define MINSTATE_START_SAVE_MIN	MINSTATE_START_SAVE_MIN_PHYS
++# define MINSTATE_END_SAVE_MIN		MINSTATE_END_SAVE_MIN_PHYS
++#endif
++
++/*
++ * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
++ * the minimum state necessary that allows us to turn psr.ic back
++ * on.
++ *
++ * Assumed state upon entry:
++ *	psr.ic: off
++ *	r31:	contains saved predicates (pr)
++ *
++ * Upon exit, the state is as follows:
++ *	psr.ic: off
++ *	 r2 = points to &pt_regs.r16
++ *	 r8 = contents of ar.ccv
++ *	 r9 = contents of ar.csd
++ *	r10 = contents of ar.ssd
++ *	r11 = FPSR_DEFAULT
++ *	r12 = kernel sp (kernel virtual address)
++ *	r13 = points to current task_struct (kernel virtual address)
++ *	p15 = TRUE if psr.i is set in cr.ipsr
++ *	predicate registers (other than p2, p3, and p15), b6, r3, r14, r15:
++ *		preserved
++ * CONFIG_XEN note: p6/p7 are not preserved
++ *
++ * Note that psr.ic is NOT turned on by this macro.  This is so that
++ * we can pass interruption state as arguments to a handler.
++ */
++#ifdef CONFIG_XEN
++#define DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA)							\
++	MINSTATE_GET_CURRENT(r16);	/* M (or M;;I) */					\
++	mov r27=ar.rsc;			/* M */							\
++	mov r20=r1;			/* A */							\
++	mov r25=ar.unat;		/* M */							\
++	/* mov r29=cr.ipsr;		/* M */							\
++	movl r29=XSI_IPSR;;									\
++	ld8 r29=[r29];;										\
++	mov r26=ar.pfs;			/* I */							\
++	/* mov r28=cr.iip;		/* M */							\
++	movl r28=XSI_IIP;;									\
++	ld8 r28=[r28];;										\
++	mov r21=ar.fpsr;		/* M */							\
++	COVER;			/* B;; (or nothing) */					\
++	;;											\
++	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16;						\
++	;;											\
++	ld1 r17=[r16];				/* load current->thread.on_ustack flag */	\
++	st1 [r16]=r0;				/* clear current->thread.on_ustack flag */	\
++	adds r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16						\
++	/* switch from user to kernel RBS: */							\
++	;;											\
++	invala;				/* M */							\
++	/* SAVE_IFS; /* see xen special handling below */						\
++	cmp.eq pKStk,pUStk=r0,r17;		/* are we in kernel mode already? */		\
++	;;											\
++	MINSTATE_START_SAVE_MIN									\
++	adds r17=2*L1_CACHE_BYTES,r1;		/* really: biggest cache-line size */		\
++	adds r16=PT(CR_IPSR),r1;								\
++	;;											\
++	lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES;						\
++	st8 [r16]=r29;		/* save cr.ipsr */						\
++	;;											\
++	lfetch.fault.excl.nt1 [r17];								\
++	tbit.nz p15,p0=r29,IA64_PSR_I_BIT;							\
++	mov r29=b0										\
++	;;											\
++	adds r16=PT(R8),r1;	/* initialize first base pointer */				\
++	adds r17=PT(R9),r1;	/* initialize second base pointer */				\
++(pKStk)	mov r18=r0;		/* make sure r18 isn't NaT */					\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r8,16;								\
++.mem.offset 8,0; st8.spill [r17]=r9,16;								\
++        ;;											\
++.mem.offset 0,0; st8.spill [r16]=r10,24;							\
++.mem.offset 8,0; st8.spill [r17]=r11,24;							\
++        ;;											\
++	/* xen special handling for possibly lazy cover */					\
++	movl r8=XSI_INCOMPL_REGFR;								\
++	;;											\
++	ld4 r30=[r8];										\
++	;;											\
++	cmp.eq	p6,p7=r30,r0;									\
++	;; /* not sure if this stop bit is necessary */						\
++(p6)	adds r8=XSI_PRECOVER_IFS-XSI_INCOMPL_REGFR,r8;						\
++(p7)	adds r8=XSI_IFS-XSI_INCOMPL_REGFR,r8;							\
++	;;											\
++	ld8 r30=[r8];										\
++	;;											\
++	st8 [r16]=r28,16;	/* save cr.iip */						\
++	st8 [r17]=r30,16;	/* save cr.ifs */						\
++(pUStk)	sub r18=r18,r22;	/* r18=RSE.ndirty*8 */						\
++	mov r8=ar.ccv;										\
++	mov r9=ar.csd;										\
++	mov r10=ar.ssd;										\
++	movl r11=FPSR_DEFAULT;   /* L-unit */							\
++	;;											\
++	st8 [r16]=r25,16;	/* save ar.unat */						\
++	st8 [r17]=r26,16;	/* save ar.pfs */						\
++	shl r18=r18,16;		/* compute ar.rsc to be used for "loadrs" */			\
++	;;											\
++	st8 [r16]=r27,16;	/* save ar.rsc */						\
++(pUStk)	st8 [r17]=r24,16;	/* save ar.rnat */						\
++(pKStk)	adds r17=16,r17;	/* skip over ar_rnat field */					\
++	;;			/* avoid RAW on r16 & r17 */					\
++(pUStk)	st8 [r16]=r23,16;	/* save ar.bspstore */						\
++	st8 [r17]=r31,16;	/* save predicates */						\
++(pKStk)	adds r16=16,r16;	/* skip over ar_bspstore field */				\
++	;;											\
++	st8 [r16]=r29,16;	/* save b0 */							\
++	st8 [r17]=r18,16;	/* save ar.rsc value for "loadrs" */				\
++	cmp.eq pNonSys,pSys=r0,r0	/* initialize pSys=0, pNonSys=1 */			\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r20,16;	/* save original r1 */				\
++.mem.offset 8,0; st8.spill [r17]=r12,16;							\
++	adds r12=-16,r1;	/* switch to kernel memory stack (with 16 bytes of scratch) */	\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r13,16;							\
++.mem.offset 8,0; st8.spill [r17]=r21,16;	/* save ar.fpsr */				\
++	mov r13=IA64_KR(CURRENT);	/* establish `current' */				\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r15,16;							\
++.mem.offset 8,0; st8.spill [r17]=r14,16;							\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r2,16;								\
++.mem.offset 8,0; st8.spill [r17]=r3,16;								\
++	;;											\
++	EXTRA;											\
++	mov r2=b0; br.call.sptk b0=xen_bsw1;; mov b0=r2;					\
++	adds r2=IA64_PT_REGS_R16_OFFSET,r1;							\
++	;;											\
++	movl r1=__gp;		/* establish kernel global pointer */				\
++	;;											\
++	/* MINSTATE_END_SAVE_MIN */
++#else
++#define DO_SAVE_MIN(COVER,SAVE_IFS,EXTRA)							\
++	MINSTATE_GET_CURRENT(r16);	/* M (or M;;I) */					\
++	mov r27=ar.rsc;			/* M */							\
++	mov r20=r1;			/* A */							\
++	mov r25=ar.unat;		/* M */							\
++	mov r29=cr.ipsr;		/* M */							\
++	mov r26=ar.pfs;			/* I */							\
++	mov r28=cr.iip;			/* M */							\
++	mov r21=ar.fpsr;		/* M */							\
++	COVER;				/* B;; (or nothing) */					\
++	;;											\
++	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16;						\
++	;;											\
++	ld1 r17=[r16];				/* load current->thread.on_ustack flag */	\
++	st1 [r16]=r0;				/* clear current->thread.on_ustack flag */	\
++	adds r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16						\
++	/* switch from user to kernel RBS: */							\
++	;;											\
++	invala;				/* M */							\
++	SAVE_IFS;										\
++	cmp.eq pKStk,pUStk=r0,r17;		/* are we in kernel mode already? */		\
++	;;											\
++	MINSTATE_START_SAVE_MIN									\
++	adds r17=2*L1_CACHE_BYTES,r1;		/* really: biggest cache-line size */		\
++	adds r16=PT(CR_IPSR),r1;								\
++	;;											\
++	lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES;						\
++	st8 [r16]=r29;		/* save cr.ipsr */						\
++	;;											\
++	lfetch.fault.excl.nt1 [r17];								\
++	tbit.nz p15,p0=r29,IA64_PSR_I_BIT;							\
++	mov r29=b0										\
++	;;											\
++	adds r16=PT(R8),r1;	/* initialize first base pointer */				\
++	adds r17=PT(R9),r1;	/* initialize second base pointer */				\
++(pKStk)	mov r18=r0;		/* make sure r18 isn't NaT */					\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r8,16;								\
++.mem.offset 8,0; st8.spill [r17]=r9,16;								\
++        ;;											\
++.mem.offset 0,0; st8.spill [r16]=r10,24;							\
++.mem.offset 8,0; st8.spill [r17]=r11,24;							\
++        ;;											\
++	st8 [r16]=r28,16;	/* save cr.iip */						\
++	st8 [r17]=r30,16;	/* save cr.ifs */						\
++(pUStk)	sub r18=r18,r22;	/* r18=RSE.ndirty*8 */						\
++	mov r8=ar.ccv;										\
++	mov r9=ar.csd;										\
++	mov r10=ar.ssd;										\
++	movl r11=FPSR_DEFAULT;   /* L-unit */							\
++	;;											\
++	st8 [r16]=r25,16;	/* save ar.unat */						\
++	st8 [r17]=r26,16;	/* save ar.pfs */						\
++	shl r18=r18,16;		/* compute ar.rsc to be used for "loadrs" */			\
++	;;											\
++	st8 [r16]=r27,16;	/* save ar.rsc */						\
++(pUStk)	st8 [r17]=r24,16;	/* save ar.rnat */						\
++(pKStk)	adds r17=16,r17;	/* skip over ar_rnat field */					\
++	;;			/* avoid RAW on r16 & r17 */					\
++(pUStk)	st8 [r16]=r23,16;	/* save ar.bspstore */						\
++	st8 [r17]=r31,16;	/* save predicates */						\
++(pKStk)	adds r16=16,r16;	/* skip over ar_bspstore field */				\
++	;;											\
++	st8 [r16]=r29,16;	/* save b0 */							\
++	st8 [r17]=r18,16;	/* save ar.rsc value for "loadrs" */				\
++	cmp.eq pNonSys,pSys=r0,r0	/* initialize pSys=0, pNonSys=1 */			\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r20,16;	/* save original r1 */				\
++.mem.offset 8,0; st8.spill [r17]=r12,16;							\
++	adds r12=-16,r1;	/* switch to kernel memory stack (with 16 bytes of scratch) */	\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r13,16;							\
++.mem.offset 8,0; st8.spill [r17]=r21,16;	/* save ar.fpsr */				\
++	mov r13=IA64_KR(CURRENT);	/* establish `current' */				\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r15,16;							\
++.mem.offset 8,0; st8.spill [r17]=r14,16;							\
++	;;											\
++.mem.offset 0,0; st8.spill [r16]=r2,16;								\
++.mem.offset 8,0; st8.spill [r17]=r3,16;								\
++	adds r2=IA64_PT_REGS_R16_OFFSET,r1;							\
++	;;											\
++	EXTRA;											\
++	movl r1=__gp;		/* establish kernel global pointer */				\
++	;;											\
++	MINSTATE_END_SAVE_MIN
++#endif
++
++/*
++ * SAVE_REST saves the remainder of pt_regs (with psr.ic on).
++ *
++ * Assumed state upon entry:
++ *	psr.ic: on
++ *	r2:	points to &pt_regs.r16
++ *	r3:	points to &pt_regs.r17
++ *	r8:	contents of ar.ccv
++ *	r9:	contents of ar.csd
++ *	r10:	contents of ar.ssd
++ *	r11:	FPSR_DEFAULT
++ *
++ * Registers r14 and r15 are guaranteed not to be touched by SAVE_REST.
++ */
++#define SAVE_REST				\
++.mem.offset 0,0; st8.spill [r2]=r16,16;		\
++.mem.offset 8,0; st8.spill [r3]=r17,16;		\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r18,16;		\
++.mem.offset 8,0; st8.spill [r3]=r19,16;		\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r20,16;		\
++.mem.offset 8,0; st8.spill [r3]=r21,16;		\
++	mov r18=b6;				\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r22,16;		\
++.mem.offset 8,0; st8.spill [r3]=r23,16;		\
++	mov r19=b7;				\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r24,16;		\
++.mem.offset 8,0; st8.spill [r3]=r25,16;		\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r26,16;		\
++.mem.offset 8,0; st8.spill [r3]=r27,16;		\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r28,16;		\
++.mem.offset 8,0; st8.spill [r3]=r29,16;		\
++	;;					\
++.mem.offset 0,0; st8.spill [r2]=r30,16;		\
++.mem.offset 8,0; st8.spill [r3]=r31,32;		\
++	;;					\
++	mov ar.fpsr=r11;	/* M-unit */	\
++	st8 [r2]=r8,8;		/* ar.ccv */	\
++	adds r24=PT(B6)-PT(F7),r3;		\
++	;;					\
++	stf.spill [r2]=f6,32;			\
++	stf.spill [r3]=f7,32;			\
++	;;					\
++	stf.spill [r2]=f8,32;			\
++	stf.spill [r3]=f9,32;			\
++	;;					\
++	stf.spill [r2]=f10;			\
++	stf.spill [r3]=f11;			\
++	adds r25=PT(B7)-PT(F11),r3;		\
++	;;					\
++	st8 [r24]=r18,16;       /* b6 */	\
++	st8 [r25]=r19,16;       /* b7 */	\
++	;;					\
++	st8 [r24]=r9;        	/* ar.csd */	\
++	st8 [r25]=r10;      	/* ar.ssd */	\
++	;;
++
++#define SAVE_MIN_WITH_COVER	DO_SAVE_MIN(cover, mov r30=cr.ifs,)
++#define SAVE_MIN_WITH_COVER_R19	DO_SAVE_MIN(cover, mov r30=cr.ifs, mov r15=r19)
++#ifdef CONFIG_XEN
++#define SAVE_MIN		break 0;; /* FIXME: non-cover version only for ia32 support? */
++#else
++#define SAVE_MIN		DO_SAVE_MIN(     , mov r30=r0, )
++#endif
+diff --git a/arch/ia64/xen/xenpal.S b/arch/ia64/xen/xenpal.S
+new file mode 100644
+index 0000000..2fd45e2
+--- /dev/null
++++ b/arch/ia64/xen/xenpal.S
+@@ -0,0 +1,73 @@
++/*
++ * ia64/xen/xenpal.S
++ *
++ * Alternate PAL  routines for Xen.  Heavily leveraged from
++ *   ia64/kernel/pal.S
++ *
++ * Copyright (C) 2005 Hewlett-Packard Co
++ *	Dan Magenheimer <dan.magenheimer at .hp.com>
++ */
++
++#include <asm/asmmacro.h>
++#include <asm/processor.h>
++
++GLOBAL_ENTRY(xen_pal_call_static)
++	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
++	alloc loc1 = ar.pfs,5,5,0,0
++#ifdef CONFIG_XEN
++	movl r22=running_on_xen;;
++	ld4 r22=[r22];;
++	cmp.eq p7,p0=r22,r0
++(p7)	br.cond.spnt.many __ia64_pal_call_static;;
++#endif
++	movl loc2 = pal_entry_point
++1:	{
++	  mov r28 = in0
++	  mov r29 = in1
++	  mov r8 = ip
++	}
++	;;
++	ld8 loc2 = [loc2]		// loc2 <- entry point
++	tbit.nz p6,p7 = in4, 0
++	adds r8 = 1f-1b,r8
++	mov loc4=ar.rsc			// save RSE configuration
++	;;
++	mov ar.rsc=0			// put RSE in enforced lazy, LE mode
++	mov loc3 = psr
++	mov loc0 = rp
++	.body
++	mov r30 = in2
++
++#ifdef CONFIG_XEN
++	// this is low priority for paravirtualization, but is called
++	// from the idle loop so confuses privop counting
++	movl r31=XSI_PSR_IC
++	;;
++(p6)	st8 [r31]=r0
++	;;
++(p7)	adds r31=XSI_PSR_I-XSI_PSR_IC,r31
++	;;
++(p7)	st4 [r31]=r0
++	;;
++	mov r31 = in3
++	mov b7 = loc2
++	;;
++#else
++(p6)	rsm psr.i | psr.ic
++	mov r31 = in3
++	mov b7 = loc2
++
++(p7)	rsm psr.i
++	;;
++(p6)	srlz.i
++#endif
++	mov rp = r8
++	br.cond.sptk.many b7
++1:	mov psr.l = loc3
++	mov ar.rsc = loc4		// restore RSE configuration
++	mov ar.pfs = loc1
++	mov rp = loc0
++	;;
++	srlz.d				// seralize restoration of psr.l
++	br.ret.sptk.many b0
++END(xen_pal_call_static)
+diff --git a/arch/ia64/xen/xensetup.S b/arch/ia64/xen/xensetup.S
+new file mode 100644
+index 0000000..c611974
+--- /dev/null
++++ b/arch/ia64/xen/xensetup.S
+@@ -0,0 +1,35 @@
++/*
++ * Support routines for Xen
++ *
++ * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer at hp.com>
++ */
++
++#include <linux/config.h>
++#include <asm/processor.h>
++#include <asm/asmmacro.h>
++
++	.data
++	.align 8
++	.globl running_on_xen
++running_on_xen:
++	data4 0
++
++#define isBP	p3	// are we the Bootstrap Processor?
++
++	.text
++GLOBAL_ENTRY(early_xen_setup)
++	mov r8=cr.dcr
++(isBP)	movl r9=running_on_xen;;
++	extr.u r8=r8,63,1;;
++	cmp.ne p7,p0=r8,r0;;
++(isBP)	st4 [r9]=r8
++(p7)	movl r10=xen_ivt;;
++(p7)	mov cr.iva=r10
++	br.ret.sptk.many rp;;
++END(early_xen_setup)
++
++GLOBAL_ENTRY(is_running_on_xen)
++	movl r9=running_on_xen;;
++	ld4 r8=[r9]
++	br.ret.sptk.many rp;;
++END(is_running_on_xen)
+diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
+index 544665e..dece10d 100644
+--- a/arch/um/kernel/physmem.c
++++ b/arch/um/kernel/physmem.c
+@@ -225,7 +225,7 @@ EXPORT_SYMBOL(physmem_forget_descriptor)
+ EXPORT_SYMBOL(physmem_remove_mapping);
+ EXPORT_SYMBOL(physmem_subst_mapping);
+ 
+-void arch_free_page(struct page *page, int order)
++int arch_free_page(struct page *page, int order)
+ {
+ 	void *virt;
+ 	int i;
+@@ -234,6 +234,8 @@ void arch_free_page(struct page *page, i
+ 		virt = __va(page_to_phys(page + i));
+ 		physmem_remove_mapping(virt);
+ 	}
++
++	return 0;
+ }
+ 
+ int is_remapped(void *virt)
+diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
+index e18eb79..75e35a5 100644
+--- a/arch/x86_64/Kconfig
++++ b/arch/x86_64/Kconfig
+@@ -119,6 +119,22 @@ config GENERIC_CPU
+ 
+ endchoice
+ 
++config X86_64_XEN
++	bool "Enable Xen compatible kernel"
++	select SWIOTLB
++	help
++	  This option will compile a kernel compatible with Xen hypervisor
++
++config X86_NO_TSS
++	bool
++	depends on X86_64_XEN
++	default y
++
++config X86_NO_IDT
++	bool
++	depends on X86_64_XEN
++	default y
++
+ #
+ # Define implied options from the CPU selection here
+ #
+@@ -134,6 +150,7 @@ config X86_L1_CACHE_SHIFT
+ 
+ config X86_TSC
+ 	bool
++	depends on !X86_64_XEN
+ 	default y
+ 
+ config X86_GOOD_APIC
+@@ -176,7 +193,7 @@ config X86_CPUID
+ 
+ config X86_HT
+ 	bool
+-	depends on SMP && !MK8
++	depends on SMP && !MK8 && !X86_64_XEN
+ 	default y
+ 
+ config MATH_EMULATION
+@@ -190,14 +207,22 @@ config EISA
+ 
+ config X86_IO_APIC
+ 	bool
++	depends !XEN_UNPRIVILEGED_GUEST
+ 	default y
+ 
++config X86_XEN_GENAPIC
++	bool
++	depends X86_64_XEN
++	default XEN_PRIVILEGED_GUEST || SMP
++
+ config X86_LOCAL_APIC
+ 	bool
++	depends !XEN_UNPRIVILEGED_GUEST
+ 	default y
+ 
+ config MTRR
+ 	bool "MTRR (Memory Type Range Register) support"
++	depends on !X86_64_XEN
+ 	---help---
+ 	  On Intel P6 family processors (Pentium Pro, Pentium II and later)
+ 	  the Memory Type Range Registers (MTRRs) may be used to control
+@@ -238,7 +263,7 @@ config SMP
+ 
+ config SCHED_SMT
+ 	bool "SMT (Hyperthreading) scheduler support"
+-	depends on SMP
++	depends on SMP && !X86_64_XEN
+ 	default n
+ 	help
+ 	  SMT scheduler support improves the CPU scheduler's decision making
+@@ -250,7 +275,7 @@ source "kernel/Kconfig.preempt"
+ 
+ config NUMA
+        bool "Non Uniform Memory Access (NUMA) Support"
+-       depends on SMP
++       depends on SMP && !X86_64_XEN
+        help
+ 	 Enable NUMA (Non Uniform Memory Access) support. The kernel 
+ 	 will try to allocate memory used by a CPU on the local memory 
+@@ -325,6 +350,7 @@ config NR_CPUS
+ 	int "Maximum number of CPUs (2-256)"
+ 	range 2 256
+ 	depends on SMP
++	default "16" if X86_64_XEN
+ 	default "8"
+ 	help
+ 	  This allows you to specify the maximum number of CPUs which this
+@@ -345,6 +371,7 @@ config HOTPLUG_CPU
+ 
+ config HPET_TIMER
+ 	bool
++	depends on !X86_64_XEN
+ 	default y
+ 	help
+ 	  Use the IA-PC HPET (High Precision Event Timer) to manage
+@@ -362,7 +389,7 @@ config GART_IOMMU
+ 	bool "K8 GART IOMMU support"
+ 	default y
+ 	select SWIOTLB
+-	depends on PCI
++	depends on PCI && !X86_64_XEN
+ 	help
+ 	  Support the IOMMU. Needed to run systems with more than 3GB of memory
+ 	  properly with 32-bit PCI devices that do not support DAC (Double Address
+@@ -380,6 +407,7 @@ config SWIOTLB
+ 
+ config X86_MCE
+ 	bool "Machine check support" if EMBEDDED
++	depends on !X86_64_XEN
+ 	default y
+ 	help
+ 	   Include a machine check error handler to report hardware errors.
+@@ -405,7 +433,7 @@ config X86_MCE_AMD
+ 
+ config KEXEC
+ 	bool "kexec system call (EXPERIMENTAL)"
+-	depends on EXPERIMENTAL
++	depends on EXPERIMENTAL && !X86_64_XEN
+ 	help
+ 	  kexec is a system call that implements the ability to shutdown your
+ 	  current kernel, and to start another kernel.  It is like a reboot
+@@ -488,8 +516,11 @@ config GENERIC_PENDING_IRQ
+ 	default y
+ 
+ menu "Power management options"
++	depends on !XEN_UNPRIVILEGED_GUEST
+ 
++if !X86_64_XEN
+ source kernel/power/Kconfig
++endif
+ 
+ source "drivers/acpi/Kconfig"
+ 
+@@ -512,6 +543,21 @@ config PCI_MMCONFIG
+ 	bool "Support mmconfig PCI config space access"
+ 	depends on PCI && ACPI
+ 
++config XEN_PCIDEV_FRONTEND
++	bool "Xen PCI Frontend"
++	depends on PCI && X86_64_XEN
++	default y
++	help
++	  The PCI device frontend driver allows the kernel to import arbitrary
++	  PCI devices from a PCI backend to support PCI driver domains.
++
++config XEN_PCIDEV_FE_DEBUG
++	bool "Xen PCI Frontend Debugging"
++	depends on XEN_PCIDEV_FRONTEND
++	default n
++	help
++	  Enables some debug statements within the PCI Frontend.
++
+ config UNORDERED_IO
+        bool "Unordered IO mapping access"
+        depends on EXPERIMENTAL
+@@ -522,6 +568,7 @@ config UNORDERED_IO
+ 	 from i386. Requires that the driver writer used memory barriers
+ 	 properly.
+ 
++if !X86_64_XEN
+ source "drivers/pci/pcie/Kconfig"
+ 
+ source "drivers/pci/Kconfig"
+@@ -529,6 +576,7 @@ source "drivers/pci/Kconfig"
+ source "drivers/pcmcia/Kconfig"
+ 
+ source "drivers/pci/hotplug/Kconfig"
++endif
+ 
+ endmenu
+ 
+@@ -592,4 +640,6 @@ source "security/Kconfig"
+ 
+ source "crypto/Kconfig"
+ 
++source "drivers/xen/Kconfig"
++
+ source "lib/Kconfig"
+diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
+index d7fd464..05a611c 100644
+--- a/arch/x86_64/Makefile
++++ b/arch/x86_64/Makefile
+@@ -70,6 +70,20 @@ boot := arch/x86_64/boot
+ .PHONY: bzImage bzlilo install archmrproper \
+ 	fdimage fdimage144 fdimage288 archclean
+ 
++ifdef CONFIG_XEN
++head-y := arch/x86_64/kernel/head-xen.o arch/x86_64/kernel/head64-xen.o arch/x86_64/kernel/init_task.o
++LDFLAGS_vmlinux := -e _start
++boot := arch/i386/boot-xen
++.PHONY: vmlinuz
++#Default target when executing "make"
++all: vmlinuz
++
++vmlinuz: vmlinux
++	$(Q)$(MAKE) $(build)=$(boot) $@
++
++install:
++	$(Q)$(MAKE) $(build)=$(boot) XENGUEST=$(XENGUEST) $@
++else
+ #Default target when executing "make"
+ all: bzImage
+ 
+@@ -90,6 +104,7 @@ fdimage fdimage144 fdimage288: vmlinux
+ 
+ install:
+ 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 
++endif
+ 
+ archclean:
+ 	$(Q)$(MAKE) $(clean)=$(boot)
+diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile
+index 929e6b0..6dcd7cf 100644
+--- a/arch/x86_64/ia32/Makefile
++++ b/arch/x86_64/ia32/Makefile
+@@ -23,9 +23,25 @@ quiet_cmd_syscall = SYSCALL $@
+ 			   -Wl,-soname=linux-gate.so.1 -o $@ \
+ 			   -Wl,-T,$(filter-out FORCE,$^)
+ 
++$(obj)/vsyscall-int80.so \
+ $(obj)/vsyscall-sysenter.so $(obj)/vsyscall-syscall.so: \
+ $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
+ 	$(call if_changed,syscall)
+ 
+-AFLAGS_vsyscall-sysenter.o = -m32
+-AFLAGS_vsyscall-syscall.o = -m32
++AFLAGS_vsyscall-sysenter.o = -m32 -Iarch/i386/kernel
++AFLAGS_vsyscall-syscall.o = -m32 -Iarch/i386/kernel
++
++ifdef CONFIG_XEN
++AFLAGS_vsyscall-int80.o = -m32 -Iarch/i386/kernel
++CFLAGS_syscall32-xen.o += -DUSE_INT80
++AFLAGS_syscall32_syscall-xen.o += -DUSE_INT80
++
++$(obj)/syscall32_syscall-xen.o: \
++	$(foreach F,int80 sysenter syscall,$(obj)/vsyscall-$F.so)
++
++targets := $(foreach F,int80 sysenter syscall,vsyscall-$F.o vsyscall-$F.so)
++
++include $(srctree)/scripts/Makefile.xen
++
++obj-y := $(call cherrypickxen, $(obj-y))
++endif
+diff --git a/arch/x86_64/ia32/ia32entry-xen.S b/arch/x86_64/ia32/ia32entry-xen.S
+new file mode 100644
+index 0000000..73129e2
+--- /dev/null
++++ b/arch/x86_64/ia32/ia32entry-xen.S
+@@ -0,0 +1,721 @@
++/*
++ * Compatibility mode system call entry point for x86-64. 
++ * 		
++ * Copyright 2000-2002 Andi Kleen, SuSE Labs.
++ */		 
++
++#include <asm/dwarf2.h>
++#include <asm/calling.h>
++#include <asm/asm-offsets.h>
++#include <asm/current.h>
++#include <asm/errno.h>
++#include <asm/ia32_unistd.h>	
++#include <asm/thread_info.h>	
++#include <asm/segment.h>
++#include <asm/vsyscall32.h>
++#include <linux/linkage.h>
++
++#define __XEN_X86_64 1
++	
++	.macro IA32_ARG_FIXUP noebp=0
++	movl	%edi,%r8d
++	.if \noebp
++	.else
++	movl	%ebp,%r9d
++	.endif
++	xchg	%ecx,%esi
++	movl	%ebx,%edi
++	movl	%edx,%edx	/* zero extension */
++	.endm 
++
++	/* clobbers %eax */	
++	.macro  CLEAR_RREGS
++	xorl 	%eax,%eax
++	movq	%rax,R11(%rsp)
++	movq	%rax,R10(%rsp)
++	movq	%rax,R9(%rsp)
++	movq	%rax,R8(%rsp)
++	.endm
++
++#if defined (__XEN_X86_64)
++#include "../kernel/xen_entry.S"
++		
++#define	__swapgs
++#define __cli
++#define __sti	
++#else
++/*
++ * Use the native instructions
++ */	
++#define	__swapgs	swapgs
++#define __cli		cli
++#define __sti		sti	
++#endif			
++
++	.macro CFI_STARTPROC32 simple
++	CFI_STARTPROC	\simple
++	CFI_UNDEFINED	r8
++	CFI_UNDEFINED	r9
++	CFI_UNDEFINED	r10
++	CFI_UNDEFINED	r11
++	CFI_UNDEFINED	r12
++	CFI_UNDEFINED	r13
++	CFI_UNDEFINED	r14
++	CFI_UNDEFINED	r15
++	.endm
++
++/*
++ * 32bit SYSENTER instruction entry.
++ *
++ * Arguments:
++ * %eax	System call number.
++ * %ebx Arg1
++ * %ecx Arg2
++ * %edx Arg3
++ * %esi Arg4
++ * %edi Arg5
++ * %ebp user stack
++ * 0(%ebp) Arg6	
++ * 	
++ * Interrupts off.
++ *	
++ * This is purely a fast path. For anything complicated we use the int 0x80
++ * path below.	Set up a complete hardware stack frame to share code
++ * with the int 0x80 path.
++ */ 	
++ENTRY(ia32_sysenter_target)
++	CFI_STARTPROC32	simple
++	CFI_DEF_CFA	rsp,0
++	CFI_REGISTER	rsp,rbp
++	__swapgs 
++	movq	%gs:pda_kernelstack, %rsp
++	addq	$(PDA_STACKOFFSET),%rsp
++	XEN_UNBLOCK_EVENTS(%r11)	
++	__sti
++ 	movl	%ebp,%ebp		/* zero extension */
++	pushq	$__USER32_DS
++	CFI_ADJUST_CFA_OFFSET 8
++	/*CFI_REL_OFFSET ss,0*/
++	pushq	%rbp
++	CFI_ADJUST_CFA_OFFSET 8
++	CFI_REL_OFFSET rsp,0
++	pushfq
++	CFI_ADJUST_CFA_OFFSET 8
++	/*CFI_REL_OFFSET rflags,0*/
++	movl	$VSYSCALL32_SYSEXIT, %r10d
++	CFI_REGISTER rip,r10
++	pushq	$__USER32_CS
++	CFI_ADJUST_CFA_OFFSET 8
++	/*CFI_REL_OFFSET cs,0*/
++	movl	%eax, %eax
++	pushq	%r10
++	CFI_ADJUST_CFA_OFFSET 8
++	CFI_REL_OFFSET rip,0
++	pushq	%rax
++	CFI_ADJUST_CFA_OFFSET 8
++	cld
++	SAVE_ARGS 0,0,1
++ 	/* no need to do an access_ok check here because rbp has been
++ 	   32bit zero extended */ 
++1:	movl	(%rbp),%r9d
++ 	.section __ex_table,"a"
++ 	.quad 1b,ia32_badarg
++ 	.previous	
++	GET_THREAD_INFO(%r10)
++	orl    $TS_COMPAT,threadinfo_status(%r10)
++	testl  $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
++	CFI_REMEMBER_STATE
++	jnz  sysenter_tracesys
++sysenter_do_call:	
++	cmpl	$(IA32_NR_syscalls),%eax
++	jae	ia32_badsys
++	IA32_ARG_FIXUP 1
++	call	*ia32_sys_call_table(,%rax,8)
++	movq	%rax,RAX-ARGOFFSET(%rsp)
++	GET_THREAD_INFO(%r10)
++	XEN_BLOCK_EVENTS(%r11)	
++	__cli
++	testl	$_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
++	jnz	int_ret_from_sys_call
++	andl    $~TS_COMPAT,threadinfo_status(%r10)
++	/* clear IF, that popfq doesn't enable interrupts early */
++	andl  $~0x200,EFLAGS-R11(%rsp) 
++	RESTORE_ARGS 1,24,1,1,1,1
++	popfq
++	CFI_ADJUST_CFA_OFFSET -8
++	/*CFI_RESTORE rflags*/
++	popq	%rcx				/* User %esp */
++	CFI_ADJUST_CFA_OFFSET -8
++	CFI_REGISTER rsp,rcx
++	movl	$VSYSCALL32_SYSEXIT,%edx	/* User %eip */
++	CFI_REGISTER rip,rdx
++	__swapgs
++	XEN_UNBLOCK_EVENTS(%r11)		
++	__sti		/* sti only takes effect after the next instruction */
++	/* sysexit */
++	.byte	0xf, 0x35  /* TBD */
++
++sysenter_tracesys:
++	CFI_RESTORE_STATE
++	SAVE_REST
++	CLEAR_RREGS
++	movq	$-ENOSYS,RAX(%rsp)	/* really needed? */
++	movq	%rsp,%rdi        /* &pt_regs -> arg1 */
++	call	syscall_trace_enter
++	LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
++	RESTORE_REST
++	movl	%ebp, %ebp
++	/* no need to do an access_ok check here because rbp has been
++	   32bit zero extended */ 
++1:	movl	(%rbp),%r9d
++	.section __ex_table,"a"
++	.quad 1b,ia32_badarg
++	.previous
++	jmp	sysenter_do_call
++	CFI_ENDPROC
++
++/*
++ * 32bit SYSCALL instruction entry.
++ *
++ * Arguments:
++ * %eax	System call number.
++ * %ebx Arg1
++ * %ecx return EIP 
++ * %edx Arg3
++ * %esi Arg4
++ * %edi Arg5
++ * %ebp Arg2    [note: not saved in the stack frame, should not be touched]
++ * %esp user stack 
++ * 0(%esp) Arg6
++ * 	
++ * Interrupts off.
++ *	
++ * This is purely a fast path. For anything complicated we use the int 0x80
++ * path below.	Set up a complete hardware stack frame to share code
++ * with the int 0x80 path.	
++ */ 	
++ENTRY(ia32_cstar_target)
++	CFI_STARTPROC32	simple
++	CFI_DEF_CFA	rsp,0
++	CFI_REGISTER	rip,rcx
++	/*CFI_REGISTER	rflags,r11*/
++	__swapgs
++	movl	%esp,%r8d
++	CFI_REGISTER	rsp,r8
++	movq	%gs:pda_kernelstack,%rsp
++	XEN_UNBLOCK_EVENTS(%r11)	
++	__sti
++	SAVE_ARGS 8,1,1
++	movl 	%eax,%eax	/* zero extension */
++	movq	%rax,ORIG_RAX-ARGOFFSET(%rsp)
++	movq	%rcx,RIP-ARGOFFSET(%rsp)
++	CFI_REL_OFFSET rip,RIP-ARGOFFSET
++	movq	%rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
++	movl	%ebp,%ecx
++	movq	$__USER32_CS,CS-ARGOFFSET(%rsp)
++	movq	$__USER32_DS,SS-ARGOFFSET(%rsp)
++	movq	%r11,EFLAGS-ARGOFFSET(%rsp)
++	/*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
++	movq	%r8,RSP-ARGOFFSET(%rsp)	
++	CFI_REL_OFFSET rsp,RSP-ARGOFFSET
 +	/* no need to do an access_ok check here because r8 has been
 +	   32bit zero extended */ 
 +	/* hardware stack frame is complete now */	
@@ -21123,72 +26208,11 @@
 +	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
 +		.quad ni_syscall
 +	.endr
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/Makefile linux-2.6-merge.hg/arch/x86_64/ia32/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/Makefile	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/ia32/Makefile	2006-02-11 17:24:57.000000000 +0000
-@@ -23,9 +23,25 @@
- 			   -Wl,-soname=linux-gate.so.1 -o $@ \
- 			   -Wl,-T,$(filter-out FORCE,$^)
- 
-+$(obj)/vsyscall-int80.so \
- $(obj)/vsyscall-sysenter.so $(obj)/vsyscall-syscall.so: \
- $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
- 	$(call if_changed,syscall)
- 
--AFLAGS_vsyscall-sysenter.o = -m32
--AFLAGS_vsyscall-syscall.o = -m32
-+AFLAGS_vsyscall-sysenter.o = -m32 -Iarch/i386/kernel
-+AFLAGS_vsyscall-syscall.o = -m32 -Iarch/i386/kernel
-+
-+ifdef CONFIG_XEN
-+AFLAGS_vsyscall-int80.o = -m32 -Iarch/i386/kernel
-+CFLAGS_syscall32-xen.o += -DUSE_INT80
-+AFLAGS_syscall32_syscall-xen.o += -DUSE_INT80
-+
-+$(obj)/syscall32_syscall-xen.o: \
-+	$(foreach F,int80 sysenter syscall,$(obj)/vsyscall-$F.so)
-+
-+targets := $(foreach F,int80 sysenter syscall,vsyscall-$F.o vsyscall-$F.so)
-+
-+include $(srctree)/scripts/Makefile.xen
-+
-+obj-y := $(call cherrypickxen, $(obj-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/syscall32_syscall-xen.S linux-2.6-merge.hg/arch/x86_64/ia32/syscall32_syscall-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/syscall32_syscall-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/ia32/syscall32_syscall-xen.S	2006-02-11 17:24:57.000000000 +0000
-@@ -0,0 +1,28 @@
-+/* 32bit VDSOs mapped into user space. */
-+
-+	.section ".init.data","aw"
-+
-+#ifdef USE_INT80
-+
-+	.globl syscall32_int80
-+	.globl syscall32_int80_end
-+
-+syscall32_int80:
-+	.incbin "arch/x86_64/ia32/vsyscall-int80.so"
-+syscall32_int80_end:
-+
-+#endif
-+
-+	.globl syscall32_syscall
-+	.globl syscall32_syscall_end
-+
-+syscall32_syscall:
-+	.incbin "arch/x86_64/ia32/vsyscall-syscall.so"
-+syscall32_syscall_end:
-+
-+	.globl syscall32_sysenter
-+	.globl syscall32_sysenter_end
-+
-+syscall32_sysenter:
-+	.incbin "arch/x86_64/ia32/vsyscall-sysenter.so"
-+syscall32_sysenter_end:
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/syscall32-xen.c linux-2.6-merge.hg/arch/x86_64/ia32/syscall32-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/syscall32-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/ia32/syscall32-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/ia32/syscall32-xen.c b/arch/x86_64/ia32/syscall32-xen.c
+new file mode 100644
+index 0000000..e99a6f7
+--- /dev/null
++++ b/arch/x86_64/ia32/syscall32-xen.c
 @@ -0,0 +1,128 @@
 +/* Copyright 2002,2003 Andi Kleen, SuSE Labs */
 +
@@ -21318,9 +26342,45 @@
 +	wrmsrl(MSR_CSTAR, ia32_cstar_target);
 +#endif
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/vsyscall-int80.S linux-2.6-merge.hg/arch/x86_64/ia32/vsyscall-int80.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/vsyscall-int80.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/ia32/vsyscall-int80.S	2006-02-11 17:24:57.000000000 +0000
+diff --git a/arch/x86_64/ia32/syscall32_syscall-xen.S b/arch/x86_64/ia32/syscall32_syscall-xen.S
+new file mode 100644
+index 0000000..749b198
+--- /dev/null
++++ b/arch/x86_64/ia32/syscall32_syscall-xen.S
+@@ -0,0 +1,28 @@
++/* 32bit VDSOs mapped into user space. */
++
++	.section ".init.data","aw"
++
++#ifdef USE_INT80
++
++	.globl syscall32_int80
++	.globl syscall32_int80_end
++
++syscall32_int80:
++	.incbin "arch/x86_64/ia32/vsyscall-int80.so"
++syscall32_int80_end:
++
++#endif
++
++	.globl syscall32_syscall
++	.globl syscall32_syscall_end
++
++syscall32_syscall:
++	.incbin "arch/x86_64/ia32/vsyscall-syscall.so"
++syscall32_syscall_end:
++
++	.globl syscall32_sysenter
++	.globl syscall32_sysenter_end
++
++syscall32_sysenter:
++	.incbin "arch/x86_64/ia32/vsyscall-sysenter.so"
++syscall32_sysenter_end:
+diff --git a/arch/x86_64/ia32/vsyscall-int80.S b/arch/x86_64/ia32/vsyscall-int80.S
+new file mode 100644
+index 0000000..00e4148
+--- /dev/null
++++ b/arch/x86_64/ia32/vsyscall-int80.S
 @@ -0,0 +1,58 @@
 +/*
 + * Code for the vsyscall page.  This version uses the old int $0x80 method.
@@ -21380,210 +26440,68 @@
 + */
 +#define SYSCALL_ENTER_KERNEL    int $0x80
 +#include "vsyscall-sigreturn.S"
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/vsyscall-sigreturn.S linux-2.6-merge.hg/arch/x86_64/ia32/vsyscall-sigreturn.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/ia32/vsyscall-sigreturn.S	2006-02-11 17:24:57.000000000 +0000
-@@ -120,5 +120,5 @@
+diff --git a/arch/x86_64/ia32/vsyscall-sigreturn.S b/arch/x86_64/ia32/vsyscall-sigreturn.S
+index d90321f..3947f45 100644
+--- a/arch/x86_64/ia32/vsyscall-sigreturn.S
++++ b/arch/x86_64/ia32/vsyscall-sigreturn.S
+@@ -120,5 +120,5 @@ __kernel_rt_sigreturn:
  	.align 4
  .LENDFDE3:
  
 -#include "../../i386/kernel/vsyscall-note.S"
 +#include <vsyscall-note.S>
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/Kconfig linux-2.6-merge.hg/arch/x86_64/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/Kconfig	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/Kconfig	2006-02-27 15:49:40.000000000 +0000
-@@ -119,6 +119,22 @@
- 
- endchoice
- 
-+config X86_64_XEN
-+	bool "Enable Xen compatible kernel"
-+	select SWIOTLB
-+	help
-+	  This option will compile a kernel compatible with Xen hypervisor
-+
-+config X86_NO_TSS
-+	bool
-+	depends on X86_64_XEN
-+	default y
-+
-+config X86_NO_IDT
-+	bool
-+	depends on X86_64_XEN
-+	default y
-+
- #
- # Define implied options from the CPU selection here
- #
-@@ -134,6 +150,7 @@
- 
- config X86_TSC
- 	bool
-+	depends on !X86_64_XEN
- 	default y
- 
- config X86_GOOD_APIC
-@@ -176,7 +193,7 @@
- 
- config X86_HT
- 	bool
--	depends on SMP && !MK8
-+	depends on SMP && !MK8 && !X86_64_XEN
- 	default y
- 
- config MATH_EMULATION
-@@ -190,14 +207,22 @@
- 
- config X86_IO_APIC
- 	bool
-+	depends !XEN_UNPRIVILEGED_GUEST
- 	default y
+diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
+index a098a11..e904c36 100644
+--- a/arch/x86_64/kernel/Makefile
++++ b/arch/x86_64/kernel/Makefile
+@@ -20,11 +20,13 @@ obj-$(CONFIG_MICROCODE)		+= microcode.o
+ obj-$(CONFIG_X86_CPUID)		+= cpuid.o
+ obj-$(CONFIG_SMP)		+= smp.o smpboot.o trampoline.o
+ obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o  nmi.o
++obj-$(CONFIG_X86_XEN_GENAPIC)	+= genapic.o genapic_xen.o
+ obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o mpparse.o \
+ 		genapic.o genapic_cluster.o genapic_flat.o
+ obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
+ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
+-obj-$(CONFIG_PM)		+= suspend.o
++obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o
++obj-$(CONFIG_ACPI_SLEEP)	+= suspend.o
+ obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+ obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
+ obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+@@ -51,3 +53,17 @@ i8237-y				+= ../../i386/kernel/i8237.o
+ msr-$(subst m,y,$(CONFIG_X86_MSR))  += ../../i386/kernel/msr.o
+ dmi_scan-y			+= ../../i386/kernel/dmi_scan.o
  
-+config X86_XEN_GENAPIC
-+	bool
-+	depends X86_64_XEN
-+	default XEN_PRIVILEGED_GUEST || SMP
++ifdef CONFIG_XEN
++time-y				+= ../../i386/kernel/time-xen.o
++pci-dma-y			+= ../../i386/kernel/pci-dma-xen.o
++microcode-$(subst m,y,$(CONFIG_MICROCODE))  := ../../i386/kernel/microcode-xen.o
++quirks-y			:= ../../i386/kernel/quirks-xen.o
 +
- config X86_LOCAL_APIC
- 	bool
-+	depends !XEN_UNPRIVILEGED_GUEST
- 	default y
- 
- config MTRR
- 	bool "MTRR (Memory Type Range Register) support"
-+	depends on !X86_64_XEN
- 	---help---
- 	  On Intel P6 family processors (Pentium Pro, Pentium II and later)
- 	  the Memory Type Range Registers (MTRRs) may be used to control
-@@ -238,7 +263,7 @@
- 
- config SCHED_SMT
- 	bool "SMT (Hyperthreading) scheduler support"
--	depends on SMP
-+	depends on SMP && !X86_64_XEN
- 	default n
- 	help
- 	  SMT scheduler support improves the CPU scheduler's decision making
-@@ -250,7 +275,7 @@
- 
- config NUMA
-        bool "Non Uniform Memory Access (NUMA) Support"
--       depends on SMP
-+       depends on SMP && !X86_64_XEN
-        help
- 	 Enable NUMA (Non Uniform Memory Access) support. The kernel 
- 	 will try to allocate memory used by a CPU on the local memory 
-@@ -325,6 +350,7 @@
- 	int "Maximum number of CPUs (2-256)"
- 	range 2 256
- 	depends on SMP
-+	default "16" if X86_64_XEN
- 	default "8"
- 	help
- 	  This allows you to specify the maximum number of CPUs which this
-@@ -345,6 +371,7 @@
- 
- config HPET_TIMER
- 	bool
-+	depends on !X86_64_XEN
- 	default y
- 	help
- 	  Use the IA-PC HPET (High Precision Event Timer) to manage
-@@ -362,7 +389,7 @@
- 	bool "K8 GART IOMMU support"
- 	default y
- 	select SWIOTLB
--	depends on PCI
-+	depends on PCI && !X86_64_XEN
- 	help
- 	  Support the IOMMU. Needed to run systems with more than 3GB of memory
- 	  properly with 32-bit PCI devices that do not support DAC (Double Address
-@@ -380,6 +407,7 @@
- 
- config X86_MCE
- 	bool "Machine check support" if EMBEDDED
-+	depends on !X86_64_XEN
- 	default y
- 	help
- 	   Include a machine check error handler to report hardware errors.
-@@ -405,7 +433,7 @@
- 
- config KEXEC
- 	bool "kexec system call (EXPERIMENTAL)"
--	depends on EXPERIMENTAL
-+	depends on EXPERIMENTAL && !X86_64_XEN
- 	help
- 	  kexec is a system call that implements the ability to shutdown your
- 	  current kernel, and to start another kernel.  It is like a reboot
-@@ -488,8 +516,11 @@
- 	default y
- 
- menu "Power management options"
-+	depends on !XEN_UNPRIVILEGED_GUEST
- 
-+if !X86_64_XEN
- source kernel/power/Kconfig
-+endif
- 
- source "drivers/acpi/Kconfig"
- 
-@@ -512,6 +543,21 @@
- 	bool "Support mmconfig PCI config space access"
- 	depends on PCI && ACPI
- 
-+config XEN_PCIDEV_FRONTEND
-+	bool "Xen PCI Frontend"
-+	depends on PCI && X86_64_XEN
-+	default y
-+	help
-+	  The PCI device frontend driver allows the kernel to import arbitrary
-+	  PCI devices from a PCI backend to support PCI driver domains.
++n-obj-xen := i8259.o reboot.o i8237.o smpboot.o trampoline.o genapic_cluster.o genapic_flat.o
 +
-+config XEN_PCIDEV_FE_DEBUG
-+	bool "Xen PCI Frontend Debugging"
-+	depends on XEN_PCIDEV_FRONTEND
-+	default n
-+	help
-+	  Enables some debug statements within the PCI Frontend.
++include $(srctree)/scripts/Makefile.xen
 +
- config UNORDERED_IO
-        bool "Unordered IO mapping access"
-        depends on EXPERIMENTAL
-@@ -522,6 +568,7 @@
- 	 from i386. Requires that the driver writer used memory barriers
- 	 properly.
- 
-+if !X86_64_XEN
- source "drivers/pci/pcie/Kconfig"
- 
- source "drivers/pci/Kconfig"
-@@ -529,6 +576,7 @@
- source "drivers/pcmcia/Kconfig"
- 
- source "drivers/pci/hotplug/Kconfig"
++obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
++obj-y := $(call cherrypickxen, $(obj-y))
++extra-y := $(call cherrypickxen, $(extra-y))
 +endif
- 
- endmenu
- 
-@@ -592,4 +640,6 @@
- 
- source "crypto/Kconfig"
- 
-+source "drivers/xen/Kconfig"
-+
- source "lib/Kconfig"
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/acpi/Makefile linux-2.6-merge.hg/arch/x86_64/kernel/acpi/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/acpi/Makefile	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/acpi/Makefile	2006-02-11 17:24:57.000000000 +0000
-@@ -6,3 +6,4 @@
+diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile
+index 4fe9707..aa84f6e 100644
+--- a/arch/x86_64/kernel/acpi/Makefile
++++ b/arch/x86_64/kernel/acpi/Makefile
+@@ -6,3 +6,4 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),)
  obj-y			+= processor.o
  endif
  
 +boot-$(CONFIG_XEN)		:= ../../../i386/kernel/acpi/boot-xen.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/apic-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/apic-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/apic-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/apic-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/kernel/apic-xen.c b/arch/x86_64/kernel/apic-xen.c
+new file mode 100644
+index 0000000..f27b0e3
+--- /dev/null
++++ b/arch/x86_64/kernel/apic-xen.c
 @@ -0,0 +1,200 @@
 +/*
 + *	Local APIC handling, local APIC timers
@@ -21785,10 +26703,11 @@
 +
 +	return 0;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/asm-offsets.c linux-2.6-merge.hg/arch/x86_64/kernel/asm-offsets.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/asm-offsets.c	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/asm-offsets.c	2006-02-21 16:06:09.000000000 +0000
-@@ -66,7 +66,9 @@
+diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c
+index 38834bb..06cf058 100644
+--- a/arch/x86_64/kernel/asm-offsets.c
++++ b/arch/x86_64/kernel/asm-offsets.c
+@@ -66,7 +66,9 @@ int main(void)
  	DEFINE(pbe_address, offsetof(struct pbe, address));
  	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  	DEFINE(pbe_next, offsetof(struct pbe, next));
@@ -21798,9 +26717,11 @@
 +#endif
  	return 0;
  }
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/e820-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/e820-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/e820-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/e820-xen.c	2006-02-11 17:24:57.000000000 +0000
+diff --git a/arch/x86_64/kernel/e820-xen.c b/arch/x86_64/kernel/e820-xen.c
+new file mode 100644
+index 0000000..ac5ae87
+--- /dev/null
++++ b/arch/x86_64/kernel/e820-xen.c
 @@ -0,0 +1,744 @@
 +/* 
 + * Handle the memory map.
@@ -22546,9 +27467,11 @@
 +		pci_mem_start, gapstart, gapsize);
 +#endif
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/early_printk-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/early_printk-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/early_printk-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/early_printk-xen.c	2006-02-11 17:24:57.000000000 +0000
+diff --git a/arch/x86_64/kernel/early_printk-xen.c b/arch/x86_64/kernel/early_printk-xen.c
+new file mode 100644
+index 0000000..c1eb6b5
+--- /dev/null
++++ b/arch/x86_64/kernel/early_printk-xen.c
 @@ -0,0 +1,306 @@
 +#include <linux/config.h>
 +#include <linux/console.h>
@@ -22856,9 +27779,11 @@
 +} 
 +
 +__setup("earlyprintk=", setup_early_printk);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/entry-xen.S linux-2.6-merge.hg/arch/x86_64/kernel/entry-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/entry-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/entry-xen.S	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/kernel/entry-xen.S b/arch/x86_64/kernel/entry-xen.S
+new file mode 100644
+index 0000000..dc41c56
+--- /dev/null
++++ b/arch/x86_64/kernel/entry-xen.S
 @@ -0,0 +1,1138 @@
 +/*
 + *  linux/arch/x86_64/entry.S
@@ -23947,60 +28872,203 @@
 +	CFI_ENDPROC
 +#endif
 +
-+ENTRY(invalid_TSS)
-+	errorentry do_invalid_TSS
-+
-+ENTRY(segment_not_present)
-+	errorentry do_segment_not_present
-+
-+	/* runs on exception stack */
-+ENTRY(stack_segment)
-+	XCPT_FRAME
-+	errorentry do_stack_segment
-+	CFI_ENDPROC
++ENTRY(invalid_TSS)
++	errorentry do_invalid_TSS
++
++ENTRY(segment_not_present)
++	errorentry do_segment_not_present
++
++	/* runs on exception stack */
++ENTRY(stack_segment)
++	XCPT_FRAME
++	errorentry do_stack_segment
++	CFI_ENDPROC
++
++KPROBE_ENTRY(general_protection)
++	errorentry do_general_protection
++	.previous .text
++
++ENTRY(alignment_check)
++	errorentry do_alignment_check
++
++ENTRY(divide_error)
++	zeroentry do_divide_error
++
++ENTRY(spurious_interrupt_bug)
++	zeroentry do_spurious_interrupt_bug
++
++#ifdef CONFIG_X86_MCE
++	/* runs on exception stack */
++ENTRY(machine_check)
++	INTR_FRAME
++	pushq $0
++	CFI_ADJUST_CFA_OFFSET 8	
++	paranoidentry do_machine_check
++	jmp paranoid_exit
++	CFI_ENDPROC
++#endif
++
++ENTRY(call_softirq)
++	CFI_STARTPROC
++	movq %gs:pda_irqstackptr,%rax
++	movq %rsp,%rdx
++	CFI_DEF_CFA_REGISTER	rdx
++	incl %gs:pda_irqcount
++	cmove %rax,%rsp
++	pushq %rdx
++	/*todo CFI_DEF_CFA_EXPRESSION ...*/
++	call __do_softirq
++	popq %rsp
++	CFI_DEF_CFA_REGISTER	rsp
++	decl %gs:pda_irqcount
++	ret
++	CFI_ENDPROC
+diff --git a/arch/x86_64/kernel/genapic-xen.c b/arch/x86_64/kernel/genapic-xen.c
+new file mode 100644
+index 0000000..0af6bc3
+--- /dev/null
++++ b/arch/x86_64/kernel/genapic-xen.c
+@@ -0,0 +1,135 @@
++/*
++ * Copyright 2004 James Cleverdon, IBM.
++ * Subject to the GNU Public License, v.2
++ *
++ * Generic APIC sub-arch probe layer.
++ *
++ * Hacked for x86-64 by James Cleverdon from i386 architecture code by
++ * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
++ * James Cleverdon.
++ */
++#include <linux/config.h>
++#include <linux/threads.h>
++#include <linux/cpumask.h>
++#include <linux/string.h>
++#include <linux/kernel.h>
++#include <linux/ctype.h>
++#include <linux/init.h>
++#include <linux/module.h>
++
++#include <asm/smp.h>
++#include <asm/ipi.h>
++
++#if defined(CONFIG_ACPI)
++#include <acpi/acpi_bus.h>
++#endif
++
++/* which logical CPU number maps to which CPU (physical APIC ID) */
++u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
++EXPORT_SYMBOL(x86_cpu_to_apicid);
++u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
++
++#ifndef CONFIG_XEN
++extern struct genapic apic_cluster;
++extern struct genapic apic_flat;
++extern struct genapic apic_physflat;
++struct genapic *genapic = &apic_flat;
++#else
++extern struct genapic apic_xen;
++struct genapic *genapic = &apic_xen;
++#endif
++
++
++/*
++ * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
++ */
++void __init clustered_apic_check(void)
++{
++#ifndef CONFIG_XEN
++	long i;
++	u8 clusters, max_cluster;
++	u8 id;
++	u8 cluster_cnt[NUM_APIC_CLUSTERS];
++	int max_apic = 0;
++
++#if defined(CONFIG_ACPI)
++	/*
++	 * Some x86_64 machines use physical APIC mode regardless of how many
++	 * procs/clusters are present (x86_64 ES7000 is an example).
++	 */
++	if (acpi_fadt.revision > FADT2_REVISION_ID)
++		if (acpi_fadt.force_apic_physical_destination_mode) {
++			genapic = &apic_cluster;
++			goto print;
++		}
++#endif
++
++	memset(cluster_cnt, 0, sizeof(cluster_cnt));
++	for (i = 0; i < NR_CPUS; i++) {
++		id = bios_cpu_apicid[i];
++		if (id == BAD_APICID)
++			continue;
++		if (id > max_apic)
++			max_apic = id;
++		cluster_cnt[APIC_CLUSTERID(id)]++;
++	}
 +
-+KPROBE_ENTRY(general_protection)
-+	errorentry do_general_protection
-+	.previous .text
++	/* Don't use clustered mode on AMD platforms. */
++ 	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
++		genapic = &apic_physflat;
++#ifndef CONFIG_HOTPLUG_CPU
++		/* In the CPU hotplug case we cannot use broadcast mode
++		   because that opens a race when a CPU is removed.
++		   Stay at physflat mode in this case.
++		   It is bad to do this unconditionally though. Once
++		   we have ACPI platform support for CPU hotplug
++		   we should detect hotplug capablity from ACPI tables and
++		   only do this when really needed. -AK */
++		if (max_apic <= 8)
++			genapic = &apic_flat;
++#endif
++ 		goto print;
++ 	}
 +
-+ENTRY(alignment_check)
-+	errorentry do_alignment_check
++	clusters = 0;
++	max_cluster = 0;
 +
-+ENTRY(divide_error)
-+	zeroentry do_divide_error
++	for (i = 0; i < NUM_APIC_CLUSTERS; i++) {
++		if (cluster_cnt[i] > 0) {
++			++clusters;
++			if (cluster_cnt[i] > max_cluster)
++				max_cluster = cluster_cnt[i];
++		}
++	}
 +
-+ENTRY(spurious_interrupt_bug)
-+	zeroentry do_spurious_interrupt_bug
++	/*
++	 * If we have clusters <= 1 and CPUs <= 8 in cluster 0, then flat mode,
++	 * else if max_cluster <= 4 and cluster_cnt[15] == 0, clustered logical
++	 * else physical mode.
++	 * (We don't use lowest priority delivery + HW APIC IRQ steering, so
++	 * can ignore the clustered logical case and go straight to physical.)
++	 */
++	if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster) {
++#ifdef CONFIG_HOTPLUG_CPU
++		/* Don't use APIC shortcuts in CPU hotplug to avoid races */
++		genapic = &apic_physflat;
++#else
++		genapic = &apic_flat;
++#endif
++	} else
++		genapic = &apic_cluster;
 +
-+#ifdef CONFIG_X86_MCE
-+	/* runs on exception stack */
-+ENTRY(machine_check)
-+	INTR_FRAME
-+	pushq $0
-+	CFI_ADJUST_CFA_OFFSET 8	
-+	paranoidentry do_machine_check
-+	jmp paranoid_exit
-+	CFI_ENDPROC
++print:
++#else
++	/* hardcode to xen apic functions */
++	genapic = &apic_xen;
 +#endif
++	printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name);
++}
 +
-+ENTRY(call_softirq)
-+	CFI_STARTPROC
-+	movq %gs:pda_irqstackptr,%rax
-+	movq %rsp,%rdx
-+	CFI_DEF_CFA_REGISTER	rdx
-+	incl %gs:pda_irqcount
-+	cmove %rax,%rsp
-+	pushq %rdx
-+	/*todo CFI_DEF_CFA_EXPRESSION ...*/
-+	call __do_softirq
-+	popq %rsp
-+	CFI_DEF_CFA_REGISTER	rsp
-+	decl %gs:pda_irqcount
-+	ret
-+	CFI_ENDPROC
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/genapic_xen.c linux-2.6-merge.hg/arch/x86_64/kernel/genapic_xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/genapic_xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/genapic_xen.c	2006-02-11 17:24:57.000000000 +0000
++/* Same for both flat and clustered. */
++
++void send_IPI_self(int vector)
++{
++	__send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
++}
+diff --git a/arch/x86_64/kernel/genapic_xen.c b/arch/x86_64/kernel/genapic_xen.c
+new file mode 100644
+index 0000000..b7a0d86
+--- /dev/null
++++ b/arch/x86_64/kernel/genapic_xen.c
 @@ -0,0 +1,162 @@
 +/*
 + * Copyright 2004 James Cleverdon, IBM.
@@ -24164,148 +29232,173 @@
 +	.cpu_mask_to_apicid = xen_cpu_mask_to_apicid,
 +	.phys_pkg_id = phys_pkg_id,
 +};
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/genapic-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/genapic-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/genapic-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/genapic-xen.c	2006-02-11 17:24:57.000000000 +0000
-@@ -0,0 +1,135 @@
+diff --git a/arch/x86_64/kernel/head-xen.S b/arch/x86_64/kernel/head-xen.S
+new file mode 100644
+index 0000000..1f3e07b
+--- /dev/null
++++ b/arch/x86_64/kernel/head-xen.S
+@@ -0,0 +1,156 @@
 +/*
-+ * Copyright 2004 James Cleverdon, IBM.
-+ * Subject to the GNU Public License, v.2
++ *  linux/arch/x86_64/kernel/head.S -- start in 32bit and switch to 64bit
 + *
-+ * Generic APIC sub-arch probe layer.
++ *  Copyright (C) 2000 Andrea Arcangeli <andrea at suse.de> SuSE
++ *  Copyright (C) 2000 Pavel Machek <pavel at suse.cz>
++ *  Copyright (C) 2000 Karsten Keil <kkeil at suse.de>
++ *  Copyright (C) 2001,2002 Andi Kleen <ak at suse.de>
 + *
-+ * Hacked for x86-64 by James Cleverdon from i386 architecture code by
-+ * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
-+ * James Cleverdon.
++ *  $Id: head.S,v 1.49 2002/03/19 17:39:25 ak Exp $
++ *
++ *  Jun Nakajima <jun.nakajima at intel.com>
++ *    Modified for Xen                                
 + */
-+#include <linux/config.h>
++
++
++#include <linux/linkage.h>
 +#include <linux/threads.h>
-+#include <linux/cpumask.h>
-+#include <linux/string.h>
-+#include <linux/kernel.h>
-+#include <linux/ctype.h>
 +#include <linux/init.h>
-+#include <linux/module.h>
++#include <asm/desc.h>
++#include <asm/segment.h>
++#include <asm/page.h>
++#include <asm/msr.h>
++#include <asm/cache.h>
 +
-+#include <asm/smp.h>
-+#include <asm/ipi.h>
++	.text
++	.code64
++	.globl startup_64
++startup_64:
++ENTRY(_start)
++	movq $(init_thread_union+THREAD_SIZE-8),%rsp
++	/* zero EFLAGS after setting rsp */
++	pushq $0
++	popfq
 +
-+#if defined(CONFIG_ACPI)
-+#include <acpi/acpi_bus.h>
-+#endif
++	/* rsi is pointer to startup info structure.
++	   pass it to C */
++	movq %rsi,%rdi
++	jmp x86_64_start_kernel
 +
-+/* which logical CPU number maps to which CPU (physical APIC ID) */
-+u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
-+EXPORT_SYMBOL(x86_cpu_to_apicid);
-+u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
++ENTRY(stext)
++ENTRY(_stext)
 +
-+#ifndef CONFIG_XEN
-+extern struct genapic apic_cluster;
-+extern struct genapic apic_flat;
-+extern struct genapic apic_physflat;
-+struct genapic *genapic = &apic_flat;
-+#else
-+extern struct genapic apic_xen;
-+struct genapic *genapic = &apic_xen;
-+#endif
++	$page = 0
++#define NEXT_PAGE(name) \
++	$page = $page + 1; \
++	.org $page * 0x1000; \
++	phys_/**/name = $page * 0x1000 + __PHYSICAL_START; \
++ENTRY(name)
 +
++NEXT_PAGE(init_level4_pgt)
++	/* This gets initialized in x86_64_start_kernel */
++	.fill	512,8,0
 +
-+/*
-+ * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
-+ */
-+void __init clustered_apic_check(void)
-+{
-+#ifndef CONFIG_XEN
-+	long i;
-+	u8 clusters, max_cluster;
-+	u8 id;
-+	u8 cluster_cnt[NUM_APIC_CLUSTERS];
-+	int max_apic = 0;
++        /*
++         * We update two pgd entries to make kernel and user pgd consistent
++         * at pgd_populate(). It can be used for kernel modules. So we place 
++         * this page here for those cases to avoid memory corruption.
++         * We also use this page to establish the initiali mapping for
++         * vsyscall area.
++         */
++NEXT_PAGE(init_level4_user_pgt)
++	.fill	512,8,0
 +
-+#if defined(CONFIG_ACPI)
-+	/*
-+	 * Some x86_64 machines use physical APIC mode regardless of how many
-+	 * procs/clusters are present (x86_64 ES7000 is an example).
-+	 */
-+	if (acpi_fadt.revision > FADT2_REVISION_ID)
-+		if (acpi_fadt.force_apic_physical_destination_mode) {
-+			genapic = &apic_cluster;
-+			goto print;
-+		}
-+#endif
++NEXT_PAGE(level3_kernel_pgt)
++	.fill	512,8,0
 +
-+	memset(cluster_cnt, 0, sizeof(cluster_cnt));
-+	for (i = 0; i < NR_CPUS; i++) {
-+		id = bios_cpu_apicid[i];
-+		if (id == BAD_APICID)
-+			continue;
-+		if (id > max_apic)
-+			max_apic = id;
-+		cluster_cnt[APIC_CLUSTERID(id)]++;
-+	}
++        /*
++         * This is used for vsyscall area mapping as we have a different
++         * level4 page table for user.
++         */
++NEXT_PAGE(level3_user_pgt)
++        .fill	512,8,0
 +
-+	/* Don't use clustered mode on AMD platforms. */
-+ 	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
-+		genapic = &apic_physflat;
-+#ifndef CONFIG_HOTPLUG_CPU
-+		/* In the CPU hotplug case we cannot use broadcast mode
-+		   because that opens a race when a CPU is removed.
-+		   Stay at physflat mode in this case.
-+		   It is bad to do this unconditionally though. Once
-+		   we have ACPI platform support for CPU hotplug
-+		   we should detect hotplug capablity from ACPI tables and
-+		   only do this when really needed. -AK */
-+		if (max_apic <= 8)
-+			genapic = &apic_flat;
-+#endif
-+ 		goto print;
-+ 	}
++NEXT_PAGE(level2_kernel_pgt)
++	.fill	512,8,0
 +
-+	clusters = 0;
-+	max_cluster = 0;
++NEXT_PAGE(empty_zero_page)
++	.skip PAGE_SIZE
 +
-+	for (i = 0; i < NUM_APIC_CLUSTERS; i++) {
-+		if (cluster_cnt[i] > 0) {
-+			++clusters;
-+			if (cluster_cnt[i] > max_cluster)
-+				max_cluster = cluster_cnt[i];
-+		}
-+	}
++NEXT_PAGE(hypercall_page)
++	.fill	512,8,0
 +
-+	/*
-+	 * If we have clusters <= 1 and CPUs <= 8 in cluster 0, then flat mode,
-+	 * else if max_cluster <= 4 and cluster_cnt[15] == 0, clustered logical
-+	 * else physical mode.
-+	 * (We don't use lowest priority delivery + HW APIC IRQ steering, so
-+	 * can ignore the clustered logical case and go straight to physical.)
-+	 */
-+	if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster) {
-+#ifdef CONFIG_HOTPLUG_CPU
-+		/* Don't use APIC shortcuts in CPU hotplug to avoid races */
-+		genapic = &apic_physflat;
-+#else
-+		genapic = &apic_flat;
-+#endif
-+	} else
-+		genapic = &apic_cluster;
++#undef NEXT_PAGE
 +
-+print:
-+#else
-+	/* hardcode to xen apic functions */
-+	genapic = &apic_xen;
++	.data
++
++	.align 16
++	.globl cpu_gdt_descr
++cpu_gdt_descr:
++	.word	gdt_end-cpu_gdt_table
++gdt:
++	.quad	cpu_gdt_table
++#ifdef CONFIG_SMP
++	.rept	NR_CPUS-1
++	.word	0
++	.quad	0
++	.endr
 +#endif
-+	printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name);
-+}
 +
-+/* Same for both flat and clustered. */
++/* We need valid kernel segments for data and code in long mode too
++ * IRET will check the segment types  kkeil 2000/10/28
++ * Also sysret mandates a special GDT layout 
++ */
++		 		
++	.section .data.page_aligned, "aw"
++	.align PAGE_SIZE
 +
-+void send_IPI_self(int vector)
-+{
-+	__send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
-+}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/head64-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/head64-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/head64-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/head64-xen.c	2006-02-21 16:06:09.000000000 +0000
++/* The TLS descriptors are currently at a different place compared to i386.
++   Hopefully nobody expects them at a fixed place (Wine?) */
++
++ENTRY(cpu_gdt_table)
++	.quad	0x0000000000000000	/* NULL descriptor */
++	.quad	0x0			/* unused */
++	.quad	0x00af9a000000ffff	/* __KERNEL_CS */
++	.quad	0x00cf92000000ffff	/* __KERNEL_DS */
++	.quad	0x00cffa000000ffff	/* __USER32_CS */
++	.quad	0x00cff2000000ffff	/* __USER_DS, __USER32_DS  */
++	.quad	0x00affa000000ffff	/* __USER_CS */
++	.quad	0x00cf9a000000ffff	/* __KERNEL32_CS */
++	.quad	0,0			/* TSS */
++	.quad	0,0			/* LDT */
++	.quad   0,0,0			/* three TLS descriptors */
++	.quad	0			/* unused */
++gdt_end:
++	/* asm/segment.h:GDT_ENTRIES must match this */
++	/* This should be a multiple of the cache line size */
++	/* GDTs of other CPUs are now dynamically allocated */
++
++	/* zero the remaining page */
++	.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
++
++/*
++ * __xen_guest information
++ */
++.macro utoh value
++ .if (\value) < 0 || (\value) >= 0x10
++	utoh (((\value)>>4)&0x0fffffffffffffff)
++ .endif
++ .if ((\value) & 0xf) < 10
++  .byte '0' + ((\value) & 0xf)
++ .else
++  .byte 'A' + ((\value) & 0xf) - 10
++ .endif
++.endm
++
++.section __xen_guest
++	.ascii	"GUEST_OS=linux,GUEST_VER=2.6"
++	.ascii	",XEN_VER=xen-3.0"
++	.ascii	",VIRT_BASE=0x"; utoh __START_KERNEL_map
++	.ascii	",HYPERCALL_PAGE=0x"; utoh (phys_hypercall_page >> PAGE_SHIFT)
++	.ascii  ",FEATURES=writable_page_tables"
++	.ascii		 "|writable_descriptor_tables"
++	.ascii		 "|auto_translated_physmap"
++	.ascii	         "|supervisor_mode_kernel"
++	.ascii	",LOADER=generic"
++	.byte	0
+diff --git a/arch/x86_64/kernel/head64-xen.c b/arch/x86_64/kernel/head64-xen.c
+new file mode 100644
+index 0000000..77176d0
+--- /dev/null
++++ b/arch/x86_64/kernel/head64-xen.c
 @@ -0,0 +1,140 @@
 +/*
 + *  linux/arch/x86_64/kernel/head64.c -- prepare to run common code
@@ -24402,215 +29495,56 @@
 +}
 +
 +void __init x86_64_start_kernel(char * real_mode_data)
-+{
-+	char *s;
-+	int i;
-+
-+	xen_start_info = (struct start_info *)real_mode_data;
-+	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
-+		phys_to_machine_mapping =
-+			(unsigned long *)xen_start_info->mfn_list;
-+		start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) +
-+			xen_start_info->nr_pt_frames;
-+	}
-+
-+#if 0
-+	for (i = 0; i < 256; i++)
-+		set_intr_gate(i, early_idt_handler);
-+	asm volatile("lidt %0" :: "m" (idt_descr));
-+#endif
-+
-+ 	for (i = 0; i < NR_CPUS; i++)
-+ 		cpu_pda(i) = &boot_cpu_pda[i];
-+
-+	pda_init(0);
-+	copy_bootdata(real_mode_data);
-+#ifdef CONFIG_SMP
-+	cpu_set(0, cpu_online_map);
-+#endif
-+	s = strstr(saved_command_line, "earlyprintk=");
-+	if (s != NULL)
-+		setup_early_printk(strchr(s, '=') + 1);
-+#ifdef CONFIG_NUMA
-+	s = strstr(saved_command_line, "numa=");
-+	if (s != NULL)
-+		numa_setup(s+5);
-+#endif
-+#ifdef CONFIG_X86_IO_APIC
-+	if (strstr(saved_command_line, "disableapic"))
-+		disable_apic = 1;
-+#endif
-+	/* You need early console to see that */
-+	if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE)
-+		panic("Kernel too big for kernel mapping\n");
-+
-+	setup_boot_cpu_data();
-+	start_kernel();
-+}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/head-xen.S linux-2.6-merge.hg/arch/x86_64/kernel/head-xen.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/head-xen.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/head-xen.S	2006-02-27 15:49:40.000000000 +0000
-@@ -0,0 +1,156 @@
-+/*
-+ *  linux/arch/x86_64/kernel/head.S -- start in 32bit and switch to 64bit
-+ *
-+ *  Copyright (C) 2000 Andrea Arcangeli <andrea at suse.de> SuSE
-+ *  Copyright (C) 2000 Pavel Machek <pavel at suse.cz>
-+ *  Copyright (C) 2000 Karsten Keil <kkeil at suse.de>
-+ *  Copyright (C) 2001,2002 Andi Kleen <ak at suse.de>
-+ *
-+ *  $Id: head.S,v 1.49 2002/03/19 17:39:25 ak Exp $
-+ *
-+ *  Jun Nakajima <jun.nakajima at intel.com>
-+ *    Modified for Xen                                
-+ */
-+
-+
-+#include <linux/linkage.h>
-+#include <linux/threads.h>
-+#include <linux/init.h>
-+#include <asm/desc.h>
-+#include <asm/segment.h>
-+#include <asm/page.h>
-+#include <asm/msr.h>
-+#include <asm/cache.h>
-+
-+	.text
-+	.code64
-+	.globl startup_64
-+startup_64:
-+ENTRY(_start)
-+	movq $(init_thread_union+THREAD_SIZE-8),%rsp
-+	/* zero EFLAGS after setting rsp */
-+	pushq $0
-+	popfq
-+
-+	/* rsi is pointer to startup info structure.
-+	   pass it to C */
-+	movq %rsi,%rdi
-+	jmp x86_64_start_kernel
-+
-+ENTRY(stext)
-+ENTRY(_stext)
-+
-+	$page = 0
-+#define NEXT_PAGE(name) \
-+	$page = $page + 1; \
-+	.org $page * 0x1000; \
-+	phys_/**/name = $page * 0x1000 + __PHYSICAL_START; \
-+ENTRY(name)
-+
-+NEXT_PAGE(init_level4_pgt)
-+	/* This gets initialized in x86_64_start_kernel */
-+	.fill	512,8,0
-+
-+        /*
-+         * We update two pgd entries to make kernel and user pgd consistent
-+         * at pgd_populate(). It can be used for kernel modules. So we place 
-+         * this page here for those cases to avoid memory corruption.
-+         * We also use this page to establish the initiali mapping for
-+         * vsyscall area.
-+         */
-+NEXT_PAGE(init_level4_user_pgt)
-+	.fill	512,8,0
-+
-+NEXT_PAGE(level3_kernel_pgt)
-+	.fill	512,8,0
-+
-+        /*
-+         * This is used for vsyscall area mapping as we have a different
-+         * level4 page table for user.
-+         */
-+NEXT_PAGE(level3_user_pgt)
-+        .fill	512,8,0
-+
-+NEXT_PAGE(level2_kernel_pgt)
-+	.fill	512,8,0
-+
-+NEXT_PAGE(empty_zero_page)
-+	.skip PAGE_SIZE
-+
-+NEXT_PAGE(hypercall_page)
-+	.fill	512,8,0
-+
-+#undef NEXT_PAGE
-+
-+	.data
-+
-+	.align 16
-+	.globl cpu_gdt_descr
-+cpu_gdt_descr:
-+	.word	gdt_end-cpu_gdt_table
-+gdt:
-+	.quad	cpu_gdt_table
-+#ifdef CONFIG_SMP
-+	.rept	NR_CPUS-1
-+	.word	0
-+	.quad	0
-+	.endr
-+#endif
-+
-+/* We need valid kernel segments for data and code in long mode too
-+ * IRET will check the segment types  kkeil 2000/10/28
-+ * Also sysret mandates a special GDT layout 
-+ */
-+		 		
-+	.section .data.page_aligned, "aw"
-+	.align PAGE_SIZE
++{
++	char *s;
++	int i;
 +
-+/* The TLS descriptors are currently at a different place compared to i386.
-+   Hopefully nobody expects them at a fixed place (Wine?) */
++	xen_start_info = (struct start_info *)real_mode_data;
++	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
++		phys_to_machine_mapping =
++			(unsigned long *)xen_start_info->mfn_list;
++		start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) +
++			xen_start_info->nr_pt_frames;
++	}
 +
-+ENTRY(cpu_gdt_table)
-+	.quad	0x0000000000000000	/* NULL descriptor */
-+	.quad	0x0			/* unused */
-+	.quad	0x00af9a000000ffff	/* __KERNEL_CS */
-+	.quad	0x00cf92000000ffff	/* __KERNEL_DS */
-+	.quad	0x00cffa000000ffff	/* __USER32_CS */
-+	.quad	0x00cff2000000ffff	/* __USER_DS, __USER32_DS  */
-+	.quad	0x00affa000000ffff	/* __USER_CS */
-+	.quad	0x00cf9a000000ffff	/* __KERNEL32_CS */
-+	.quad	0,0			/* TSS */
-+	.quad	0,0			/* LDT */
-+	.quad   0,0,0			/* three TLS descriptors */
-+	.quad	0			/* unused */
-+gdt_end:
-+	/* asm/segment.h:GDT_ENTRIES must match this */
-+	/* This should be a multiple of the cache line size */
-+	/* GDTs of other CPUs are now dynamically allocated */
++#if 0
++	for (i = 0; i < 256; i++)
++		set_intr_gate(i, early_idt_handler);
++	asm volatile("lidt %0" :: "m" (idt_descr));
++#endif
 +
-+	/* zero the remaining page */
-+	.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
++ 	for (i = 0; i < NR_CPUS; i++)
++ 		cpu_pda(i) = &boot_cpu_pda[i];
 +
-+/*
-+ * __xen_guest information
-+ */
-+.macro utoh value
-+ .if (\value) < 0 || (\value) >= 0x10
-+	utoh (((\value)>>4)&0x0fffffffffffffff)
-+ .endif
-+ .if ((\value) & 0xf) < 10
-+  .byte '0' + ((\value) & 0xf)
-+ .else
-+  .byte 'A' + ((\value) & 0xf) - 10
-+ .endif
-+.endm
++	pda_init(0);
++	copy_bootdata(real_mode_data);
++#ifdef CONFIG_SMP
++	cpu_set(0, cpu_online_map);
++#endif
++	s = strstr(saved_command_line, "earlyprintk=");
++	if (s != NULL)
++		setup_early_printk(strchr(s, '=') + 1);
++#ifdef CONFIG_NUMA
++	s = strstr(saved_command_line, "numa=");
++	if (s != NULL)
++		numa_setup(s+5);
++#endif
++#ifdef CONFIG_X86_IO_APIC
++	if (strstr(saved_command_line, "disableapic"))
++		disable_apic = 1;
++#endif
++	/* You need early console to see that */
++	if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE)
++		panic("Kernel too big for kernel mapping\n");
 +
-+.section __xen_guest
-+	.ascii	"GUEST_OS=linux,GUEST_VER=2.6"
-+	.ascii	",XEN_VER=xen-3.0"
-+	.ascii	",VIRT_BASE=0x"; utoh __START_KERNEL_map
-+	.ascii	",HYPERCALL_PAGE=0x"; utoh (phys_hypercall_page >> PAGE_SHIFT)
-+	.ascii  ",FEATURES=writable_page_tables"
-+	.ascii		 "|writable_descriptor_tables"
-+	.ascii		 "|auto_translated_physmap"
-+	.ascii	         "|supervisor_mode_kernel"
-+	.ascii	",LOADER=generic"
-+	.byte	0
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/i387.c linux-2.6-merge.hg/arch/x86_64/kernel/i387.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/i387.c	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/i387.c	2006-02-11 17:24:57.000000000 +0000
-@@ -44,7 +44,6 @@
++	setup_boot_cpu_data();
++	start_kernel();
++}
+diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c
+index a5d7e16..724f7b8 100644
+--- a/arch/x86_64/kernel/i387.c
++++ b/arch/x86_64/kernel/i387.c
+@@ -44,7 +44,6 @@ void mxcsr_feature_mask_init(void)
   */
  void __cpuinit fpu_init(void)
  {
@@ -24618,7 +29552,7 @@
  	extern void __bad_fxsave_alignment(void);
  		
  	if (offsetof(struct task_struct, thread.i387.fxsave) & 15)
-@@ -52,7 +51,9 @@
+@@ -52,7 +51,9 @@ void __cpuinit fpu_init(void)
  	set_in_cr4(X86_CR4_OSFXSR);
  	set_in_cr4(X86_CR4_OSXMMEXCPT);
  
@@ -24629,10 +29563,11 @@
  
  	mxcsr_feature_mask_init();
  	/* clean state in init */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/init_task.c linux-2.6-merge.hg/arch/x86_64/kernel/init_task.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/init_task.c	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/init_task.c	2006-02-21 16:06:09.000000000 +0000
-@@ -37,6 +37,8 @@
+diff --git a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c
+index ce31d90..9c141e1 100644
+--- a/arch/x86_64/kernel/init_task.c
++++ b/arch/x86_64/kernel/init_task.c
+@@ -37,6 +37,8 @@ union thread_union init_thread_union 
  struct task_struct init_task = INIT_TASK(init_task);
  
  EXPORT_SYMBOL(init_task);
@@ -24641,16 +29576,18 @@
  /*
   * per-CPU TSS segments. Threads are completely 'soft' on Linux,
   * no more per-task TSS's. The TSS size is kept cacheline-aligned
-@@ -45,5 +47,6 @@
+@@ -45,5 +47,6 @@ EXPORT_SYMBOL(init_task);
   * on exact cacheline boundaries, to eliminate cacheline ping-pong.
   */ 
  DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
 +#endif
  
  #define ALIGN_TO_4K __attribute__((section(".data.init_task")))
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/io_apic-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/io_apic-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/io_apic-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/io_apic-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/kernel/io_apic-xen.c b/arch/x86_64/kernel/io_apic-xen.c
+new file mode 100644
+index 0000000..fd72947
+--- /dev/null
++++ b/arch/x86_64/kernel/io_apic-xen.c
 @@ -0,0 +1,2231 @@
 +/*
 + *	Intel IO-APIC support for multi-Pentium hosts.
@@ -24762,8 +29699,8 @@
 +	int ret;
 +
 +	op.cmd = PHYSDEVOP_APIC_READ;
-+	op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid;
-+	op.u.apic_op.offset = reg;
++	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
++	op.u.apic_op.reg = reg;
 +	ret = HYPERVISOR_physdev_op(&op);
 +	if (ret)
 +		return ret;
@@ -24775,8 +29712,8 @@
 +	physdev_op_t op;
 +
 +	op.cmd = PHYSDEVOP_APIC_WRITE;
-+	op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid;
-+	op.u.apic_op.offset = reg;
++	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
++	op.u.apic_op.reg = reg;
 +	op.u.apic_op.value = value;
 +	HYPERVISOR_physdev_op(&op);
 +}
@@ -26883,9 +31820,11 @@
 +}
 +#endif
 +#endif /* !CONFIG_XEN */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/ioport-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/ioport-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/ioport-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/ioport-xen.c	2006-02-11 17:24:57.000000000 +0000
+diff --git a/arch/x86_64/kernel/ioport-xen.c b/arch/x86_64/kernel/ioport-xen.c
+new file mode 100644
+index 0000000..1b628df
+--- /dev/null
++++ b/arch/x86_64/kernel/ioport-xen.c
 @@ -0,0 +1,58 @@
 +/*
 + *	linux/arch/x86_64/kernel/ioport.c
@@ -26945,9 +31884,11 @@
 +{
 +  return turn_on ? sys_iopl(3, NULL) : 0;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/irq-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/irq-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/irq-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/irq-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/kernel/irq-xen.c b/arch/x86_64/kernel/irq-xen.c
+new file mode 100644
+index 0000000..c64715d
+--- /dev/null
++++ b/arch/x86_64/kernel/irq-xen.c
 @@ -0,0 +1,168 @@
 +/*
 + *	linux/arch/x86_64/kernel/irq.c
@@ -27117,9 +32058,11 @@
 +        printk("unexpected IRQ trap at vector %02x\n", irq);
 +}
 +#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/ldt-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/ldt-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/ldt-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/ldt-xen.c	2006-02-11 17:24:57.000000000 +0000
+diff --git a/arch/x86_64/kernel/ldt-xen.c b/arch/x86_64/kernel/ldt-xen.c
+new file mode 100644
+index 0000000..6efbb64
+--- /dev/null
++++ b/arch/x86_64/kernel/ldt-xen.c
 @@ -0,0 +1,282 @@
 +/*
 + * linux/arch/x86_64/kernel/ldt.c
@@ -27403,45 +32346,11 @@
 +	}
 +	return ret;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/Makefile linux-2.6-merge.hg/arch/x86_64/kernel/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/Makefile	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/Makefile	2006-02-27 15:49:40.000000000 +0000
-@@ -20,11 +20,13 @@
- obj-$(CONFIG_X86_CPUID)		+= cpuid.o
- obj-$(CONFIG_SMP)		+= smp.o smpboot.o trampoline.o
- obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o  nmi.o
-+obj-$(CONFIG_X86_XEN_GENAPIC)	+= genapic.o genapic_xen.o
- obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o mpparse.o \
- 		genapic.o genapic_cluster.o genapic_flat.o
- obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
- obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
--obj-$(CONFIG_PM)		+= suspend.o
-+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o
-+obj-$(CONFIG_ACPI_SLEEP)	+= suspend.o
- obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
- obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
- obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
-@@ -51,3 +53,17 @@
- msr-$(subst m,y,$(CONFIG_X86_MSR))  += ../../i386/kernel/msr.o
- dmi_scan-y			+= ../../i386/kernel/dmi_scan.o
- 
-+ifdef CONFIG_XEN
-+time-y				+= ../../i386/kernel/time-xen.o
-+pci-dma-y			+= ../../i386/kernel/pci-dma-xen.o
-+microcode-$(subst m,y,$(CONFIG_MICROCODE))  := ../../i386/kernel/microcode-xen.o
-+quirks-y			:= ../../i386/kernel/quirks-xen.o
-+
-+n-obj-xen := i8259.o reboot.o i8237.o smpboot.o trampoline.o genapic_cluster.o genapic_flat.o
-+
-+include $(srctree)/scripts/Makefile.xen
-+
-+obj-y := $(call filterxen, $(obj-y), $(n-obj-xen))
-+obj-y := $(call cherrypickxen, $(obj-y))
-+extra-y := $(call cherrypickxen, $(extra-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/mpparse-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/mpparse-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/mpparse-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/mpparse-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/kernel/mpparse-xen.c b/arch/x86_64/kernel/mpparse-xen.c
+new file mode 100644
+index 0000000..a5f7437
+--- /dev/null
++++ b/arch/x86_64/kernel/mpparse-xen.c
 @@ -0,0 +1,1005 @@
 +/*
 + *	Intel Multiprocessor Specification 1.1 and 1.4
@@ -28448,10 +33357,11 @@
 +
 +#endif /*CONFIG_X86_IO_APIC*/
 +#endif /*CONFIG_ACPI*/
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/pci-gart.c linux-2.6-merge.hg/arch/x86_64/kernel/pci-gart.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/pci-gart.c	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/pci-gart.c	2006-02-27 15:49:40.000000000 +0000
-@@ -274,7 +274,8 @@
+diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
+index 0c3f052..9f62301 100644
+--- a/arch/x86_64/kernel/pci-gart.c
++++ b/arch/x86_64/kernel/pci-gart.c
+@@ -274,7 +274,8 @@ static dma_addr_t gart_map_simple(struct
  }
  
  /* Map a single area into the IOMMU */
@@ -28461,7 +33371,7 @@
  {
  	unsigned long phys_mem, bus;
  
-@@ -392,7 +393,8 @@
+@@ -392,7 +393,8 @@ static inline int dma_map_cont(struct sc
   * DMA map all entries in a scatterlist.
   * Merge chunks that have page aligned sizes into a continuous mapping. 
   */
@@ -28471,7 +33381,7 @@
  {
  	int i;
  	int out;
-@@ -465,7 +467,7 @@
+@@ -465,7 +467,7 @@ error:
   * Free a DMA mapping.
   */ 
  void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
@@ -28480,9 +33390,11 @@
  {
  	unsigned long iommu_page; 
  	int npages;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/pci-swiotlb-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/pci-swiotlb-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/pci-swiotlb-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/pci-swiotlb-xen.c	2006-02-18 12:03:34.000000000 +0000
+diff --git a/arch/x86_64/kernel/pci-swiotlb-xen.c b/arch/x86_64/kernel/pci-swiotlb-xen.c
+new file mode 100644
+index 0000000..0a5a8d4
+--- /dev/null
++++ b/arch/x86_64/kernel/pci-swiotlb-xen.c
 @@ -0,0 +1,54 @@
 +/* Glue code to lib/swiotlb.c */
 +
@@ -28538,9 +33450,11 @@
 +	}
 +#endif
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/process-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/process-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/process-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/process-xen.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/x86_64/kernel/process-xen.c b/arch/x86_64/kernel/process-xen.c
+new file mode 100644
+index 0000000..4c40063
+--- /dev/null
++++ b/arch/x86_64/kernel/process-xen.c
 @@ -0,0 +1,803 @@
 +/*
 + *  linux/arch/x86-64/kernel/process.c
@@ -28668,9 +33582,9 @@
 +{
 +	local_irq_disable();
 +
-+	if (need_resched()) {
++	if (need_resched())
 +		local_irq_enable();
-+	} else {
++	else {
 +		clear_thread_flag(TIF_POLLING_NRFLAG);
 +		smp_mb__after_clear_bit();
 +		stop_hz_timer();
@@ -29282,449 +34196,75 @@
 +		unsigned long base; 
 +		if (task->thread.fsindex == FS_TLS_SEL)
 +			base = read_32bit_tls(task, FS_TLS);
-+		else if (doit)
-+			rdmsrl(MSR_FS_BASE, base);
-+		else
-+			base = task->thread.fs;
-+		ret = put_user(base, (unsigned long __user *)addr); 
-+		break; 
-+	}
-+	case ARCH_GET_GS: { 
-+		unsigned long base;
-+		if (task->thread.gsindex == GS_TLS_SEL)
-+			base = read_32bit_tls(task, GS_TLS);
-+		else if (doit)
-+			rdmsrl(MSR_KERNEL_GS_BASE, base);
-+		else
-+			base = task->thread.gs;
-+		ret = put_user(base, (unsigned long __user *)addr); 
-+		break;
-+	}
-+
-+	default:
-+		ret = -EINVAL;
-+		break;
-+	} 
-+
-+	return ret;	
-+} 
-+
-+long sys_arch_prctl(int code, unsigned long addr)
-+{
-+	return do_arch_prctl(current, code, addr);
-+} 
-+
-+/* 
-+ * Capture the user space registers if the task is not running (in user space)
-+ */
-+int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
-+{
-+	struct pt_regs *pp, ptregs;
-+
-+	pp = task_pt_regs(tsk);
-+
-+	ptregs = *pp; 
-+	ptregs.cs &= 0xffff;
-+	ptregs.ss &= 0xffff;
-+
-+	elf_core_copy_regs(regs, &ptregs);
-+ 
-+        boot_option_idle_override = 1;
-+	return 1;
-+}
-+
-+unsigned long arch_align_stack(unsigned long sp)
-+{
-+	if (randomize_va_space)
-+		sp -= get_random_int() % 8192;
-+	return sp & ~0xf;
-+}
-+
-+#ifndef CONFIG_SMP
-+void _restore_vcpu(void)
-+{
-+}
-+#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/setup64.c linux-2.6-merge.hg/arch/x86_64/kernel/setup64.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/setup64.c	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/setup64.c	2006-02-11 17:24:58.000000000 +0000
-@@ -128,8 +128,10 @@
- 	pda->irqcount = -1;
- 	pda->kernelstack = 
- 		(unsigned long)stack_thread_info() - PDA_STACKOFFSET + THREAD_SIZE; 
-+#ifdef CONFIG_SMP
- 	pda->active_mm = &init_mm;
- 	pda->mmu_state = 0;
-+#endif
- 
- 	if (cpu == 0) {
- 		/* others are initialized in smpboot.c */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/setup64-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/setup64-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/setup64-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/setup64-xen.c	2006-02-21 16:06:09.000000000 +0000
-@@ -0,0 +1,358 @@
-+/* 
-+ * X86-64 specific CPU setup.
-+ * Copyright (C) 1995  Linus Torvalds
-+ * Copyright 2001, 2002, 2003 SuSE Labs / Andi Kleen.
-+ * See setup.c for older changelog.
-+ * $Id: setup64.c,v 1.12 2002/03/21 10:09:17 ak Exp $
-+ *
-+ * Jun Nakajima <jun.nakajima at intel.com> 
-+ *   Modified for Xen
-+ *
-+ */ 
-+#include <linux/config.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/sched.h>
-+#include <linux/string.h>
-+#include <linux/bootmem.h>
-+#include <linux/bitops.h>
-+#include <linux/module.h>
-+#include <asm/bootsetup.h>
-+#include <asm/pda.h>
-+#include <asm/pgtable.h>
-+#include <asm/processor.h>
-+#include <asm/desc.h>
-+#include <asm/atomic.h>
-+#include <asm/mmu_context.h>
-+#include <asm/smp.h>
-+#include <asm/i387.h>
-+#include <asm/percpu.h>
-+#include <asm/proto.h>
-+#include <asm/sections.h>
-+#ifdef CONFIG_XEN
-+#include <asm/hypervisor.h>
-+#endif
-+
-+cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
-+
-+struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
-+struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
-+
-+#ifndef CONFIG_X86_NO_IDT
-+struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
-+#endif
-+
-+char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
-+
-+unsigned long __supported_pte_mask __read_mostly = ~0UL;
-+static int do_not_nx __cpuinitdata = 0;
-+
-+/* noexec=on|off
-+Control non executable mappings for 64bit processes.
-+
-+on	Enable(default)
-+off	Disable
-+*/ 
-+int __init nonx_setup(char *str)
-+{
-+	if (!strncmp(str, "on", 2)) {
-+                __supported_pte_mask |= _PAGE_NX; 
-+ 		do_not_nx = 0; 
-+	} else if (!strncmp(str, "off", 3)) {
-+		do_not_nx = 1;
-+		__supported_pte_mask &= ~_PAGE_NX;
-+        }
-+	return 0;
-+} 
-+__setup("noexec=", nonx_setup);	/* parsed early actually */
-+
-+int force_personality32 = READ_IMPLIES_EXEC;
-+
-+/* noexec32=on|off
-+Control non executable heap for 32bit processes.
-+To control the stack too use noexec=off
-+
-+on	PROT_READ does not imply PROT_EXEC for 32bit processes
-+off	PROT_READ implies PROT_EXEC (default)
-+*/
-+static int __init nonx32_setup(char *str)
-+{
-+	if (!strcmp(str, "on"))
-+		force_personality32 &= ~READ_IMPLIES_EXEC;
-+	else if (!strcmp(str, "off"))
-+		force_personality32 |= READ_IMPLIES_EXEC;
-+	return 0;
-+}
-+__setup("noexec32=", nonx32_setup);
-+
-+/*
-+ * Great future plan:
-+ * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
-+ * Always point %gs to its beginning
-+ */
-+void __init setup_per_cpu_areas(void)
-+{ 
-+	int i;
-+	unsigned long size;
-+
-+#ifdef CONFIG_HOTPLUG_CPU
-+	prefill_possible_map();
-+#endif
-+
-+	/* Copy section for each CPU (we discard the original) */
-+	size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
-+#ifdef CONFIG_MODULES
-+	if (size < PERCPU_ENOUGH_ROOM)
-+		size = PERCPU_ENOUGH_ROOM;
-+#endif
-+
-+	for_each_cpu_mask (i, cpu_possible_map) {
-+		char *ptr;
-+
-+		if (!NODE_DATA(cpu_to_node(i))) {
-+			printk("cpu with no node %d, num_online_nodes %d\n",
-+			       i, num_online_nodes());
-+			ptr = alloc_bootmem(size);
-+		} else { 
-+			ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
-+		}
-+		if (!ptr)
-+			panic("Cannot allocate cpu data for CPU %d\n", i);
-+		cpu_pda(i)->data_offset = ptr - __per_cpu_start;
-+		memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
-+	}
-+} 
-+
-+#ifdef CONFIG_XEN
-+static void switch_pt(void)
-+{
-+	xen_pt_switch(__pa(init_level4_pgt));
-+        xen_new_user_pt(__pa(init_level4_user_pgt));
-+}
-+
-+void __cpuinit cpu_gdt_init(struct desc_ptr *gdt_descr)
-+{
-+	unsigned long frames[16];
-+	unsigned long va;
-+	int f;
-+
-+	for (va = gdt_descr->address, f = 0;
-+	     va < gdt_descr->address + gdt_descr->size;
-+	     va += PAGE_SIZE, f++) {
-+		frames[f] = virt_to_mfn(va);
-+		make_page_readonly(
-+			(void *)va, XENFEAT_writable_descriptor_tables);
-+	}
-+	if (HYPERVISOR_set_gdt(frames, gdt_descr->size /
-+                               sizeof (struct desc_struct)))
-+		BUG();
-+}
-+#else
-+static void switch_pt(void)
-+{
-+	asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt)));
-+}
-+
-+void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
-+{
-+	asm volatile("lgdt %0" :: "m" (*gdt_descr));
-+	asm volatile("lidt %0" :: "m" (idt_descr));
-+}
-+#endif
-+
-+void pda_init(int cpu)
-+{ 
-+	struct x8664_pda *pda = cpu_pda(cpu);
-+
-+	/* Setup up data that may be needed in __get_free_pages early */
-+	asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 
-+#ifndef CONFIG_XEN
-+	wrmsrl(MSR_GS_BASE, pda);
-+#else
-+	HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, (unsigned long)pda);
-+#endif
-+	pda->cpunumber = cpu; 
-+	pda->irqcount = -1;
-+	pda->kernelstack = 
-+		(unsigned long)stack_thread_info() - PDA_STACKOFFSET + THREAD_SIZE; 
-+
-+	if (cpu == 0) {
-+#ifdef CONFIG_XEN
-+		xen_init_pt();
-+#endif
-+		/* others are initialized in smpboot.c */
-+		pda->pcurrent = &init_task;
-+		pda->irqstackptr = boot_cpu_stack; 
-+	} else {
-+		pda->irqstackptr = (char *)
-+			__get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER);
-+		if (!pda->irqstackptr)
-+			panic("cannot allocate irqstack for cpu %d", cpu); 
-+	}
-+
-+	switch_pt();
-+
-+	pda->irqstackptr += IRQSTACKSIZE-64;
-+} 
-+
-+#ifndef CONFIG_X86_NO_TSS
-+char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]
-+__attribute__((section(".bss.page_aligned")));
-+#endif
-+
-+/* May not be marked __init: used by software suspend */
-+void syscall_init(void)
-+{
-+#ifndef CONFIG_XEN
-+	/* 
-+	 * LSTAR and STAR live in a bit strange symbiosis.
-+	 * They both write to the same internal register. STAR allows to set CS/DS
-+	 * but only a 32bit target. LSTAR sets the 64bit rip. 	 
-+	 */ 
-+	wrmsrl(MSR_STAR,  ((u64)__USER32_CS)<<48  | ((u64)__KERNEL_CS)<<32); 
-+	wrmsrl(MSR_LSTAR, system_call); 
-+
-+	/* Flags to clear on syscall */
-+	wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000); 
-+#endif
-+#ifdef CONFIG_IA32_EMULATION   		
-+	syscall32_cpu_init ();
-+#endif
-+}
-+
-+void __cpuinit check_efer(void)
-+{
-+	unsigned long efer;
-+
-+	rdmsrl(MSR_EFER, efer); 
-+        if (!(efer & EFER_NX) || do_not_nx) { 
-+                __supported_pte_mask &= ~_PAGE_NX; 
-+        }       
-+}
-+
-+/*
-+ * cpu_init() initializes state that is per-CPU. Some data is already
-+ * initialized (naturally) in the bootstrap process, such as the GDT
-+ * and IDT. We reload them nevertheless, this function acts as a
-+ * 'CPU state barrier', nothing should get across.
-+ * A lot of state is already set up in PDA init.
-+ */
-+void __cpuinit cpu_init (void)
-+{
-+	int cpu = stack_smp_processor_id();
-+#ifndef CONFIG_X86_NO_TSS
-+	struct tss_struct *t = &per_cpu(init_tss, cpu);
-+	unsigned long v; 
-+	char *estacks = NULL; 
-+	unsigned i;
-+#endif
-+	struct task_struct *me;
-+
-+	/* CPU 0 is initialised in head64.c */
-+	if (cpu != 0) {
-+		pda_init(cpu);
-+		zap_low_mappings(cpu);
-+	}
-+#ifndef CONFIG_X86_NO_TSS
-+	else
-+		estacks = boot_exception_stacks; 
-+#endif
-+
-+	me = current;
-+
-+	if (cpu_test_and_set(cpu, cpu_initialized))
-+		panic("CPU#%d already initialized!\n", cpu);
-+
-+	printk("Initializing CPU#%d\n", cpu);
-+
-+#ifndef CONFIG_XEN 
-+	clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
-+#endif
-+
-+	/*
-+	 * Initialize the per-CPU GDT with the boot GDT,
-+	 * and set up the GDT descriptor:
-+	 */
-+#ifndef CONFIG_XEN 
-+	if (cpu)
-+ 		memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
-+#endif
-+
-+	cpu_gdt_descr[cpu].size = GDT_SIZE;
-+	cpu_gdt_init(&cpu_gdt_descr[cpu]);
-+
-+	memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
-+	syscall_init();
-+
-+	wrmsrl(MSR_FS_BASE, 0);
-+	wrmsrl(MSR_KERNEL_GS_BASE, 0);
-+	barrier(); 
-+
-+	check_efer();
-+
-+#ifndef CONFIG_X86_NO_TSS
-+	/*
-+	 * set up and load the per-CPU TSS
-+	 */
-+	for (v = 0; v < N_EXCEPTION_STACKS; v++) {
-+		if (cpu) {
-+			static const unsigned int order[N_EXCEPTION_STACKS] = {
-+				[0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
-+				[DEBUG_STACK - 1] = DEBUG_STACK_ORDER
-+			};
-+
-+			estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
-+			if (!estacks)
-+				panic("Cannot allocate exception stack %ld %d\n",
-+				      v, cpu); 
-+		}
-+		switch (v + 1) {
-+#if DEBUG_STKSZ > EXCEPTION_STKSZ
-+		case DEBUG_STACK:
-+			cpu_pda[cpu].debugstack = (unsigned long)estacks;
-+			estacks += DEBUG_STKSZ;
-+			break;
-+#endif
-+		default:
-+			estacks += EXCEPTION_STKSZ;
-+			break;
-+		}
-+		t->ist[v] = (unsigned long)estacks;
++		else if (doit)
++			rdmsrl(MSR_FS_BASE, base);
++		else
++			base = task->thread.fs;
++		ret = put_user(base, (unsigned long __user *)addr); 
++		break; 
++	}
++	case ARCH_GET_GS: { 
++		unsigned long base;
++		if (task->thread.gsindex == GS_TLS_SEL)
++			base = read_32bit_tls(task, GS_TLS);
++		else if (doit)
++			rdmsrl(MSR_KERNEL_GS_BASE, base);
++		else
++			base = task->thread.gs;
++		ret = put_user(base, (unsigned long __user *)addr); 
++		break;
 +	}
 +
-+	t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
-+	/*
-+	 * <= is required because the CPU will access up to
-+	 * 8 bits beyond the end of the IO permission bitmap.
-+	 */
-+	for (i = 0; i <= IO_BITMAP_LONGS; i++)
-+		t->io_bitmap[i] = ~0UL;
-+#endif
++	default:
++		ret = -EINVAL;
++		break;
++	} 
 +
-+	atomic_inc(&init_mm.mm_count);
-+	me->active_mm = &init_mm;
-+	if (me->mm)
-+		BUG();
-+	enter_lazy_tlb(&init_mm, me);
++	return ret;	
++} 
 +
-+#ifndef CONFIG_X86_NO_TSS
-+	set_tss_desc(cpu, t);
-+#endif
-+#ifndef CONFIG_XEN
-+	load_TR_desc();
-+#endif
-+	load_LDT(&init_mm.context);
++long sys_arch_prctl(int code, unsigned long addr)
++{
++	return do_arch_prctl(current, code, addr);
++} 
 +
-+	/*
-+	 * Clear all 6 debug registers:
-+	 */
++/* 
++ * Capture the user space registers if the task is not running (in user space)
++ */
++int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
++{
++	struct pt_regs *pp, ptregs;
 +
-+	set_debug(0UL, 0);
-+	set_debug(0UL, 1);
-+	set_debug(0UL, 2);
-+	set_debug(0UL, 3);
-+	set_debug(0UL, 6);
-+	set_debug(0UL, 7);
++	pp = task_pt_regs(tsk);
 +
-+	fpu_init(); 
++	ptregs = *pp; 
++	ptregs.cs &= 0xffff;
++	ptregs.ss &= 0xffff;
++
++	elf_core_copy_regs(regs, &ptregs);
++ 
++        boot_option_idle_override = 1;
++	return 1;
++}
++
++unsigned long arch_align_stack(unsigned long sp)
++{
++	if (randomize_va_space)
++		sp -= get_random_int() % 8192;
++	return sp & ~0xf;
++}
++
++#ifndef CONFIG_SMP
++void _restore_vcpu(void)
++{
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/setup-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/setup-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/setup-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/setup-xen.c	2006-02-27 15:49:40.000000000 +0000
-@@ -0,0 +1,1623 @@
++#endif
+diff --git a/arch/x86_64/kernel/setup-xen.c b/arch/x86_64/kernel/setup-xen.c
+new file mode 100644
+index 0000000..be0853d
+--- /dev/null
++++ b/arch/x86_64/kernel/setup-xen.c
+@@ -0,0 +1,1619 @@
 +/*
 + *  linux/arch/x86-64/kernel/setup.c
 + *
@@ -30388,13 +34928,7 @@
 +	HYPERVISOR_nmi_op(XENNMI_register_callback, (unsigned long)&nmi);
 +#endif
 +
-+	clear_bit(X86_FEATURE_VME, boot_cpu_data.x86_capability);
-+	clear_bit(X86_FEATURE_DE, boot_cpu_data.x86_capability);
-+	clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
-+	clear_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability);
-+	clear_bit(X86_FEATURE_SEP, boot_cpu_data.x86_capability);
-+	if (!(xen_start_info->flags & SIF_PRIVILEGED))
-+		clear_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability);
++	modify_cpu_capabilities(&boot_cpu_data);
 +#endif
 +
 +	if (!MOUNT_ROOT_RDONLY)
@@ -31120,6 +35654,8 @@
 +	select_idle_routine(c);
 +	detect_ht(c); 
 +
++	modify_cpu_capabilities(c);
++
 +	/*
 +	 * On SMP, boot_cpu_data holds the common feature set between
 +	 * all CPUs; so make sure that we indicate which features are
@@ -31132,225 +35668,606 @@
 +			boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
 +	}
 +
-+#ifdef CONFIG_X86_MCE
-+	mcheck_init(c);
++#ifdef CONFIG_X86_MCE
++	mcheck_init(c);
++#endif
++	if (c == &boot_cpu_data)
++		mtrr_bp_init();
++	else
++		mtrr_ap_init();
++#ifdef CONFIG_NUMA
++	numa_add_cpu(smp_processor_id());
++#endif
++}
++ 
++
++void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
++{
++	if (c->x86_model_id[0])
++		printk("%s", c->x86_model_id);
++
++	if (c->x86_mask || c->cpuid_level >= 0) 
++		printk(" stepping %02x\n", c->x86_mask);
++	else
++		printk("\n");
++}
++
++/*
++ *	Get CPU information for use by the procfs.
++ */
++
++static int show_cpuinfo(struct seq_file *m, void *v)
++{
++	struct cpuinfo_x86 *c = v;
++
++	/* 
++	 * These flag bits must match the definitions in <asm/cpufeature.h>.
++	 * NULL means this bit is undefined or reserved; either way it doesn't
++	 * have meaning as far as Linux is concerned.  Note that it's important
++	 * to realize there is a difference between this table and CPUID -- if
++	 * applications want to get the raw CPUID data, they should access
++	 * /dev/cpu/<cpu_nr>/cpuid instead.
++	 */
++	static char *x86_cap_flags[] = {
++		/* Intel-defined */
++	        "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
++	        "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
++	        "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
++	        "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
++
++		/* AMD-defined */
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
++		NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
++
++		/* Transmeta-defined */
++		"recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++
++		/* Other (Linux-defined) */
++		"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
++		"constant_tsc", NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++
++		/* Intel-defined (#2) */
++		"pni", NULL, NULL, "monitor", "ds_cpl", "vmx", NULL, "est",
++		"tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++
++		/* VIA/Cyrix/Centaur-defined */
++		NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++
++		/* AMD-defined (#2) */
++		"lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++	};
++	static char *x86_power_flags[] = { 
++		"ts",	/* temperature sensor */
++		"fid",  /* frequency id control */
++		"vid",  /* voltage id control */
++		"ttp",  /* thermal trip */
++		"tm",
++		"stc",
++		NULL,
++		/* nothing */	/* constant_tsc - moved to flags */
++	};
++
++
++#ifdef CONFIG_SMP
++	if (!cpu_online(c-cpu_data))
++		return 0;
++#endif
++
++	seq_printf(m,"processor\t: %u\n"
++		     "vendor_id\t: %s\n"
++		     "cpu family\t: %d\n"
++		     "model\t\t: %d\n"
++		     "model name\t: %s\n",
++		     (unsigned)(c-cpu_data),
++		     c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
++		     c->x86,
++		     (int)c->x86_model,
++		     c->x86_model_id[0] ? c->x86_model_id : "unknown");
++	
++	if (c->x86_mask || c->cpuid_level >= 0)
++		seq_printf(m, "stepping\t: %d\n", c->x86_mask);
++	else
++		seq_printf(m, "stepping\t: unknown\n");
++	
++	if (cpu_has(c,X86_FEATURE_TSC)) {
++		unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data));
++		if (!freq)
++			freq = cpu_khz;
++		seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
++			     freq / 1000, (freq % 1000));
++	}
++
++	/* Cache size */
++	if (c->x86_cache_size >= 0) 
++		seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size);
++	
++#ifdef CONFIG_SMP
++	if (smp_num_siblings * c->x86_max_cores > 1) {
++		int cpu = c - cpu_data;
++		seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]);
++		seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu]));
++		seq_printf(m, "core id\t\t: %d\n", cpu_core_id[cpu]);
++		seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
++	}
++#endif	
++
++	seq_printf(m,
++	        "fpu\t\t: yes\n"
++	        "fpu_exception\t: yes\n"
++	        "cpuid level\t: %d\n"
++	        "wp\t\t: yes\n"
++	        "flags\t\t:",
++		   c->cpuid_level);
++
++	{ 
++		int i; 
++		for ( i = 0 ; i < 32*NCAPINTS ; i++ )
++			if ( test_bit(i, &c->x86_capability) &&
++			     x86_cap_flags[i] != NULL )
++				seq_printf(m, " %s", x86_cap_flags[i]);
++	}
++		
++	seq_printf(m, "\nbogomips\t: %lu.%02lu\n",
++		   c->loops_per_jiffy/(500000/HZ),
++		   (c->loops_per_jiffy/(5000/HZ)) % 100);
++
++	if (c->x86_tlbsize > 0) 
++		seq_printf(m, "TLB size\t: %d 4K pages\n", c->x86_tlbsize);
++	seq_printf(m, "clflush size\t: %d\n", c->x86_clflush_size);
++	seq_printf(m, "cache_alignment\t: %d\n", c->x86_cache_alignment);
++
++	seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n", 
++		   c->x86_phys_bits, c->x86_virt_bits);
++
++	seq_printf(m, "power management:");
++	{
++		unsigned i;
++		for (i = 0; i < 32; i++) 
++			if (c->x86_power & (1 << i)) {
++				if (i < ARRAY_SIZE(x86_power_flags) &&
++					x86_power_flags[i])
++					seq_printf(m, "%s%s",
++						x86_power_flags[i][0]?" ":"",
++						x86_power_flags[i]);
++				else
++					seq_printf(m, " [%d]", i);
++			}
++	}
++
++	seq_printf(m, "\n\n");
++
++	return 0;
++}
++
++static void *c_start(struct seq_file *m, loff_t *pos)
++{
++	return *pos < NR_CPUS ? cpu_data + *pos : NULL;
++}
++
++static void *c_next(struct seq_file *m, void *v, loff_t *pos)
++{
++	++*pos;
++	return c_start(m, pos);
++}
++
++static void c_stop(struct seq_file *m, void *v)
++{
++}
++
++struct seq_operations cpuinfo_op = {
++	.start =c_start,
++	.next =	c_next,
++	.stop =	c_stop,
++	.show =	show_cpuinfo,
++};
++
++static int __init run_dmi_scan(void)
++{
++	dmi_scan_machine();
++	return 0;
++}
++core_initcall(run_dmi_scan);
++
+diff --git a/arch/x86_64/kernel/setup64-xen.c b/arch/x86_64/kernel/setup64-xen.c
+new file mode 100644
+index 0000000..946c593
+--- /dev/null
++++ b/arch/x86_64/kernel/setup64-xen.c
+@@ -0,0 +1,358 @@
++/* 
++ * X86-64 specific CPU setup.
++ * Copyright (C) 1995  Linus Torvalds
++ * Copyright 2001, 2002, 2003 SuSE Labs / Andi Kleen.
++ * See setup.c for older changelog.
++ * $Id: setup64.c,v 1.12 2002/03/21 10:09:17 ak Exp $
++ *
++ * Jun Nakajima <jun.nakajima at intel.com> 
++ *   Modified for Xen
++ *
++ */ 
++#include <linux/config.h>
++#include <linux/init.h>
++#include <linux/kernel.h>
++#include <linux/sched.h>
++#include <linux/string.h>
++#include <linux/bootmem.h>
++#include <linux/bitops.h>
++#include <linux/module.h>
++#include <asm/bootsetup.h>
++#include <asm/pda.h>
++#include <asm/pgtable.h>
++#include <asm/processor.h>
++#include <asm/desc.h>
++#include <asm/atomic.h>
++#include <asm/mmu_context.h>
++#include <asm/smp.h>
++#include <asm/i387.h>
++#include <asm/percpu.h>
++#include <asm/proto.h>
++#include <asm/sections.h>
++#ifdef CONFIG_XEN
++#include <asm/hypervisor.h>
++#endif
++
++cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
++
++struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
++struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
++
++#ifndef CONFIG_X86_NO_IDT
++struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
++#endif
++
++char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
++
++unsigned long __supported_pte_mask __read_mostly = ~0UL;
++static int do_not_nx __cpuinitdata = 0;
++
++/* noexec=on|off
++Control non executable mappings for 64bit processes.
++
++on	Enable(default)
++off	Disable
++*/ 
++int __init nonx_setup(char *str)
++{
++	if (!strncmp(str, "on", 2)) {
++                __supported_pte_mask |= _PAGE_NX; 
++ 		do_not_nx = 0; 
++	} else if (!strncmp(str, "off", 3)) {
++		do_not_nx = 1;
++		__supported_pte_mask &= ~_PAGE_NX;
++        }
++	return 0;
++} 
++__setup("noexec=", nonx_setup);	/* parsed early actually */
++
++int force_personality32 = READ_IMPLIES_EXEC;
++
++/* noexec32=on|off
++Control non executable heap for 32bit processes.
++To control the stack too use noexec=off
++
++on	PROT_READ does not imply PROT_EXEC for 32bit processes
++off	PROT_READ implies PROT_EXEC (default)
++*/
++static int __init nonx32_setup(char *str)
++{
++	if (!strcmp(str, "on"))
++		force_personality32 &= ~READ_IMPLIES_EXEC;
++	else if (!strcmp(str, "off"))
++		force_personality32 |= READ_IMPLIES_EXEC;
++	return 0;
++}
++__setup("noexec32=", nonx32_setup);
++
++/*
++ * Great future plan:
++ * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
++ * Always point %gs to its beginning
++ */
++void __init setup_per_cpu_areas(void)
++{ 
++	int i;
++	unsigned long size;
++
++#ifdef CONFIG_HOTPLUG_CPU
++	prefill_possible_map();
++#endif
++
++	/* Copy section for each CPU (we discard the original) */
++	size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
++#ifdef CONFIG_MODULES
++	if (size < PERCPU_ENOUGH_ROOM)
++		size = PERCPU_ENOUGH_ROOM;
++#endif
++
++	for_each_cpu_mask (i, cpu_possible_map) {
++		char *ptr;
++
++		if (!NODE_DATA(cpu_to_node(i))) {
++			printk("cpu with no node %d, num_online_nodes %d\n",
++			       i, num_online_nodes());
++			ptr = alloc_bootmem(size);
++		} else { 
++			ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
++		}
++		if (!ptr)
++			panic("Cannot allocate cpu data for CPU %d\n", i);
++		cpu_pda(i)->data_offset = ptr - __per_cpu_start;
++		memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
++	}
++} 
++
++#ifdef CONFIG_XEN
++static void switch_pt(void)
++{
++	xen_pt_switch(__pa(init_level4_pgt));
++        xen_new_user_pt(__pa(init_level4_user_pgt));
++}
++
++void __cpuinit cpu_gdt_init(struct desc_ptr *gdt_descr)
++{
++	unsigned long frames[16];
++	unsigned long va;
++	int f;
++
++	for (va = gdt_descr->address, f = 0;
++	     va < gdt_descr->address + gdt_descr->size;
++	     va += PAGE_SIZE, f++) {
++		frames[f] = virt_to_mfn(va);
++		make_page_readonly(
++			(void *)va, XENFEAT_writable_descriptor_tables);
++	}
++	if (HYPERVISOR_set_gdt(frames, gdt_descr->size /
++                               sizeof (struct desc_struct)))
++		BUG();
++}
++#else
++static void switch_pt(void)
++{
++	asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt)));
++}
++
++void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
++{
++	asm volatile("lgdt %0" :: "m" (*gdt_descr));
++	asm volatile("lidt %0" :: "m" (idt_descr));
++}
++#endif
++
++void pda_init(int cpu)
++{ 
++	struct x8664_pda *pda = cpu_pda(cpu);
++
++	/* Setup up data that may be needed in __get_free_pages early */
++	asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 
++#ifndef CONFIG_XEN
++	wrmsrl(MSR_GS_BASE, pda);
++#else
++	HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, (unsigned long)pda);
++#endif
++	pda->cpunumber = cpu; 
++	pda->irqcount = -1;
++	pda->kernelstack = 
++		(unsigned long)stack_thread_info() - PDA_STACKOFFSET + THREAD_SIZE; 
++
++	if (cpu == 0) {
++#ifdef CONFIG_XEN
++		xen_init_pt();
++#endif
++		/* others are initialized in smpboot.c */
++		pda->pcurrent = &init_task;
++		pda->irqstackptr = boot_cpu_stack; 
++	} else {
++		pda->irqstackptr = (char *)
++			__get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER);
++		if (!pda->irqstackptr)
++			panic("cannot allocate irqstack for cpu %d", cpu); 
++	}
++
++	switch_pt();
++
++	pda->irqstackptr += IRQSTACKSIZE-64;
++} 
++
++#ifndef CONFIG_X86_NO_TSS
++char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]
++__attribute__((section(".bss.page_aligned")));
++#endif
++
++/* May not be marked __init: used by software suspend */
++void syscall_init(void)
++{
++#ifndef CONFIG_XEN
++	/* 
++	 * LSTAR and STAR live in a bit strange symbiosis.
++	 * They both write to the same internal register. STAR allows to set CS/DS
++	 * but only a 32bit target. LSTAR sets the 64bit rip. 	 
++	 */ 
++	wrmsrl(MSR_STAR,  ((u64)__USER32_CS)<<48  | ((u64)__KERNEL_CS)<<32); 
++	wrmsrl(MSR_LSTAR, system_call); 
++
++	/* Flags to clear on syscall */
++	wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000); 
 +#endif
-+	if (c == &boot_cpu_data)
-+		mtrr_bp_init();
-+	else
-+		mtrr_ap_init();
-+#ifdef CONFIG_NUMA
-+	numa_add_cpu(smp_processor_id());
++#ifdef CONFIG_IA32_EMULATION   		
++	syscall32_cpu_init ();
 +#endif
 +}
-+ 
 +
-+void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
++void __cpuinit check_efer(void)
 +{
-+	if (c->x86_model_id[0])
-+		printk("%s", c->x86_model_id);
++	unsigned long efer;
 +
-+	if (c->x86_mask || c->cpuid_level >= 0) 
-+		printk(" stepping %02x\n", c->x86_mask);
-+	else
-+		printk("\n");
++	rdmsrl(MSR_EFER, efer); 
++        if (!(efer & EFER_NX) || do_not_nx) { 
++                __supported_pte_mask &= ~_PAGE_NX; 
++        }       
 +}
 +
 +/*
-+ *	Get CPU information for use by the procfs.
++ * cpu_init() initializes state that is per-CPU. Some data is already
++ * initialized (naturally) in the bootstrap process, such as the GDT
++ * and IDT. We reload them nevertheless, this function acts as a
++ * 'CPU state barrier', nothing should get across.
++ * A lot of state is already set up in PDA init.
 + */
-+
-+static int show_cpuinfo(struct seq_file *m, void *v)
++void __cpuinit cpu_init (void)
 +{
-+	struct cpuinfo_x86 *c = v;
-+
-+	/* 
-+	 * These flag bits must match the definitions in <asm/cpufeature.h>.
-+	 * NULL means this bit is undefined or reserved; either way it doesn't
-+	 * have meaning as far as Linux is concerned.  Note that it's important
-+	 * to realize there is a difference between this table and CPUID -- if
-+	 * applications want to get the raw CPUID data, they should access
-+	 * /dev/cpu/<cpu_nr>/cpuid instead.
-+	 */
-+	static char *x86_cap_flags[] = {
-+		/* Intel-defined */
-+	        "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
-+	        "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
-+	        "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
-+	        "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
-+
-+		/* AMD-defined */
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
-+		NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
-+
-+		/* Transmeta-defined */
-+		"recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+
-+		/* Other (Linux-defined) */
-+		"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
-+		"constant_tsc", NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++	int cpu = stack_smp_processor_id();
++#ifndef CONFIG_X86_NO_TSS
++	struct tss_struct *t = &per_cpu(init_tss, cpu);
++	unsigned long v; 
++	char *estacks = NULL; 
++	unsigned i;
++#endif
++	struct task_struct *me;
 +
-+		/* Intel-defined (#2) */
-+		"pni", NULL, NULL, "monitor", "ds_cpl", "vmx", NULL, "est",
-+		"tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++	/* CPU 0 is initialised in head64.c */
++	if (cpu != 0) {
++		pda_init(cpu);
++		zap_low_mappings(cpu);
++	}
++#ifndef CONFIG_X86_NO_TSS
++	else
++		estacks = boot_exception_stacks; 
++#endif
 +
-+		/* VIA/Cyrix/Centaur-defined */
-+		NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
++	me = current;
 +
-+		/* AMD-defined (#2) */
-+		"lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-+	};
-+	static char *x86_power_flags[] = { 
-+		"ts",	/* temperature sensor */
-+		"fid",  /* frequency id control */
-+		"vid",  /* voltage id control */
-+		"ttp",  /* thermal trip */
-+		"tm",
-+		"stc",
-+		NULL,
-+		/* nothing */	/* constant_tsc - moved to flags */
-+	};
++	if (cpu_test_and_set(cpu, cpu_initialized))
++		panic("CPU#%d already initialized!\n", cpu);
 +
++	printk("Initializing CPU#%d\n", cpu);
 +
-+#ifdef CONFIG_SMP
-+	if (!cpu_online(c-cpu_data))
-+		return 0;
++#ifndef CONFIG_XEN 
++	clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
 +#endif
 +
-+	seq_printf(m,"processor\t: %u\n"
-+		     "vendor_id\t: %s\n"
-+		     "cpu family\t: %d\n"
-+		     "model\t\t: %d\n"
-+		     "model name\t: %s\n",
-+		     (unsigned)(c-cpu_data),
-+		     c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
-+		     c->x86,
-+		     (int)c->x86_model,
-+		     c->x86_model_id[0] ? c->x86_model_id : "unknown");
-+	
-+	if (c->x86_mask || c->cpuid_level >= 0)
-+		seq_printf(m, "stepping\t: %d\n", c->x86_mask);
-+	else
-+		seq_printf(m, "stepping\t: unknown\n");
-+	
-+	if (cpu_has(c,X86_FEATURE_TSC)) {
-+		unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data));
-+		if (!freq)
-+			freq = cpu_khz;
-+		seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
-+			     freq / 1000, (freq % 1000));
-+	}
++	/*
++	 * Initialize the per-CPU GDT with the boot GDT,
++	 * and set up the GDT descriptor:
++	 */
++#ifndef CONFIG_XEN 
++	if (cpu)
++ 		memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
++#endif
 +
-+	/* Cache size */
-+	if (c->x86_cache_size >= 0) 
-+		seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size);
-+	
-+#ifdef CONFIG_SMP
-+	if (smp_num_siblings * c->x86_max_cores > 1) {
-+		int cpu = c - cpu_data;
-+		seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]);
-+		seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu]));
-+		seq_printf(m, "core id\t\t: %d\n", cpu_core_id[cpu]);
-+		seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
-+	}
-+#endif	
++	cpu_gdt_descr[cpu].size = GDT_SIZE;
++	cpu_gdt_init(&cpu_gdt_descr[cpu]);
 +
-+	seq_printf(m,
-+	        "fpu\t\t: yes\n"
-+	        "fpu_exception\t: yes\n"
-+	        "cpuid level\t: %d\n"
-+	        "wp\t\t: yes\n"
-+	        "flags\t\t:",
-+		   c->cpuid_level);
++	memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
++	syscall_init();
 +
-+	{ 
-+		int i; 
-+		for ( i = 0 ; i < 32*NCAPINTS ; i++ )
-+			if ( test_bit(i, &c->x86_capability) &&
-+			     x86_cap_flags[i] != NULL )
-+				seq_printf(m, " %s", x86_cap_flags[i]);
-+	}
-+		
-+	seq_printf(m, "\nbogomips\t: %lu.%02lu\n",
-+		   c->loops_per_jiffy/(500000/HZ),
-+		   (c->loops_per_jiffy/(5000/HZ)) % 100);
++	wrmsrl(MSR_FS_BASE, 0);
++	wrmsrl(MSR_KERNEL_GS_BASE, 0);
++	barrier(); 
 +
-+	if (c->x86_tlbsize > 0) 
-+		seq_printf(m, "TLB size\t: %d 4K pages\n", c->x86_tlbsize);
-+	seq_printf(m, "clflush size\t: %d\n", c->x86_clflush_size);
-+	seq_printf(m, "cache_alignment\t: %d\n", c->x86_cache_alignment);
++	check_efer();
 +
-+	seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n", 
-+		   c->x86_phys_bits, c->x86_virt_bits);
++#ifndef CONFIG_X86_NO_TSS
++	/*
++	 * set up and load the per-CPU TSS
++	 */
++	for (v = 0; v < N_EXCEPTION_STACKS; v++) {
++		if (cpu) {
++			static const unsigned int order[N_EXCEPTION_STACKS] = {
++				[0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
++				[DEBUG_STACK - 1] = DEBUG_STACK_ORDER
++			};
 +
-+	seq_printf(m, "power management:");
-+	{
-+		unsigned i;
-+		for (i = 0; i < 32; i++) 
-+			if (c->x86_power & (1 << i)) {
-+				if (i < ARRAY_SIZE(x86_power_flags) &&
-+					x86_power_flags[i])
-+					seq_printf(m, "%s%s",
-+						x86_power_flags[i][0]?" ":"",
-+						x86_power_flags[i]);
-+				else
-+					seq_printf(m, " [%d]", i);
-+			}
++			estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
++			if (!estacks)
++				panic("Cannot allocate exception stack %ld %d\n",
++				      v, cpu); 
++		}
++		switch (v + 1) {
++#if DEBUG_STKSZ > EXCEPTION_STKSZ
++		case DEBUG_STACK:
++			cpu_pda[cpu].debugstack = (unsigned long)estacks;
++			estacks += DEBUG_STKSZ;
++			break;
++#endif
++		default:
++			estacks += EXCEPTION_STKSZ;
++			break;
++		}
++		t->ist[v] = (unsigned long)estacks;
 +	}
 +
-+	seq_printf(m, "\n\n");
-+
-+	return 0;
-+}
++	t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
++	/*
++	 * <= is required because the CPU will access up to
++	 * 8 bits beyond the end of the IO permission bitmap.
++	 */
++	for (i = 0; i <= IO_BITMAP_LONGS; i++)
++		t->io_bitmap[i] = ~0UL;
++#endif
 +
-+static void *c_start(struct seq_file *m, loff_t *pos)
-+{
-+	return *pos < NR_CPUS ? cpu_data + *pos : NULL;
-+}
++	atomic_inc(&init_mm.mm_count);
++	me->active_mm = &init_mm;
++	if (me->mm)
++		BUG();
++	enter_lazy_tlb(&init_mm, me);
 +
-+static void *c_next(struct seq_file *m, void *v, loff_t *pos)
-+{
-+	++*pos;
-+	return c_start(m, pos);
-+}
++#ifndef CONFIG_X86_NO_TSS
++	set_tss_desc(cpu, t);
++#endif
++#ifndef CONFIG_XEN
++	load_TR_desc();
++#endif
++	load_LDT(&init_mm.context);
 +
-+static void c_stop(struct seq_file *m, void *v)
-+{
-+}
++	/*
++	 * Clear all 6 debug registers:
++	 */
 +
-+struct seq_operations cpuinfo_op = {
-+	.start =c_start,
-+	.next =	c_next,
-+	.stop =	c_stop,
-+	.show =	show_cpuinfo,
-+};
++	set_debug(0UL, 0);
++	set_debug(0UL, 1);
++	set_debug(0UL, 2);
++	set_debug(0UL, 3);
++	set_debug(0UL, 6);
++	set_debug(0UL, 7);
 +
-+static int __init run_dmi_scan(void)
-+{
-+	dmi_scan_machine();
-+	return 0;
++	fpu_init(); 
 +}
-+core_initcall(run_dmi_scan);
-+
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/smp-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/smp-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/smp-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/smp-xen.c	2006-02-11 17:24:58.000000000 +0000
+diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
+index 70f1bb8..8d48eed 100644
+--- a/arch/x86_64/kernel/setup64.c
++++ b/arch/x86_64/kernel/setup64.c
+@@ -128,8 +128,10 @@ void pda_init(int cpu)
+ 	pda->irqcount = -1;
+ 	pda->kernelstack = 
+ 		(unsigned long)stack_thread_info() - PDA_STACKOFFSET + THREAD_SIZE; 
++#ifdef CONFIG_SMP
+ 	pda->active_mm = &init_mm;
+ 	pda->mmu_state = 0;
++#endif
+ 
+ 	if (cpu == 0) {
+ 		/* others are initialized in smpboot.c */
+diff --git a/arch/x86_64/kernel/smp-xen.c b/arch/x86_64/kernel/smp-xen.c
+new file mode 100644
+index 0000000..5aef99e
+--- /dev/null
++++ b/arch/x86_64/kernel/smp-xen.c
 @@ -0,0 +1,592 @@
 +/*
 + *	Intel SMP support routines.
@@ -31944,9 +36861,11 @@
 +	return 0; /* Should not happen */
 +#endif
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/traps-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/traps-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/traps-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/traps-xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/arch/x86_64/kernel/traps-xen.c b/arch/x86_64/kernel/traps-xen.c
+new file mode 100644
+index 0000000..9fd0b94
+--- /dev/null
++++ b/arch/x86_64/kernel/traps-xen.c
 @@ -0,0 +1,1023 @@
 +/*
 + *  linux/arch/x86-64/traps.c
@@ -32971,9 +37890,11 @@
 +}
 +__setup("kstack=", kstack_setup);
 +
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/vsyscall-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/vsyscall-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/vsyscall-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/vsyscall-xen.c	2006-02-11 17:24:58.000000000 +0000
+diff --git a/arch/x86_64/kernel/vsyscall-xen.c b/arch/x86_64/kernel/vsyscall-xen.c
+new file mode 100644
+index 0000000..190834b
+--- /dev/null
++++ b/arch/x86_64/kernel/vsyscall-xen.c
 @@ -0,0 +1,239 @@
 +/*
 + *  linux/arch/x86_64/kernel/vsyscall.c
@@ -33214,10 +38135,12 @@
 +}
 +
 +__initcall(vsyscall_init);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/x8664_ksyms-xen.c linux-2.6-merge.hg/arch/x86_64/kernel/x8664_ksyms-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/x8664_ksyms-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/x8664_ksyms-xen.c	2006-02-18 12:03:34.000000000 +0000
-@@ -0,0 +1,172 @@
+diff --git a/arch/x86_64/kernel/x8664_ksyms-xen.c b/arch/x86_64/kernel/x8664_ksyms-xen.c
+new file mode 100644
+index 0000000..d6f9285
+--- /dev/null
++++ b/arch/x86_64/kernel/x8664_ksyms-xen.c
+@@ -0,0 +1,163 @@
 +#include <linux/config.h>
 +#include <linux/module.h>
 +#include <linux/smp.h>
@@ -33252,8 +38175,6 @@
 +#include <asm/tlbflush.h>
 +#include <asm/kdebug.h>
 +
-+extern spinlock_t rtc_lock;
-+
 +#ifdef CONFIG_SMP
 +extern void __write_lock_failed(rwlock_t *rw);
 +extern void __read_lock_failed(rwlock_t *rw);
@@ -33262,9 +38183,6 @@
 +/* platform dependent support */
 +EXPORT_SYMBOL(boot_cpu_data);
 +//EXPORT_SYMBOL(dump_fpu);
-+EXPORT_SYMBOL(__ioremap);
-+EXPORT_SYMBOL(ioremap_nocache);
-+EXPORT_SYMBOL(iounmap);
 +EXPORT_SYMBOL(kernel_thread);
 +EXPORT_SYMBOL(pm_idle);
 +EXPORT_SYMBOL(pm_power_off);
@@ -33322,8 +38240,6 @@
 +
 +EXPORT_SYMBOL(get_wchan);
 +
-+EXPORT_SYMBOL(rtc_lock);
-+
 +#ifdef CONFIG_X86_LOCAL_APIC
 +EXPORT_SYMBOL_GPL(set_nmi_callback);
 +EXPORT_SYMBOL_GPL(unset_nmi_callback);
@@ -33386,13 +38302,13 @@
 +EXPORT_SYMBOL(flush_tlb_page);
 +#endif
 +
-+EXPORT_SYMBOL(cpu_khz);
-+
 +EXPORT_SYMBOL(load_gs_index);
 +
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/xen_entry.S linux-2.6-merge.hg/arch/x86_64/kernel/xen_entry.S
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/kernel/xen_entry.S	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/kernel/xen_entry.S	2006-02-11 17:24:58.000000000 +0000
+diff --git a/arch/x86_64/kernel/xen_entry.S b/arch/x86_64/kernel/xen_entry.S
+new file mode 100644
+index 0000000..9b42d15
+--- /dev/null
++++ b/arch/x86_64/kernel/xen_entry.S
 @@ -0,0 +1,41 @@
 +/*
 + * Copied from arch/xen/i386/kernel/entry.S
@@ -33435,41 +38351,29 @@
 +VGCF_IN_SYSCALL = (1<<8)
 +        
 +	
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/Makefile linux-2.6-merge.hg/arch/x86_64/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/Makefile	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/Makefile	2006-02-18 12:03:34.000000000 +0000
-@@ -70,6 +70,20 @@
- .PHONY: bzImage bzlilo install archmrproper \
- 	fdimage fdimage144 fdimage288 archclean
+diff --git a/arch/x86_64/mm/Makefile b/arch/x86_64/mm/Makefile
+index d25ac86..7d6ceae 100644
+--- a/arch/x86_64/mm/Makefile
++++ b/arch/x86_64/mm/Makefile
+@@ -9,3 +9,13 @@ obj-$(CONFIG_K8_NUMA) += k8topology.o
+ obj-$(CONFIG_ACPI_NUMA) += srat.o
  
+ hugetlbpage-y = ../../i386/mm/hugetlbpage.o
++
 +ifdef CONFIG_XEN
-+head-y := arch/x86_64/kernel/head-xen.o arch/x86_64/kernel/head64-xen.o arch/x86_64/kernel/init_task.o
-+LDFLAGS_vmlinux := -e _start
-+boot := arch/i386/boot-xen
-+.PHONY: vmlinuz
-+#Default target when executing "make"
-+all: vmlinuz
++include $(srctree)/scripts/Makefile.xen
 +
-+vmlinuz: vmlinux
-+	$(Q)$(MAKE) $(build)=$(boot) $@
++ioremap-y	+= ../../i386/mm/ioremap-xen.o
++hypervisor-y	+= ../../i386/mm/hypervisor.o
++obj-y		+= hypervisor.o
 +
-+install:
-+	$(Q)$(MAKE) $(build)=$(boot) XENGUEST=$(XENGUEST) $@
-+else
- #Default target when executing "make"
- all: bzImage
- 
-@@ -90,6 +104,7 @@
- 
- install:
- 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 
++obj-y := $(call cherrypickxen, $(obj-y))
 +endif
- 
- archclean:
- 	$(Q)$(MAKE) $(clean)=$(boot)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/fault-xen.c linux-2.6-merge.hg/arch/x86_64/mm/fault-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/fault-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/mm/fault-xen.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/x86_64/mm/fault-xen.c b/arch/x86_64/mm/fault-xen.c
+new file mode 100644
+index 0000000..dfd2f2d
+--- /dev/null
++++ b/arch/x86_64/mm/fault-xen.c
 @@ -0,0 +1,595 @@
 +/*
 + *  linux/arch/x86-64/mm/fault.c
@@ -34066,9 +38970,11 @@
 +	return 0;
 +}
 +__setup("pagefaulttrace", enable_pagefaulttrace);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/init-xen.c linux-2.6-merge.hg/arch/x86_64/mm/init-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/init-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/mm/init-xen.c	2006-02-21 16:06:09.000000000 +0000
+diff --git a/arch/x86_64/mm/init-xen.c b/arch/x86_64/mm/init-xen.c
+new file mode 100644
+index 0000000..0d09c4e
+--- /dev/null
++++ b/arch/x86_64/mm/init-xen.c
 @@ -0,0 +1,1107 @@
 +/*
 + *  linux/arch/x86_64/mm/init.c
@@ -35177,26 +40083,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/Makefile linux-2.6-merge.hg/arch/x86_64/mm/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/Makefile	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/mm/Makefile	2006-02-11 17:24:58.000000000 +0000
-@@ -9,3 +9,13 @@
- obj-$(CONFIG_ACPI_NUMA) += srat.o
- 
- hugetlbpage-y = ../../i386/mm/hugetlbpage.o
-+
-+ifdef CONFIG_XEN
-+include $(srctree)/scripts/Makefile.xen
-+
-+ioremap-y	+= ../../i386/mm/ioremap-xen.o
-+hypervisor-y	+= ../../i386/mm/hypervisor.o
-+obj-y		+= hypervisor.o
-+
-+obj-y := $(call cherrypickxen, $(obj-y))
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/pageattr-xen.c linux-2.6-merge.hg/arch/x86_64/mm/pageattr-xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/mm/pageattr-xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/mm/pageattr-xen.c	2006-02-11 17:24:58.000000000 +0000
+diff --git a/arch/x86_64/mm/pageattr-xen.c b/arch/x86_64/mm/pageattr-xen.c
+new file mode 100644
+index 0000000..a2305bc
+--- /dev/null
++++ b/arch/x86_64/mm/pageattr-xen.c
 @@ -0,0 +1,382 @@
 +/* 
 + * Copyright 2002 Andi Kleen, SuSE Labs. 
@@ -35580,10 +40471,11 @@
 +
 +EXPORT_SYMBOL(change_page_attr);
 +EXPORT_SYMBOL(global_flush_tlb);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/pci/Makefile linux-2.6-merge.hg/arch/x86_64/pci/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/arch/x86_64/pci/Makefile	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/arch/x86_64/pci/Makefile	2006-02-21 16:06:09.000000000 +0000
-@@ -15,10 +15,22 @@
+diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile
+index a8f75a2..73dd478 100644
+--- a/arch/x86_64/pci/Makefile
++++ b/arch/x86_64/pci/Makefile
+@@ -15,10 +15,22 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
  
  obj-$(CONFIG_NUMA)	+= k8-bus.o
  
@@ -35606,10 +40498,23 @@
 +
 +obj-y := $(call cherrypickxen, $(obj-y))
 +endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/acpi/Kconfig linux-2.6-merge.hg/drivers/acpi/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/acpi/Kconfig	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/acpi/Kconfig	2006-02-27 15:49:40.000000000 +0000
-@@ -46,7 +46,7 @@
+diff --git a/drivers/Makefile b/drivers/Makefile
+index 5c69b86..73c1c4a 100644
+--- a/drivers/Makefile
++++ b/drivers/Makefile
+@@ -34,6 +34,7 @@ obj-y				+= base/ block/ misc/ mfd/ net/
+ obj-$(CONFIG_NUBUS)		+= nubus/
+ obj-$(CONFIG_ATM)		+= atm/
+ obj-$(CONFIG_PPC_PMAC)		+= macintosh/
++obj-$(CONFIG_XEN)		+= xen/
+ obj-$(CONFIG_IDE)		+= ide/
+ obj-$(CONFIG_FC4)		+= fc4/
+ obj-$(CONFIG_SCSI)		+= scsi/
+diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
+index 33e2ca8..b6e265a 100644
+--- a/drivers/acpi/Kconfig
++++ b/drivers/acpi/Kconfig
+@@ -46,7 +46,7 @@ if ACPI
  
  config ACPI_SLEEP
  	bool "Sleep States"
@@ -35618,7 +40523,7 @@
  	depends on PM
  	default y
  	---help---
-@@ -287,6 +287,7 @@
+@@ -287,6 +287,7 @@ config ACPI_SYSTEM
  config X86_PM_TIMER
  	bool "Power Management Timer Support" if EMBEDDED
  	depends on X86
@@ -35626,10 +40531,11 @@
  	default y
  	help
  	  The Power Management Timer is available on all ACPI-capable,
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/acpi/tables.c linux-2.6-merge.hg/drivers/acpi/tables.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/acpi/tables.c	2006-02-27 15:51:21.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/acpi/tables.c	2006-02-11 17:24:59.000000000 +0000
-@@ -572,6 +572,11 @@
+diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
+index 31d4f3f..a60095a 100644
+--- a/drivers/acpi/tables.c
++++ b/drivers/acpi/tables.c
+@@ -572,6 +572,11 @@ static int __init acpi_table_get_sdt(str
   * 
   * result: sdt_entry[] is initialized
   */
@@ -35641,7 +40547,7 @@
  
  int __init acpi_table_init(void)
  {
-@@ -587,7 +592,7 @@
+@@ -587,7 +592,7 @@ int __init acpi_table_init(void)
  		return -ENODEV;
  	}
  
@@ -35650,91 +40556,243 @@
  	if (!rsdp) {
  		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
  		return -ENODEV;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/mem.c linux-2.6-merge.hg/drivers/char/mem.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/mem.c	2006-02-27 15:51:22.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/mem.c	2006-02-11 17:25:03.000000000 +0000
-@@ -108,6 +108,7 @@
+diff --git a/drivers/char/mem.c b/drivers/char/mem.c
+index 29c41f4..e65a3ef 100644
+--- a/drivers/char/mem.c
++++ b/drivers/char/mem.c
+@@ -108,6 +108,7 @@ static inline int valid_mmap_phys_addr_r
  }
  #endif
  
-+#ifndef ARCH_HAS_DEV_MEM
- /*
-  * This funcion reads the *physical* memory. The f_pos points directly to the 
-  * memory location. 
-@@ -232,6 +233,7 @@
- 	*ppos += written;
- 	return written;
++#ifndef ARCH_HAS_DEV_MEM
+ /*
+  * This funcion reads the *physical* memory. The f_pos points directly to the 
+  * memory location. 
+@@ -232,6 +233,7 @@ static ssize_t write_mem(struct file * f
+ 	*ppos += written;
+ 	return written;
+ }
++#endif
+ 
+ #ifndef __HAVE_PHYS_MEM_ACCESS_PROT
+ static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
+@@ -773,6 +775,7 @@ static int open_port(struct inode * inod
+ #define open_kmem	open_mem
+ #define open_oldmem	open_mem
+ 
++#ifndef ARCH_HAS_DEV_MEM
+ static struct file_operations mem_fops = {
+ 	.llseek		= memory_lseek,
+ 	.read		= read_mem,
+@@ -780,6 +783,9 @@ static struct file_operations mem_fops =
+ 	.mmap		= mmap_mem,
+ 	.open		= open_mem,
+ };
++#else
++extern struct file_operations mem_fops;
++#endif
+ 
+ static struct file_operations kmem_fops = {
+ 	.llseek		= memory_lseek,
+diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
+index a6873bf..a0879ae 100644
+--- a/drivers/char/tpm/Kconfig
++++ b/drivers/char/tpm/Kconfig
+@@ -22,7 +22,7 @@ config TCG_TPM
+ 
+ config TCG_NSC
+ 	tristate "National Semiconductor TPM Interface"
+-	depends on TCG_TPM
++	depends on TCG_TPM && !XEN_UNPRIVILEGED_GUEST
+ 	---help---
+ 	  If you have a TPM security chip from National Semicondutor 
+ 	  say Yes and it will be accessible from within Linux.  To 
+@@ -31,7 +31,7 @@ config TCG_NSC
+ 
+ config TCG_ATMEL
+ 	tristate "Atmel TPM Interface"
+-	depends on TCG_TPM
++	depends on TCG_TPM && !XEN_UNPRIVILEGED_GUEST
+ 	---help---
+ 	  If you have a TPM security chip from Atmel say Yes and it 
+ 	  will be accessible from within Linux.  To compile this driver 
+@@ -49,5 +49,15 @@ config TCG_INFINEON
+ 	  Further information on this driver and the supported hardware
+ 	  can be found at http://www.prosec.rub.de/tpm
+ 
++config TCG_XEN
++	tristate "XEN TPM Interface"
++	depends on TCG_TPM && XEN && XEN_TPMDEV_FRONTEND
++	---help---
++	  If you want to make TPM support available to a Xen
++	  user domain, say Yes and it will
++          be accessible from within Linux. To compile this driver
++          as a module, choose M here; the module will be called
++          tpm_xen.
++
+ endmenu
+ 
+diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
+index ba4582d..f266799 100644
+--- a/drivers/char/tpm/Makefile
++++ b/drivers/char/tpm/Makefile
+@@ -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 --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
+index 5a38704..9709a60 100644
+--- a/drivers/char/tpm/tpm.c
++++ b/drivers/char/tpm/tpm.c
+@@ -30,7 +30,8 @@
+ 
+ enum tpm_const {
+ 	TPM_MINOR = 224,	/* officially assigned */
+-	TPM_BUFSIZE = 2048,
++	TPM_MIN_BUFSIZE = 2048,
++	TPM_MAX_BUFSIZE = 64 * 1024,
+ 	TPM_NUM_DEVICES = 256,
+ 	TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int))
+ };
+@@ -52,14 +53,14 @@ static void timeout_work(void * ptr)
+ 
+ 	down(&chip->buffer_mutex);
+ 	atomic_set(&chip->data_pending, 0);
+-	memset(chip->data_buffer, 0, TPM_BUFSIZE);
++	memset(chip->data_buffer, 0, get_chip_buffersize(chip));
+ 	up(&chip->buffer_mutex);
+ }
+ 
+ /*
+  * Internal kernel interface to transmit TPM commands
+  */
+-static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
++static ssize_t tpm_transmit(struct tpm_chip * chip, const char *buf,
+ 			    size_t bufsiz)
+ {
+ 	ssize_t rc;
+@@ -351,7 +352,7 @@ int tpm_open(struct inode *inode, struct
+ 
+ 	spin_unlock(&driver_lock);
+ 
+-	chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
++	chip->data_buffer = kmalloc(get_chip_buffersize(chip) * sizeof(u8), GFP_KERNEL);
+ 	if (chip->data_buffer == NULL) {
+ 		chip->num_opens--;
+ 		put_device(chip->dev);
+@@ -399,8 +400,8 @@ ssize_t tpm_write(struct file *file, con
+ 
+ 	down(&chip->buffer_mutex);
+ 
+-	if (in_size > TPM_BUFSIZE)
+-		in_size = TPM_BUFSIZE;
++	if (in_size > get_chip_buffersize(chip))
++		in_size = get_chip_buffersize(chip);
+ 
+ 	if (copy_from_user
+ 	    (chip->data_buffer, (void __user *) buf, in_size)) {
+@@ -409,9 +410,11 @@ ssize_t tpm_write(struct file *file, con
+ 	}
+ 
+ 	/* atomic tpm command send and result receive */
+-	out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);
++	out_size = tpm_transmit(chip, chip->data_buffer, 
++	                        get_chip_buffersize(chip));
+ 
+ 	atomic_set(&chip->data_pending, out_size);
++	atomic_set(&chip->data_position, 0);
+ 	up(&chip->buffer_mutex);
+ 
+ 	/* Set a timeout by which the reader must come claim the result */
+@@ -427,20 +430,33 @@ ssize_t tpm_read(struct file * file, cha
+ {
+ 	struct tpm_chip *chip = file->private_data;
+ 	int ret_size;
++	int pos, pending = 0;
+ 
+-	del_singleshot_timer_sync(&chip->user_read_timer);
+-	flush_scheduled_work();
+ 	ret_size = atomic_read(&chip->data_pending);
+-	atomic_set(&chip->data_pending, 0);
+ 	if (ret_size > 0) {	/* relay data */
+ 		if (size < ret_size)
+ 			ret_size = size;
+ 
++		pos = atomic_read(&chip->data_position);
++
+ 		down(&chip->buffer_mutex);
+-		if (copy_to_user(buf, chip->data_buffer, ret_size))
++		if (copy_to_user(buf, &chip->data_buffer[pos], ret_size)) {
+ 			ret_size = -EFAULT;
++		} else {
++			pending = atomic_read(&chip->data_pending) - ret_size;
++			if ( pending ) {
++				atomic_set( &chip->data_pending, pending );
++				atomic_set( &chip->data_position, pos+ret_size );
++			}
++		}
+ 		up(&chip->buffer_mutex);
+ 	}
++	
++	if ( ret_size <= 0 || pending == 0 ) {
++		atomic_set( &chip->data_pending, 0 );
++		del_singleshot_timer_sync(&chip->user_read_timer);
++		flush_scheduled_work();
++	}
+ 
+ 	return ret_size;
  }
-+#endif
+@@ -544,6 +560,12 @@ int tpm_register_hardware(struct device 
+ 	chip->user_read_timer.data = (unsigned long) chip;
  
- #ifndef __HAVE_PHYS_MEM_ACCESS_PROT
- static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
-@@ -773,6 +775,7 @@
- #define open_kmem	open_mem
- #define open_oldmem	open_mem
+ 	chip->vendor = entry;
++	
++	if (entry->buffersize < TPM_MIN_BUFSIZE) {
++		entry->buffersize = TPM_MIN_BUFSIZE;
++	} else if (entry->buffersize > TPM_MAX_BUFSIZE) {
++		entry->buffersize = TPM_MAX_BUFSIZE;
++	}
  
-+#ifndef ARCH_HAS_DEV_MEM
- static struct file_operations mem_fops = {
- 	.llseek		= memory_lseek,
- 	.read		= read_mem,
-@@ -780,6 +783,9 @@
- 	.mmap		= mmap_mem,
- 	.open		= open_mem,
- };
-+#else
-+extern struct file_operations mem_fops;
-+#endif
+ 	chip->dev_num = -1;
  
- static struct file_operations kmem_fops = {
- 	.llseek		= memory_lseek,
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/Kconfig linux-2.6-merge.hg/drivers/char/tpm/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/Kconfig	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/Kconfig	2006-02-11 17:25:04.000000000 +0000
-@@ -22,7 +22,7 @@
+diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
+index fd3a4be..090b889 100644
+--- a/drivers/char/tpm/tpm.h
++++ b/drivers/char/tpm/tpm.h
+@@ -50,6 +50,7 @@ struct tpm_vendor_specific {
+ 	u8 req_complete_mask;
+ 	u8 req_complete_val;
+ 	u8 req_canceled;
++	u32 buffersize;
+ 	void __iomem *iobase;		/* ioremapped address */
+ 	unsigned long base;		/* TPM base address */
  
- config TCG_NSC
- 	tristate "National Semiconductor TPM Interface"
--	depends on TCG_TPM
-+	depends on TCG_TPM && !XEN_UNPRIVILEGED_GUEST
- 	---help---
- 	  If you have a TPM security chip from National Semicondutor 
- 	  say Yes and it will be accessible from within Linux.  To 
-@@ -31,7 +31,7 @@
+@@ -74,6 +75,7 @@ struct tpm_chip {
+ 	/* Data passed to and from the tpm via the read/write calls */
+ 	u8 *data_buffer;
+ 	atomic_t data_pending;
++	atomic_t data_position;
+ 	struct semaphore buffer_mutex;
  
- config TCG_ATMEL
- 	tristate "Atmel TPM Interface"
--	depends on TCG_TPM
-+	depends on TCG_TPM && !XEN_UNPRIVILEGED_GUEST
- 	---help---
- 	  If you have a TPM security chip from Atmel say Yes and it 
- 	  will be accessible from within Linux.  To compile this driver 
-@@ -49,5 +49,15 @@
- 	  Further information on this driver and the supported hardware
- 	  can be found at http://www.prosec.rub.de/tpm
+ 	struct timer_list user_read_timer;	/* user needs to claim result */
+@@ -99,6 +101,11 @@ static inline void tpm_write_index(int b
+ 	outb(value & 0xFF, base+1);
+ }
  
-+config TCG_XEN
-+	tristate "XEN TPM Interface"
-+	depends on TCG_TPM && XEN && XEN_TPMDEV_FRONTEND
-+	---help---
-+	  If you want to make TPM support available to a Xen
-+	  user domain, say Yes and it will
-+          be accessible from within Linux. To compile this driver
-+          as a module, choose M here; the module will be called
-+          tpm_xen.
++static inline u32 get_chip_buffersize(struct tpm_chip *chip)
++{
++	return chip->vendor->buffersize;
++}
 +
- endmenu
- 
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/Makefile linux-2.6-merge.hg/drivers/char/tpm/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/Makefile	2006-02-27 15:51:23.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/Makefile	2006-02-11 17:25:04.000000000 +0000
-@@ -8,3 +8,4 @@
- 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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm_atmel.c linux-2.6-merge.hg/drivers/char/tpm/tpm_atmel.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm_atmel.c	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/tpm_atmel.c	1970-01-01 00:00:00.000000000 +0000
+ extern int tpm_register_hardware(struct device *,
+ 				 struct tpm_vendor_specific *);
+ extern int tpm_open(struct inode *, struct file *);
+diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
+deleted file mode 100644
+index ff36549..0000000
+--- a/drivers/char/tpm/tpm_atmel.c
++++ /dev/null
 @@ -1,230 +0,0 @@
 -/*
 - * Copyright (C) 2004 IBM Corporation
@@ -35966,154 +41024,11 @@
 -MODULE_DESCRIPTION("TPM Driver");
 -MODULE_VERSION("2.0");
 -MODULE_LICENSE("GPL");
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm.c linux-2.6-merge.hg/drivers/char/tpm/tpm.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm.c	2006-02-27 15:51:23.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/tpm.c	2006-02-27 15:49:40.000000000 +0000
-@@ -30,7 +30,8 @@
- 
- enum tpm_const {
- 	TPM_MINOR = 224,	/* officially assigned */
--	TPM_BUFSIZE = 2048,
-+	TPM_MIN_BUFSIZE = 2048,
-+	TPM_MAX_BUFSIZE = 64 * 1024,
- 	TPM_NUM_DEVICES = 256,
- 	TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int))
- };
-@@ -52,14 +53,14 @@
- 
- 	down(&chip->buffer_mutex);
- 	atomic_set(&chip->data_pending, 0);
--	memset(chip->data_buffer, 0, TPM_BUFSIZE);
-+	memset(chip->data_buffer, 0, get_chip_buffersize(chip));
- 	up(&chip->buffer_mutex);
- }
- 
- /*
-  * Internal kernel interface to transmit TPM commands
-  */
--static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
-+static ssize_t tpm_transmit(struct tpm_chip * chip, const char *buf,
- 			    size_t bufsiz)
- {
- 	ssize_t rc;
-@@ -351,7 +352,7 @@
- 
- 	spin_unlock(&driver_lock);
- 
--	chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
-+	chip->data_buffer = kmalloc(get_chip_buffersize(chip) * sizeof(u8), GFP_KERNEL);
- 	if (chip->data_buffer == NULL) {
- 		chip->num_opens--;
- 		put_device(chip->dev);
-@@ -399,8 +400,8 @@
- 
- 	down(&chip->buffer_mutex);
- 
--	if (in_size > TPM_BUFSIZE)
--		in_size = TPM_BUFSIZE;
-+	if (in_size > get_chip_buffersize(chip))
-+		in_size = get_chip_buffersize(chip);
- 
- 	if (copy_from_user
- 	    (chip->data_buffer, (void __user *) buf, in_size)) {
-@@ -409,9 +410,11 @@
- 	}
- 
- 	/* atomic tpm command send and result receive */
--	out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);
-+	out_size = tpm_transmit(chip, chip->data_buffer, 
-+	                        get_chip_buffersize(chip));
- 
- 	atomic_set(&chip->data_pending, out_size);
-+	atomic_set(&chip->data_position, 0);
- 	up(&chip->buffer_mutex);
- 
- 	/* Set a timeout by which the reader must come claim the result */
-@@ -427,20 +430,33 @@
- {
- 	struct tpm_chip *chip = file->private_data;
- 	int ret_size;
-+	int pos, pending = 0;
- 
--	del_singleshot_timer_sync(&chip->user_read_timer);
--	flush_scheduled_work();
- 	ret_size = atomic_read(&chip->data_pending);
--	atomic_set(&chip->data_pending, 0);
- 	if (ret_size > 0) {	/* relay data */
- 		if (size < ret_size)
- 			ret_size = size;
- 
-+		pos = atomic_read(&chip->data_position);
-+
- 		down(&chip->buffer_mutex);
--		if (copy_to_user(buf, chip->data_buffer, ret_size))
-+		if (copy_to_user(buf, &chip->data_buffer[pos], ret_size)) {
- 			ret_size = -EFAULT;
-+		} else {
-+			pending = atomic_read(&chip->data_pending) - ret_size;
-+			if ( pending ) {
-+				atomic_set( &chip->data_pending, pending );
-+				atomic_set( &chip->data_position, pos+ret_size );
-+			}
-+		}
- 		up(&chip->buffer_mutex);
- 	}
-+	
-+	if ( ret_size <= 0 || pending == 0 ) {
-+		atomic_set( &chip->data_pending, 0 );
-+		del_singleshot_timer_sync(&chip->user_read_timer);
-+		flush_scheduled_work();
-+	}
- 
- 	return ret_size;
- }
-@@ -544,6 +560,12 @@
- 	chip->user_read_timer.data = (unsigned long) chip;
- 
- 	chip->vendor = entry;
-+	
-+	if (entry->buffersize < TPM_MIN_BUFSIZE) {
-+		entry->buffersize = TPM_MIN_BUFSIZE;
-+	} else if (entry->buffersize > TPM_MAX_BUFSIZE) {
-+		entry->buffersize = TPM_MAX_BUFSIZE;
-+	}
- 
- 	chip->dev_num = -1;
- 
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm.h linux-2.6-merge.hg/drivers/char/tpm/tpm.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm.h	2006-02-27 15:51:23.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/tpm.h	2006-02-27 15:49:40.000000000 +0000
-@@ -50,6 +50,7 @@
- 	u8 req_complete_mask;
- 	u8 req_complete_val;
- 	u8 req_canceled;
-+	u32 buffersize;
- 	void __iomem *iobase;		/* ioremapped address */
- 	unsigned long base;		/* TPM base address */
- 
-@@ -74,6 +75,7 @@
- 	/* Data passed to and from the tpm via the read/write calls */
- 	u8 *data_buffer;
- 	atomic_t data_pending;
-+	atomic_t data_position;
- 	struct semaphore buffer_mutex;
- 
- 	struct timer_list user_read_timer;	/* user needs to claim result */
-@@ -99,6 +101,11 @@
- 	outb(value & 0xFF, base+1);
- }
- 
-+static inline u32 get_chip_buffersize(struct tpm_chip *chip)
-+{
-+	return chip->vendor->buffersize;
-+}
-+
- extern int tpm_register_hardware(struct device *,
- 				 struct tpm_vendor_specific *);
- extern int tpm_open(struct inode *, struct file *);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm_nsc.c linux-2.6-merge.hg/drivers/char/tpm/tpm_nsc.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm_nsc.c	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/tpm_nsc.c	1970-01-01 00:00:00.000000000 +0000
+diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
+deleted file mode 100644
+index 680a8e3..0000000
+--- a/drivers/char/tpm/tpm_nsc.c
++++ /dev/null
 @@ -1,395 +0,0 @@
 -/*
 - * Copyright (C) 2004 IBM Corporation
@@ -36510,9 +41425,11 @@
 -MODULE_DESCRIPTION("TPM Driver");
 -MODULE_VERSION("2.0");
 -MODULE_LICENSE("GPL");
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm_xen.c linux-2.6-merge.hg/drivers/char/tpm/tpm_xen.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tpm/tpm_xen.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tpm/tpm_xen.c	2006-02-27 15:49:40.000000000 +0000
+diff --git a/drivers/char/tpm/tpm_xen.c b/drivers/char/tpm/tpm_xen.c
+new file mode 100644
+index 0000000..0ee6920
+--- /dev/null
++++ b/drivers/char/tpm/tpm_xen.c
 @@ -0,0 +1,536 @@
 +/*
 + * Copyright (C) 2004 IBM Corporation
@@ -37050,10 +41967,11 @@
 +MODULE_DESCRIPTION("TPM Driver for XEN (shared memory)");
 +MODULE_VERSION("1.0");
 +MODULE_LICENSE("GPL");
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tty_io.c linux-2.6-merge.hg/drivers/char/tty_io.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/char/tty_io.c	2006-02-27 15:51:23.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/char/tty_io.c	2006-02-27 15:49:40.000000000 +0000
-@@ -132,6 +132,8 @@
+diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
+index 53d3d06..752834f 100644
+--- a/drivers/char/tty_io.c
++++ b/drivers/char/tty_io.c
+@@ -132,6 +132,8 @@ LIST_HEAD(tty_drivers);			/* linked list
     vt.c for deeply disgusting hack reasons */
  DECLARE_MUTEX(tty_sem);
  
@@ -37062,7 +41980,7 @@
  #ifdef CONFIG_UNIX98_PTYS
  extern struct tty_driver *ptm_driver;	/* Unix98 pty masters; for /dev/ptmx */
  extern int pty_limit;		/* Config limit on Unix98 ptys */
-@@ -2054,7 +2056,7 @@
+@@ -2054,7 +2056,7 @@ retry_open:
  		goto got_driver;
  	}
  #ifdef CONFIG_VT
@@ -37071,7 +41989,7 @@
  		extern struct tty_driver *console_driver;
  		driver = console_driver;
  		index = fg_console;
-@@ -3237,6 +3239,8 @@
+@@ -3237,6 +3239,8 @@ static int __init tty_init(void)
  #endif
  
  #ifdef CONFIG_VT
@@ -37080,7 +41998,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)
-@@ -3245,6 +3249,7 @@
+@@ -3245,6 +3249,7 @@ static int __init tty_init(void)
  	class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
  
  	vty_init();
@@ -37088,10 +42006,11 @@
  #endif
  	return 0;
  }
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/firmware/Kconfig linux-2.6-merge.hg/drivers/firmware/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/firmware/Kconfig	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/firmware/Kconfig	2006-02-11 17:25:05.000000000 +0000
-@@ -8,7 +8,7 @@
+diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
+index 1e371a5..f0dff5a 100644
+--- a/drivers/firmware/Kconfig
++++ b/drivers/firmware/Kconfig
+@@ -8,7 +8,7 @@ menu "Firmware Drivers"
  config EDD
  	tristate "BIOS Enhanced Disk Drive calls determine boot disk (EXPERIMENTAL)"
  	depends on EXPERIMENTAL
@@ -37100,10 +42019,11 @@
  	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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/ide/legacy/hd.c linux-2.6-merge.hg/drivers/ide/legacy/hd.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/ide/legacy/hd.c	2006-02-27 15:51:24.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/ide/legacy/hd.c	2006-02-11 17:25:05.000000000 +0000
-@@ -718,7 +718,7 @@
+diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
+index 6439dec..835d108 100644
+--- a/drivers/ide/legacy/hd.c
++++ b/drivers/ide/legacy/hd.c
+@@ -718,7 +718,7 @@ static int __init hd_init(void)
  	device_timer.function = hd_times_out;
  	blk_queue_hardsect_size(hd_queue, 512);
  
@@ -37112,21 +42032,11 @@
  	if (!NR_HD) {
  		extern struct drive_info drive_info;
  		unsigned char *BIOS = (unsigned char *) &drive_info;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/Makefile linux-2.6-merge.hg/drivers/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/Makefile	2006-02-27 15:51:20.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/Makefile	2006-02-18 12:03:34.000000000 +0000
-@@ -34,6 +34,7 @@
- obj-$(CONFIG_NUBUS)		+= nubus/
- obj-$(CONFIG_ATM)		+= atm/
- obj-$(CONFIG_PPC_PMAC)		+= macintosh/
-+obj-$(CONFIG_XEN)		+= xen/
- obj-$(CONFIG_IDE)		+= ide/
- obj-$(CONFIG_FC4)		+= fc4/
- obj-$(CONFIG_SCSI)		+= scsi/
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/pci/Kconfig linux-2.6-merge.hg/drivers/pci/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/pci/Kconfig	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/pci/Kconfig	2006-02-11 17:25:17.000000000 +0000
-@@ -5,6 +5,7 @@
+diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
+index f187fd8..a47a5df 100644
+--- a/drivers/pci/Kconfig
++++ b/drivers/pci/Kconfig
+@@ -5,6 +5,7 @@ config PCI_MSI
  	bool "Message Signaled Interrupts (MSI and MSI-X)"
  	depends on PCI
  	depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64
@@ -37134,10 +42044,11 @@
  	help
  	   This allows device drivers to enable MSI (Message Signaled
  	   Interrupts).  Message Signaled Interrupts enable a device to
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/serial/Kconfig linux-2.6-merge.hg/drivers/serial/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/serial/Kconfig	2006-02-27 15:51:33.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/serial/Kconfig	2006-02-27 15:49:41.000000000 +0000
-@@ -11,6 +11,7 @@
+diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
+index b3c561a..fa1fdb0 100644
+--- a/drivers/serial/Kconfig
++++ b/drivers/serial/Kconfig
+@@ -11,6 +11,7 @@ menu "Serial drivers"
  config SERIAL_8250
  	tristate "8250/16550 and compatible serial support"
  	depends on (BROKEN || !SPARC)
@@ -37145,22 +42056,11 @@
  	select SERIAL_CORE
  	---help---
  	  This selects whether you want to include the driver for the standard
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/video/fbmon.c linux-2.6-merge.hg/drivers/video/fbmon.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/video/fbmon.c	2006-02-27 15:51:37.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/video/fbmon.c	2006-02-11 17:25:24.000000000 +0000
-@@ -1281,7 +1281,7 @@
- 		-EINVAL : 0;
- }
- 
--#if defined(__i386__)
-+#if defined(__i386__) && !defined(CONFIG_XEN)
- #include <linux/pci.h>
- 
- /*
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/video/Kconfig linux-2.6-merge.hg/drivers/video/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/video/Kconfig	2006-02-27 15:51:37.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/video/Kconfig	2006-02-27 15:49:41.000000000 +0000
-@@ -495,7 +495,7 @@
+diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
+index f5079c7..cb5942d 100644
+--- a/drivers/video/Kconfig
++++ b/drivers/video/Kconfig
+@@ -495,7 +495,7 @@ config FB_HGA_ACCEL
  
  config VIDEO_SELECT
  	bool
@@ -37169,9 +42069,266 @@
  	default y
  
  config FB_SGIVW
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/balloon/balloon.c linux-2.6-merge.hg/drivers/xen/balloon/balloon.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/balloon/balloon.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/balloon/balloon.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
+index 7c74e73..73116e3 100644
+--- a/drivers/video/fbmon.c
++++ b/drivers/video/fbmon.c
+@@ -1281,7 +1281,7 @@ int fb_validate_mode(const struct fb_var
+ 		-EINVAL : 0;
+ }
+ 
+-#if defined(__i386__)
++#if defined(__i386__) && !defined(CONFIG_XEN)
+ #include <linux/pci.h>
+ 
+ /*
+diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
+new file mode 100644
+index 0000000..7a6a569
+--- /dev/null
++++ b/drivers/xen/Kconfig
+@@ -0,0 +1,200 @@
++#
++# This Kconfig describe xen options
++#
++
++mainmenu "Xen Configuration"
++
++config XEN
++	bool
++	default y if X86_XEN || X86_64_XEN
++	help
++	  This is the Linux Xen port.
++
++config NO_IDLE_HZ
++	bool
++	depends on XEN
++	default y
++
++if XEN
++menu "XEN"
++
++config XEN_PRIVILEGED_GUEST
++	bool "Privileged Guest (domain 0)"
++	depends XEN
++	default n
++	help
++	  Support for privileged operation (domain 0)
++
++config XEN_UNPRIVILEGED_GUEST
++	bool
++	default !XEN_PRIVILEGED_GUEST
++
++config XEN_PCIDEV_BACKEND
++	bool "PCI device backend driver"
++	select PCI
++	default y if XEN_PRIVILEGED_GUEST
++	help
++	  The PCI device backend driver allows the kernel to export arbitrary
++	  PCI devices to other guests.
++
++choice
++	prompt "PCI Backend Mode"
++	depends on XEN_PCIDEV_BACKEND
++	default XEN_PCIDEV_BACKEND_VPCI
++
++config XEN_PCIDEV_BACKEND_VPCI
++	bool "Virtual PCI"
++	---help---
++	  This PCI Backend hides the true PCI topology and makes the frontend
++	  think there is a single PCI bus with only the exported devices on it.
++	  For example, a device at 03:05.0 will be re-assigned to 00:00.0. A
++	  second device at 02:1a.0 will be re-assigned to 00:01.0.
++
++config XEN_PCIDEV_BACKEND_PASS
++	bool "Passthrough"
++	---help---
++	  This PCI Backend provides a real view of the PCI topology to the
++	  frontend (for example, a device at 06:01.b will still appear at
++	  06:01.b to the frontend). This is similar to how Xen 2.0.x exposed
++	  PCI devices to its driver domains. This may be required for drivers
++	  which depend on finding their hardward in certain bus/slot
++	  locations.
++
++endchoice
++
++config XEN_PCIDEV_BE_DEBUG
++	bool "PCI Backend Debugging"
++	depends on XEN_PCIDEV_BACKEND
++	default n
++
++config XEN_BLKDEV_BACKEND
++	tristate "Block-device backend driver"
++	default y
++	help
++	  The block-device backend driver allows the kernel to export its
++	  block devices to other guests via a high-performance shared-memory
++	  interface.
++
++config XEN_BLKDEV_TAP_BE
++        tristate "Block Tap support for backend driver (DANGEROUS)"
++        depends on XEN_BLKDEV_BACKEND
++        default n
++        help
++          If you intend to use the block tap driver, the backend domain will
++          not know the domain id of the real frontend, and so will not be able
++          to map its data pages.  This modifies the backend to attempt to map
++          from both the tap domain and the real frontend.  This presents a
++          security risk, and so should ONLY be used for development
++          with the blktap.  This option will be removed as the block drivers are
++          modified to use grant tables.
++
++config XEN_NETDEV_BACKEND
++	tristate "Network-device backend driver"
++	default y
++	help
++	  The network-device backend driver allows the kernel to export its
++	  network devices to other guests via a high-performance shared-memory
++	  interface.
++
++config XEN_NETDEV_PIPELINED_TRANSMITTER
++	bool "Pipelined transmitter (DANGEROUS)"
++	depends on XEN_NETDEV_BACKEND
++	default n
++	help
++	  If the net backend is a dumb domain, such as a transparent Ethernet
++	  bridge with no local IP interface, it is safe to say Y here to get
++	  slightly lower network overhead.
++	  If the backend has a local IP interface; or may be doing smart things
++	  like reassembling packets to perform firewall filtering; or if you
++	  are unsure; or if you experience network hangs when this option is
++	  enabled; then you must say N here.
++
++config XEN_NETDEV_LOOPBACK
++	tristate "Network-device loopback driver"
++	depends on XEN_NETDEV_BACKEND
++	default y
++	help
++	  A two-interface loopback device to emulate a local netfront-netback
++	  connection.
++
++config XEN_TPMDEV_BACKEND
++	tristate "TPM-device backend driver"
++	default n
++	help
++	  The TPM-device backend driver
++
++config XEN_TPMDEV_CLOSE_IF_VTPM_FAILS
++	bool "TPM backend closes upon vTPM failure"
++	depends on XEN_TPMDEV_BACKEND
++	default n
++	help
++	  The TPM backend closes the channel if the vTPM in userspace indicates
++	  a failure. The corresponding domain's channel will be closed.
++	  Say Y if you want this feature.
++
++config XEN_BLKDEV_FRONTEND
++	tristate "Block-device frontend driver"
++	depends on XEN
++	default y
++	help
++	  The block-device frontend driver allows the kernel to access block
++	  devices mounted within another guest OS. Unless you are building a
++	  dedicated device-driver domain, or your master control domain
++	  (domain 0), then you almost certainly want to say Y here.
++
++config XEN_NETDEV_FRONTEND
++	tristate "Network-device frontend driver"
++	depends on XEN
++	default y
++	help
++	  The network-device frontend driver allows the kernel to access
++	  network interfaces within another guest OS. Unless you are building a
++	  dedicated device-driver domain, or your master control domain
++	  (domain 0), then you almost certainly want to say Y here.
++
++config XEN_BLKDEV_TAP
++	tristate "Block device tap driver"
++	default n
++	help
++	  This driver allows a VM to interact on block device channels
++	  to other VMs.  Block messages may be passed through or redirected
++	  to a character device, allowing device prototyping in application
++	  space.  Odds are that you want to say N here.
++
++config XEN_TPMDEV_FRONTEND
++	tristate "TPM-device frontend driver"
++	default n
++	select TCG_TPM
++	select TCG_XEN
++	help
++	  The TPM-device frontend driver.
++
++config XEN_SCRUB_PAGES
++	bool "Scrub memory before freeing it to Xen"
++	default y
++	help
++	  Erase memory contents before freeing it back to Xen's global
++	  pool. This ensures that any secrets contained within that
++	  memory (e.g., private keys) cannot be found by other guests that
++	  may be running on the machine. Most people will want to say Y here.
++	  If security is not a concern then you may increase performance by
++	  saying N.
++
++config XEN_DISABLE_SERIAL
++	bool "Disable serial port drivers"
++	default y
++	help
++	  Disable serial port drivers, allowing the Xen console driver
++	  to provide a serial console at ttyS0.
++
++endmenu
++
++config HAVE_ARCH_ALLOC_SKB
++	bool
++	default y
++
++config HAVE_ARCH_DEV_ALLOC_SKB
++	bool
++	default y
++
++endif
+diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
+new file mode 100644
+index 0000000..657e999
+--- /dev/null
++++ b/drivers/xen/Makefile
+@@ -0,0 +1,22 @@
++
++obj-y	+= net_driver_util.o
++obj-y	+= util.o
++
++obj-y	+= core/
++obj-y	+= char/
++obj-y	+= console/
++obj-y	+= evtchn/
++obj-y	+= balloon/
++obj-y	+= privcmd/
++obj-y	+= xenbus/
++
++obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
++obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
++obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmback/
++obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
++obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
++obj-$(CONFIG_XEN_BLKDEV_TAP)    	+= blktap/
++obj-$(CONFIG_XEN_TPMDEV_FRONTEND)	+= tpmfront/
++obj-$(CONFIG_XEN_PCIDEV_BACKEND)	+= pciback/
++obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront/
++
+diff --git a/drivers/xen/balloon/Makefile b/drivers/xen/balloon/Makefile
+new file mode 100644
+index 0000000..0e3a348
+--- /dev/null
++++ b/drivers/xen/balloon/Makefile
+@@ -0,0 +1,2 @@
++
++obj-y += balloon.o
+diff --git a/drivers/xen/balloon/balloon.c b/drivers/xen/balloon/balloon.c
+new file mode 100644
+index 0000000..6a70087
+--- /dev/null
++++ b/drivers/xen/balloon/balloon.c
 @@ -0,0 +1,585 @@
 +/******************************************************************************
 + * balloon.c
@@ -37758,16 +42915,21 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/balloon/Makefile linux-2.6-merge.hg/drivers/xen/balloon/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/balloon/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/balloon/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,2 @@
+diff --git a/drivers/xen/blkback/Makefile b/drivers/xen/blkback/Makefile
+new file mode 100644
+index 0000000..8bab63d
+--- /dev/null
++++ b/drivers/xen/blkback/Makefile
+@@ -0,0 +1,3 @@
++obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkbk.o
 +
-+obj-y += balloon.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/blkback.c linux-2.6-merge.hg/drivers/xen/blkback/blkback.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/blkback.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkback/blkback.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,590 @@
++blkbk-y	:= blkback.o xenbus.o interface.o vbd.o
+diff --git a/drivers/xen/blkback/blkback.c b/drivers/xen/blkback/blkback.c
+new file mode 100644
+index 0000000..d624caf
+--- /dev/null
++++ b/drivers/xen/blkback/blkback.c
+@@ -0,0 +1,596 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/main.c
 + * 
@@ -37799,14 +42961,10 @@
 + * 64 should be enough to keep us competitive with Linux.
 + */
 +static int blkif_reqs = 64;
-+static int mmap_pages;
++module_param_named(reqs, blkif_reqs, int, 0);
++MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate");
 +
-+static int __init set_blkif_reqs(char *str)
-+{
-+	get_option(&str, &blkif_reqs);
-+	return 1;
-+}
-+__setup("blkif_reqs=", set_blkif_reqs);
++static int mmap_pages;
 +
 +/* Run-time switchable: /sys/module/blkback/parameters/ */
 +static unsigned int log_stats = 0;
@@ -38344,10 +43502,20 @@
 +		list_add_tail(&pending_reqs[i].free_list, &pending_free);
 +    
 +	blkif_xenbus_init();
++	__unsafe(THIS_MODULE);
 +	return 0;
 +}
 +
-+__initcall(blkif_init);
++module_init(blkif_init);
++
++static void blkif_exit(void)
++{
++	BUG();
++}
++
++module_exit(blkif_exit);
++
++MODULE_LICENSE("Dual BSD/GPL");
 +
 +/*
 + * Local variables:
@@ -38358,9 +43526,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/common.h linux-2.6-merge.hg/drivers/xen/blkback/common.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/common.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkback/common.h	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blkback/common.h b/drivers/xen/blkback/common.h
+new file mode 100644
+index 0000000..aab5a9f
+--- /dev/null
++++ b/drivers/xen/blkback/common.h
 @@ -0,0 +1,123 @@
 +
 +#ifndef __BLKIF__BACKEND__COMMON_H__
@@ -38485,9 +43655,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/interface.c linux-2.6-merge.hg/drivers/xen/blkback/interface.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/interface.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkback/interface.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blkback/interface.c b/drivers/xen/blkback/interface.c
+new file mode 100644
+index 0000000..090d107
+--- /dev/null
++++ b/drivers/xen/blkback/interface.c
 @@ -0,0 +1,164 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/interface.c
@@ -38653,15 +43825,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/Makefile linux-2.6-merge.hg/drivers/xen/blkback/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkback/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,2 @@
-+
-+obj-y	:= blkback.o xenbus.o interface.o vbd.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/vbd.c linux-2.6-merge.hg/drivers/xen/blkback/vbd.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/vbd.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkback/vbd.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blkback/vbd.c b/drivers/xen/blkback/vbd.c
+new file mode 100644
+index 0000000..b2d0939
+--- /dev/null
++++ b/drivers/xen/blkback/vbd.c
 @@ -0,0 +1,102 @@
 +/******************************************************************************
 + * blkback/vbd.c
@@ -38765,9 +43933,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/xenbus.c linux-2.6-merge.hg/drivers/xen/blkback/xenbus.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkback/xenbus.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkback/xenbus.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blkback/xenbus.c b/drivers/xen/blkback/xenbus.c
+new file mode 100644
+index 0000000..b1934d1
+--- /dev/null
++++ b/drivers/xen/blkback/xenbus.c
 @@ -0,0 +1,421 @@
 +/*  Xenbus code for blkif backend
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
@@ -39190,10 +44360,35 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/blkfront.c linux-2.6-merge.hg/drivers/xen/blkfront/blkfront.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/blkfront.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkfront/blkfront.c	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,834 @@
+diff --git a/drivers/xen/blkfront/Kconfig b/drivers/xen/blkfront/Kconfig
+new file mode 100644
+index 0000000..edde837
+--- /dev/null
++++ b/drivers/xen/blkfront/Kconfig
+@@ -0,0 +1,6 @@
++
++config XENBLOCK
++	tristate "Block device driver"
++	depends on ARCH_XEN
++	help
++	  Block device driver for Xen
+diff --git a/drivers/xen/blkfront/Makefile b/drivers/xen/blkfront/Makefile
+new file mode 100644
+index 0000000..182ef65
+--- /dev/null
++++ b/drivers/xen/blkfront/Makefile
+@@ -0,0 +1,5 @@
++
++obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	:= xenblk.o
++
++xenblk-objs := blkfront.o vbd.o
++
+diff --git a/drivers/xen/blkfront/blkfront.c b/drivers/xen/blkfront/blkfront.c
+new file mode 100644
+index 0000000..c8c9dec
+--- /dev/null
++++ b/drivers/xen/blkfront/blkfront.c
+@@ -0,0 +1,831 @@
 +/******************************************************************************
 + * blkfront.c
 + * 
@@ -39378,9 +44573,8 @@
 +	}
 +
 +	err = xenbus_switch_state(dev, xbt, XenbusStateInitialised);
-+	if (err) {
++	if (err)
 +		goto abort_transaction;
-+	}
 +
 +	err = xenbus_transaction_end(xbt, 0);
 +	if (err) {
@@ -39491,17 +44685,17 @@
 +/* ** Connection ** */
 +
 +
-+/* 
-+** Invoked when the backend is finally 'ready' (and has told produced 
-+** the details about the physical device - #sectors, size, etc). 
-+*/
++/*
++ * Invoked when the backend is finally 'ready' (and has told produced
++ * the details about the physical device - #sectors, size, etc).
++ */
 +static void connect(struct blkfront_info *info)
 +{
 +	unsigned long sectors, sector_size;
 +	unsigned int binfo;
 +	int err;
 +
-+        if( (info->connected == BLKIF_STATE_CONNECTED) || 
++	if ((info->connected == BLKIF_STATE_CONNECTED) ||
 +	    (info->connected == BLKIF_STATE_SUSPENDED) )
 +		return;
 +
@@ -39526,7 +44720,7 @@
 +		return;
 +	}
 +
-+	(void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected); 
++	(void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected);
 +
 +	/* Kick pending requests. */
 +	spin_lock_irq(&blkif_io_lock);
@@ -39659,8 +44853,7 @@
 +	DPRINTK_IOCTL("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n",
 +		      command, (long)argument, inode->i_rdev);
 +
-+	switch ( command )
-+	{
++	switch (command) {
 +	case HDIO_GETGEO:
 +		/* return ENOSYS to use defaults */
 +		return -ENOSYS;
@@ -39686,7 +44879,7 @@
 + * blkif_queue_request
 + *
 + * request block io
-+ * 
++ *
 + * id: for guest use only.
 + * operation: BLKIF_OP_{READ,WRITE,PROBE}
 + * buffer: buffer to read/write into. this should be a
@@ -39753,7 +44946,7 @@
 +			ring_req->seg[ring_req->nr_segments] =
 +				(struct blkif_request_segment) {
 +					.gref       = ref,
-+					.first_sect = fsect, 
++					.first_sect = fsect,
 +					.last_sect  = lsect };
 +
 +			ring_req->nr_segments++;
@@ -39875,9 +45068,8 @@
 +		RING_FINAL_CHECK_FOR_RESPONSES(&info->ring, more_to_do);
 +		if (more_to_do)
 +			goto again;
-+	} else {
++	} else
 +		info->ring.sring->rsp_event = i + 1;
-+	}
 +
 +	kick_pending_request_queues(info);
 +
@@ -39890,8 +45082,8 @@
 +{
 +	/* Prevent new requests being issued until we fix things up. */
 +	spin_lock_irq(&blkif_io_lock);
-+	info->connected = suspend ? 
-+		BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; 
++	info->connected = suspend ?
++		BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED;
 +	spin_unlock_irq(&blkif_io_lock);
 +
 +	/* Free resources associated with old device channel. */
@@ -39902,7 +45094,7 @@
 +		info->ring.sring = NULL;
 +	}
 +	if (info->irq)
-+		unbind_from_irqhandler(info->irq, info); 
++		unbind_from_irqhandler(info->irq, info);
 +	info->evtchn = info->irq = 0;
 +
 +}
@@ -39963,11 +45155,11 @@
 +
 +	kfree(copy);
 +
-+	(void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected); 
-+	
++	(void)xenbus_switch_state(info->xbdev, XBT_NULL, XenbusStateConnected);
++
 +	/* Now safe for us to use the shared ring */
 +	spin_lock_irq(&blkif_io_lock);
-+        info->connected = BLKIF_STATE_CONNECTED;
++	info->connected = BLKIF_STATE_CONNECTED;
 +	spin_unlock_irq(&blkif_io_lock);
 +
 +	/* Send off requeued requests */
@@ -40028,9 +45220,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/block.h linux-2.6-merge.hg/drivers/xen/blkfront/block.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/block.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkfront/block.h	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blkfront/block.h b/drivers/xen/blkfront/block.h
+new file mode 100644
+index 0000000..ecede04
+--- /dev/null
++++ b/drivers/xen/blkfront/block.h
 @@ -0,0 +1,162 @@
 +/******************************************************************************
 + * block.h
@@ -40089,24 +45283,24 @@
 +#include <asm/atomic.h>
 +#include <asm/uaccess.h>
 +
-+#if 1 
++#if 1
 +#define IPRINTK(fmt, args...) \
 +    printk(KERN_INFO "xen_blk: " fmt, ##args)
 +#else
 +#define IPRINTK(fmt, args...) ((void)0)
 +#endif
 +
-+#if 1 
++#if 1
 +#define WPRINTK(fmt, args...) \
 +    printk(KERN_WARNING "xen_blk: " fmt, ##args)
 +#else
 +#define WPRINTK(fmt, args...) ((void)0)
 +#endif
-+ 
-+#define DPRINTK(_f, _a...) pr_debug ( _f , ## _a )
++
++#define DPRINTK(_f, _a...) pr_debug(_f, ## _a)
 +
 +#if 0
-+#define DPRINTK_IOCTL(_f, _a...) printk ( KERN_ALERT _f , ## _a )
++#define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a)
 +#else
 +#define DPRINTK_IOCTL(_f, _a...) ((void)0)
 +#endif
@@ -40173,7 +45367,7 @@
 +                       unsigned command, unsigned long argument);
 +extern int blkif_check(dev_t dev);
 +extern int blkif_revalidate(dev_t dev);
-+extern void do_blkif_request (request_queue_t *rq); 
++extern void do_blkif_request (request_queue_t *rq);
 +
 +/* Virtual block-device subsystem. */
 +/* Note that xlvbd_add doesn't call add_disk for you: you're expected
@@ -40194,28 +45388,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/Kconfig linux-2.6-merge.hg/drivers/xen/blkfront/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/Kconfig	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkfront/Kconfig	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,6 @@
-+
-+config XENBLOCK
-+	tristate "Block device driver"
-+	depends on ARCH_XEN
-+	help
-+	  Block device driver for Xen
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/Makefile linux-2.6-merge.hg/drivers/xen/blkfront/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkfront/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,5 @@
-+
-+obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	:= xenblk.o
-+
-+xenblk-objs := blkfront.o vbd.o
-+
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/vbd.c linux-2.6-merge.hg/drivers/xen/blkfront/vbd.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blkfront/vbd.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blkfront/vbd.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blkfront/vbd.c b/drivers/xen/blkfront/vbd.c
+new file mode 100644
+index 0000000..d97f798
+--- /dev/null
++++ b/drivers/xen/blkfront/vbd.c
 @@ -0,0 +1,323 @@
 +/******************************************************************************
 + * vbd.c
@@ -40540,9 +45717,20 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/blktap.c linux-2.6-merge.hg/drivers/xen/blktap/blktap.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/blktap.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blktap/blktap.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blktap/Makefile b/drivers/xen/blktap/Makefile
+new file mode 100644
+index 0000000..822b35f
+--- /dev/null
++++ b/drivers/xen/blktap/Makefile
+@@ -0,0 +1,3 @@
++
++obj-y	:= xenbus.o interface.o blktap.o 
++
+diff --git a/drivers/xen/blktap/blktap.c b/drivers/xen/blktap/blktap.c
+new file mode 100644
+index 0000000..2442cea
+--- /dev/null
++++ b/drivers/xen/blktap/blktap.c
 @@ -0,0 +1,910 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/blktap/blktap.c
@@ -41454,9 +46642,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/common.h linux-2.6-merge.hg/drivers/xen/blktap/common.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/common.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blktap/common.h	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blktap/common.h b/drivers/xen/blktap/common.h
+new file mode 100644
+index 0000000..c261822
+--- /dev/null
++++ b/drivers/xen/blktap/common.h
 @@ -0,0 +1,110 @@
 +
 +#ifndef __BLKIF__BACKEND__COMMON_H__
@@ -41568,9 +46758,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/interface.c linux-2.6-merge.hg/drivers/xen/blktap/interface.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/interface.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blktap/interface.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blktap/interface.c b/drivers/xen/blktap/interface.c
+new file mode 100644
+index 0000000..99cb7bf
+--- /dev/null
++++ b/drivers/xen/blktap/interface.c
 @@ -0,0 +1,146 @@
 +/******************************************************************************
 + * arch/xen/drivers/blkif/backend/interface.c
@@ -41718,16 +46910,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/Makefile linux-2.6-merge.hg/drivers/xen/blktap/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blktap/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,3 @@
-+
-+obj-y	:= xenbus.o interface.o blktap.o 
-+
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/xenbus.c linux-2.6-merge.hg/drivers/xen/blktap/xenbus.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/blktap/xenbus.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/blktap/xenbus.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/blktap/xenbus.c b/drivers/xen/blktap/xenbus.c
+new file mode 100644
+index 0000000..3dc9167
+--- /dev/null
++++ b/drivers/xen/blktap/xenbus.c
 @@ -0,0 +1,234 @@
 +/*  Xenbus code for blkif tap
 +
@@ -41963,16 +47150,20 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/char/Makefile linux-2.6-merge.hg/drivers/xen/char/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/char/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/char/Makefile	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/char/Makefile b/drivers/xen/char/Makefile
+new file mode 100644
+index 0000000..c73925e
+--- /dev/null
++++ b/drivers/xen/char/Makefile
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= mem.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/char/mem.c linux-2.6-merge.hg/drivers/xen/char/mem.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/char/mem.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/char/mem.c	2006-02-18 12:03:38.000000000 +0000
-@@ -0,0 +1,156 @@
+diff --git a/drivers/xen/char/mem.c b/drivers/xen/char/mem.c
+new file mode 100644
+index 0000000..61d7991
+--- /dev/null
++++ b/drivers/xen/char/mem.c
+@@ -0,0 +1,192 @@
 +/*
 + *  Originally from linux/drivers/char/mem.c
 + *
@@ -42018,49 +47209,85 @@
 +static ssize_t read_mem(struct file * file, char __user * buf,
 +			size_t count, loff_t *ppos)
 +{
-+	unsigned long i, p = *ppos;
-+	ssize_t read = -EFAULT;
++	unsigned long p = *ppos, ignored;
++	ssize_t read = 0, sz;
 +	void __iomem *v;
 +
-+	if ((v = ioremap(p, count)) == NULL) {
++	while (count > 0) {
 +		/*
-+		 * Some programs (e.g., dmidecode) groove off into weird RAM
-+		 * areas where no table scan possibly exist (because Xen will
-+		 * have stomped on them!). These programs get rather upset if
-+                 * we let them know that Xen failed their access, so we fake
-+                 * out a read of all zeroes. :-)
++		 * Handle first page in case it's not aligned
 +		 */
-+		for (i = 0; i < count; i++)
-+			if (put_user(0, buf+i))
++		if (-p & (PAGE_SIZE - 1))
++			sz = -p & (PAGE_SIZE - 1);
++		else
++			sz = PAGE_SIZE;
++
++		sz = min_t(unsigned long, sz, count);
++
++		if ((v = ioremap(p, sz)) == NULL) {
++			/*
++			 * Some programs (e.g., dmidecode) groove off into weird RAM
++			 * areas where no tables can possibly exist (because Xen will
++			 * have stomped on them!). These programs get rather upset if
++			 * we let them know that Xen failed their access, so we fake
++			 * out a read of all zeroes. :-)
++			 */
++			if (clear_user(buf, count))
 +				return -EFAULT;
-+		return count;
++			read += count;
++			break;
++		}
++
++		ignored = copy_to_user(buf, v, sz);
++		iounmap(v);
++		if (ignored)
++			return -EFAULT;
++		buf += sz;
++		p += sz;
++		count -= sz;
++		read += sz;
 +	}
-+	if (copy_to_user(buf, v, count))
-+		goto out;
 +
-+	read = count;
 +	*ppos += read;
-+out:
-+	iounmap(v);
 +	return read;
 +}
 +
 +static ssize_t write_mem(struct file * file, const char __user * buf, 
 +			 size_t count, loff_t *ppos)
 +{
-+	unsigned long p = *ppos;
-+	ssize_t written = -EFAULT;
++	unsigned long p = *ppos, ignored;
++	ssize_t written = 0, sz;
 +	void __iomem *v;
 +
-+	if ((v = ioremap(p, count)) == NULL)
-+		return -EFAULT;
-+	if (copy_from_user(v, buf, count))
-+		goto out;
++	while (count > 0) {
++		/*
++		 * Handle first page in case it's not aligned
++		 */
++		if (-p & (PAGE_SIZE - 1))
++			sz = -p & (PAGE_SIZE - 1);
++		else
++			sz = PAGE_SIZE;
++
++		sz = min_t(unsigned long, sz, count);
++
++		if ((v = ioremap(p, sz)) == NULL)
++			break;
++
++		ignored = copy_from_user(v, buf, sz);
++		iounmap(v);
++		if (ignored) {
++			written += sz - ignored;
++			if (written)
++				break;
++			return -EFAULT;
++		}
++		buf += sz;
++		p += sz;
++		count -= sz;
++		written += sz;
++	}
 +
-+	written = count;
 +	*ppos += written;
-+out:
-+	iounmap(v);
 +	return written;
 +}
 +
@@ -42129,10 +47356,20 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/console/console.c linux-2.6-merge.hg/drivers/xen/console/console.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/console/console.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/console/console.c	2006-02-18 12:03:38.000000000 +0000
-@@ -0,0 +1,647 @@
+diff --git a/drivers/xen/console/Makefile b/drivers/xen/console/Makefile
+new file mode 100644
+index 0000000..35de3e9
+--- /dev/null
++++ b/drivers/xen/console/Makefile
+@@ -0,0 +1,2 @@
++
++obj-y	:= console.o xencons_ring.o
+diff --git a/drivers/xen/console/console.c b/drivers/xen/console/console.c
+new file mode 100644
+index 0000000..ae8255c
+--- /dev/null
++++ b/drivers/xen/console/console.c
+@@ -0,0 +1,643 @@
 +/******************************************************************************
 + * console.c
 + * 
@@ -42220,8 +47457,7 @@
 +	else if (!strncmp(str, "off", 3))
 +		xc_mode = XC_OFF;
 +
-+	switch ( xc_mode )
-+	{
++	switch (xc_mode) {
 +	case XC_SERIAL:
 +		n = simple_strtol(str+4, &q, 10);
 +		if (q > (str + 4))
@@ -42362,7 +47598,7 @@
 +	va_list args;
 +	int printk_len;
 +	static char printk_buf[1024];
-+    
++
 +	/* Emit the output into the temporary buffer */
 +	va_start(args, fmt);
 +	printk_len = vsnprintf(printk_buf, sizeof(printk_buf), fmt, args);
@@ -42620,7 +47856,7 @@
 +
 +	spin_lock_irqsave(&xencons_lock, flags);
 +	__xencons_tx_flush();
-+	spin_unlock_irqrestore(&xencons_lock, flags);    
++	spin_unlock_irqrestore(&xencons_lock, flags);
 +}
 +
 +static void xencons_wait_until_sent(struct tty_struct *tty, int timeout)
@@ -42630,17 +47866,15 @@
 +	if (TTY_INDEX(tty) != 0)
 +		return;
 +
-+	while (DRV(tty->driver)->chars_in_buffer(tty))
-+	{
++	while (DRV(tty->driver)->chars_in_buffer(tty)) {
 +		set_current_state(TASK_INTERRUPTIBLE);
 +		schedule_timeout(1);
 +		if (signal_pending(current))
 +			break;
-+		if ( (timeout != 0) &&
-+		     time_after(jiffies, orig_jiffies + timeout) )
++		if (timeout && time_after(jiffies, orig_jiffies + timeout))
 +			break;
 +	}
-+    
++
 +	set_current_state(TASK_RUNNING);
 +}
 +
@@ -42656,7 +47890,7 @@
 +	if (xencons_tty == NULL)
 +		xencons_tty = tty;
 +	__xencons_tx_flush();
-+	spin_unlock_irqrestore(&xencons_lock, flags);    
++	spin_unlock_irqrestore(&xencons_lock, flags);
 +
 +	return 0;
 +}
@@ -42678,7 +47912,7 @@
 +		tty->closing = 0;
 +		spin_lock_irqsave(&xencons_lock, flags);
 +		xencons_tty = NULL;
-+		spin_unlock_irqrestore(&xencons_lock, flags);    
++		spin_unlock_irqrestore(&xencons_lock, flags);
 +	}
 +}
 +
@@ -42709,7 +47943,7 @@
 +
 +	xencons_ring_init();
 +
-+	xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ? 
++	xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
 +					  1 : MAX_NR_CONSOLES);
 +	if (xencons_driver == NULL)
 +		return -ENOMEM;
@@ -42719,15 +47953,14 @@
 +	DRV(xencons_driver)->type            = TTY_DRIVER_TYPE_SERIAL;
 +	DRV(xencons_driver)->subtype         = SERIAL_TYPE_NORMAL;
 +	DRV(xencons_driver)->init_termios    = tty_std_termios;
-+	DRV(xencons_driver)->flags           = 
++	DRV(xencons_driver)->flags           =
 +		TTY_DRIVER_REAL_RAW |
 +		TTY_DRIVER_RESET_TERMIOS |
 +		TTY_DRIVER_NO_DEVFS;
 +	DRV(xencons_driver)->termios         = xencons_termios;
 +	DRV(xencons_driver)->termios_locked  = xencons_termios_locked;
 +
-+	if (xc_mode == XC_SERIAL)
-+	{
++	if (xc_mode == XC_SERIAL) {
 +		DRV(xencons_driver)->name        = "ttyS";
 +		DRV(xencons_driver)->minor_start = 64 + xc_num;
 +		DRV(xencons_driver)->name_base   = 0 + xc_num;
@@ -42765,7 +47998,7 @@
 +	printk("Xen virtual console successfully installed as %s%d\n",
 +	       DRV(xencons_driver)->name,
 +	       DRV(xencons_driver)->name_base );
-+    
++
 +	return 0;
 +}
 +
@@ -42780,15 +48013,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/console/Makefile linux-2.6-merge.hg/drivers/xen/console/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/console/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/console/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,2 @@
-+
-+obj-y	:= console.o xencons_ring.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/console/xencons_ring.c linux-2.6-merge.hg/drivers/xen/console/xencons_ring.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/console/xencons_ring.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/console/xencons_ring.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/console/xencons_ring.c b/drivers/xen/console/xencons_ring.c
+new file mode 100644
+index 0000000..8abb0a4
+--- /dev/null
++++ b/drivers/xen/console/xencons_ring.c
 @@ -0,0 +1,125 @@
 +#include <linux/version.h>
 +#include <linux/module.h>
@@ -42847,7 +48076,7 @@
 +	notify_daemon();
 +
 +	return sent;
-+}	
++}
 +
 +static irqreturn_t handle_input(int irq, void *unused, struct pt_regs *regs)
 +{
@@ -42915,10 +48144,27 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/evtchn.c linux-2.6-merge.hg/drivers/xen/core/evtchn.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/evtchn.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/evtchn.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,823 @@
+diff --git a/drivers/xen/core/Makefile b/drivers/xen/core/Makefile
+new file mode 100644
+index 0000000..1d57a5b
+--- /dev/null
++++ b/drivers/xen/core/Makefile
+@@ -0,0 +1,9 @@
++#
++# Makefile for the linux kernel.
++#
++
++obj-y   := evtchn.o reboot.o gnttab.o features.o
++
++obj-$(CONFIG_PROC_FS) += xen_proc.o
++obj-$(CONFIG_NET)     += skbuff.o
++obj-$(CONFIG_SMP)     += smpboot.o
+diff --git a/drivers/xen/core/evtchn.c b/drivers/xen/core/evtchn.c
+new file mode 100644
+index 0000000..58f08c6
+--- /dev/null
++++ b/drivers/xen/core/evtchn.c
+@@ -0,0 +1,822 @@
 +/******************************************************************************
 + * evtchn.c
 + * 
@@ -42993,7 +48239,7 @@
 +
 +/* IRQ <-> IPI mapping. */
 +#ifndef NR_IPIS
-+#define NR_IPIS 1 
++#define NR_IPIS 1
 +#endif
 +DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
 +
@@ -43130,7 +48376,7 @@
 +	irq_bindcount[irq]++;
 +
 +	spin_unlock(&irq_mapping_update_lock);
-+    
++
 +	return irq;
 +}
 +
@@ -43159,7 +48405,7 @@
 +	irq_bindcount[irq]++;
 +
 +	spin_unlock(&irq_mapping_update_lock);
-+    
++
 +	return irq;
 +}
 +
@@ -43456,9 +48702,9 @@
 +	/* NB. We are happy to share unless we are probing. */
 +	op.u.bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
 +	if (HYPERVISOR_event_channel_op(&op) != 0) {
-+		if ( !probing_irq(irq) )
-+			printk(KERN_INFO "Failed to obtain physical "
-+			       "IRQ %d\n", irq);
++		if (!probing_irq(irq))
++			printk(KERN_INFO "Failed to obtain physical IRQ %d\n",
++			       irq);
 +		return 0;
 +	}
 +	evtchn = op.u.bind_pirq.port;
@@ -43590,7 +48836,7 @@
 +	 * like a real IO-APIC we 'lose the interrupt edge' if the channel is
 +	 * masked.
 +	 */
-+	if (synch_test_bit(port, &s->evtchn_pending[0]) && 
++	if (synch_test_bit(port, &s->evtchn_pending[0]) &&
 +	    !synch_test_and_set_bit(port / BITS_PER_LONG,
 +				    &vcpu_info->evtchn_pending_sel)) {
 +		vcpu_info->evtchn_upcall_pending = 1;
@@ -43643,7 +48889,7 @@
 +		op.u.bind_virq.vcpu = 0;
 +		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
 +		evtchn = op.u.bind_virq.port;
-+        
++
 +		/* Record the new mapping. */
 +		evtchn_to_irq[evtchn] = irq;
 +		irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
@@ -43665,7 +48911,7 @@
 +		op.u.bind_ipi.vcpu = 0;
 +		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
 +		evtchn = op.u.bind_ipi.port;
-+        
++
 +		/* Record the new mapping. */
 +		evtchn_to_irq[evtchn] = irq;
 +		irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn);
@@ -43715,8 +48961,7 @@
 +	}
 +
 +	/* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */
-+	for (i = 0; i < NR_PIRQS; i++)
-+	{
++	for (i = 0; i < NR_PIRQS; i++) {
 +		irq_bindcount[pirq_to_irq(i)] = 1;
 +
 +#ifdef RTC_IRQ
@@ -43742,9 +48987,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/features.c linux-2.6-merge.hg/drivers/xen/core/features.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/features.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/features.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/core/features.c b/drivers/xen/core/features.c
+new file mode 100644
+index 0000000..297d13f
+--- /dev/null
++++ b/drivers/xen/core/features.c
 @@ -0,0 +1,29 @@
 +/******************************************************************************
 + * features.c
@@ -43767,7 +49014,7 @@
 +	xen_feature_info_t fi;
 +	int i, j;
 +
-+	for (i=0; i<XENFEAT_NR_SUBMAPS; i++) {
++	for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) {
 +		fi.submap_idx = i;
 +		if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
 +			break;
@@ -43775,10 +49022,12 @@
 +			xen_features[i*32+j] = !!(fi.submap & 1<<j);
 +	}
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/gnttab.c linux-2.6-merge.hg/drivers/xen/core/gnttab.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/gnttab.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/gnttab.c	2006-02-27 15:49:41.000000000 +0000
-@@ -0,0 +1,429 @@
+diff --git a/drivers/xen/core/gnttab.c b/drivers/xen/core/gnttab.c
+new file mode 100644
+index 0000000..0f1a295
+--- /dev/null
++++ b/drivers/xen/core/gnttab.c
+@@ -0,0 +1,426 @@
 +/******************************************************************************
 + * gnttab.c
 + * 
@@ -43816,13 +49065,12 @@
 +#include <xen/interface/xen.h>
 +#include <asm/fixmap.h>
 +#include <asm/uaccess.h>
-+#include <xen/public/privcmd.h>
 +#include <xen/gnttab.h>
 +#include <asm/synch_bitops.h>
 +
 +#if 1
 +#define ASSERT(_p)							      \
-+	if ( !(_p) ) { printk(KERN_ALERT"Assertion '%s': line %d, file %s\n", \
++	if (!(_p)) { printk(KERN_ALERT"Assertion '%s': line %d, file %s\n",   \
 +	#_p , __LINE__, __FILE__); *(int*)0=0; }
 +#else
 +#define ASSERT(_p) ((void)0)
@@ -43934,7 +49182,7 @@
 +gnttab_grant_foreign_access(domid_t domid, unsigned long frame, int readonly)
 +{
 +	int ref;
-+    
++
 +	if (unlikely((ref = get_free_entry()) == -1))
 +		return -ENOSPC;
 +
@@ -43974,13 +49222,12 @@
 +
 +	nflags = shared[ref].flags;
 +	do {
-+		if ( (flags = nflags) & (GTF_reading|GTF_writing) ) {
++		if ((flags = nflags) & (GTF_reading|GTF_writing)) {
 +			printk(KERN_ALERT "WARNING: g.e. still in use!\n");
 +			return 0;
 +		}
-+	}
-+	while ((nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) !=
-+	       flags);
++	} while ((nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) !=
++		 flags);
 +
 +	return 1;
 +}
@@ -43993,8 +49240,7 @@
 +		if (page != 0) {
 +			free_page(page);
 +		}
-+	}
-+	else {
++	} else {
 +		/* XXX This needs to be fixed so that the ref and page are
 +		   placed on a list to be freed up later. */
 +		printk(KERN_WARNING
@@ -44035,7 +49281,7 @@
 +         * reference and return failure (== 0).
 +         */
 +	while (!((flags = shared[ref].flags) & GTF_transfer_committed)) {
-+		if ( synch_cmpxchg(&shared[ref].flags, flags, 0) == flags )
++		if (synch_cmpxchg(&shared[ref].flags, flags, 0) == flags)
 +			return 0;
 +		cpu_relax();
 +	}
@@ -44208,23 +49454,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/Makefile linux-2.6-merge.hg/drivers/xen/core/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,9 @@
-+#
-+# Makefile for the linux kernel.
-+#
-+
-+obj-y   := evtchn.o reboot.o gnttab.o features.o
-+
-+obj-$(CONFIG_PROC_FS) += xen_proc.o
-+obj-$(CONFIG_NET)     += skbuff.o
-+obj-$(CONFIG_SMP)     += smpboot.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/reboot.c linux-2.6-merge.hg/drivers/xen/core/reboot.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/reboot.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/reboot.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,442 @@
+diff --git a/drivers/xen/core/reboot.c b/drivers/xen/core/reboot.c
+new file mode 100644
+index 0000000..1fa1f56
+--- /dev/null
++++ b/drivers/xen/core/reboot.c
+@@ -0,0 +1,441 @@
 +#define __KERNEL_SYSCALLS__
 +#include <linux/version.h>
 +#include <linux/kernel.h>
@@ -44256,10 +49491,11 @@
 +#define SHUTDOWN_POWEROFF  0
 +#define SHUTDOWN_REBOOT    1
 +#define SHUTDOWN_SUSPEND   2
-+// Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only
-+// report a crash, not be instructed to crash!
-+// HALT is the same as POWEROFF, as far as we're concerned.  The tools use
-+// the distinction when we return the reason code to them.
++/* Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only
++ * report a crash, not be instructed to crash!
++ * HALT is the same as POWEROFF, as far as we're concerned.  The tools use
++ * the distinction when we return the reason code to them.
++ */
 +#define SHUTDOWN_HALT      4
 +
 +void machine_emergency_restart(void)
@@ -44311,14 +49547,14 @@
 +{
 +	int i, j, k, fpp;
 +
-+	extern int gnttab_suspend(void);
-+	extern int gnttab_resume(void);
-+
-+	extern void time_resume(void);
 +	extern unsigned long max_pfn;
 +	extern unsigned long *pfn_to_mfn_frame_list_list;
 +	extern unsigned long *pfn_to_mfn_frame_list[];
 +
++	extern int gnttab_suspend(void);
++	extern int gnttab_resume(void);
++	extern void time_resume(void);
++
 +#ifdef CONFIG_SMP
 +	cpumask_t prev_online_cpus;
 +	int vcpu_prepare(int vcpu);
@@ -44394,26 +49630,26 @@
 +	 */
 +	HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
 +
-+	shutting_down = SHUTDOWN_INVALID; 
++	shutting_down = SHUTDOWN_INVALID;
 +
 +	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, PAGE_SIZE);
-+	     
++
 +	HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
 +		virt_to_mfn(pfn_to_mfn_frame_list_list);
-+  
++
 +	fpp = PAGE_SIZE/sizeof(unsigned long);
 +	for (i = 0, j = 0, k = -1; i < max_pfn; i += fpp, j++) {
 +		if ((j % fpp) == 0) {
 +			k++;
-+			pfn_to_mfn_frame_list_list[k] = 
++			pfn_to_mfn_frame_list_list[k] =
 +				virt_to_mfn(pfn_to_mfn_frame_list[k]);
 +			j = 0;
 +		}
-+		pfn_to_mfn_frame_list[k][j] = 
++		pfn_to_mfn_frame_list[k][j] =
 +			virt_to_mfn(&phys_to_machine_mapping[i]);
 +	}
 +	HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
@@ -44434,7 +49670,7 @@
 +
 +#endif
 +
-+	/* 
++	/*
 +	 * Only resume xenbus /after/ we've prepared our VCPUs; otherwise
 +	 * the VCPU hotplug callback can race with our vcpu_prepare
 +	 */
@@ -44458,7 +49694,7 @@
 +
 +static int shutdown_process(void *__unused)
 +{
-+	static char *envp[] = { "HOME=/", "TERM=linux", 
++	static char *envp[] = { "HOME=/", "TERM=linux",
 +				"PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
 +	static char *restart_argv[]  = { "/sbin/reboot", NULL };
 +	static char *poweroff_argv[] = { "/sbin/poweroff", NULL };
@@ -44518,7 +49754,7 @@
 +	else
 +		err = kthread_create_on_cpu(__do_suspend, NULL, "suspend", 0);
 +
-+	if ( err < 0 ) {
++	if (err < 0) {
 +		printk(KERN_WARNING "Error creating shutdown process (%d): "
 +		       "retrying...\n", -err);
 +		schedule_delayed_work(&shutdown_work, HZ/2);
@@ -44633,14 +49869,12 @@
 +	err2 = register_xenbus_watch(&sysrq_watch);
 +#endif
 +
-+	if (err1) {
++	if (err1)
 +		printk(KERN_ERR "Failed to set shutdown watcher\n");
-+	}
-+    
++
 +#ifdef CONFIG_MAGIC_SYSRQ
-+	if (err2) {
++	if (err2)
 +		printk(KERN_ERR "Failed to set sysrq watcher\n");
-+	}
 +#endif
 +
 +	return NOTIFY_DONE;
@@ -44648,11 +49882,11 @@
 +
 +static int __init setup_shutdown_event(void)
 +{
-+    
++
 +	xenstore_notifier.notifier_call = setup_shutdown_watcher;
 +
 +	register_xenstore_notifier(&xenstore_notifier);
-+    
++
 +	return 0;
 +}
 +
@@ -44667,10 +49901,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/skbuff.c linux-2.6-merge.hg/drivers/xen/core/skbuff.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/skbuff.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/skbuff.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,143 @@
+diff --git a/drivers/xen/core/skbuff.c b/drivers/xen/core/skbuff.c
+new file mode 100644
+index 0000000..c12362d
+--- /dev/null
++++ b/drivers/xen/core/skbuff.c
+@@ -0,0 +1,144 @@
 +
 +#include <linux/config.h>
 +#include <linux/module.h>
@@ -44689,6 +49925,7 @@
 +
 +/* Referenced in netback.c. */
 +/*static*/ kmem_cache_t *skbuff_cachep;
++EXPORT_SYMBOL(skbuff_cachep);
 +
 +#define MAX_SKBUFF_ORDER 4
 +static kmem_cache_t *skbuff_order_cachep[MAX_SKBUFF_ORDER + 1];
@@ -44814,9 +50051,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/smpboot.c linux-2.6-merge.hg/drivers/xen/core/smpboot.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/smpboot.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/smpboot.c	2006-02-27 15:49:41.000000000 +0000
+diff --git a/drivers/xen/core/smpboot.c b/drivers/xen/core/smpboot.c
+new file mode 100644
+index 0000000..a8a3b05
+--- /dev/null
++++ b/drivers/xen/core/smpboot.c
 @@ -0,0 +1,464 @@
 +/*
 + *	Xen SMP booting functions
@@ -45282,9 +50521,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/xen_proc.c linux-2.6-merge.hg/drivers/xen/core/xen_proc.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/core/xen_proc.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/core/xen_proc.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/core/xen_proc.c b/drivers/xen/core/xen_proc.c
+new file mode 100644
+index 0000000..c5a8c14
+--- /dev/null
++++ b/drivers/xen/core/xen_proc.c
 @@ -0,0 +1,29 @@
 +
 +#include <linux/config.h>
@@ -45315,9 +50556,19 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/evtchn/evtchn.c linux-2.6-merge.hg/drivers/xen/evtchn/evtchn.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/evtchn/evtchn.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/evtchn/evtchn.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/evtchn/Makefile b/drivers/xen/evtchn/Makefile
+new file mode 100644
+index 0000000..7b082a0
+--- /dev/null
++++ b/drivers/xen/evtchn/Makefile
+@@ -0,0 +1,2 @@
++
++obj-y	:= evtchn.o
+diff --git a/drivers/xen/evtchn/evtchn.c b/drivers/xen/evtchn/evtchn.c
+new file mode 100644
+index 0000000..7222429
+--- /dev/null
++++ b/drivers/xen/evtchn/evtchn.c
 @@ -0,0 +1,459 @@
 +/******************************************************************************
 + * evtchn.c
@@ -45778,237 +51029,95 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/evtchn/Makefile linux-2.6-merge.hg/drivers/xen/evtchn/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/evtchn/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/evtchn/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,2 @@
-+
-+obj-y	:= evtchn.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/Kconfig linux-2.6-merge.hg/drivers/xen/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/Kconfig	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/Kconfig	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,192 @@
-+#
-+# This Kconfig describe xen options
-+#
-+
-+mainmenu "Xen Configuration"
-+
-+config XEN
-+	bool
-+	default y if X86_XEN || X86_64_XEN
-+	help
-+	  This is the Linux Xen port.
-+
-+config NO_IDLE_HZ
-+	bool
-+	depends on XEN
-+	default y
-+
-+if XEN
-+menu "XEN"
-+
-+config XEN_PRIVILEGED_GUEST
-+	bool "Privileged Guest (domain 0)"
-+	depends XEN
-+	default n
-+	help
-+	  Support for privileged operation (domain 0)
-+
-+config XEN_UNPRIVILEGED_GUEST
-+	bool
-+	default !XEN_PRIVILEGED_GUEST
-+
-+config XEN_PCIDEV_BACKEND
-+	bool "PCI device backend driver"
-+	select PCI
-+	default y if XEN_PRIVILEGED_GUEST
-+	help
-+	  The PCI device backend driver allows the kernel to export arbitrary
-+	  PCI devices to other guests.
-+
-+choice
-+	prompt "PCI Backend Mode"
-+	depends on XEN_PCIDEV_BACKEND
-+	default XEN_PCIDEV_BACKEND_VPCI
-+
-+config XEN_PCIDEV_BACKEND_VPCI
-+	bool "Virtual PCI"
-+	---help---
-+	  This PCI Backend hides the true PCI topology and makes the frontend
-+	  think there is a single PCI bus with only the exported devices on it.
-+	  For example, a device at 03:05.0 will be re-assigned to 00:00.0. A
-+	  second device at 02:1a.0 will be re-assigned to 00:01.0.
-+
-+config XEN_PCIDEV_BACKEND_PASS
-+	bool "Passthrough"
-+	---help---
-+	  This PCI Backend provides a real view of the PCI topology to the
-+	  frontend (for example, a device at 06:01.b will still appear at
-+	  06:01.b to the frontend). This is similar to how Xen 2.0.x exposed
-+	  PCI devices to its driver domains. This may be required for drivers
-+	  which depend on finding their hardward in certain bus/slot
-+	  locations.
-+
-+endchoice
-+
-+config XEN_PCIDEV_BE_DEBUG
-+	bool "PCI Backend Debugging"
-+	depends on XEN_PCIDEV_BACKEND
-+	default n
-+
-+config XEN_BLKDEV_BACKEND
-+	bool "Block-device backend driver"
-+	default y
-+	help
-+	  The block-device backend driver allows the kernel to export its
-+	  block devices to other guests via a high-performance shared-memory
-+	  interface.
-+
-+config XEN_BLKDEV_TAP_BE
-+        bool "Block Tap support for backend driver (DANGEROUS)"
-+        depends on XEN_BLKDEV_BACKEND
-+        default n
-+        help
-+          If you intend to use the block tap driver, the backend domain will
-+          not know the domain id of the real frontend, and so will not be able
-+          to map its data pages.  This modifies the backend to attempt to map
-+          from both the tap domain and the real frontend.  This presents a
-+          security risk, and so should ONLY be used for development
-+          with the blktap.  This option will be removed as the block drivers are
-+          modified to use grant tables.
-+
-+config XEN_NETDEV_BACKEND
-+	bool "Network-device backend driver"
-+	default y
-+	help
-+	  The network-device backend driver allows the kernel to export its
-+	  network devices to other guests via a high-performance shared-memory
-+	  interface.
-+
-+config XEN_NETDEV_PIPELINED_TRANSMITTER
-+	bool "Pipelined transmitter (DANGEROUS)"
-+	depends on XEN_NETDEV_BACKEND
-+	default n
-+	help
-+	  If the net backend is a dumb domain, such as a transparent Ethernet
-+	  bridge with no local IP interface, it is safe to say Y here to get
-+	  slightly lower network overhead.
-+	  If the backend has a local IP interface; or may be doing smart things
-+	  like reassembling packets to perform firewall filtering; or if you
-+	  are unsure; or if you experience network hangs when this option is
-+	  enabled; then you must say N here.
-+
-+config XEN_TPMDEV_BACKEND
-+	bool "TPM-device backend driver"
-+	default n
-+	help
-+	  The TPM-device backend driver
-+
-+config XEN_TPMDEV_CLOSE_IF_VTPM_FAILS
-+	bool "TPM backend closes upon vTPM failure"
-+	depends on XEN_TPMDEV_BACKEND
-+	default n
-+	help
-+	  The TPM backend closes the channel if the vTPM in userspace indicates
-+	  a failure. The corresponding domain's channel will be closed.
-+	  Say Y if you want this feature.
-+
-+config XEN_BLKDEV_FRONTEND
-+	tristate "Block-device frontend driver"
-+	depends on XEN
-+	default y
-+	help
-+	  The block-device frontend driver allows the kernel to access block
-+	  devices mounted within another guest OS. Unless you are building a
-+	  dedicated device-driver domain, or your master control domain
-+	  (domain 0), then you almost certainly want to say Y here.
-+
-+config XEN_NETDEV_FRONTEND
-+	tristate "Network-device frontend driver"
-+	depends on XEN
-+	default y
-+	help
-+	  The network-device frontend driver allows the kernel to access
-+	  network interfaces within another guest OS. Unless you are building a
-+	  dedicated device-driver domain, or your master control domain
-+	  (domain 0), then you almost certainly want to say Y here.
-+
-+config XEN_BLKDEV_TAP
-+	bool "Block device tap driver"
-+	default n
-+	help
-+	  This driver allows a VM to interact on block device channels
-+	  to other VMs.  Block messages may be passed through or redirected
-+	  to a character device, allowing device prototyping in application
-+	  space.  Odds are that you want to say N here.
-+
-+config XEN_TPMDEV_FRONTEND
-+	bool "TPM-device frontend driver"
-+	default n
-+	select TCG_TPM
-+	select TCG_XEN
-+	help
-+	  The TPM-device frontend driver.
-+
-+config XEN_SCRUB_PAGES
-+	bool "Scrub memory before freeing it to Xen"
-+	default y
-+	help
-+	  Erase memory contents before freeing it back to Xen's global
-+	  pool. This ensures that any secrets contained within that
-+	  memory (e.g., private keys) cannot be found by other guests that
-+	  may be running on the machine. Most people will want to say Y here.
-+	  If security is not a concern then you may increase performance by
-+	  saying N.
-+
-+config XEN_DISABLE_SERIAL
-+	bool "Disable serial port drivers"
-+	default y
-+	help
-+	  Disable serial port drivers, allowing the Xen console driver
-+	  to provide a serial console at ttyS0.
-+
-+endmenu
-+
-+config HAVE_ARCH_ALLOC_SKB
-+	bool
-+	default y
+diff --git a/drivers/xen/net_driver_util.c b/drivers/xen/net_driver_util.c
+new file mode 100644
+index 0000000..10688f9
+--- /dev/null
++++ b/drivers/xen/net_driver_util.c
+@@ -0,0 +1,67 @@
++/*****************************************************************************
++ *
++ * Utility functions for Xen network devices.
++ *
++ * Copyright (c) 2005 XenSource Ltd.
++ * 
++ * This file may be distributed separately from the Linux kernel, or
++ * incorporated into other software packages, subject to the following
++ * license:
++ * 
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this source file (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy, modify,
++ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so, subject
++ * to the following conditions:
++ * 
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ * 
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * 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.
++ */
 +
-+config HAVE_ARCH_DEV_ALLOC_SKB
-+	bool
-+	default y
 +
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/Makefile linux-2.6-merge.hg/drivers/xen/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/Makefile	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,22 @@
++#include <linux/if_ether.h>
++#include <linux/err.h>
++#include <linux/module.h>
++#include <xen/net_driver_util.h>
 +
-+obj-y	+= net_driver_util.o
-+obj-y	+= util.o
 +
-+obj-y	+= core/
-+obj-y	+= char/
-+obj-y	+= console/
-+obj-y	+= evtchn/
-+obj-y	+= balloon/
-+obj-y	+= privcmd/
-+obj-y	+= xenbus/
++int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
++{
++	char *s;
++	int i;
++	char *e;
++	char *macstr = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
++	if (IS_ERR(macstr))
++		return PTR_ERR(macstr);
++	s = macstr;
++	for (i = 0; i < ETH_ALEN; i++) {
++		mac[i] = simple_strtoul(s, &e, 16);
++		if (s == e || (e[0] != ':' && e[0] != 0)) {
++			kfree(macstr);
++			return -ENOENT;
++		}
++		s = &e[1];
++	}
++	kfree(macstr);
++	return 0;
++}
++EXPORT_SYMBOL(xen_net_read_mac);
 +
-+obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
-+obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
-+obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmback/
-+obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
-+obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
-+obj-$(CONFIG_XEN_BLKDEV_TAP)    	+= blktap/
-+obj-$(CONFIG_XEN_TPMDEV_FRONTEND)	+= tpmfront/
-+obj-$(CONFIG_XEN_PCIDEV_BACKEND)	+= pciback/
-+obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront/
++/*
++ * Local variables:
++ *  c-file-style: "linux"
++ *  indent-tabs-mode: t
++ *  c-indent-level: 8
++ *  c-basic-offset: 8
++ *  tab-width: 8
++ * End:
++ */
+diff --git a/drivers/xen/netback/Makefile b/drivers/xen/netback/Makefile
+new file mode 100644
+index 0000000..d5d2328
+--- /dev/null
++++ b/drivers/xen/netback/Makefile
+@@ -0,0 +1,5 @@
++obj-$(CONFIG_XEN_NETDEV_BACKEND) := netbk.o
++obj-$(CONFIG_XEN_NETDEV_LOOPBACK) += netloop.o
 +
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/common.h linux-2.6-merge.hg/drivers/xen/netback/common.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/common.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netback/common.h	2006-02-11 17:25:26.000000000 +0000
++netbk-y   := netback.o xenbus.o interface.o
++netloop-y := loopback.o
+diff --git a/drivers/xen/netback/common.h b/drivers/xen/netback/common.h
+new file mode 100644
+index 0000000..61f8d58
+--- /dev/null
++++ b/drivers/xen/netback/common.h
 @@ -0,0 +1,110 @@
 +/******************************************************************************
 + * arch/xen/drivers/netif/backend/common.h
@@ -46120,9 +51229,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/interface.c linux-2.6-merge.hg/drivers/xen/netback/interface.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/interface.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netback/interface.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/netback/interface.c b/drivers/xen/netback/interface.c
+new file mode 100644
+index 0000000..a27533c
+--- /dev/null
++++ b/drivers/xen/netback/interface.c
 @@ -0,0 +1,320 @@
 +/******************************************************************************
 + * arch/xen/drivers/netif/backend/interface.c
@@ -46444,10 +51555,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/loopback.c linux-2.6-merge.hg/drivers/xen/netback/loopback.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/loopback.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netback/loopback.c	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,202 @@
+diff --git a/drivers/xen/netback/loopback.c b/drivers/xen/netback/loopback.c
+new file mode 100644
+index 0000000..a5a11cc
+--- /dev/null
++++ b/drivers/xen/netback/loopback.c
+@@ -0,0 +1,231 @@
 +/******************************************************************************
 + * netback/loopback.c
 + * 
@@ -46628,6 +51741,23 @@
 +	return err;
 +}
 +
++static void __init clean_loopback(int i)
++{
++	struct net_device *dev1, *dev2;
++	char dev_name[IFNAMSIZ];
++
++	sprintf(dev_name, "vif0.%d", i);
++	dev1 = dev_get_by_name(dev_name);
++	sprintf(dev_name, "veth%d", i);
++	dev2 = dev_get_by_name(dev_name);
++	if (dev1 && dev2) {
++		unregister_netdev(dev2);
++		unregister_netdev(dev1);
++		free_netdev(dev2);
++		free_netdev(dev1);
++	}
++}
++
 +static int __init loopback_init(void)
 +{
 +	int i, err = 0;
@@ -46641,6 +51771,18 @@
 +
 +module_init(loopback_init);
 +
++static void __exit loopback_exit(void)
++{
++	int i;
++
++	for (i = nloopbacks; i-- > 0; )
++		clean_loopback(i);
++}
++
++module_exit(loopback_exit);
++
++MODULE_LICENSE("Dual BSD/GPL");
++
 +/*
 + * Local variables:
 + *  c-file-style: "linux"
@@ -46650,16 +51792,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/Makefile linux-2.6-merge.hg/drivers/xen/netback/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netback/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,2 @@
-+
-+obj-y	:= netback.o xenbus.o interface.o loopback.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/netback.c linux-2.6-merge.hg/drivers/xen/netback/netback.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/netback.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netback/netback.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,833 @@
+diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
+new file mode 100644
+index 0000000..64173fa
+--- /dev/null
++++ b/drivers/xen/netback/netback.c
+@@ -0,0 +1,835 @@
 +/******************************************************************************
 + * drivers/xen/netback/netback.c
 + * 
@@ -47167,14 +52305,12 @@
 +			/* Still too big to send right now? Set a callback. */
 +			if (txreq.size > netif->remaining_credit) {
 +				netif->remaining_credit = 0;
-+				netif->credit_timeout.expires  = 
-+					next_credit;
 +				netif->credit_timeout.data     =
 +					(unsigned long)netif;
 +				netif->credit_timeout.function =
 +					tx_credit_callback;
-+				add_timer_on(&netif->credit_timeout,
-+					     smp_processor_id());
++				__mod_timer(&netif->credit_timeout,
++					    next_credit);
 +				break;
 +			}
 +		}
@@ -47473,6 +52609,8 @@
 +		&netif_be_dbg);
 +#endif
 +
++	__unsafe(THIS_MODULE);
++
 +	return 0;
 +}
 +
@@ -47484,6 +52622,8 @@
 +module_init(netback_init);
 +module_exit(netback_cleanup);
 +
++MODULE_LICENSE("Dual BSD/GPL");
++
 +/*
 + * Local variables:
 + *  c-file-style: "linux"
@@ -47493,9 +52633,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/xenbus.c linux-2.6-merge.hg/drivers/xen/netback/xenbus.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netback/xenbus.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netback/xenbus.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/netback/xenbus.c b/drivers/xen/netback/xenbus.c
+new file mode 100644
+index 0000000..64bebdb
+--- /dev/null
++++ b/drivers/xen/netback/xenbus.c
 @@ -0,0 +1,327 @@
 +/*  Xenbus code for netif backend
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
@@ -47803,89 +52945,17 @@
 +	.owner = THIS_MODULE,
 +	.ids = netback_ids,
 +	.probe = netback_probe,
-+	.remove = netback_remove,
-+	.uevent = netback_uevent,
-+	.otherend_changed = frontend_changed,
-+};
-+
-+
-+void netif_xenbus_init(void)
-+{
-+	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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/net_driver_util.c linux-2.6-merge.hg/drivers/xen/net_driver_util.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/net_driver_util.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/net_driver_util.c	2006-02-27 15:49:41.000000000 +0000
-@@ -0,0 +1,68 @@
-+/*****************************************************************************
-+ *
-+ * Utility functions for Xen network devices.
-+ *
-+ * Copyright (c) 2005 XenSource Ltd.
-+ * 
-+ * This file may be distributed separately from the Linux kernel, or
-+ * incorporated into other software packages, subject to the following
-+ * license:
-+ * 
-+ * Permission is hereby granted, free of charge, to any person obtaining a
-+ * copy of this source file (the "Software"), to deal in the Software without
-+ * restriction, including without limitation the rights to use, copy, modify,
-+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
-+ * and to permit persons to whom the Software is furnished to do so, subject
-+ * to the following conditions:
-+ * 
-+ * The above copyright notice and this permission notice shall be included in
-+ * all copies or substantial portions of the Software.
-+ * 
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * 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.
-+ */
-+
-+
-+#include <linux/if_ether.h>
-+#include <linux/err.h>
-+#include <linux/module.h>
-+#include <xen/net_driver_util.h>
-+
-+
-+int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
-+{
-+	char *s;
-+	int i;
-+	char *e;
-+	char *macstr = xenbus_read(XBT_NULL, dev->nodename, "mac", NULL);
-+	if (IS_ERR(macstr)) {
-+		return PTR_ERR(macstr);
-+	}
-+	s = macstr;
-+	for (i = 0; i < ETH_ALEN; i++) {
-+		mac[i] = simple_strtoul(s, &e, 16);
-+		if (s == e || (e[0] != ':' && e[0] != 0)) {
-+			kfree(macstr);
-+			return -ENOENT;
-+		}
-+		s = &e[1];
-+	}
-+	kfree(macstr);
-+	return 0;
++	.remove = netback_remove,
++	.uevent = netback_uevent,
++	.otherend_changed = frontend_changed,
++};
++
++
++void netif_xenbus_init(void)
++{
++	xenbus_register_backend(&netback);
 +}
-+EXPORT_SYMBOL(xen_net_read_mac);
++
 +
 +/*
 + * Local variables:
@@ -47896,9 +52966,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netfront/Kconfig linux-2.6-merge.hg/drivers/xen/netfront/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netfront/Kconfig	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netfront/Kconfig	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/netfront/Kconfig b/drivers/xen/netfront/Kconfig
+new file mode 100644
+index 0000000..334e6c3
+--- /dev/null
++++ b/drivers/xen/netfront/Kconfig
 @@ -0,0 +1,6 @@
 +
 +config XENNET
@@ -47906,18 +52978,22 @@
 +	depends on NETDEVICES && ARCH_XEN
 +	help
 +	  Network driver for Xen
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netfront/Makefile linux-2.6-merge.hg/drivers/xen/netfront/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netfront/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netfront/Makefile	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/netfront/Makefile b/drivers/xen/netfront/Makefile
+new file mode 100644
+index 0000000..dc22829
+--- /dev/null
++++ b/drivers/xen/netfront/Makefile
 @@ -0,0 +1,4 @@
 +
 +obj-$(CONFIG_XEN_NETDEV_FRONTEND)	:= xennet.o
 +
 +xennet-objs := netfront.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netfront/netfront.c linux-2.6-merge.hg/drivers/xen/netfront/netfront.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/netfront/netfront.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/netfront/netfront.c	2006-02-27 15:49:41.000000000 +0000
-@@ -0,0 +1,1504 @@
+diff --git a/drivers/xen/netfront/netfront.c b/drivers/xen/netfront/netfront.c
+new file mode 100644
+index 0000000..79d8645
+--- /dev/null
++++ b/drivers/xen/netfront/netfront.c
+@@ -0,0 +1,1500 @@
 +/******************************************************************************
 + * Virtual network driver for conversing with remote driver backends.
 + * 
@@ -48011,7 +53087,7 @@
 +
 +	struct net_device_stats stats;
 +	unsigned int tx_full;
-+    
++
 +	netif_tx_front_ring_t tx;
 +	netif_rx_front_ring_t rx;
 +
@@ -48049,9 +53125,9 @@
 +	struct sk_buff *rx_skbs[NET_RX_RING_SIZE+1];
 +
 +	grant_ref_t gref_tx_head;
-+	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1]; 
++	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1];
 +	grant_ref_t gref_rx_head;
-+	grant_ref_t grant_rx_ref[NET_TX_RING_SIZE + 1]; 
++	grant_ref_t grant_rx_ref[NET_TX_RING_SIZE + 1];
 +
 +	struct xenbus_device *xbdev;
 +	int tx_ring_ref;
@@ -48353,7 +53429,7 @@
 +
 +	skb = arp_create(ARPOP_REPLY, ETH_P_ARP,
 +			 dst_ip, dev, src_ip,
-+			 /*dst_hw*/ NULL, /*src_hw*/ NULL, 
++			 /*dst_hw*/ NULL, /*src_hw*/ NULL,
 +			 /*target_hw*/ dev->dev_addr);
 +	if (skb == NULL)
 +		return -ENOMEM;
@@ -48400,7 +53476,7 @@
 +				printk(KERN_ALERT "network_tx_buf_gc: warning "
 +				       "-- grant still in use by backend "
 +				       "domain.\n");
-+				goto out; 
++				goto out;
 +			}
 +			gnttab_end_foreign_access_ref(
 +				np->grant_tx_ref[id], GNTMAP_readonly);
@@ -48410,9 +53486,9 @@
 +			ADD_ID_TO_FREELIST(np->tx_skbs, id);
 +			dev_kfree_skb_irq(skb);
 +		}
-+        
++
 +		np->tx.rsp_cons = prod;
-+        
++
 +		/*
 +		 * Set a new event, then check for race with update of tx_cons.
 +		 * Note that it is essential to schedule a callback, no matter
@@ -48426,7 +53502,7 @@
 +		mb();
 +	} while (prod != np->tx.sring->rsp_prod);
 +
-+ out: 
++ out:
 +	if (np->tx_full &&
 +	    ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE)) {
 +		np->tx_full = 0;
@@ -48502,7 +53578,7 @@
 +		id = GET_ID_FROM_FREELIST(np->rx_skbs);
 +
 +		np->rx_skbs[id] = skb;
-+        
++
 +		RING_GET_REQUEST(&np->rx, req_prod + i)->id = id;
 +		ref = gnttab_claim_grant_reference(&np->gref_rx_head);
 +		BUG_ON((signed short)ref < 0);
@@ -48548,11 +53624,10 @@
 +		/* Check return status of HYPERVISOR_memory_op(). */
 +		if (unlikely(rx_mcl[i].result != i))
 +			panic("Unable to reduce memory reservation\n");
-+	} else {
++	} else
 +		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
 +					 &reservation) != i)
 +			panic("Unable to reduce memory reservation\n");
-+	}
 +
 +	/* Above is a suitable barrier to ensure backend will see requests. */
 +	np->rx.req_prod_pvt = req_prod + i;
@@ -48588,7 +53663,7 @@
 +		dev_kfree_skb(skb);
 +		skb = nskb;
 +	}
-+    
++
 +	spin_lock_irq(&np->tx_lock);
 +
 +	if (np->backend_state != BEST_CONNECTED) {
@@ -48685,7 +53760,7 @@
 +	rp = np->rx.sring->rsp_prod;
 +	rmb(); /* Ensure we see queued responses up to 'rp'. */
 +
-+	for (i = np->rx.rsp_cons, work_done = 0; 
++	for (i = np->rx.rsp_cons, work_done = 0;
 +	     (i != rp) && (work_done < budget);
 +	     i++, work_done++) {
 +		rx = RING_GET_RESPONSE(&np->rx, i);
@@ -48727,7 +53802,7 @@
 +		skb->len  = rx->status;
 +		skb->tail = skb->data + skb->len;
 +
-+		if ( rx->flags & NETRXF_csum_valid )
++		if (rx->flags & NETRXF_csum_valid)
 +			skb->ip_summed = CHECKSUM_UNNECESSARY;
 +
 +		np->stats.rx_packets++;
@@ -48782,7 +53857,7 @@
 +		 * Enough room in skbuff for the data we were passed? Also,
 +		 * Linux expects at least 16 bytes headroom in each rx buffer.
 +		 */
-+		if (unlikely(skb->tail > skb->end) || 
++		if (unlikely(skb->tail > skb->end) ||
 +		    unlikely((skb->data - skb->head) < 16)) {
 +			if (net_ratelimit()) {
 +				if (skb->tail > skb->end)
@@ -48814,7 +53889,7 @@
 +			if ((skb = nskb) == NULL)
 +				continue;
 +		}
-+        
++
 +		/* Set the shinfo area, which is hidden behind the data. */
 +		init_skb_shinfo(skb);
 +		/* Ethernet work: Delayed to here as it peeks the header. */
@@ -48915,9 +53990,9 @@
 +
 +		tx->id = i;
 +		gnttab_grant_foreign_access_ref(
-+			np->grant_tx_ref[i], np->xbdev->otherend_id, 
++			np->grant_tx_ref[i], np->xbdev->otherend_id,
 +			virt_to_mfn(np->tx_skbs[i]->data),
-+			GNTMAP_readonly); 
++			GNTMAP_readonly);
 +		tx->gref = np->grant_tx_ref[i];
 +		tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
 +		tx->size = skb->len;
@@ -48932,7 +54007,7 @@
 +	RING_PUSH_REQUESTS(&np->tx);
 +
 +	/* Rebuild the RX buffer freelist and the RX ring itself. */
-+	for (requeue_idx = 0, i = 1; i <= NET_RX_RING_SIZE; i++) { 
++	for (requeue_idx = 0, i = 1; i <= NET_RX_RING_SIZE; i++) {
 +		if ((unsigned long)np->rx_skbs[i] < __PAGE_OFFSET)
 +			continue;
 +		gnttab_grant_foreign_transfer_ref(
@@ -48941,7 +54016,7 @@
 +		RING_GET_REQUEST(&np->rx, requeue_idx)->gref =
 +			np->grant_rx_ref[i];
 +		RING_GET_REQUEST(&np->rx, requeue_idx)->id = i;
-+		requeue_idx++; 
++		requeue_idx++;
 +	}
 +
 +	np->rx.req_prod_pvt = requeue_idx;
@@ -48975,9 +54050,8 @@
 +			np->evtchn,
 +			np->tx,
 +			np->rx);
-+	} else {
++	} else
 +		IPRINTK("<vif NULL>\n");
-+	}
 +#endif
 +}
 +
@@ -49070,7 +54144,7 @@
 +	SET_ETHTOOL_OPS(netdev, &network_ethtool_ops);
 +	SET_MODULE_OWNER(netdev);
 +	SET_NETDEV_DEV(netdev, &dev->dev);
-+    
++
 +	if ((err = register_netdev(netdev)) != 0) {
 +		printk(KERN_WARNING "%s> register_netdev err=%d\n",
 +		       __FUNCTION__, err);
@@ -49101,16 +54175,16 @@
 + * We use this notifier to send out a fake ARP reply to reset switches and
 + * router ARP caches when an IP interface is brought up on a VIF.
 + */
-+static int 
++static int
 +inetdev_notify(struct notifier_block *this, unsigned long event, void *ptr)
 +{
-+	struct in_ifaddr  *ifa = (struct in_ifaddr *)ptr; 
++	struct in_ifaddr  *ifa = (struct in_ifaddr *)ptr;
 +	struct net_device *dev = ifa->ifa_dev->dev;
 +
 +	/* UP event and is it one of our devices? */
 +	if (event == NETDEV_UP && dev->open == network_open)
 +		(void)send_fake_arp(dev);
-+        
++
 +	return NOTIFY_DONE;
 +}
 +
@@ -49256,8 +54330,8 @@
 +module_exit(netif_exit);
 +
 +MODULE_LICENSE("Dual BSD/GPL");
-+ 
-+ 
++
++
 +/* ** /proc **/
 +
 +
@@ -49274,9 +54348,8 @@
 +		(struct net_device *)((unsigned long)data & ~3UL);
 +	struct netfront_info *np = netdev_priv(dev);
 +	int len = 0, which_target = (long)data & 3;
-+    
-+	switch (which_target)
-+	{
++
++	switch (which_target) {
 +	case TARGET_MIN:
 +		len = sprintf(page, "%d\n", np->rx_min_target);
 +		break;
@@ -49323,8 +54396,7 @@
 +
 +	spin_lock(&np->rx_lock);
 +
-+	switch (which_target)
-+	{
++	switch (which_target) {
 +	case TARGET_MIN:
 +		if (target > np->rx_max_target)
 +			np->rx_max_target = target;
@@ -49422,9 +54494,27 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/conf_space.c linux-2.6-merge.hg/drivers/xen/pciback/conf_space.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/conf_space.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/conf_space.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/Makefile b/drivers/xen/pciback/Makefile
+new file mode 100644
+index 0000000..e031caa
+--- /dev/null
++++ b/drivers/xen/pciback/Makefile
+@@ -0,0 +1,10 @@
++obj-y += pciback.o
++
++pciback-y := pci_stub.o pciback_ops.o xenbus.o
++pciback-y += conf_space.o conf_space_header.o
++pciback-${CONFIG_XEN_PCIDEV_BACKEND_VPCI} += vpci.o
++pciback-${CONFIG_XEN_PCIDEV_BACKEND_PASS} += passthrough.o
++
++ifeq ($(CONFIG_XEN_PCIDEV_BE_DEBUG),y)
++EXTRA_CFLAGS += -DDEBUG
++endif
+diff --git a/drivers/xen/pciback/conf_space.c b/drivers/xen/pciback/conf_space.c
+new file mode 100644
+index 0000000..f08eafa
+--- /dev/null
++++ b/drivers/xen/pciback/conf_space.c
 @@ -0,0 +1,324 @@
 +/*
 + * PCI Backend - Functions for creating a virtual configuration space for
@@ -49750,9 +54840,11 @@
 +
 +	return err;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/conf_space.h linux-2.6-merge.hg/drivers/xen/pciback/conf_space.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/conf_space.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/conf_space.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/conf_space.h b/drivers/xen/pciback/conf_space.h
+new file mode 100644
+index 0000000..3ef8365
+--- /dev/null
++++ b/drivers/xen/pciback/conf_space.h
 @@ -0,0 +1,97 @@
 +/*
 + * PCI Backend - Common data structures for overriding the configuration space
@@ -49851,9 +54943,11 @@
 +			       void *data);
 +
 +#endif				/* __XEN_PCIBACK_CONF_SPACE_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/conf_space_header.c linux-2.6-merge.hg/drivers/xen/pciback/conf_space_header.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/conf_space_header.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/conf_space_header.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/conf_space_header.c b/drivers/xen/pciback/conf_space_header.c
+new file mode 100644
+index 0000000..17607d3
+--- /dev/null
++++ b/drivers/xen/pciback/conf_space_header.c
 @@ -0,0 +1,269 @@
 +/*
 + * PCI Backend - Handles the virtual fields in the configuration space headers.
@@ -50124,23 +55218,11 @@
 +      out:
 +	return err;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/Makefile linux-2.6-merge.hg/drivers/xen/pciback/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/Makefile	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,10 @@
-+obj-y += pciback.o
-+
-+pciback-y := pci_stub.o pciback_ops.o xenbus.o
-+pciback-y += conf_space.o conf_space_header.o
-+pciback-${CONFIG_XEN_PCIDEV_BACKEND_VPCI} += vpci.o
-+pciback-${CONFIG_XEN_PCIDEV_BACKEND_PASS} += passthrough.o
-+
-+ifeq ($(CONFIG_XEN_PCIDEV_BE_DEBUG),y)
-+EXTRA_CFLAGS += -DDEBUG
-+endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/passthrough.c linux-2.6-merge.hg/drivers/xen/pciback/passthrough.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/passthrough.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/passthrough.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/passthrough.c b/drivers/xen/pciback/passthrough.c
+new file mode 100644
+index 0000000..e5b7fbb
+--- /dev/null
++++ b/drivers/xen/pciback/passthrough.c
 @@ -0,0 +1,116 @@
 +/*
 + * PCI Backend - Provides restricted access to the real PCI bus topology
@@ -50258,174 +55340,11 @@
 +	kfree(dev_data);
 +	pdev->pci_dev_data = NULL;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/pciback.h linux-2.6-merge.hg/drivers/xen/pciback/pciback.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/pciback.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/pciback.h	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,73 @@
-+/*
-+ * PCI Backend Common Data Structures & Function Declarations
-+ *
-+ *   Author: Ryan Wilson <hap9 at epoch.ncsc.mil>
-+ */
-+#ifndef __XEN_PCIBACK_H__
-+#define __XEN_PCIBACK_H__
-+
-+#include <linux/pci.h>
-+#include <linux/interrupt.h>
-+#include <xen/xenbus.h>
-+#include <linux/list.h>
-+#include <linux/spinlock.h>
-+#include <xen/interface/io/pciif.h>
-+
-+struct pci_dev_entry {
-+	struct list_head list;
-+	struct pci_dev *dev;
-+};
-+
-+struct pciback_device {
-+	void *pci_dev_data;
-+	spinlock_t dev_lock;
-+
-+	struct xenbus_device *xdev;
-+
-+	struct xenbus_watch be_watch;
-+	u8 be_watching;
-+
-+	int evtchn_irq;
-+
-+	struct xen_pci_sharedinfo *sh_info;
-+};
-+
-+struct pciback_dev_data {
-+	struct list_head config_fields;
-+};
-+
-+/* Get/Put PCI Devices that are hidden from the PCI Backend Domain */
-+struct pci_dev *pcistub_get_pci_dev_by_slot(int domain, int bus,
-+					    int slot, int func);
-+struct pci_dev *pcistub_get_pci_dev(struct pci_dev *dev);
-+void pcistub_put_pci_dev(struct pci_dev *dev);
-+
-+/* Ensure a device is turned off or reset */
-+void pciback_disable_device(struct pci_dev *dev);
-+void pciback_reset_device(struct pci_dev *pdev);
-+
-+/* Access a virtual configuration space for a PCI device */
-+int pciback_config_init(struct pci_dev *dev);
-+void pciback_config_reset(struct pci_dev *dev);
-+void pciback_config_free(struct pci_dev *dev);
-+int pciback_config_read(struct pci_dev *dev, int offset, int size,
-+			u32 * ret_val);
-+int pciback_config_write(struct pci_dev *dev, int offset, int size, u32 value);
-+
-+/* Handle requests for specific devices from the frontend */
-+typedef int (*publish_pci_root_cb) (struct pciback_device * pdev,
-+				    unsigned int domain, unsigned int bus);
-+int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev);
-+struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev,
-+				    unsigned int domain, unsigned int bus,
-+				    unsigned int devfn);
-+int pciback_init_devices(struct pciback_device *pdev);
-+int pciback_publish_pci_roots(struct pciback_device *pdev,
-+			      publish_pci_root_cb cb);
-+void pciback_release_devices(struct pciback_device *pdev);
-+
-+/* Handles events from front-end */
-+irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs);
-+
-+extern int verbose_request;
-+#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/pciback_ops.c linux-2.6-merge.hg/drivers/xen/pciback/pciback_ops.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/pciback_ops.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/pciback_ops.c	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,84 @@
-+/*
-+ * PCI Backend Operations - respond to PCI requests from Frontend
-+ *
-+ *   Author: Ryan Wilson <hap9 at epoch.ncsc.mil>
-+ */
-+#include <linux/module.h>
-+#include <asm/bitops.h>
-+#include "pciback.h"
-+
-+int verbose_request = 0;
-+module_param(verbose_request, int, 0644);
-+
-+/* For those architectures without a pcibios_disable_device */
-+void __attribute__ ((weak)) pcibios_disable_device(struct pci_dev *dev) { }
-+
-+void pciback_disable_device(struct pci_dev *dev)
-+{
-+	if (dev->is_enabled) {
-+		dev->is_enabled = 0;
-+		pcibios_disable_device(dev);
-+	}
-+}
-+
-+/* Ensure a device is "turned off" and ready to be exported.
-+ * This also sets up the device's private data to keep track of what should
-+ * be in the base address registers (BARs) so that we can keep the
-+ * client from manipulating them directly.
-+ */
-+void pciback_reset_device(struct pci_dev *dev)
-+{
-+	u16 cmd;
-+
-+	/* Disable devices (but not bridges) */
-+	if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
-+		pciback_disable_device(dev);
-+
-+		pci_write_config_word(dev, PCI_COMMAND, 0);
-+
-+		dev->is_enabled = 0;
-+		dev->is_busmaster = 0;
-+	} else {
-+		pci_read_config_word(dev, PCI_COMMAND, &cmd);
-+		if (cmd & (PCI_COMMAND_INVALIDATE)) {
-+			cmd &= ~(PCI_COMMAND_INVALIDATE);
-+			pci_write_config_word(dev, PCI_COMMAND, cmd);
-+
-+			dev->is_busmaster = 0;
-+		}
-+	}
-+
-+	pciback_config_reset(dev);
-+}
-+
-+irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs)
-+{
-+	struct pciback_device *pdev = dev_id;
-+	struct pci_dev *dev;
-+	struct xen_pci_op *op = &pdev->sh_info->op;
-+
-+	if (unlikely(!test_bit(_XEN_PCIF_active,
-+			       (unsigned long *)&pdev->sh_info->flags))) {
-+		pr_debug("pciback: interrupt, but no active operation\n");
-+		goto out;
-+	}
-+
-+	dev = pciback_get_pci_dev(pdev, op->domain, op->bus, op->devfn);
-+
-+	if (dev == NULL)
-+		op->err = XEN_PCI_ERR_dev_not_found;
-+	else if (op->cmd == XEN_PCI_OP_conf_read)
-+		op->err = pciback_config_read(dev, op->offset, op->size,
-+					      &op->value);
-+	else if (op->cmd == XEN_PCI_OP_conf_write)
-+		op->err = pciback_config_write(dev, op->offset, op->size,
-+					       op->value);
-+	else
-+		op->err = XEN_PCI_ERR_not_implemented;
-+
-+	wmb();
-+	clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags);
-+
-+      out:
-+	return IRQ_HANDLED;
-+}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/pci_stub.c linux-2.6-merge.hg/drivers/xen/pciback/pci_stub.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/pci_stub.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/pci_stub.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/pci_stub.c b/drivers/xen/pciback/pci_stub.c
+new file mode 100644
+index 0000000..aa76d75
+--- /dev/null
++++ b/drivers/xen/pciback/pci_stub.c
 @@ -0,0 +1,377 @@
 +/*
 + * PCI Stub Driver - Grabs devices in backend to be exported later
@@ -50804,9 +55723,180 @@
 + * driver to register)
 + */
 +fs_initcall(pcistub_init);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/vpci.c linux-2.6-merge.hg/drivers/xen/pciback/vpci.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/vpci.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/vpci.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/pciback.h b/drivers/xen/pciback/pciback.h
+new file mode 100644
+index 0000000..a1f408b
+--- /dev/null
++++ b/drivers/xen/pciback/pciback.h
+@@ -0,0 +1,73 @@
++/*
++ * PCI Backend Common Data Structures & Function Declarations
++ *
++ *   Author: Ryan Wilson <hap9 at epoch.ncsc.mil>
++ */
++#ifndef __XEN_PCIBACK_H__
++#define __XEN_PCIBACK_H__
++
++#include <linux/pci.h>
++#include <linux/interrupt.h>
++#include <xen/xenbus.h>
++#include <linux/list.h>
++#include <linux/spinlock.h>
++#include <xen/interface/io/pciif.h>
++
++struct pci_dev_entry {
++	struct list_head list;
++	struct pci_dev *dev;
++};
++
++struct pciback_device {
++	void *pci_dev_data;
++	spinlock_t dev_lock;
++
++	struct xenbus_device *xdev;
++
++	struct xenbus_watch be_watch;
++	u8 be_watching;
++
++	int evtchn_irq;
++
++	struct xen_pci_sharedinfo *sh_info;
++};
++
++struct pciback_dev_data {
++	struct list_head config_fields;
++};
++
++/* Get/Put PCI Devices that are hidden from the PCI Backend Domain */
++struct pci_dev *pcistub_get_pci_dev_by_slot(int domain, int bus,
++					    int slot, int func);
++struct pci_dev *pcistub_get_pci_dev(struct pci_dev *dev);
++void pcistub_put_pci_dev(struct pci_dev *dev);
++
++/* Ensure a device is turned off or reset */
++void pciback_disable_device(struct pci_dev *dev);
++void pciback_reset_device(struct pci_dev *pdev);
++
++/* Access a virtual configuration space for a PCI device */
++int pciback_config_init(struct pci_dev *dev);
++void pciback_config_reset(struct pci_dev *dev);
++void pciback_config_free(struct pci_dev *dev);
++int pciback_config_read(struct pci_dev *dev, int offset, int size,
++			u32 * ret_val);
++int pciback_config_write(struct pci_dev *dev, int offset, int size, u32 value);
++
++/* Handle requests for specific devices from the frontend */
++typedef int (*publish_pci_root_cb) (struct pciback_device * pdev,
++				    unsigned int domain, unsigned int bus);
++int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev);
++struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev,
++				    unsigned int domain, unsigned int bus,
++				    unsigned int devfn);
++int pciback_init_devices(struct pciback_device *pdev);
++int pciback_publish_pci_roots(struct pciback_device *pdev,
++			      publish_pci_root_cb cb);
++void pciback_release_devices(struct pciback_device *pdev);
++
++/* Handles events from front-end */
++irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs);
++
++extern int verbose_request;
++#endif
+diff --git a/drivers/xen/pciback/pciback_ops.c b/drivers/xen/pciback/pciback_ops.c
+new file mode 100644
+index 0000000..9019608
+--- /dev/null
++++ b/drivers/xen/pciback/pciback_ops.c
+@@ -0,0 +1,84 @@
++/*
++ * PCI Backend Operations - respond to PCI requests from Frontend
++ *
++ *   Author: Ryan Wilson <hap9 at epoch.ncsc.mil>
++ */
++#include <linux/module.h>
++#include <asm/bitops.h>
++#include "pciback.h"
++
++int verbose_request = 0;
++module_param(verbose_request, int, 0644);
++
++/* For those architectures without a pcibios_disable_device */
++void __attribute__ ((weak)) pcibios_disable_device(struct pci_dev *dev) { }
++
++void pciback_disable_device(struct pci_dev *dev)
++{
++	if (dev->is_enabled) {
++		dev->is_enabled = 0;
++		pcibios_disable_device(dev);
++	}
++}
++
++/* Ensure a device is "turned off" and ready to be exported.
++ * This also sets up the device's private data to keep track of what should
++ * be in the base address registers (BARs) so that we can keep the
++ * client from manipulating them directly.
++ */
++void pciback_reset_device(struct pci_dev *dev)
++{
++	u16 cmd;
++
++	/* Disable devices (but not bridges) */
++	if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
++		pciback_disable_device(dev);
++
++		pci_write_config_word(dev, PCI_COMMAND, 0);
++
++		dev->is_enabled = 0;
++		dev->is_busmaster = 0;
++	} else {
++		pci_read_config_word(dev, PCI_COMMAND, &cmd);
++		if (cmd & (PCI_COMMAND_INVALIDATE)) {
++			cmd &= ~(PCI_COMMAND_INVALIDATE);
++			pci_write_config_word(dev, PCI_COMMAND, cmd);
++
++			dev->is_busmaster = 0;
++		}
++	}
++
++	pciback_config_reset(dev);
++}
++
++irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs)
++{
++	struct pciback_device *pdev = dev_id;
++	struct pci_dev *dev;
++	struct xen_pci_op *op = &pdev->sh_info->op;
++
++	if (unlikely(!test_bit(_XEN_PCIF_active,
++			       (unsigned long *)&pdev->sh_info->flags))) {
++		pr_debug("pciback: interrupt, but no active operation\n");
++		goto out;
++	}
++
++	dev = pciback_get_pci_dev(pdev, op->domain, op->bus, op->devfn);
++
++	if (dev == NULL)
++		op->err = XEN_PCI_ERR_dev_not_found;
++	else if (op->cmd == XEN_PCI_OP_conf_read)
++		op->err = pciback_config_read(dev, op->offset, op->size,
++					      &op->value);
++	else if (op->cmd == XEN_PCI_OP_conf_write)
++		op->err = pciback_config_write(dev, op->offset, op->size,
++					       op->value);
++	else
++		op->err = XEN_PCI_ERR_not_implemented;
++
++	wmb();
++	clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags);
++
++      out:
++	return IRQ_HANDLED;
++}
+diff --git a/drivers/xen/pciback/vpci.c b/drivers/xen/pciback/vpci.c
+new file mode 100644
+index 0000000..17d554d
+--- /dev/null
++++ b/drivers/xen/pciback/vpci.c
 @@ -0,0 +1,163 @@
 +/*
 + * PCI Backend - Provides a Virtual PCI bus (with real devices)
@@ -50971,9 +56061,11 @@
 +	kfree(vpci_dev);
 +	pdev->pci_dev_data = NULL;
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/xenbus.c linux-2.6-merge.hg/drivers/xen/pciback/xenbus.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pciback/xenbus.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pciback/xenbus.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pciback/xenbus.c b/drivers/xen/pciback/xenbus.c
+new file mode 100644
+index 0000000..b3dc7fb
+--- /dev/null
++++ b/drivers/xen/pciback/xenbus.c
 @@ -0,0 +1,439 @@
 +/*
 + * PCI Backend Xenbus Setup - handles setup with frontend and xend
@@ -51414,9 +56506,11 @@
 +
 +/* Must only initialize our xenbus driver after the pcistub driver */
 +device_initcall(pciback_xenbus_register);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/Makefile linux-2.6-merge.hg/drivers/xen/pcifront/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pcifront/Makefile	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pcifront/Makefile b/drivers/xen/pcifront/Makefile
+new file mode 100644
+index 0000000..621e988
+--- /dev/null
++++ b/drivers/xen/pcifront/Makefile
 @@ -0,0 +1,7 @@
 +obj-y += pcifront.o
 +
@@ -51425,9 +56519,11 @@
 +ifeq ($(CONFIG_XEN_PCIDEV_FE_DEBUG),y)
 +EXTRA_CFLAGS += -DDEBUG
 +endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/pci.c linux-2.6-merge.hg/drivers/xen/pcifront/pci.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/pci.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pcifront/pci.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pcifront/pci.c b/drivers/xen/pcifront/pci.c
+new file mode 100644
+index 0000000..d383410
+--- /dev/null
++++ b/drivers/xen/pcifront/pci.c
 @@ -0,0 +1,44 @@
 +/*
 + * PCI Frontend Operations - ensure only one PCI frontend runs at a time
@@ -51473,53 +56569,11 @@
 +
 +	spin_unlock(&pcifront_dev_lock);
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/pcifront.h linux-2.6-merge.hg/drivers/xen/pcifront/pcifront.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/pcifront.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pcifront/pcifront.h	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,40 @@
-+/*
-+ * PCI Frontend - Common data structures & function declarations
-+ *
-+ *   Author: Ryan Wilson <hap9 at epoch.ncsc.mil>
-+ */
-+#ifndef __XEN_PCIFRONT_H__
-+#define __XEN_PCIFRONT_H__
-+
-+#include <linux/spinlock.h>
-+#include <linux/pci.h>
-+#include <xen/xenbus.h>
-+#include <xen/interface/io/pciif.h>
-+#include <xen/pcifront.h>
-+
-+struct pci_bus_entry {
-+	struct list_head list;
-+	struct pci_bus *bus;
-+};
-+
-+struct pcifront_device {
-+	struct xenbus_device *xdev;
-+	struct list_head root_buses;
-+	spinlock_t dev_lock;
-+
-+	int evtchn;
-+	int gnt_ref;
-+
-+	/* Lock this when doing any operations in sh_info */
-+	spinlock_t sh_info_lock;
-+	struct xen_pci_sharedinfo *sh_info;
-+};
-+
-+int pcifront_connect(struct pcifront_device *pdev);
-+void pcifront_disconnect(struct pcifront_device *pdev);
-+
-+int pcifront_scan_root(struct pcifront_device *pdev,
-+		       unsigned int domain, unsigned int bus);
-+void pcifront_free_roots(struct pcifront_device *pdev);
-+
-+#endif	/* __XEN_PCIFRONT_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/pci_op.c linux-2.6-merge.hg/drivers/xen/pcifront/pci_op.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/pci_op.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pcifront/pci_op.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pcifront/pci_op.c b/drivers/xen/pcifront/pci_op.c
+new file mode 100644
+index 0000000..9679192
+--- /dev/null
++++ b/drivers/xen/pcifront/pci_op.c
 @@ -0,0 +1,245 @@
 +/*
 + * PCI Frontend Operations - Communicates with frontend
@@ -51766,9 +56820,57 @@
 +		kfree(bus_entry);
 +	}
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/xenbus.c linux-2.6-merge.hg/drivers/xen/pcifront/xenbus.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/pcifront/xenbus.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/pcifront/xenbus.c	2006-02-21 16:06:10.000000000 +0000
+diff --git a/drivers/xen/pcifront/pcifront.h b/drivers/xen/pcifront/pcifront.h
+new file mode 100644
+index 0000000..70bbf3b
+--- /dev/null
++++ b/drivers/xen/pcifront/pcifront.h
+@@ -0,0 +1,40 @@
++/*
++ * PCI Frontend - Common data structures & function declarations
++ *
++ *   Author: Ryan Wilson <hap9 at epoch.ncsc.mil>
++ */
++#ifndef __XEN_PCIFRONT_H__
++#define __XEN_PCIFRONT_H__
++
++#include <linux/spinlock.h>
++#include <linux/pci.h>
++#include <xen/xenbus.h>
++#include <xen/interface/io/pciif.h>
++#include <xen/pcifront.h>
++
++struct pci_bus_entry {
++	struct list_head list;
++	struct pci_bus *bus;
++};
++
++struct pcifront_device {
++	struct xenbus_device *xdev;
++	struct list_head root_buses;
++	spinlock_t dev_lock;
++
++	int evtchn;
++	int gnt_ref;
++
++	/* Lock this when doing any operations in sh_info */
++	spinlock_t sh_info_lock;
++	struct xen_pci_sharedinfo *sh_info;
++};
++
++int pcifront_connect(struct pcifront_device *pdev);
++void pcifront_disconnect(struct pcifront_device *pdev);
++
++int pcifront_scan_root(struct pcifront_device *pdev,
++		       unsigned int domain, unsigned int bus);
++void pcifront_free_roots(struct pcifront_device *pdev);
++
++#endif	/* __XEN_PCIFRONT_H__ */
+diff --git a/drivers/xen/pcifront/xenbus.c b/drivers/xen/pcifront/xenbus.c
+new file mode 100644
+index 0000000..c596ed4
+--- /dev/null
++++ b/drivers/xen/pcifront/xenbus.c
 @@ -0,0 +1,295 @@
 +/*
 + * PCI Frontend Xenbus Setup - handles setup with backend (imports page/evtchn)
@@ -52065,15 +57167,19 @@
 +
 +/* Initialize after the Xen PCI Frontend Stub is initialized */
 +subsys_initcall(pcifront_init);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/privcmd/Makefile linux-2.6-merge.hg/drivers/xen/privcmd/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/privcmd/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/privcmd/Makefile	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/privcmd/Makefile b/drivers/xen/privcmd/Makefile
+new file mode 100644
+index 0000000..e218695
+--- /dev/null
++++ b/drivers/xen/privcmd/Makefile
 @@ -0,0 +1,2 @@
 +
 +obj-y	:= privcmd.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/privcmd/privcmd.c linux-2.6-merge.hg/drivers/xen/privcmd/privcmd.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/privcmd/privcmd.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/privcmd/privcmd.c	2006-02-18 12:03:38.000000000 +0000
+diff --git a/drivers/xen/privcmd/privcmd.c b/drivers/xen/privcmd/privcmd.c
+new file mode 100644
+index 0000000..52364f9
+--- /dev/null
++++ b/drivers/xen/privcmd/privcmd.c
 @@ -0,0 +1,302 @@
 +/******************************************************************************
 + * privcmd.c
@@ -52377,10 +57483,22 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/common.h linux-2.6-merge.hg/drivers/xen/tpmback/common.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/common.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmback/common.h	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,89 @@
+diff --git a/drivers/xen/tpmback/Makefile b/drivers/xen/tpmback/Makefile
+new file mode 100644
+index 0000000..d5865c4
+--- /dev/null
++++ b/drivers/xen/tpmback/Makefile
+@@ -0,0 +1,4 @@
++
++obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmbk.o
++
++tpmbk-y += tpmback.o interface.o xenbus.o
+diff --git a/drivers/xen/tpmback/common.h b/drivers/xen/tpmback/common.h
+new file mode 100644
+index 0000000..44a3d4c
+--- /dev/null
++++ b/drivers/xen/tpmback/common.h
+@@ -0,0 +1,91 @@
 +/******************************************************************************
 + * drivers/xen/tpmback/common.h
 + */
@@ -52437,9 +57555,11 @@
 +void tpmif_disconnect_complete(tpmif_t * tpmif);
 +tpmif_t *tpmif_find(domid_t domid, long int instance);
 +void tpmif_interface_init(void);
++void tpmif_interface_exit(void);
 +void tpmif_schedule_work(tpmif_t * tpmif);
 +void tpmif_deschedule_work(tpmif_t * tpmif);
 +void tpmif_xenbus_init(void);
++void tpmif_xenbus_exit(void);
 +int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
 +irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
 +int tpmif_vtpm_open(tpmif_t *tpmif, domid_t domain, u32 instance);
@@ -52470,10 +57590,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/interface.c linux-2.6-merge.hg/drivers/xen/tpmback/interface.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/interface.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmback/interface.c	2006-02-27 15:49:41.000000000 +0000
-@@ -0,0 +1,197 @@
+diff --git a/drivers/xen/tpmback/interface.c b/drivers/xen/tpmback/interface.c
+new file mode 100644
+index 0000000..93ab2b7
+--- /dev/null
++++ b/drivers/xen/tpmback/interface.c
+@@ -0,0 +1,194 @@
 + /*****************************************************************************
 + * drivers/xen/tpmback/interface.c
 + *
@@ -52495,8 +57617,7 @@
 +
 +LIST_HEAD(tpmif_list);
 +
-+tpmif_t *
-+alloc_tpmif(domid_t domid, long int instance)
++static tpmif_t *alloc_tpmif(domid_t domid, long int instance)
 +{
 +	struct page *page;
 +	tpmif_t *tpmif;
@@ -52521,16 +57642,14 @@
 +	return tpmif;
 +}
 +
-+void
-+free_tpmif(tpmif_t * tpmif)
++static void free_tpmif(tpmif_t * tpmif)
 +{
 +	num_frontends--;
 +	list_del(&tpmif->tpmif_list);
 +	kmem_cache_free(tpmif_cachep, tpmif);
 +}
 +
-+tpmif_t *
-+tpmif_find(domid_t domid, long int instance)
++tpmif_t *tpmif_find(domid_t domid, long int instance)
 +{
 +	tpmif_t *tpmif;
 +
@@ -52548,8 +57667,7 @@
 +	return alloc_tpmif(domid, instance);
 +}
 +
-+static int
-+map_frontend_page(tpmif_t *tpmif, unsigned long shared_page)
++static int map_frontend_page(tpmif_t *tpmif, unsigned long shared_page)
 +{
 +	int ret;
 +	struct gnttab_map_grant_ref op = {
@@ -52575,8 +57693,7 @@
 +	return 0;
 +}
 +
-+static void
-+unmap_frontend_page(tpmif_t *tpmif)
++static void unmap_frontend_page(tpmif_t *tpmif)
 +{
 +	struct gnttab_unmap_grant_ref op;
 +	int ret;
@@ -52591,14 +57708,14 @@
 +	BUG_ON(ret);
 +}
 +
-+int
-+tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
++int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
 +{
 +	int err;
 +	evtchn_op_t op = {
 +		.cmd = EVTCHNOP_bind_interdomain,
 +		.u.bind_interdomain.remote_dom = tpmif->domid,
-+		.u.bind_interdomain.remote_port = evtchn };
++		.u.bind_interdomain.remote_port = evtchn,
++        };
 +
 +        if (tpmif->irq) {
 +                return 0;
@@ -52632,8 +57749,7 @@
 +	return 0;
 +}
 +
-+static void
-+__tpmif_disconnect_complete(void *arg)
++static void __tpmif_disconnect_complete(void *arg)
 +{
 +	tpmif_t *tpmif = (tpmif_t *) arg;
 +
@@ -52648,20 +57764,23 @@
 +	free_tpmif(tpmif);
 +}
 +
-+void
-+tpmif_disconnect_complete(tpmif_t * tpmif)
++void tpmif_disconnect_complete(tpmif_t * tpmif)
 +{
 +	INIT_WORK(&tpmif->work, __tpmif_disconnect_complete, (void *)tpmif);
 +	schedule_work(&tpmif->work);
 +}
 +
-+void __init
-+tpmif_interface_init(void)
++void __init tpmif_interface_init(void)
 +{
 +	tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
 +					 0, 0, NULL, NULL);
 +}
 +
++void __init tpmif_interface_exit(void)
++{
++	kmem_cache_destroy(tpmif_cachep);
++}
++
 +/*
 + * Local variables:
 + *  c-file-style: "linux"
@@ -52671,18 +57790,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/Makefile linux-2.6-merge.hg/drivers/xen/tpmback/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmback/Makefile	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,4 @@
-+
-+obj-$(CONFIG_XEN_TPMDEV_BACKEND)	+= tpmbk.o
-+
-+tpmbk-y += tpmback.o interface.o xenbus.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/tpmback.c linux-2.6-merge.hg/drivers/xen/tpmback/tpmback.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/tpmback.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmback/tpmback.c	2006-02-27 15:49:41.000000000 +0000
-@@ -0,0 +1,1105 @@
+diff --git a/drivers/xen/tpmback/tpmback.c b/drivers/xen/tpmback/tpmback.c
+new file mode 100644
+index 0000000..1fda74e
+--- /dev/null
++++ b/drivers/xen/tpmback/tpmback.c
+@@ -0,0 +1,1060 @@
 +/******************************************************************************
 + * drivers/xen/tpmback/tpmback.c
 + *
@@ -52707,17 +57820,23 @@
 +#include <xen/xenbus.h>
 +#include <xen/interface/grant_table.h>
 +
-+
 +/* local data structures */
 +struct data_exchange {
 +	struct list_head pending_pak;
 +	struct list_head current_pak;
 +	unsigned int copied_so_far;
 +	u8 has_opener;
-+	rwlock_t pak_lock;  // protects all of the previous fields
++	rwlock_t pak_lock;	// protects all of the previous fields
 +	wait_queue_head_t wait_queue;
 +};
 +
++struct vtpm_resp_hdr {
++	uint32_t instance_no;
++	uint16_t tag_no;
++	uint32_t len_no;
++	uint32_t ordinal_no;
++} __attribute__ ((packed));
++
 +struct packet {
 +	struct list_head next;
 +	unsigned int data_len;
@@ -52735,36 +57854,43 @@
 +	PACKET_FLAG_CHECK_RESPONSESTATUS = 2,
 +};
 +
++/* local variables */
 +static struct data_exchange dataex;
 +
 +/* local function prototypes */
-+static int vtpm_queue_packet(struct packet *pak);
 +static int _packet_write(struct packet *pak,
-+                         const char *data, size_t size,
-+                         int userbuffer);
++			 const char *data, size_t size, int userbuffer);
 +static void processing_timeout(unsigned long ptr);
-+static int  packet_read_shmem(struct packet *pak,
-+                              tpmif_t *tpmif,
-+                              u32 offset,
-+                              char *buffer,
-+                              int isuserbuffer,
-+                              u32 left);
-+
++static int packet_read_shmem(struct packet *pak,
++			     tpmif_t * tpmif,
++			     u32 offset,
++			     char *buffer, int isuserbuffer, u32 left);
++static int vtpm_queue_packet(struct packet *pak);
 +
 +#define MIN(x,y)  (x) < (y) ? (x) : (y)
 +
-+
 +/***************************************************************
-+ Buffer copying
++ Buffer copying fo user and kernel space buffes.
 +***************************************************************/
-+static inline int
-+copy_from_buffer(void *to,
-+                 const void *from,
-+                 unsigned long size,
-+                 int userbuffer)
++static inline int copy_from_buffer(void *to,
++				   const void *from, unsigned long size,
++				   int isuserbuffer)
 +{
-+	if (userbuffer) {
-+		if (copy_from_user(to, from, size))
++	if (isuserbuffer) {
++		if (copy_from_user(to, (void __user *)from, size))
++			return -EFAULT;
++	} else {
++		memcpy(to, from, size);
++	}
++	return 0;
++}
++
++static inline int copy_to_buffer(void *to,
++				 const void *from, unsigned long size,
++				 int isuserbuffer)
++{
++	if (isuserbuffer) {
++		if (copy_to_user((void __user *)to, from, size))
 +			return -EFAULT;
 +	} else {
 +		memcpy(to, from, size);
@@ -52776,17 +57902,19 @@
 + Packet-related functions
 +***************************************************************/
 +
-+static struct packet *
-+packet_find_instance(struct list_head *head, u32 tpm_instance)
++static struct packet *packet_find_instance(struct list_head *head,
++					   u32 tpm_instance)
 +{
 +	struct packet *pak;
 +	struct list_head *p;
++
 +	/*
 +	 * traverse the list of packets and return the first
 +	 * one with the given instance number
 +	 */
 +	list_for_each(p, head) {
 +		pak = list_entry(p, struct packet, next);
++
 +		if (pak->tpm_instance == tpm_instance) {
 +			return pak;
 +		}
@@ -52794,17 +57922,18 @@
 +	return NULL;
 +}
 +
-+static struct packet *
-+packet_find_packet(struct list_head *head, void *packet)
++static struct packet *packet_find_packet(struct list_head *head, void *packet)
 +{
 +	struct packet *pak;
 +	struct list_head *p;
++
 +	/*
 +	 * traverse the list of packets and return the first
 +	 * one with the given instance number
 +	 */
 +	list_for_each(p, head) {
 +		pak = list_entry(p, struct packet, next);
++
 +		if (pak == packet) {
 +			return pak;
 +		}
@@ -52812,22 +57941,20 @@
 +	return NULL;
 +}
 +
-+static struct packet *
-+packet_alloc(tpmif_t *tpmif, u32 size, u8 req_tag, u8 flags)
++static struct packet *packet_alloc(tpmif_t * tpmif,
++				   u32 size, u8 req_tag, u8 flags)
 +{
 +	struct packet *pak = NULL;
-+	pak = kmalloc(sizeof(struct packet),
-+                      GFP_KERNEL);
++	pak = kzalloc(sizeof (struct packet), GFP_KERNEL);
 +	if (NULL != pak) {
-+		memset(pak, 0x0, sizeof(*pak));
 +		if (tpmif) {
 +			pak->tpmif = tpmif;
 +			pak->tpm_instance = tpmif->tpm_instance;
 +		}
-+		pak->data_len  = size;
-+		pak->req_tag   = req_tag;
++		pak->data_len = size;
++		pak->req_tag = req_tag;
 +		pak->last_read = 0;
-+		pak->flags     = flags;
++		pak->flags = flags;
 +
 +		/*
 +		 * cannot do tpmif_get(tpmif); bad things happen
@@ -52840,16 +57967,16 @@
 +	return pak;
 +}
 +
-+static void inline
-+packet_reset(struct packet *pak)
++static void inline packet_reset(struct packet *pak)
 +{
 +	pak->last_read = 0;
 +}
 +
-+static void inline
-+packet_free(struct packet *pak)
++static void packet_free(struct packet *pak)
 +{
-+	del_singleshot_timer_sync(&pak->processing_timer);
++	if (timer_pending(&pak->processing_timer)) {
++		BUG();
++	}
 +	kfree(pak->data_buffer);
 +	/*
 +	 * cannot do tpmif_put(pak->tpmif); bad things happen
@@ -52858,13 +57985,13 @@
 +	kfree(pak);
 +}
 +
-+static int
-+packet_set(struct packet *pak,
-+           const unsigned char *buffer, u32 size)
++static int packet_set(struct packet *pak,
++		      const unsigned char *buffer, u32 size)
 +{
 +	int rc = 0;
 +	unsigned char *buf = kmalloc(size, GFP_KERNEL);
-+	if (NULL != buf) {
++
++	if (buf) {
 +		pak->data_buffer = buf;
 +		memcpy(buf, buffer, size);
 +		pak->data_len = size;
@@ -52874,27 +58001,21 @@
 +	return rc;
 +}
 +
-+
 +/*
 + * Write data to the shared memory and send it to the FE.
 + */
-+static int
-+packet_write(struct packet *pak,
-+             const char *data, size_t size,
-+             int userbuffer)
++static int packet_write(struct packet *pak,
++			const char *data, size_t size, int isuserbuffer)
 +{
 +	int rc = 0;
 +
-+	DPRINTK("Supposed to send %d bytes to front-end!\n",
-+	        size);
-+
-+	if (0 != (pak->flags & PACKET_FLAG_CHECK_RESPONSESTATUS)) {
++	if ((pak->flags & PACKET_FLAG_CHECK_RESPONSESTATUS)) {
 +#ifdef CONFIG_XEN_TPMDEV_CLOSE_IF_VTPM_FAILS
 +		u32 res;
++
 +		if (copy_from_buffer(&res,
-+		                     &data[2+4],
-+		                     sizeof(res),
-+		                     userbuffer)) {
++				     &data[2 + 4], sizeof (res),
++				     isuserbuffer)) {
 +			return -EFAULT;
 +		}
 +
@@ -52915,17 +58036,14 @@
 +		/* Don't send a respone to this packet. Just acknowledge it. */
 +		rc = size;
 +	} else {
-+		rc = _packet_write(pak, data, size, userbuffer);
++		rc = _packet_write(pak, data, size, isuserbuffer);
 +	}
 +
 +	return rc;
 +}
 +
-+
-+static int
-+_packet_write(struct packet *pak,
-+              const char *data, size_t size,
-+              int userbuffer)
++int _packet_write(struct packet *pak,
++		  const char *data, size_t size, int isuserbuffer)
 +{
 +	/*
 +	 * Write into the shared memory pages directly
@@ -52939,7 +58057,7 @@
 +
 +	if (tpmif == NULL) {
 +		return -EFAULT;
-+        }
++	}
 +
 +	if (tpmif->status == DISCONNECTED) {
 +		return size;
@@ -52958,16 +58076,13 @@
 +			return 0;
 +		}
 +
-+		map_op.host_addr  = MMAP_VADDR(tpmif, i);
-+		map_op.flags      = GNTMAP_host_map;
-+		map_op.ref        = tx->ref;
-+		map_op.dom        = tpmif->domid;
-+
-+		if(unlikely(
-+		    HYPERVISOR_grant_table_op(
-+		        GNTTABOP_map_grant_ref,
-+		        &map_op,
-+		        1))) {
++		map_op.host_addr = MMAP_VADDR(tpmif, i);
++		map_op.flags = GNTMAP_host_map;
++		map_op.ref = tx->ref;
++		map_op.dom = tpmif->domid;
++
++		if (unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
++						       &map_op, 1))) {
 +			BUG();
 +		}
 +
@@ -52977,28 +58092,27 @@
 +			DPRINTK(" Grant table operation failure !\n");
 +			return 0;
 +		}
-+		set_phys_to_machine(__pa(MMAP_VADDR(tpmif,i)) >> PAGE_SHIFT,
-+			FOREIGN_FRAME(map_op.dev_bus_addr >> PAGE_SHIFT));
++		set_phys_to_machine(__pa(MMAP_VADDR(tpmif, i)) >> PAGE_SHIFT,
++				    FOREIGN_FRAME(map_op.
++						  dev_bus_addr >> PAGE_SHIFT));
 +
 +		tocopy = MIN(size - offset, PAGE_SIZE);
 +
-+		if (copy_from_buffer((void *)(MMAP_VADDR(tpmif,i)|
-+		                     (tx->addr & ~PAGE_MASK)),
-+		                     &data[offset],
-+		                     tocopy,
-+		                     userbuffer)) {
++		if (copy_from_buffer((void *)(MMAP_VADDR(tpmif, i) |
++					      (tx->addr & ~PAGE_MASK)),
++				     &data[offset], tocopy, isuserbuffer)) {
 +			tpmif_put(tpmif);
 +			return -EFAULT;
 +		}
 +		tx->size = tocopy;
 +
-+		unmap_op.host_addr    = MMAP_VADDR(tpmif, i);
-+		unmap_op.handle       = handle;
++		unmap_op.host_addr = MMAP_VADDR(tpmif, i);
++		unmap_op.handle = handle;
 +		unmap_op.dev_bus_addr = 0;
 +
-+		if(unlikely(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
-+		                                      &unmap_op,
-+		                                      1))) {
++		if (unlikely
++		    (HYPERVISOR_grant_table_op
++		     (GNTTABOP_unmap_grant_ref, &unmap_op, 1))) {
 +			BUG();
 +		}
 +
@@ -53007,8 +58121,7 @@
 +	}
 +
 +	rc = offset;
-+	DPRINTK("Notifying frontend via irq %d\n",
-+	        tpmif->irq);
++	DPRINTK("Notifying frontend via irq %d\n", tpmif->irq);
 +	notify_remote_via_irq(tpmif->irq);
 +
 +	return rc;
@@ -53019,26 +58132,19 @@
 + * provided buffer. Advance the read_last indicator which tells
 + * how many bytes have already been read.
 + */
-+static int
-+packet_read(struct packet *pak, size_t numbytes,
-+            char *buffer, size_t buffersize,
-+            int userbuffer)
++static int packet_read(struct packet *pak, size_t numbytes,
++		       char *buffer, size_t buffersize, int isuserbuffer)
 +{
 +	tpmif_t *tpmif = pak->tpmif;
++
 +	/*
-+	 * I am supposed to read 'numbytes' of data from the
-+	 * buffer.
-+	 * The first 4 bytes that are read are the instance number in
-+	 * network byte order, after that comes the data from the
-+	 * shared memory buffer.
++	 * Read 'numbytes' of data from the buffer. The first 4
++	 * bytes are the instance number in network byte order,
++	 * after that come the data from the shared memory buffer.
 +	 */
 +	u32 to_copy;
 +	u32 offset = 0;
 +	u32 room_left = buffersize;
-+	/*
-+	 * Ensure that we see the request when we copy it.
-+	 */
-+	mb();
 +
 +	if (pak->last_read < 4) {
 +		/*
@@ -53046,18 +58152,13 @@
 +		 */
 +		u32 instance_no = htonl(pak->tpm_instance);
 +		u32 last_read = pak->last_read;
++
 +		to_copy = MIN(4 - last_read, numbytes);
 +
-+		if (userbuffer) {
-+			if (copy_to_user(&buffer[0],
-+			                 &(((u8 *)&instance_no)[last_read]),
-+			                 to_copy)) {
-+				return -EFAULT;
-+			}
-+		} else {
-+			memcpy(&buffer[0],
-+			       &(((u8 *)&instance_no)[last_read]),
-+			       to_copy);
++		if (copy_to_buffer(&buffer[0],
++				   &(((u8 *) & instance_no)[last_read]),
++				   to_copy, isuserbuffer)) {
++			return -EFAULT;
 +		}
 +
 +		pak->last_read += to_copy;
@@ -53073,39 +58174,30 @@
 +		if (pak->data_buffer) {
 +			u32 to_copy = MIN(pak->data_len - offset, room_left);
 +			u32 last_read = pak->last_read - 4;
-+			if (userbuffer) {
-+				if (copy_to_user(&buffer[offset],
-+				                 &pak->data_buffer[last_read],
-+				                 to_copy)) {
-+					return -EFAULT;
-+				}
-+			} else {
-+				memcpy(&buffer[offset],
-+				       &pak->data_buffer[last_read],
-+				       to_copy);
++
++			if (copy_to_buffer(&buffer[offset],
++					   &pak->data_buffer[last_read],
++					   to_copy, isuserbuffer)) {
++				return -EFAULT;
 +			}
 +			pak->last_read += to_copy;
 +			offset += to_copy;
 +		} else {
 +			offset = packet_read_shmem(pak,
-+			                           tpmif,
-+			                           offset,
-+			                           buffer,
-+			                           userbuffer,
-+			                           room_left);
++						   tpmif,
++						   offset,
++						   buffer,
++						   isuserbuffer, room_left);
 +		}
 +	}
 +	return offset;
 +}
 +
-+
-+static int
-+packet_read_shmem(struct packet *pak,
-+                  tpmif_t *tpmif,
-+                  u32 offset,
-+                  char *buffer,
-+                  int isuserbuffer,
-+                  u32 room_left) {
++static int packet_read_shmem(struct packet *pak,
++			     tpmif_t * tpmif,
++			     u32 offset, char *buffer, int isuserbuffer,
++			     u32 room_left)
++{
 +	u32 last_read = pak->last_read - 4;
 +	u32 i = (last_read / PAGE_SIZE);
 +	u32 pg_offset = last_read & (PAGE_SIZE - 1);
@@ -53113,6 +58205,7 @@
 +	grant_handle_t handle;
 +
 +	tpmif_tx_request_t *tx;
++
 +	tx = &tpmif->tx->ring[0].req;
 +	/*
 +	 * Start copying data at the page with index 'index'
@@ -53128,13 +58221,12 @@
 +		tx = &tpmif->tx->ring[i].req;
 +
 +		map_op.host_addr = MMAP_VADDR(tpmif, i);
-+		map_op.flags     = GNTMAP_host_map;
-+		map_op.ref       = tx->ref;
-+		map_op.dom       = tpmif->domid;
-+
-+		if(unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
-+		                                      &map_op,
-+		                                      1))) {
++		map_op.flags = GNTMAP_host_map;
++		map_op.ref = tx->ref;
++		map_op.dom = tpmif->domid;
++
++		if (unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
++						       &map_op, 1))) {
 +			BUG();
 +		}
 +
@@ -53147,41 +58239,33 @@
 +
 +		if (to_copy > tx->size) {
 +			/*
-+			 * This is the case when the user wants to read more
-+			 * than what we have. So we just give him what we
-+			 * have.
++			 * User requests more than what's available
 +			 */
 +			to_copy = MIN(tx->size, to_copy);
 +		}
 +
 +		DPRINTK("Copying from mapped memory at %08lx\n",
-+		        (unsigned long)(MMAP_VADDR(tpmif,i) |
-+			(tx->addr & ~PAGE_MASK)));
++			(unsigned long)(MMAP_VADDR(tpmif, i) |
++					(tx->addr & ~PAGE_MASK)));
 +
-+		src = (void *)(MMAP_VADDR(tpmif,i) | ((tx->addr & ~PAGE_MASK) + pg_offset));
-+		if (isuserbuffer) {
-+			if (copy_to_user(&buffer[offset],
-+			                 src,
-+			                 to_copy)) {
-+				return -EFAULT;
-+			}
-+		} else {
-+			memcpy(&buffer[offset],
-+			       src,
-+			       to_copy);
++		src = (void *)(MMAP_VADDR(tpmif, i) |
++			       ((tx->addr & ~PAGE_MASK) + pg_offset));
++		if (copy_to_buffer(&buffer[offset],
++				   src, to_copy, isuserbuffer)) {
++			return -EFAULT;
 +		}
 +
-+
 +		DPRINTK("Data from TPM-FE of domain %d are %d %d %d %d\n",
-+		        tpmif->domid, buffer[offset], buffer[offset+1],buffer[offset+2],buffer[offset+3]);
++			tpmif->domid, buffer[offset], buffer[offset + 1],
++			buffer[offset + 2], buffer[offset + 3]);
 +
-+		unmap_op.host_addr    = MMAP_VADDR(tpmif, i);
-+		unmap_op.handle       = handle;
++		unmap_op.host_addr = MMAP_VADDR(tpmif, i);
++		unmap_op.handle = handle;
 +		unmap_op.dev_bus_addr = 0;
 +
-+		if(unlikely(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
-+		                                      &unmap_op,
-+		                                      1))) {
++		if (unlikely
++		    (HYPERVISOR_grant_table_op
++		     (GNTTABOP_unmap_grant_ref, &unmap_op, 1))) {
 +			BUG();
 +		}
 +
@@ -53192,7 +58276,7 @@
 +
 +		to_copy = MIN(PAGE_SIZE, room_left);
 +		i++;
-+	} /* while (to_copy > 0) */
++	}			/* while (to_copy > 0) */
 +	/*
 +	 * Adjust the last_read pointer
 +	 */
@@ -53200,13 +58284,11 @@
 +	return offset;
 +}
 +
-+
 +/* ============================================================
 + * The file layer for reading data from this device
 + * ============================================================
 + */
-+static int
-+vtpm_op_open(struct inode *inode, struct file *f)
++static int vtpm_op_open(struct inode *inode, struct file *f)
 +{
 +	int rc = 0;
 +	unsigned long flags;
@@ -53221,9 +58303,8 @@
 +	return rc;
 +}
 +
-+static ssize_t
-+vtpm_op_read(struct file *file,
-+	     char __user * data, size_t size, loff_t * offset)
++static ssize_t vtpm_op_read(struct file *file,
++			    char __user * data, size_t size, loff_t * offset)
 +{
 +	int ret_size = -ENODATA;
 +	struct packet *pak = NULL;
@@ -53234,7 +58315,7 @@
 +	if (list_empty(&dataex.pending_pak)) {
 +		write_unlock_irqrestore(&dataex.pak_lock, flags);
 +		wait_event_interruptible(dataex.wait_queue,
-+		                         !list_empty(&dataex.pending_pak));
++					 !list_empty(&dataex.pending_pak));
 +		write_lock_irqsave(&dataex.pak_lock, flags);
 +	}
 +
@@ -53246,7 +58327,7 @@
 +
 +		DPRINTK("size given by app: %d, available: %d\n", size, left);
 +
-+		ret_size = MIN(size,left);
++		ret_size = MIN(size, left);
 +
 +		ret_size = packet_read(pak, ret_size, data, size, 1);
 +		if (ret_size < 0) {
@@ -53259,7 +58340,8 @@
 +				DPRINTK("All data from this packet given to app.\n");
 +				/* All data given to app */
 +
-+				del_singleshot_timer_sync(&pak->processing_timer);
++				del_singleshot_timer_sync(&pak->
++							  processing_timer);
 +				list_del(&pak->next);
 +				list_add_tail(&pak->next, &dataex.current_pak);
 +				/*
@@ -53267,7 +58349,7 @@
 +				 * the more time we give the TPM to process the request.
 +				 */
 +				mod_timer(&pak->processing_timer,
-+				          jiffies + (num_frontends * 60 * HZ));
++					  jiffies + (num_frontends * 60 * HZ));
 +				dataex.copied_so_far = 0;
 +			}
 +		}
@@ -53282,16 +58364,15 @@
 +/*
 + * Write operation - only works after a previous read operation!
 + */
-+static ssize_t
-+vtpm_op_write(struct file *file, const char __user * data, size_t size,
-+	      loff_t * offset)
++static ssize_t vtpm_op_write(struct file *file,
++			     const char __user * data, size_t size,
++			     loff_t * offset)
 +{
 +	struct packet *pak;
 +	int rc = 0;
 +	unsigned int off = 4;
 +	unsigned long flags;
-+	u32 instance_no = 0;
-+	u32 len_no = 0;
++	struct vtpm_resp_hdr vrh;
 +
 +	/*
 +	 * Minimum required packet size is:
@@ -53301,45 +58382,38 @@
 +	 * 4 bytes for the ordinal
 +	 * sum: 14 bytes
 +	 */
-+	if ( size < off + 10 ) {
++	if (size < sizeof (vrh))
 +		return -EFAULT;
-+	}
 +
-+	if (copy_from_user(&instance_no,
-+	                   (void __user *)&data[0],
-+	                   4)) {
++	if (copy_from_user(&vrh, data, sizeof (vrh)))
 +		return -EFAULT;
-+	}
 +
-+	if (copy_from_user(&len_no,
-+	                   (void __user *)&data[off+2],
-+	                   4) ||
-+	    (off + ntohl(len_no) != size)) {
++	/* malformed packet? */
++	if ((off + ntohl(vrh.len_no)) != size)
 +		return -EFAULT;
-+	}
 +
 +	write_lock_irqsave(&dataex.pak_lock, flags);
-+	pak = packet_find_instance(&dataex.current_pak, ntohl(instance_no));
++	pak = packet_find_instance(&dataex.current_pak,
++				   ntohl(vrh.instance_no));
 +
 +	if (pak == NULL) {
 +		write_unlock_irqrestore(&dataex.pak_lock, flags);
-+		printk(KERN_ALERT "No associated packet!\n");
++		printk(KERN_ALERT "No associated packet! (inst=%d)\n",
++		       ntohl(vrh.instance_no));
 +		return -EFAULT;
-+	} else {
-+		del_singleshot_timer_sync(&pak->processing_timer);
-+		list_del(&pak->next);
 +	}
 +
++	del_singleshot_timer_sync(&pak->processing_timer);
++	list_del(&pak->next);
++
 +	write_unlock_irqrestore(&dataex.pak_lock, flags);
 +
 +	/*
-+	 * The first 'offset' bytes must be the instance number.
-+	 * I will just pull that from the packet.
++	 * The first 'offset' bytes must be the instance number - skip them.
 +	 */
 +	size -= off;
-+	data = &data[off];
 +
-+	rc = packet_write(pak, data, size, 1);
++	rc = packet_write(pak, &data[off], size, 1);
 +
 +	if (rc > 0) {
 +		/* I neglected the first 4 bytes */
@@ -53349,10 +58423,10 @@
 +	return rc;
 +}
 +
-+static int
-+vtpm_op_release(struct inode *inode, struct file *file)
++static int vtpm_op_release(struct inode *inode, struct file *file)
 +{
 +	unsigned long flags;
++
 +	vtpm_release_packets(NULL, 1);
 +	write_lock_irqsave(&dataex.pak_lock, flags);
 +	dataex.has_opener = 0;
@@ -53360,10 +58434,11 @@
 +	return 0;
 +}
 +
-+static unsigned int
-+vtpm_op_poll(struct file *file, struct poll_table_struct *pts)
++static unsigned int vtpm_op_poll(struct file *file,
++				 struct poll_table_struct *pts)
 +{
 +	unsigned int flags = POLLOUT | POLLWRNORM;
++
 +	poll_wait(file, &dataex.wait_queue, pts);
 +	if (!list_empty(&dataex.pending_pak)) {
 +		flags |= POLLIN | POLLRDNORM;
@@ -53381,54 +58456,47 @@
 +	.poll = vtpm_op_poll,
 +};
 +
-+static struct miscdevice ibmvtpms_miscdevice = {
++static struct miscdevice vtpms_miscdevice = {
 +	.minor = 225,
 +	.name = "vtpm",
 +	.fops = &vtpm_ops,
 +};
 +
-+
 +/***************************************************************
 + Virtual TPM functions and data stuctures
 +***************************************************************/
 +
 +static u8 create_cmd[] = {
-+        1,193,		/* 0: TPM_TAG_RQU_COMMAMD */
-+        0,0,0,19,	/* 2: length */
-+        0,0,0,0x1,	/* 6: VTPM_ORD_OPEN */
-+        0,		/* 10: VTPM type */
-+        0,0,0,0,	/* 11: domain id */
-+        0,0,0,0		/* 15: instance id */
-+};
-+
-+static u8 destroy_cmd[] = {
-+        1,193,		/* 0: TPM_TAG_RQU_COMMAMD */
-+        0,0,0,14,	/* 2: length */
-+        0,0,0,0x2,	/* 6: VTPM_ORD_CLOSE */
-+        0,0,0,0		/* 10: instance id */
++	1, 193,			/* 0: TPM_TAG_RQU_COMMAMD */
++	0, 0, 0, 19,		/* 2: length */
++	0, 0, 0, 0x1,		/* 6: VTPM_ORD_OPEN */
++	0,			/* 10: VTPM type */
++	0, 0, 0, 0,		/* 11: domain id */
++	0, 0, 0, 0		/* 15: instance id */
 +};
 +
-+int tpmif_vtpm_open(tpmif_t *tpmif, domid_t domid, u32 instance)
++int tpmif_vtpm_open(tpmif_t * tpmif, domid_t domid, u32 instance)
 +{
 +	int rc = 0;
 +	struct packet *pak;
 +
 +	pak = packet_alloc(tpmif,
-+	                   sizeof(create_cmd),
-+	                   create_cmd[0],
-+	                   PACKET_FLAG_DISCARD_RESPONSE|
-+	                   PACKET_FLAG_CHECK_RESPONSESTATUS);
++			   sizeof (create_cmd),
++			   create_cmd[1],
++			   PACKET_FLAG_DISCARD_RESPONSE |
++			   PACKET_FLAG_CHECK_RESPONSESTATUS);
 +	if (pak) {
-+		u8 buf[sizeof(create_cmd)];
-+		u32 domid_no = htonl((u32)domid);
++		u8 buf[sizeof (create_cmd)];
++		u32 domid_no = htonl((u32) domid);
 +		u32 instance_no = htonl(instance);
-+		memcpy(buf, create_cmd, sizeof(create_cmd));
 +
-+		memcpy(&buf[11], &domid_no, sizeof(u32));
-+		memcpy(&buf[15], &instance_no, sizeof(u32));
++		memcpy(buf, create_cmd, sizeof (create_cmd));
++
++		memcpy(&buf[11], &domid_no, sizeof (u32));
++		memcpy(&buf[15], &instance_no, sizeof (u32));
 +
 +		/* copy the buffer into the packet */
-+		rc = packet_set(pak, buf, sizeof(buf));
++		rc = packet_set(pak, buf, sizeof (buf));
 +
 +		if (rc == 0) {
 +			pak->tpm_instance = 0;
@@ -53444,23 +58512,30 @@
 +	return rc;
 +}
 +
++static u8 destroy_cmd[] = {
++	1, 193,			/* 0: TPM_TAG_RQU_COMMAMD */
++	0, 0, 0, 14,		/* 2: length */
++	0, 0, 0, 0x2,		/* 6: VTPM_ORD_CLOSE */
++	0, 0, 0, 0		/* 10: instance id */
++};
++
 +int tpmif_vtpm_close(u32 instid)
 +{
 +	int rc = 0;
 +	struct packet *pak;
 +
 +	pak = packet_alloc(NULL,
-+	                   sizeof(create_cmd),
-+	                   create_cmd[0],
-+	                   PACKET_FLAG_DISCARD_RESPONSE);
++			   sizeof (destroy_cmd),
++			   destroy_cmd[1], PACKET_FLAG_DISCARD_RESPONSE);
 +	if (pak) {
-+		u8 buf[sizeof(destroy_cmd)];
++		u8 buf[sizeof (destroy_cmd)];
 +		u32 instid_no = htonl(instid);
-+		memcpy(buf, destroy_cmd, sizeof(destroy_cmd));
-+		memcpy(&buf[10], &instid_no, sizeof(u32));
++
++		memcpy(buf, destroy_cmd, sizeof (destroy_cmd));
++		memcpy(&buf[10], &instid_no, sizeof (u32));
 +
 +		/* copy the buffer into the packet */
-+		rc = packet_set(pak, buf, sizeof(buf));
++		rc = packet_set(pak, buf, sizeof (buf));
 +
 +		if (rc == 0) {
 +			pak->tpm_instance = 0;
@@ -53476,23 +58551,22 @@
 +	return rc;
 +}
 +
-+
 +/***************************************************************
 + Utility functions
 +***************************************************************/
 +
-+static int
-+tpm_send_fail_message(struct packet *pak, u8 req_tag)
++static int tpm_send_fail_message(struct packet *pak, u8 req_tag)
 +{
 +	int rc;
 +	static const unsigned char tpm_error_message_fail[] = {
 +		0x00, 0x00,
 +		0x00, 0x00, 0x00, 0x0a,
-+		0x00, 0x00, 0x00, 0x09 /* TPM_FAIL */
++		0x00, 0x00, 0x00, 0x09	/* TPM_FAIL */
 +	};
-+	unsigned char buffer[sizeof(tpm_error_message_fail)];
++	unsigned char buffer[sizeof (tpm_error_message_fail)];
 +
-+	memcpy(buffer, tpm_error_message_fail, sizeof(tpm_error_message_fail));
++	memcpy(buffer, tpm_error_message_fail,
++	       sizeof (tpm_error_message_fail));
 +	/*
 +	 * Insert the right response tag depending on the given tag
 +	 * All response tags are '+3' to the request tag.
@@ -53502,23 +58576,24 @@
 +	/*
 +	 * Write the data to shared memory and notify the front-end
 +	 */
-+	rc = packet_write(pak, buffer, sizeof(buffer), 0);
++	rc = packet_write(pak, buffer, sizeof (buffer), 0);
 +
 +	return rc;
 +}
 +
-+
-+static void
-+_vtpm_release_packets(struct list_head *head, tpmif_t *tpmif,
-+                      int send_msgs)
++static void _vtpm_release_packets(struct list_head *head,
++				  tpmif_t * tpmif, int send_msgs)
 +{
 +	struct packet *pak;
-+	struct list_head *pos, *tmp;
++	struct list_head *pos,
++	         *tmp;
 +
 +	list_for_each_safe(pos, tmp, head) {
 +		pak = list_entry(pos, struct packet, next);
++
 +		if (tpmif == NULL || pak->tpmif == tpmif) {
 +			int can_send = 0;
++
 +			del_singleshot_timer_sync(&pak->processing_timer);
 +			list_del(&pak->next);
 +
@@ -53534,9 +58609,7 @@
 +	}
 +}
 +
-+
-+int
-+vtpm_release_packets(tpmif_t *tpmif, int send_msgs)
++int vtpm_release_packets(tpmif_t * tpmif, int send_msgs)
 +{
 +	unsigned long flags;
 +
@@ -53545,23 +58618,22 @@
 +	_vtpm_release_packets(&dataex.pending_pak, tpmif, send_msgs);
 +	_vtpm_release_packets(&dataex.current_pak, tpmif, send_msgs);
 +
-+	write_unlock_irqrestore(&dataex.pak_lock,
-+	                        flags);
++	write_unlock_irqrestore(&dataex.pak_lock, flags);
 +	return 0;
 +}
 +
-+
 +static int vtpm_queue_packet(struct packet *pak)
 +{
 +	int rc = 0;
++
 +	if (dataex.has_opener) {
 +		unsigned long flags;
++
 +		write_lock_irqsave(&dataex.pak_lock, flags);
 +		list_add_tail(&pak->next, &dataex.pending_pak);
 +		/* give the TPM some time to pick up the request */
 +		mod_timer(&pak->processing_timer, jiffies + (30 * HZ));
-+		write_unlock_irqrestore(&dataex.pak_lock,
-+		                        flags);
++		write_unlock_irqrestore(&dataex.pak_lock, flags);
 +
 +		wake_up_interruptible(&dataex.wait_queue);
 +	} else {
@@ -53570,24 +58642,22 @@
 +	return rc;
 +}
 +
-+
-+static int vtpm_receive(tpmif_t *tpmif, u32 size)
++static int vtpm_receive(tpmif_t * tpmif, u32 size)
 +{
 +	int rc = 0;
 +	unsigned char buffer[10];
 +	__be32 *native_size;
++	struct packet *pak = packet_alloc(tpmif, size, 0, 0);
 +
-+	struct packet *pak = packet_alloc(tpmif, size, buffer[4], 0);
-+	if (NULL == pak) {
++	if (!pak)
 +		return -ENOMEM;
-+	}
 +	/*
 +	 * Read 10 bytes from the received buffer to test its
 +	 * content for validity.
 +	 */
-+	if (sizeof(buffer) != packet_read(pak,
-+	                                  sizeof(buffer), buffer,
-+	                                  sizeof(buffer), 0)) {
++	if (sizeof (buffer) != packet_read(pak,
++					   sizeof (buffer), buffer,
++					   sizeof (buffer), 0)) {
 +		goto failexit;
 +	}
 +	/*
@@ -53596,7 +58666,7 @@
 +	 */
 +	packet_reset(pak);
 +
-+	native_size = (__force __be32 *)(&buffer[4+2]);
++	native_size = (__force __be32 *) (&buffer[4 + 2]);
 +	/*
 +	 * Verify that the size of the packet is correct
 +	 * as indicated and that there's actually someone reading packets.
@@ -53605,26 +58675,24 @@
 +	 */
 +	if (size < 10 ||
 +	    be32_to_cpu(*native_size) != size ||
-+	    0 == dataex.has_opener ||
-+	    tpmif->status != CONNECTED) {
-+	    	rc = -EINVAL;
-+	    	goto failexit;
++	    0 == dataex.has_opener || tpmif->status != CONNECTED) {
++		rc = -EINVAL;
++		goto failexit;
 +	} else {
-+		if ((rc = vtpm_queue_packet(pak)) < 0) {
++		rc = vtpm_queue_packet(pak);
++		if (rc < 0)
 +			goto failexit;
-+		}
 +	}
 +	return 0;
 +
-+failexit:
++      failexit:
 +	if (pak) {
-+		tpm_send_fail_message(pak, buffer[4+1]);
++		tpm_send_fail_message(pak, buffer[4 + 1]);
 +		packet_free(pak);
 +	}
 +	return rc;
 +}
 +
-+
 +/*
 + * Timeout function that gets invoked when a packet has not been processed
 + * during the timeout period.
@@ -53636,44 +58704,42 @@
 +{
 +	struct packet *pak = (struct packet *)ptr;
 +	unsigned long flags;
++
 +	write_lock_irqsave(&dataex.pak_lock, flags);
 +	/*
 +	 * The packet needs to be searched whether it
 +	 * is still on the list.
 +	 */
 +	if (pak == packet_find_packet(&dataex.pending_pak, pak) ||
-+	    pak == packet_find_packet(&dataex.current_pak, pak) ) {
++	    pak == packet_find_packet(&dataex.current_pak, pak)) {
 +		list_del(&pak->next);
-+		tpm_send_fail_message(pak, pak->req_tag);
++		if ((pak->flags & PACKET_FLAG_DISCARD_RESPONSE) == 0) {
++			tpm_send_fail_message(pak, pak->req_tag);
++		}
 +		packet_free(pak);
 +	}
 +
 +	write_unlock_irqrestore(&dataex.pak_lock, flags);
 +}
 +
-+
-+
 +static void tpm_tx_action(unsigned long unused);
 +static DECLARE_TASKLET(tpm_tx_tasklet, tpm_tx_action, 0);
 +
 +static struct list_head tpm_schedule_list;
 +static spinlock_t tpm_schedule_list_lock;
 +
-+static inline void
-+maybe_schedule_tx_action(void)
++static inline void maybe_schedule_tx_action(void)
 +{
 +	smp_mb();
 +	tasklet_schedule(&tpm_tx_tasklet);
 +}
 +
-+static inline int
-+__on_tpm_schedule_list(tpmif_t * tpmif)
++static inline int __on_tpm_schedule_list(tpmif_t * tpmif)
 +{
 +	return tpmif->list.next != NULL;
 +}
 +
-+static void
-+remove_from_tpm_schedule_list(tpmif_t * tpmif)
++static void remove_from_tpm_schedule_list(tpmif_t * tpmif)
 +{
 +	spin_lock_irq(&tpm_schedule_list_lock);
 +	if (likely(__on_tpm_schedule_list(tpmif))) {
@@ -53684,8 +58750,7 @@
 +	spin_unlock_irq(&tpm_schedule_list_lock);
 +}
 +
-+static void
-+add_to_tpm_schedule_list_tail(tpmif_t * tpmif)
++static void add_to_tpm_schedule_list_tail(tpmif_t * tpmif)
 +{
 +	if (__on_tpm_schedule_list(tpmif))
 +		return;
@@ -53698,22 +58763,18 @@
 +	spin_unlock_irq(&tpm_schedule_list_lock);
 +}
 +
-+void
-+tpmif_schedule_work(tpmif_t * tpmif)
++void tpmif_schedule_work(tpmif_t * tpmif)
 +{
 +	add_to_tpm_schedule_list_tail(tpmif);
 +	maybe_schedule_tx_action();
 +}
 +
-+void
-+tpmif_deschedule_work(tpmif_t * tpmif)
++void tpmif_deschedule_work(tpmif_t * tpmif)
 +{
 +	remove_from_tpm_schedule_list(tpmif);
 +}
 +
-+
-+static void
-+tpm_tx_action(unsigned long unused)
++static void tpm_tx_action(unsigned long unused)
 +{
 +	struct list_head *ent;
 +	tpmif_t *tpmif;
@@ -53727,10 +58788,6 @@
 +		tpmif = list_entry(ent, tpmif_t, list);
 +		tpmif_get(tpmif);
 +		remove_from_tpm_schedule_list(tpmif);
-+		/*
-+		 * Ensure that we see the request when we read from it.
-+		 */
-+		mb();
 +
 +		tx = &tpmif->tx->ring[0].req;
 +
@@ -53741,22 +58798,22 @@
 +	}
 +}
 +
-+irqreturn_t
-+tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs)
++irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs)
 +{
-+	tpmif_t *tpmif = dev_id;
++	tpmif_t *tpmif = (tpmif_t *) dev_id;
++
 +	add_to_tpm_schedule_list_tail(tpmif);
 +	maybe_schedule_tx_action();
 +	return IRQ_HANDLED;
 +}
 +
-+static int __init
-+tpmback_init(void)
++static int __init tpmback_init(void)
 +{
 +	int rc;
 +
-+	if ((rc = misc_register(&ibmvtpms_miscdevice)) != 0) {
-+		printk(KERN_ALERT "Could not register misc device for TPM BE.\n");
++	if ((rc = misc_register(&vtpms_miscdevice)) != 0) {
++		printk(KERN_ALERT
++		       "Could not register misc device for TPM BE.\n");
 +		return rc;
 +	}
 +
@@ -53777,7 +58834,18 @@
 +	return 0;
 +}
 +
-+__initcall(tpmback_init);
++module_init(tpmback_init);
++
++static void __exit tpmback_exit(void)
++{
++	tpmif_xenbus_exit();
++	tpmif_interface_exit();
++	misc_deregister(&vtpms_miscdevice);
++}
++
++module_exit(tpmback_exit);
++
++MODULE_LICENSE("Dual BSD/GPL");
 +
 +/*
 + * Local variables:
@@ -53788,10 +58856,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/xenbus.c linux-2.6-merge.hg/drivers/xen/tpmback/xenbus.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmback/xenbus.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmback/xenbus.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,328 @@
+diff --git a/drivers/xen/tpmback/xenbus.c b/drivers/xen/tpmback/xenbus.c
+new file mode 100644
+index 0000000..9a2be8d
+--- /dev/null
++++ b/drivers/xen/tpmback/xenbus.c
+@@ -0,0 +1,333 @@
 +/*  Xenbus code for tpmif backend
 +    Copyright (C) 2005 IBM Corporation
 +    Copyright (C) 2005 Rusty Russell <rusty at rustcorp.com.au>
@@ -54111,6 +59181,11 @@
 +	xenbus_register_backend(&tpmback);
 +}
 +
++void tpmif_xenbus_exit(void)
++{
++	xenbus_unregister_driver(&tpmback);
++}
++
 +/*
 + * Local variables:
 + *  c-file-style: "linux"
@@ -54120,16 +59195,20 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmfront/Makefile linux-2.6-merge.hg/drivers/xen/tpmfront/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmfront/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmfront/Makefile	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/tpmfront/Makefile b/drivers/xen/tpmfront/Makefile
+new file mode 100644
+index 0000000..d43666f
+--- /dev/null
++++ b/drivers/xen/tpmfront/Makefile
 @@ -0,0 +1,2 @@
 +
 +obj-$(CONFIG_XEN_TPMDEV_FRONTEND)	+= tpmfront.o
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmfront/tpmfront.c linux-2.6-merge.hg/drivers/xen/tpmfront/tpmfront.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmfront/tpmfront.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmfront/tpmfront.c	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,713 @@
+diff --git a/drivers/xen/tpmfront/tpmfront.c b/drivers/xen/tpmfront/tpmfront.c
+new file mode 100644
+index 0000000..62e3d56
+--- /dev/null
++++ b/drivers/xen/tpmfront/tpmfront.c
+@@ -0,0 +1,728 @@
 +/*
 + * Copyright (c) 2005, IBM Corporation
 + *
@@ -54612,6 +59691,11 @@
 +	xenbus_register_frontend(&tpmfront);
 +}
 +
++static void __exit exit_tpm_xenbus(void)
++{
++	xenbus_unregister_driver(&tpmfront);
++}
++
 +
 +static int
 +tpm_allocate_buffers(struct tpm_private *tp)
@@ -54729,7 +59813,6 @@
 +
 +		tx = &tp->tx->ring[i].req;
 +
-+		tx->id = i;
 +		tx->addr = virt_to_machine(txb->data);
 +		tx->size = txb->len;
 +
@@ -54832,7 +59915,18 @@
 +	return 0;
 +}
 +
-+__initcall(tpmif_init);
++module_init(tpmif_init);
++
++static void __exit
++tpmif_exit(void)
++{
++	exit_tpm_xenbus();
++	gnttab_free_grant_references(gref_head);
++}
++
++module_exit(tpmif_exit);
++
++MODULE_LICENSE("Dual BSD/GPL");
 +
 +/*
 + * Local variables:
@@ -54843,9 +59937,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmfront/tpmfront.h linux-2.6-merge.hg/drivers/xen/tpmfront/tpmfront.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/tpmfront/tpmfront.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/tpmfront/tpmfront.h	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/tpmfront/tpmfront.h b/drivers/xen/tpmfront/tpmfront.h
+new file mode 100644
+index 0000000..66568ba
+--- /dev/null
++++ b/drivers/xen/tpmfront/tpmfront.h
 @@ -0,0 +1,40 @@
 +#ifndef TPM_FRONT_H
 +#define TPM_FRONT_H
@@ -54887,9 +59983,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/util.c linux-2.6-merge.hg/drivers/xen/util.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/util.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/util.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/util.c b/drivers/xen/util.c
+new file mode 100644
+index 0000000..7f76a39
+--- /dev/null
++++ b/drivers/xen/util.c
 @@ -0,0 +1,80 @@
 +#include <linux/config.h>
 +#include <linux/mm.h>
@@ -54971,22 +60069,26 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/Makefile linux-2.6-merge.hg/drivers/xen/xenbus/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/Makefile	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile
+new file mode 100644
+index 0000000..4ef620c
+--- /dev/null
++++ b/drivers/xen/xenbus/Makefile
 @@ -0,0 +1,8 @@
 +obj-y	+= xenbus.o
 +
 +xenbus-objs =
-+xenbus-objs += xenbus_client.o 
++xenbus-objs += xenbus_client.o
 +xenbus-objs += xenbus_comms.o
 +xenbus-objs += xenbus_xs.o
-+xenbus-objs += xenbus_probe.o 
-+xenbus-objs += xenbus_dev.o 
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_client.c linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_client.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_client.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_client.c	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,403 @@
++xenbus-objs += xenbus_probe.o
++xenbus-objs += xenbus_dev.o
+diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
+new file mode 100644
+index 0000000..fea04d0
+--- /dev/null
++++ b/drivers/xen/xenbus/xenbus_client.c
+@@ -0,0 +1,405 @@
 +/******************************************************************************
 + * Client-facing interface for the Xenbus driver.  In other words, the
 + * interface between the Xenbus and the device-specific code, be it the
@@ -55028,7 +60130,7 @@
 +    pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
 +
 +int xenbus_watch_path(struct xenbus_device *dev, const char *path,
-+		      struct xenbus_watch *watch, 
++		      struct xenbus_watch *watch,
 +		      void (*callback)(struct xenbus_watch *,
 +				       const char **, unsigned int))
 +{
@@ -55051,7 +60153,7 @@
 +
 +
 +int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
-+		       const char *path2, struct xenbus_watch *watch, 
++		       const char *path2, struct xenbus_watch *watch,
 +		       void (*callback)(struct xenbus_watch *,
 +					const char **, unsigned int))
 +{
@@ -55063,9 +60165,8 @@
 +	}
 +	err = xenbus_watch_path(dev, state, watch, callback);
 +
-+	if (err) {
++	if (err)
 +		kfree(state);
-+	}
 +	return err;
 +}
 +EXPORT_SYMBOL(xenbus_watch_path2);
@@ -55084,18 +60185,25 @@
 +	 */
 +
 +	int current_state;
++	int err;
 +
-+	int err = xenbus_scanf(xbt, dev->nodename, "state", "%d",
++	if (state == dev->state)
++		return 0;
++
++	err = xenbus_scanf(xbt, dev->nodename, "state", "%d",
 +			       &current_state);
-+	if ((err == 1 && (XenbusState)current_state == state) ||
-+	    err == -ENOENT)
++	if (err != 1)
 +		return 0;
 +
 +	err = xenbus_printf(xbt, dev->nodename, "state", "%d", state);
 +	if (err) {
-+		xenbus_dev_fatal(dev, err, "writing new state");
++		if (state != XenbusStateClosing) /* Avoid looping */
++			xenbus_dev_fatal(dev, err, "writing new state");
 +		return err;
 +	}
++
++	dev->state = state;
++
 +	return 0;
 +}
 +EXPORT_SYMBOL(xenbus_switch_state);
@@ -55127,7 +60235,6 @@
 +	ret = vsnprintf(printf_buffer+len, PRINTF_BUFFER_SIZE-len, fmt, ap);
 +
 +	BUG_ON(len + ret > PRINTF_BUFFER_SIZE-1);
-+	dev->has_error = 1;
 +
 +	dev_err(&dev->dev, "%s\n", printf_buffer);
 +
@@ -55173,7 +60280,7 @@
 +	va_start(ap, fmt);
 +	_dev_error(dev, err, fmt, ap);
 +	va_end(ap);
-+	
++
 +	xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
 +}
 +EXPORT_SYMBOL(xenbus_dev_fatal);
@@ -55196,7 +60303,6 @@
 +		.u.alloc_unbound.dom = DOMID_SELF,
 +		.u.alloc_unbound.remote_dom = dev->otherend_id
 +	};
-+
 +	int err = HYPERVISOR_event_channel_op(&op);
 +	if (err)
 +		xenbus_dev_fatal(dev, err, "allocating event channel");
@@ -55214,7 +60320,6 @@
 +		.u.bind_interdomain.remote_dom = dev->otherend_id,
 +		.u.bind_interdomain.remote_port = remote_port,
 +	};
-+
 +	int err = HYPERVISOR_event_channel_op(&op);
 +	if (err)
 +		xenbus_dev_fatal(dev, err,
@@ -55371,7 +60476,6 @@
 +XenbusState xenbus_read_driver_state(const char *path)
 +{
 +	XenbusState result;
-+
 +	int err = xenbus_gather(XBT_NULL, path, "state", "%d", &result, NULL);
 +	if (err)
 +		result = XenbusStateClosed;
@@ -55390,10 +60494,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_comms.c linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_comms.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_comms.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_comms.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,203 @@
+diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c
+new file mode 100644
+index 0000000..6d06b4d
+--- /dev/null
++++ b/drivers/xen/xenbus/xenbus_comms.c
+@@ -0,0 +1,211 @@
 +/******************************************************************************
 + * xenbus_comms.c
 + *
@@ -55434,8 +60540,8 @@
 +
 +static int xenbus_irq;
 +
-+extern void xenbus_probe(void *); 
-+extern int xenstored_ready; 
++extern void xenbus_probe(void *);
++extern int xenstored_ready;
 +static DECLARE_WORK(probe_work, xenbus_probe, NULL);
 +
 +DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
@@ -55448,9 +60554,9 @@
 +static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
 +{
 +	if (unlikely(xenstored_ready == 0)) {
-+		xenstored_ready = 1; 
-+		schedule_work(&probe_work); 
-+	} 
++		xenstored_ready = 1;
++		schedule_work(&probe_work);
++	}
 +
 +	wake_up(&xb_waitq);
 +	return IRQ_HANDLED;
@@ -55485,14 +60591,18 @@
 +{
 +	struct xenstore_domain_interface *intf = xenstore_domain_interface();
 +	XENSTORE_RING_IDX cons, prod;
++	int rc;
 +
 +	while (len != 0) {
 +		void *dst;
 +		unsigned int avail;
 +
-+		wait_event_interruptible(xb_waitq,
-+					 (intf->req_prod - intf->req_cons) !=
-+					 XENSTORE_RING_SIZE);
++		rc = wait_event_interruptible(
++			xb_waitq,
++			(intf->req_prod - intf->req_cons) !=
++			XENSTORE_RING_SIZE);
++		if (rc < 0)
++			return rc;
 +
 +		/* Read indexes, then verify. */
 +		cons = intf->req_cons;
@@ -55526,13 +60636,17 @@
 +{
 +	struct xenstore_domain_interface *intf = xenstore_domain_interface();
 +	XENSTORE_RING_IDX cons, prod;
++	int rc;
 +
 +	while (len != 0) {
 +		unsigned int avail;
 +		const char *src;
 +
-+		wait_event_interruptible(xb_waitq,
-+					 intf->rsp_cons != intf->rsp_prod);
++		rc = wait_event_interruptible(
++			xb_waitq,
++			intf->rsp_cons != intf->rsp_prod);
++		if (rc < 0)
++			return rc;
 +
 +		/* Read indexes, then verify. */
 +		cons = intf->rsp_cons;
@@ -55597,9 +60711,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_comms.h linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_comms.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_comms.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_comms.h	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
+new file mode 100644
+index 0000000..59ca0d3
+--- /dev/null
++++ b/drivers/xen/xenbus/xenbus_comms.h
 @@ -0,0 +1,50 @@
 +/*
 + * Private include for xenbus communications.
@@ -55651,9 +60767,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_dev.c linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_dev.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_dev.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_dev.c	2006-02-11 17:25:26.000000000 +0000
+diff --git a/drivers/xen/xenbus/xenbus_dev.c b/drivers/xen/xenbus/xenbus_dev.c
+new file mode 100644
+index 0000000..cdab7e8
+--- /dev/null
++++ b/drivers/xen/xenbus/xenbus_dev.c
 @@ -0,0 +1,238 @@
 +/*
 + * xenbus_dev.c
@@ -55893,10 +61011,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_probe.c linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_probe.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_probe.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_probe.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,1015 @@
+diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
+new file mode 100644
+index 0000000..d43f9fb
+--- /dev/null
++++ b/drivers/xen/xenbus/xenbus_probe.c
+@@ -0,0 +1,1081 @@
 +/******************************************************************************
 + * Talks to Xen Store to figure out what devices we have.
 + *
@@ -55944,9 +61064,7 @@
 +#include <asm/hypervisor.h>
 +#include <xen/xenbus.h>
 +#include <xen/xen_proc.h>
-+#include <xen/balloon.h>
 +#include <xen/evtchn.h>
-+#include <xen/public/evtchn.h>
 +
 +#include "xenbus_comms.h"
 +
@@ -56267,7 +61385,6 @@
 +	xenbus_dev_error(dev, err, "xenbus_dev_probe on %s", dev->nodename);
 +	xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
 +	return -ENODEV;
-+	
 +}
 +
 +static int xenbus_dev_remove(struct device *_dev)
@@ -56396,9 +61513,8 @@
 +
 +static void xenbus_dev_release(struct device *dev)
 +{
-+	if (dev) {
++	if (dev)
 +		xenbus_dev_free(to_xenbus_device(dev));
-+	}
 +}
 +
 +/* Simplified asprintf. */
@@ -56501,7 +61617,7 @@
 +	nodename = kasprintf("%s/%s/%s", xenbus_frontend.root, type, name);
 +	if (!nodename)
 +		return -ENOMEM;
-+	
++
 +	DPRINTK("%s", nodename);
 +
 +	err = xenbus_probe_node(&xenbus_frontend, type, nodename);
@@ -56785,9 +61901,33 @@
 +EXPORT_SYMBOL(unregister_xenstore_notifier);
 +
 +
++static int all_devices_ready_(struct device *dev, void *data)
++{
++	struct xenbus_device *xendev = to_xenbus_device(dev);
++	int *result = data;
++
++	if (xendev->state != XenbusStateConnected) {
++		result = 0;
++		return 1;
++	}
++
++	return 0;
++}
++
++
++static int all_devices_ready(void)
++{
++	int ready = 1;
++	bus_for_each_dev(&xenbus_frontend.bus, NULL, &ready,
++			 all_devices_ready_);
++	return ready;
++}
++
 +
 +void xenbus_probe(void *unused)
 +{
++	int i;
++
 +	BUG_ON((xenstored_ready <= 0));
 +
 +	/* Enumerate devices in xenstore. */
@@ -56800,17 +61940,56 @@
 +
 +	/* Notify others that xenstore is up */
 +	notifier_call_chain(&xenstore_chain, 0, NULL);
++
++	/* On a 10 second timeout, waiting for all devices currently
++	   configured.  We need to do this to guarantee that the filesystems
++	   and / or network devices needed for boot are available, before we
++	   can allow the boot to proceed.
++
++	   A possible improvement here would be to have the tools add a
++	   per-device flag to the store entry, indicating whether it is needed
++	   at boot time.  This would allow people who knew what they were
++	   doing to accelerate their boot slightly, but of course needs tools
++	   or manual intervention to set up those flags correctly.
++	 */
++	for (i = 0; i < 10 * HZ; i++) {
++		if (all_devices_ready())
++			return;
++
++		set_current_state(TASK_INTERRUPTIBLE);
++		schedule_timeout(1);
++	}
++
++	printk(KERN_WARNING
++	       "XENBUS: Timeout connecting to devices!\n");
 +}
 +
 +
++static struct file_operations xsd_kva_fops;
 +static struct proc_dir_entry *xsd_kva_intf;
 +static struct proc_dir_entry *xsd_port_intf;
 +
++static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
++{
++	size_t size = vma->vm_end - vma->vm_start;
++
++	if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
++		return -EINVAL;
++
++	vma->vm_pgoff = mfn_to_pfn(xen_start_info->store_mfn);
++
++	if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
++			    size, vma->vm_page_prot))
++		return -EAGAIN;
++
++	return 0;
++}
 +
 +static int xsd_kva_read(char *page, char **start, off_t off,
 +                        int count, int *eof, void *data)
 +{
 +	int len;
++
 +	len  = sprintf(page, "0x%p", mfn_to_virt(xen_start_info->store_mfn));
 +	*eof = 1;
 +	return len;
@@ -56845,8 +62024,8 @@
 +	device_register(&xenbus_backend.dev);
 +
 +	/*
-+	** Domain0 doesn't have a store_evtchn or store_mfn yet.
-+	*/
++	 * Domain0 doesn't have a store_evtchn or store_mfn yet.
++	 */
 +	dom0 = (xen_start_info->store_evtchn == 0);
 +
 +	if (dom0) {
@@ -56868,7 +62047,7 @@
 +		xen_start_info->store_mfn =
 +			pfn_to_mfn(virt_to_phys((void *)page) >>
 +				   PAGE_SHIFT);
-+		
++
 +		/* Next allocate a local port which xenstored can bind to */
 +		op.cmd = EVTCHNOP_alloc_unbound;
 +		op.u.alloc_unbound.dom        = DOMID_SELF;
@@ -56879,9 +62058,16 @@
 +		xen_start_info->store_evtchn = op.u.alloc_unbound.port;
 +
 +		/* And finally publish the above info in /proc/xen */
-+		if((xsd_kva_intf = create_xen_proc_entry("xsd_kva", 0400)))
++		xsd_kva_intf = create_xen_proc_entry("xsd_kva", 0400);
++		if (xsd_kva_intf) {
++			memcpy(&xsd_kva_fops, xsd_kva_intf->proc_fops,
++			       sizeof(xsd_kva_fops));
++			xsd_kva_fops.mmap = xsd_kva_mmap;
++			xsd_kva_intf->proc_fops = &xsd_kva_fops;
 +			xsd_kva_intf->read_proc = xsd_kva_read;
-+		if((xsd_port_intf = create_xen_proc_entry("xsd_port", 0400)))
++		}
++		xsd_port_intf = create_xen_proc_entry("xsd_port", 0400);
++		if (xsd_port_intf)
 +			xsd_port_intf->read_proc = xsd_port_read;
 +	}
 +
@@ -56912,10 +62098,12 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_xs.c linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_xs.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/drivers/xen/xenbus/xenbus_xs.c	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/drivers/xen/xenbus/xenbus_xs.c	2006-02-11 17:25:26.000000000 +0000
-@@ -0,0 +1,821 @@
+diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
+new file mode 100644
+index 0000000..ad43b0c
+--- /dev/null
++++ b/drivers/xen/xenbus/xenbus_xs.c
+@@ -0,0 +1,830 @@
 +/******************************************************************************
 + * xenbus_xs.c
 + *
@@ -57041,8 +62229,9 @@
 +
 +	while (list_empty(&xs_state.reply_list)) {
 +		spin_unlock(&xs_state.reply_lock);
-+		wait_event_interruptible(xs_state.reply_waitq,
-+					 !list_empty(&xs_state.reply_list));
++		/* XXX FIXME: Avoid synchronous wait for response here. */
++		wait_event(xs_state.reply_waitq,
++			   !list_empty(&xs_state.reply_list));
 +		spin_lock(&xs_state.reply_lock);
 +	}
 +
@@ -57093,9 +62282,8 @@
 +	if (err) {
 +		msg->type = XS_ERROR;
 +		ret = ERR_PTR(err);
-+	} else {
++	} else
 +		ret = read_reply(&msg->type, &msg->len);
-+	}
 +
 +	up(&xs_state.request_mutex);
 +
@@ -57192,7 +62380,7 @@
 +	return num;
 +}
 +
-+/* Return the path to dir with /name appended. Buffer must be kfree()'ed. */ 
++/* Return the path to dir with /name appended. Buffer must be kfree()'ed. */
 +static char *join(const char *dir, const char *name)
 +{
 +	char *buffer;
@@ -57603,6 +62791,9 @@
 +		wait_event_interruptible(watch_events_waitq,
 +					 !list_empty(&watch_events));
 +
++		if (kthread_should_stop())
++			break;
++
 +		down(&xenwatch_mutex);
 +
 +		spin_lock(&watch_events_lock);
@@ -57623,6 +62814,8 @@
 +
 +		up(&xenwatch_mutex);
 +	}
++
++	return 0;
 +}
 +
 +static int process_msg(void)
@@ -57696,7 +62889,11 @@
 +		if (err)
 +			printk(KERN_WARNING "XENBUS error %d while reading "
 +			       "message\n", err);
++		if (kthread_should_stop())
++			break;
 +	}
++
++	return 0;
 +}
 +
 +int xs_init(void)
@@ -57737,10 +62934,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/fs/Kconfig linux-2.6-merge.hg/fs/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/fs/Kconfig	2006-02-27 15:51:37.000000000 +0000
-+++ linux-2.6-merge.hg/fs/Kconfig	2006-02-18 12:03:38.000000000 +0000
-@@ -841,6 +841,7 @@
+diff --git a/fs/Kconfig b/fs/Kconfig
+index e9749b0..de4c01e 100644
+--- a/fs/Kconfig
++++ b/fs/Kconfig
+@@ -841,6 +841,7 @@ config TMPFS
  config HUGETLBFS
  	bool "HugeTLB file system support"
  	depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN
@@ -57748,46 +62946,23 @@
  
  config HUGETLB_PAGE
  	def_bool HUGETLBFS
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/.hgtags linux-2.6-merge.hg/.hgtags
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/.hgtags	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/.hgtags	2006-02-27 15:49:39.000000000 +0000
-@@ -0,0 +1,33 @@
-+02b35b03186a87cbaec3e55f9695b6bb27aa8b80 v2.6.14-rc3
-+08e7482ef16d7a26655fbd6298d2d8b4980a09cd v2.6.15-rc4
-+21a42a0b51f3671c3325acdd9b0ae1c0ea0b458d v2.6.12-rc5
-+25a5a3917dd568adb8190c7c7f8208ccc217bf13 v2.6.16-rc4
-+27d63cef65923a1a0d40c47512d494dc9b5d971f v2.6.14-rc2
-+2f26d0106bd8c74a8a2962e4916a07a5bc41b29f v2.6.13-rc2
-+2f3622de40ddbaa8d9ecda833e6b5988d66f8118 v2.6.12
-+41a2c32624ac313f6512366c43146a28862ea92b v2.6.13-rc6
-+481cd7b22f1860b4b0eab8e304ab009f10efafdd v2.6.15-rc6
-+4b78a7fcf4f30a5068087e2af2d99232a2e83213 v2.6.14-rc5
-+58fe9a9ac2431f10d70c2e4ff2a3e0b4dc650011 v2.6.14-rc1
-+5ea738d3feabdb6f4910d8bec4ebfcd977b225ee v2.6.13-rc4
-+6b0dd6218eec12c090191ccaa1ae375dc96fe254 v2.6.16-rc5
-+724ffcfe4c8bf9fd1c4dfe8f7e478d3f19110fdf v2.6.12-rc3
-+83f934cdd6339c787c6f76c255ad62c7f56367bf v2.6.15-rc2
-+85e0964123ded5217ccb74d584ee331248d742cf v2.6.15-rc3
-+8c44deff96e974546c548839336f5fed3e4375a4 v2.6.14-rc4
-+8f542c0cec11b551ed5d0f884484dc9372a95fa6 v2.6.13-rc3
-+929f817c80bad6c3e9f752f0e742c73e4dafa18a v2.6.13
-+9324aafdab00818c31e4b97980eed8af3cd714ea v2.6.15-rc1
-+99f9d6e8df470c4d54b459a02501ad58107d79ee v2.6.14
-+9e339739cbbc607207e01aa69c247d5ed023565f v2.6.12-rc6
-+9ff134ec7ab6d04bc70f63e290fc72bb5ae5a4d8 v2.6.16-rc2
-+b66abb024bdd831a6edadd05d154d58cde130a5d v2.6.15-rc7
-+bb22db4aefdf9c5761a8f3740e578bb52160e307 v2.6.12-rc4
-+c37d609f9ba33616f0ccf95d5049f9a7833a0f10 v2.6.13-rc5
-+c3f7b1685de874136c2fcbea01e4aeff263fc9f7 v2.6.15-rc5
-+c88a6a1d1838f375fd62e2652f1ed225f4540075 v2.6.16-rc1
-+d1f4bbb0befc13bd8cd39d0fcdd93b8c078c4a2f v2.6.12-rc2
-+df592ef4c8bf5771b7f08304c64ce6c205dbe579 v2.6.16-rc3
-+e0fb9949adb40a68651d4a5c814c2998bdaa56ed v2.6.15
-+e4ca539abe8197f95f5c1dcf081ca4e32e6deafa v2.6.13-rc1
-+ece559f16b050344b8db42569144c558c6edfa80 v2.6.13-rc7
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/agp.h linux-2.6-merge.hg/include/asm-i386/agp.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/agp.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/agp.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/a.out.h b/include/asm-i386/a.out.h
+index ab17bb8..66db229 100644
+--- a/include/asm-i386/a.out.h
++++ b/include/asm-i386/a.out.h
+@@ -19,7 +19,7 @@ struct exec
+ 
+ #ifdef __KERNEL__
+ 
+-#define STACK_TOP	TASK_SIZE
++#define STACK_TOP	(TASK_SIZE - 3*PAGE_SIZE)
+ 
+ #endif
+ 
+diff --git a/include/asm-i386/agp.h b/include/asm-i386/agp.h
+index 9075083..5ce4e2f 100644
+--- a/include/asm-i386/agp.h
++++ b/include/asm-i386/agp.h
 @@ -1,8 +1,10 @@
  #ifndef AGP_H
  #define AGP_H 1
@@ -57799,7 +62974,7 @@
  
  /* 
   * Functions to keep the agpgart mappings coherent with the MMU.
-@@ -22,13 +24,26 @@
+@@ -22,13 +24,26 @@ int unmap_page_from_agp(struct page *pag
  #define flush_agp_cache() wbinvd()
  
  /* Convert a physical address to an address suitable for the GART. */
@@ -57826,22 +63001,11 @@
 +#endif
  
  #endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/a.out.h linux-2.6-merge.hg/include/asm-i386/a.out.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/a.out.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/a.out.h	2006-02-27 15:49:45.000000000 +0000
-@@ -19,7 +19,7 @@
- 
- #ifdef __KERNEL__
- 
--#define STACK_TOP	TASK_SIZE
-+#define STACK_TOP	(TASK_SIZE - 3*PAGE_SIZE)
- 
- #endif
- 
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/apic.h linux-2.6-merge.hg/include/asm-i386/apic.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/apic.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/apic.h	2006-02-21 16:06:10.000000000 +0000
-@@ -132,10 +132,12 @@
+diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
+index ff9ac8d..1fb4d71 100644
+--- a/include/asm-i386/apic.h
++++ b/include/asm-i386/apic.h
+@@ -132,10 +132,12 @@ extern unsigned int nmi_watchdog;
  
  extern int disable_timer_pin_1;
  
@@ -57852,11 +63016,12 @@
  #define ARCH_APICTIMER_STOPS_ON_C3	1
 +#endif
  
- #else /* !CONFIG_X86_LOCAL_APIC */
- static inline void lapic_shutdown(void) { }
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/atomic.h linux-2.6-merge.hg/include/asm-i386/atomic.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/atomic.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/atomic.h	2006-02-11 17:25:36.000000000 +0000
+ extern int timer_over_8254;
+ 
+diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
+index de649d3..4a9e85d 100644
+--- a/include/asm-i386/atomic.h
++++ b/include/asm-i386/atomic.h
 @@ -4,18 +4,13 @@
  #include <linux/config.h>
  #include <linux/compiler.h>
@@ -57877,9 +63042,10 @@
  /*
   * 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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/bitops.h linux-2.6-merge.hg/include/asm-i386/bitops.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/bitops.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/bitops.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
+index 88e6ca2..5f438be 100644
+--- a/include/asm-i386/bitops.h
++++ b/include/asm-i386/bitops.h
 @@ -7,6 +7,7 @@
  
  #include <linux/config.h>
@@ -57910,7 +63076,7 @@
  		"btsl %1,%0"
  		:"+m" (ADDR)
  		:"Ir" (nr));
-@@ -76,7 +71,7 @@
+@@ -76,7 +71,7 @@ static inline void __set_bit(int nr, vol
   */
  static inline void clear_bit(int nr, volatile unsigned long * addr)
  {
@@ -57919,7 +63085,7 @@
  		"btrl %1,%0"
  		:"+m" (ADDR)
  		:"Ir" (nr));
-@@ -121,7 +116,7 @@
+@@ -121,7 +116,7 @@ static inline void __change_bit(int nr, 
   */
  static inline void change_bit(int nr, volatile unsigned long * addr)
  {
@@ -57928,7 +63094,7 @@
  		"btcl %1,%0"
  		:"+m" (ADDR)
  		:"Ir" (nr));
-@@ -140,7 +135,7 @@
+@@ -140,7 +135,7 @@ static inline int test_and_set_bit(int n
  {
  	int oldbit;
  
@@ -57937,7 +63103,7 @@
  		"btsl %2,%1\n\tsbbl %0,%0"
  		:"=r" (oldbit),"+m" (ADDR)
  		:"Ir" (nr) : "memory");
-@@ -180,7 +175,7 @@
+@@ -180,7 +175,7 @@ static inline int test_and_clear_bit(int
  {
  	int oldbit;
  
@@ -57946,7 +63112,7 @@
  		"btrl %2,%1\n\tsbbl %0,%0"
  		:"=r" (oldbit),"+m" (ADDR)
  		:"Ir" (nr) : "memory");
-@@ -231,7 +226,7 @@
+@@ -231,7 +226,7 @@ static inline int test_and_change_bit(in
  {
  	int oldbit;
  
@@ -57955,10 +63121,11 @@
  		"btcl %2,%1\n\tsbbl %0,%0"
  		:"=r" (oldbit),"+m" (ADDR)
  		:"Ir" (nr) : "memory");
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/desc.h linux-2.6-merge.hg/include/asm-i386/desc.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/desc.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/desc.h	2006-02-27 15:49:45.000000000 +0000
-@@ -33,6 +33,8 @@
+diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
+index 89b8b82..2dfbb9f 100644
+--- a/include/asm-i386/desc.h
++++ b/include/asm-i386/desc.h
+@@ -33,6 +33,8 @@ static inline struct desc_struct *get_cp
  	return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address;
  }
  
@@ -57967,7 +63134,7 @@
  #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
  #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
  
-@@ -41,6 +43,8 @@
+@@ -41,6 +43,8 @@ static inline struct desc_struct *get_cp
  #define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr))
  #define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt))
  
@@ -57976,7 +63143,7 @@
  #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr))
  #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr))
  #define store_tr(tr) __asm__ ("str %0":"=mr" (tr))
-@@ -53,6 +57,8 @@
+@@ -53,6 +57,8 @@ static inline struct desc_struct *get_cp
  extern struct desc_struct default_ldt[];
  extern void set_intr_gate(unsigned int irq, void * addr);
  
@@ -57985,7 +63152,7 @@
  #define _set_tssldt_desc(n,addr,limit,type) \
  __asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
  	"movw %w1,2(%2)\n\t" \
-@@ -64,6 +70,7 @@
+@@ -64,6 +70,7 @@ __asm__ __volatile__ ("movw %w3,0(%2)\n\
  	"rorl $16,%1" \
  	: "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type))
  
@@ -57993,7 +63160,7 @@
  static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr)
  {
  	_set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr,
-@@ -71,12 +78,15 @@
+@@ -71,12 +78,15 @@ static inline void __set_tss_desc(unsign
  }
  
  #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
@@ -58009,7 +63176,7 @@
  #define LDT_entry_a(info) \
  	((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
  
-@@ -102,12 +112,16 @@
+@@ -102,12 +112,16 @@ static inline void set_ldt_desc(unsigned
  	(info)->seg_not_present	== 1	&& \
  	(info)->useable		== 0	)
  
@@ -58026,7 +63193,7 @@
  
  #if TLS_SIZE != 24
  # error update this code.
-@@ -115,17 +129,41 @@
+@@ -115,17 +129,41 @@ static inline void write_ldt_entry(void 
  
  static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
  {
@@ -58070,7 +63237,7 @@
  	put_cpu();
  }
  
-@@ -138,12 +176,11 @@
+@@ -138,12 +176,11 @@ static inline void load_LDT_nolock(mm_co
  	int count = pc->size;
  
  	if (likely(!count)) {
@@ -58086,9 +63253,10 @@
  }
  
  static inline void load_LDT(mm_context_t *pc)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/dma-mapping.h linux-2.6-merge.hg/include/asm-i386/dma-mapping.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/dma-mapping.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/dma-mapping.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
+index 9cf20ca..7508849 100644
+--- a/include/asm-i386/dma-mapping.h
++++ b/include/asm-i386/dma-mapping.h
 @@ -7,6 +7,8 @@
  #include <asm/io.h>
  #include <asm/scatterlist.h>
@@ -58098,7 +63266,7 @@
  
  #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
  #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-@@ -17,78 +19,22 @@
+@@ -17,78 +19,22 @@ void *dma_alloc_coherent(struct device *
  void dma_free_coherent(struct device *dev, size_t size,
  			 void *vaddr, dma_addr_t dma_handle);
  
@@ -58183,7 +63351,7 @@
  	flush_write_buffers();
  }
  
-@@ -97,6 +43,9 @@
+@@ -97,6 +43,9 @@ dma_sync_single_range_for_cpu(struct dev
  			      unsigned long offset, size_t size,
  			      enum dma_data_direction direction)
  {
@@ -58193,7 +63361,7 @@
  }
  
  static inline void
-@@ -104,6 +53,9 @@
+@@ -104,6 +53,9 @@ dma_sync_single_range_for_device(struct 
  				 unsigned long offset, size_t size,
  				 enum dma_data_direction direction)
  {
@@ -58203,7 +63371,7 @@
  	flush_write_buffers();
  }
  
-@@ -111,36 +63,22 @@
+@@ -111,36 +63,22 @@ static inline void
  dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
  		    enum dma_data_direction direction)
  {
@@ -58246,10 +63414,11 @@
  dma_set_mask(struct device *dev, u64 mask)
  {
  	if(!dev->dma_mask || !dma_supported(dev, mask))
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/elf.h linux-2.6-merge.hg/include/asm-i386/elf.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/elf.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/elf.h	2006-02-27 15:49:45.000000000 +0000
-@@ -129,11 +129,16 @@
+diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
+index 4153d80..b08208c 100644
+--- a/include/asm-i386/elf.h
++++ b/include/asm-i386/elf.h
+@@ -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)
  #define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
  
@@ -58267,9 +63436,10 @@
  #define ARCH_DLINFO						\
  do {								\
  		NEW_AUX_ENT(AT_SYSINFO,	VSYSCALL_ENTRY);	\
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/fixmap.h linux-2.6-merge.hg/include/asm-i386/fixmap.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/fixmap.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/fixmap.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
+index cfb1c61..a533f08 100644
+--- a/include/asm-i386/fixmap.h
++++ b/include/asm-i386/fixmap.h
 @@ -20,7 +20,7 @@
   * Leave one empty page between vmalloc'ed areas and
   * the start of the fixmap.
@@ -58297,7 +63467,7 @@
  #ifdef CONFIG_X86_LOCAL_APIC
  	FIX_APIC_BASE,	/* local (CPU) APIC) -- required for SMP or not */
  #endif
-@@ -83,6 +85,14 @@
+@@ -83,6 +85,14 @@ enum fixed_addresses {
  #ifdef CONFIG_PCI_MMCONFIG
  	FIX_PCIE_MCFG,
  #endif
@@ -58312,7 +63482,7 @@
  	__end_of_permanent_fixed_addresses,
  	/* temporary boot-time mappings, used before ioremap() is functional */
  #define NR_FIX_BTMAPS	16
-@@ -93,7 +103,9 @@
+@@ -93,7 +103,9 @@ enum fixed_addresses {
  };
  
  extern void __set_fixmap (enum fixed_addresses idx,
@@ -58323,7 +63493,7 @@
  
  #define set_fixmap(idx, phys) \
  		__set_fixmap(idx, phys, PAGE_KERNEL)
-@@ -116,14 +128,6 @@
+@@ -116,14 +128,6 @@ extern void __set_fixmap (enum fixed_add
  #define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
  #define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
  
@@ -58338,9 +63508,10 @@
  extern void __this_fixmap_does_not_exist(void);
  
  /*
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/floppy.h linux-2.6-merge.hg/include/asm-i386/floppy.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/floppy.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/floppy.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h
+index 79727af..37ea9eb 100644
+--- a/include/asm-i386/floppy.h
++++ b/include/asm-i386/floppy.h
 @@ -6,6 +6,8 @@
   * for more details.
   *
@@ -58382,7 +63553,7 @@
  
  static int virtual_dma_count;
  static int virtual_dma_residue;
-@@ -187,6 +199,8 @@
+@@ -187,6 +199,8 @@ static int fd_request_irq(void)
  
  }
  
@@ -58391,7 +63562,7 @@
  static unsigned long dma_mem_alloc(unsigned long size)
  {
  	return __get_dma_pages(GFP_KERNEL,get_order(size));
-@@ -227,6 +241,18 @@
+@@ -227,6 +241,18 @@ static void _fd_chose_dma_mode(char *add
  
  #define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size)
  
@@ -58410,7 +63581,7 @@
  
  static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
  {
-@@ -239,6 +265,7 @@
+@@ -239,6 +265,7 @@ static int vdma_dma_setup(char *addr, un
  	return 0;
  }
  
@@ -58418,7 +63589,7 @@
  static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
  {
  #ifdef FLOPPY_SANITY_CHECK
-@@ -256,6 +283,7 @@
+@@ -256,6 +283,7 @@ static int hard_dma_setup(char *addr, un
  	enable_dma(FLOPPY_DMA);
  	return 0;
  }
@@ -58426,7 +63597,7 @@
  
  static struct fd_routine_l {
  	int (*_request_dma)(unsigned int dmanr, const char * device_id);
-@@ -265,11 +293,13 @@
+@@ -265,11 +293,13 @@ static struct fd_routine_l {
  	int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
  } fd_routine[] = {
  	{
@@ -58440,7 +63611,7 @@
  	},
  	{
  		vdma_request_dma,
-@@ -281,7 +311,18 @@
+@@ -281,7 +311,18 @@ static struct fd_routine_l {
  };
  
  
@@ -58459,7 +63630,7 @@
  static int FDC2 = -1;
  
  /*
-@@ -312,7 +353,9 @@
+@@ -312,7 +353,9 @@ static int FDC2 = -1;
  
  #define FLOPPY_MOTOR_MASK 0xf0
  
@@ -58469,9 +63640,10 @@
  
  #define EXTRA_FLOPPY_PARAMS
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/futex.h linux-2.6-merge.hg/include/asm-i386/futex.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/futex.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/futex.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
+index 44b9db8..24c9fd3 100644
+--- a/include/asm-i386/futex.h
++++ b/include/asm-i386/futex.h
 @@ -28,7 +28,7 @@
  "1:	movl	%2, %0\n\
  	movl	%0, %3\n"					\
@@ -58481,7 +63653,7 @@
  	jnz	1b\n\
  3:	.section .fixup,\"ax\"\n\
  4:	mov	%5, %1\n\
-@@ -68,7 +68,7 @@
+@@ -68,7 +68,7 @@ futex_atomic_op_inuser (int encoded_op, 
  #endif
  		switch (op) {
  		case FUTEX_OP_ADD:
@@ -58490,10 +63662,11 @@
  					   oldval, uaddr, oparg);
  			break;
  		case FUTEX_OP_OR:
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/highmem.h linux-2.6-merge.hg/include/asm-i386/highmem.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/highmem.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/highmem.h	2006-02-11 17:25:36.000000000 +0000
-@@ -69,6 +69,11 @@
+diff --git a/include/asm-i386/highmem.h b/include/asm-i386/highmem.h
+index 0fd3313..775a136 100644
+--- a/include/asm-i386/highmem.h
++++ b/include/asm-i386/highmem.h
+@@ -69,6 +69,11 @@ extern void FASTCALL(kunmap_high(struct 
  void *kmap(struct page *page);
  void kunmap(struct page *page);
  void *kmap_atomic(struct page *page, enum km_type type);
@@ -58505,10 +63678,11 @@
  void kunmap_atomic(void *kvaddr, enum km_type type);
  void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
  struct page *kmap_atomic_to_page(void *ptr);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/hw_irq.h linux-2.6-merge.hg/include/asm-i386/hw_irq.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/hw_irq.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/hw_irq.h	2006-02-11 17:25:36.000000000 +0000
-@@ -68,7 +68,9 @@
+diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
+index 622815b..3173498 100644
+--- a/include/asm-i386/hw_irq.h
++++ b/include/asm-i386/hw_irq.h
+@@ -68,7 +68,9 @@ extern atomic_t irq_mis_count;
  
  #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
  
@@ -58519,9 +63693,11 @@
  static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
  {
  	if (IO_APIC_IRQ(i))
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/hypercall.h linux-2.6-merge.hg/include/asm-i386/hypercall.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/hypercall.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/hypercall.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/hypercall.h b/include/asm-i386/hypercall.h
+new file mode 100644
+index 0000000..1b2605e
+--- /dev/null
++++ b/include/asm-i386/hypercall.h
 @@ -0,0 +1,329 @@
 +/******************************************************************************
 + * hypercall.h
@@ -58852,9 +64028,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/hypervisor.h linux-2.6-merge.hg/include/asm-i386/hypervisor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/hypervisor.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/hypervisor.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/hypervisor.h b/include/asm-i386/hypervisor.h
+new file mode 100644
+index 0000000..021e2de
+--- /dev/null
++++ b/include/asm-i386/hypervisor.h
 @@ -0,0 +1,168 @@
 +/******************************************************************************
 + * hypervisor.h
@@ -59024,9 +64202,10 @@
 +#endif /* CONFIG_XEN */
 +
 +#endif /* __HYPERVISOR_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/io.h linux-2.6-merge.hg/include/asm-i386/io.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/io.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/io.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
+index 03233c2..b788028 100644
+--- a/include/asm-i386/io.h
++++ b/include/asm-i386/io.h
 @@ -46,7 +46,8 @@
  #ifdef __KERNEL__
  
@@ -59037,7 +64216,7 @@
  #include <linux/vmalloc.h>
  
  /*
-@@ -96,11 +97,6 @@
+@@ -96,11 +97,6 @@ static inline void * phys_to_virt(unsign
  	return __va(address);
  }
  
@@ -59049,7 +64228,7 @@
  extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
  
  /**
-@@ -137,22 +133,6 @@
+@@ -137,22 +133,6 @@ extern void bt_iounmap(void *addr, unsig
  #define dmi_alloc alloc_bootmem
  
  /*
@@ -59072,7 +64251,7 @@
   * readX/writeX() are used to access memory mapped devices. On some
   * architectures the memory mapped IO stuff needs to be accessed
   * differently. On the x86 architecture, we just read/write the
-@@ -209,16 +189,6 @@
+@@ -209,16 +189,6 @@ static inline void memcpy_toio(volatile 
  	__memcpy((void __force *) dst, src, count);
  }
  
@@ -59089,7 +64268,7 @@
  #define isa_readb(a) readb(__ISA_IO_base + (a))
  #define isa_readw(a) readw(__ISA_IO_base + (a))
  #define isa_readl(a) readl(__ISA_IO_base + (a))
-@@ -383,4 +353,9 @@
+@@ -383,4 +353,9 @@ BUILDIO(b,b,char)
  BUILDIO(w,w,short)
  BUILDIO(l,,int)
  
@@ -59099,10 +64278,11 @@
 +#endif
 +
  #endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/kmap_types.h linux-2.6-merge.hg/include/asm-i386/kmap_types.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/kmap_types.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/kmap_types.h	2006-02-11 17:25:36.000000000 +0000
-@@ -23,7 +23,8 @@
+diff --git a/include/asm-i386/kmap_types.h b/include/asm-i386/kmap_types.h
+index 6886a0c..7a660e8 100644
+--- a/include/asm-i386/kmap_types.h
++++ b/include/asm-i386/kmap_types.h
+@@ -23,7 +23,8 @@ D(9)	KM_IRQ0,
  D(10)	KM_IRQ1,
  D(11)	KM_SOFTIRQ0,
  D(12)	KM_SOFTIRQ1,
@@ -59112,9 +64292,11 @@
  };
  
  #undef D
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_dma_map.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_dma_map.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_dma_map.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_dma_map.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_dma_map.h b/include/asm-i386/mach-default/mach_dma_map.h
+new file mode 100644
+index 0000000..5a594ea
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_dma_map.h
 @@ -0,0 +1,85 @@
 +#ifndef __ASM_MACH_DMA_MAP_H
 +#define __ASM_MACH_DMA_MAP_H
@@ -59201,9 +64383,11 @@
 +}
 +
 +#endif /* __ASM_MACH_DMA_MAP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_fixmap.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_fixmap.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_fixmap.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_fixmap.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_fixmap.h b/include/asm-i386/mach-default/mach_fixmap.h
+new file mode 100644
+index 0000000..5d9fc52
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_fixmap.h
 @@ -0,0 +1,15 @@
 +#ifndef __ASM_MACH_FIXMAP_H
 +#define __ASM_MACH_FIXMAP_H
@@ -59220,9 +64404,11 @@
 +#endif
 +
 +#endif /* __ASM_MACH_FIXMAP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_io.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_io.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_io.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_io.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_io.h b/include/asm-i386/mach-default/mach_io.h
+new file mode 100644
+index 0000000..3597ae5
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_io.h
 @@ -0,0 +1,35 @@
 +#ifndef __ASM_MACH_IO_H
 +#define __ASM_MACH_IO_H
@@ -59259,9 +64445,11 @@
 +#define bus_to_virt phys_to_virt
 +
 +#endif /* __ASM_MACH_IO_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_mmu.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_mmu.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_mmu.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_mmu.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_mmu.h b/include/asm-i386/mach-default/mach_mmu.h
+new file mode 100644
+index 0000000..bbd7d44
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_mmu.h
 @@ -0,0 +1,18 @@
 +#ifndef __ASM_MACH_MMU_H
 +#define __ASM_MACH_MMU_H
@@ -59281,9 +64469,11 @@
 +#define mach_switch_commit() 0
 +
 +#endif /* __ASM_MACH_MMU_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_mode.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_mode.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_mode.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_mode.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_mode.h b/include/asm-i386/mach-default/mach_mode.h
+new file mode 100644
+index 0000000..1c3b98d
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_mode.h
 @@ -0,0 +1,7 @@
 +#ifndef __ASM_MACH_MODE_H
 +#define __ASM_MACH_MODE_H
@@ -59292,9 +64482,11 @@
 +#define USER_MODE_MASK 3
 +
 +#endif /* __ASM_MACH_MODE_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_page.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_page.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_page.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_page.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_page.h b/include/asm-i386/mach-default/mach_page.h
+new file mode 100644
+index 0000000..b8beb05
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_page.h
 @@ -0,0 +1,26 @@
 +#ifndef __ASM_MACH_PAGE_H
 +#define __ASM_MACH_PAGE_H
@@ -59322,9 +64514,11 @@
 +#endif /* __ASSEMBLY__ */
 +
 +#endif /* __ASM_MACH_PAGE_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_pgtable.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_pgtable.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_pgtable.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_pgtable.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_pgtable.h b/include/asm-i386/mach-default/mach_pgtable.h
+new file mode 100644
+index 0000000..118b32c
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_pgtable.h
 @@ -0,0 +1,45 @@
 +#ifndef __ASM_MACH_PGTABLE_H
 +#define __ASM_MACH_PGTABLE_H
@@ -59371,9 +64565,11 @@
 +		remap_pfn_range(vma, vaddr, pfn, size, prot)
 +
 +#endif /* __ASM_MACH_PGTABLE_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_processor.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_processor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_processor.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_processor.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_processor.h b/include/asm-i386/mach-default/mach_processor.h
+new file mode 100644
+index 0000000..7d6b3b2
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_processor.h
 @@ -0,0 +1,53 @@
 +#ifndef __ASM_MACH_PROCESSOR_H
 +#define __ASM_MACH_PROCESSOR_H
@@ -59428,9 +64624,11 @@
 +}
 +
 +#endif /* __ASM_MACH_PROCESSOR_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_seg.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_seg.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_seg.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_seg.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_seg.h b/include/asm-i386/mach-default/mach_seg.h
+new file mode 100644
+index 0000000..5c7f021
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_seg.h
 @@ -0,0 +1,42 @@
 +#ifndef __ASM_MACH_SEG_H
 +#define __ASM_MACH_SEG_H
@@ -59474,9 +64672,11 @@
 +#define PNP_TS2    (GDT_ENTRY_PNPBIOS_TS2 * 8)	/* another data segment */
 +
 +#endif /* __ASM_MACH_SEG_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_setup.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_setup.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_setup.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_setup.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_setup.h b/include/asm-i386/mach-default/mach_setup.h
+new file mode 100644
+index 0000000..a24cded
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_setup.h
 @@ -0,0 +1,50 @@
 +#ifndef __ASM_MACH_SETUP_H
 +#define __ASM_MACH_SETUP_H
@@ -59528,9 +64728,11 @@
 +#endif /* __ASSEMBLY__ */
 +
 +#endif /* __ASM_MACH_SETUP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_system.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_system.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_system.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_system.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_system.h b/include/asm-i386/mach-default/mach_system.h
+new file mode 100644
+index 0000000..462c8d7
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_system.h
 @@ -0,0 +1,87 @@
 +#ifndef __ASM_MACH_SYSTEM_H
 +#define __ASM_MACH_SYSTEM_H
@@ -59619,9 +64821,11 @@
 +#define local_irq_save(x)	__asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
 +
 +#endif /* __ASM_MACH_SYSTEM_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_tlbflush.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_tlbflush.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_tlbflush.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_tlbflush.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-default/mach_tlbflush.h b/include/asm-i386/mach-default/mach_tlbflush.h
+new file mode 100644
+index 0000000..a8eda34
+--- /dev/null
++++ b/include/asm-i386/mach-default/mach_tlbflush.h
 @@ -0,0 +1,59 @@
 +#ifndef __ASM_MACH_TLBFLUSH_H
 +#define __ASM_MACH_TLBFLUSH_H
@@ -59682,10 +64886,11 @@
 +#endif
 +
 +#endif /* __ASM_MACH_TLBFLUSH_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_traps.h linux-2.6-merge.hg/include/asm-i386/mach-default/mach_traps.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-default/mach_traps.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-default/mach_traps.h	2006-02-11 17:25:36.000000000 +0000
-@@ -15,6 +15,18 @@
+diff --git a/include/asm-i386/mach-default/mach_traps.h b/include/asm-i386/mach-default/mach_traps.h
+index 625438b..4e34a91 100644
+--- a/include/asm-i386/mach-default/mach_traps.h
++++ b/include/asm-i386/mach-default/mach_traps.h
+@@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig
  	outb(reason, 0x61);
  }
  
@@ -59704,9 +64909,11 @@
  static inline unsigned char get_nmi_reason(void)
  {
  	return inb(0x61);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/irq_vectors.h linux-2.6-merge.hg/include/asm-i386/mach-xen/irq_vectors.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/irq_vectors.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/irq_vectors.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/irq_vectors.h b/include/asm-i386/mach-xen/irq_vectors.h
+new file mode 100644
+index 0000000..49e5ac0
+--- /dev/null
++++ b/include/asm-i386/mach-xen/irq_vectors.h
 @@ -0,0 +1,125 @@
 +/*
 + * This file should contain #defines for all of the interrupt vector
@@ -59833,9 +65040,11 @@
 +#define irq_to_dynirq(_x)	((_x) - DYNIRQ_BASE)
 +
 +#endif /* _ASM_IRQ_VECTORS_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_dma_map.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_dma_map.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_dma_map.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_dma_map.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_dma_map.h b/include/asm-i386/mach-xen/mach_dma_map.h
+new file mode 100644
+index 0000000..c690f3f
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_dma_map.h
 @@ -0,0 +1,47 @@
 +#ifndef __ASM_MACH_DMA_MAP_H
 +#define __ASM_MACH_DMA_MAP_H
@@ -59884,9 +65093,11 @@
 +dma_supported(struct device *dev, u64 mask);
 +
 +#endif /* __ASM_MACH_DMA_MAP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_fixmap.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_fixmap.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_fixmap.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_fixmap.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_fixmap.h b/include/asm-i386/mach-xen/mach_fixmap.h
+new file mode 100644
+index 0000000..018c82f
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_fixmap.h
 @@ -0,0 +1,15 @@
 +#ifndef __ASM_MACH_FIXMAP_H
 +#define __ASM_MACH_FIXMAP_H
@@ -59903,9 +65114,11 @@
 +#endif
 +
 +#endif /* __ASM_MACH_FIXMAP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_io.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_io.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_io.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_io.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_io.h b/include/asm-i386/mach-xen/mach_io.h
+new file mode 100644
+index 0000000..a026e52
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_io.h
 @@ -0,0 +1,46 @@
 +#ifndef __ASM_MACH_IO_H
 +#define __ASM_MACH_IO_H
@@ -59953,9 +65166,11 @@
 +#define bus_to_virt(_x) __va(machine_to_phys(_x))
 +
 +#endif /* __ASM_MACH_XLAT_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_mmu.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_mmu.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_mmu.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_mmu.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_mmu.h b/include/asm-i386/mach-xen/mach_mmu.h
+new file mode 100644
+index 0000000..b50dbb5
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_mmu.h
 @@ -0,0 +1,47 @@
 +#ifndef __ASM_MACH_MMU_H
 +#define __ASM_MACH_MMU_H
@@ -60004,9 +65219,11 @@
 +#define mach_switch_commit() HYPERVISOR_mmuext_op(ops, op - ops, NULL, DOMID_SELF)
 +
 +#endif /* __ASM_MACH_MMU_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_mode.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_mode.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_mode.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_mode.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_mode.h b/include/asm-i386/mach-xen/mach_mode.h
+new file mode 100644
+index 0000000..792cabd
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_mode.h
 @@ -0,0 +1,7 @@
 +#ifndef __ASM_MACH_MODE_H
 +#define __ASM_MACH_MODE_H
@@ -60015,10 +65232,12 @@
 +#define USER_MODE_MASK 2
 +
 +#endif /* __ASM_MACH_MODE_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_page.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_page.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_page.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_page.h	2006-02-27 15:49:45.000000000 +0000
-@@ -0,0 +1,204 @@
+diff --git a/include/asm-i386/mach-xen/mach_page.h b/include/asm-i386/mach-xen/mach_page.h
+new file mode 100644
+index 0000000..274aedd
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_page.h
+@@ -0,0 +1,205 @@
 +#ifndef __ASM_MACH_PAGE_H
 +#define __ASM_MACH_PAGE_H
 +
@@ -60062,7 +65281,8 @@
 +{
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
 +		return pfn;
-+	return phys_to_machine_mapping[(unsigned int)(pfn)] & ~FOREIGN_FRAME_BIT;
++	return phys_to_machine_mapping[(unsigned int)(pfn)] &
++		~FOREIGN_FRAME_BIT;
 +}
 +
 +static inline int phys_to_machine_mapping_valid(unsigned long pfn)
@@ -60223,9 +65443,11 @@
 +#define LOAD_OFFSET		0
 +
 +#endif /* __ASM_MACH_PAGE_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_pgtable.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_pgtable.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_pgtable.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_pgtable.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_pgtable.h b/include/asm-i386/mach-xen/mach_pgtable.h
+new file mode 100644
+index 0000000..3e2a1db
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_pgtable.h
 @@ -0,0 +1,119 @@
 +#ifndef __ASM_MACH_PGTABLE_H
 +#define __ASM_MACH_PGTABLE_H
@@ -60256,8 +65478,8 @@
 +#define pfn_pte_ma(pfn, prot)	__pte_ma(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
 +#else
 +#define PTRS_PER_PGD_NO_HV PTRS_PER_PGD
-+#define pte_mfn(_pte) ( ((_pte).pte_low >> PAGE_SHIFT) |\
-+		        (((_pte).pte_high & 0xfff) << (32-PAGE_SHIFT)) )
++#define pte_mfn(_pte) (((_pte).pte_low >> PAGE_SHIFT) |\
++		       (((_pte).pte_high & 0xfff) << (32-PAGE_SHIFT)))
 +static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
 +{
 +	pte_t pte;
@@ -60346,9 +65568,11 @@
 +direct_remap_pfn_range(vma,from,pfn,size,prot,DOMID_IO)
 +
 +#endif /* __ASM_MACH_PGTABLE_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_processor.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_processor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_processor.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_processor.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_processor.h b/include/asm-i386/mach-xen/mach_processor.h
+new file mode 100644
+index 0000000..4080373
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_processor.h
 @@ -0,0 +1,57 @@
 +#ifndef __ASM_MACH_PROCESSOR_H
 +#define __ASM_MACH_PROCESSOR_H
@@ -60407,9 +65631,11 @@
 +}
 +
 +#endif /* __ASM_MACH_PROCESSOR_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_seg.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_seg.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_seg.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_seg.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_seg.h b/include/asm-i386/mach-xen/mach_seg.h
+new file mode 100644
+index 0000000..aa7f5a2
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_seg.h
 @@ -0,0 +1,12 @@
 +#ifndef __ASM_MACH_SEG_H
 +#define __ASM_MACH_SEG_H
@@ -60423,9 +65649,11 @@
 +#define GDT_ENTRIES 18
 +
 +#endif /* __ASM_MACH_SEG_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_setup.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_setup.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_setup.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_setup.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_setup.h b/include/asm-i386/mach-xen/mach_setup.h
+new file mode 100644
+index 0000000..8f4cd35
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_setup.h
 @@ -0,0 +1,11 @@
 +#ifndef __ASM_MACH_SETUP_H
 +#define __ASM_MACH_SETUP_H
@@ -60438,9 +65666,11 @@
 +#endif /* __ASSEMBLY__ */
 +
 +#endif /* __ASM_MACH_SETUP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_system.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_system.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_system.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_system.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_system.h b/include/asm-i386/mach-xen/mach_system.h
+new file mode 100644
+index 0000000..d364816
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_system.h
 @@ -0,0 +1,157 @@
 +#ifndef __ASM_MACH_SYSTEM_H
 +#define __ASM_MACH_SYSTEM_H
@@ -60537,7 +65767,7 @@
 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];		\
 +	_vcpu->evtchn_upcall_mask = 0;					\
 +	barrier(); /* unmask then check (avoid races) */		\
-+	if ( unlikely(_vcpu->evtchn_upcall_pending) )			\
++	if (unlikely(_vcpu->evtchn_upcall_pending))			\
 +		force_evtchn_callback();				\
 +	preempt_enable();						\
 +} while (0)
@@ -60559,7 +65789,7 @@
 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];		\
 +	if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {			\
 +		barrier(); /* unmask then check (avoid races) */	\
-+		if ( unlikely(_vcpu->evtchn_upcall_pending) )		\
++		if (unlikely(_vcpu->evtchn_upcall_pending))		\
 +			force_evtchn_callback();			\
 +		preempt_enable();					\
 +	} else								\
@@ -60599,9 +65829,11 @@
 +#endif /* __KERNEL__ */
 +
 +#endif /* __ASM_MACH_SYSTEM_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_tlbflush.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_tlbflush.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_tlbflush.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_tlbflush.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_tlbflush.h b/include/asm-i386/mach-xen/mach_tlbflush.h
+new file mode 100644
+index 0000000..bce6ac2
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_tlbflush.h
 @@ -0,0 +1,10 @@
 +#ifndef __ASM_MACH_TLBFLUSH_H
 +#define __ASM_MACH_TLBFLUSH_H
@@ -60613,9 +65845,11 @@
 +#define __flush_tlb_one(addr) __flush_tlb_single(addr)
 +
 +#endif /* __ASM_MACH_TLBFLUSH_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_traps.h linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_traps.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/mach_traps.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/mach_traps.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/mach_traps.h b/include/asm-i386/mach-xen/mach_traps.h
+new file mode 100644
+index 0000000..8daed2c
+--- /dev/null
++++ b/include/asm-i386/mach-xen/mach_traps.h
 @@ -0,0 +1,33 @@
 +/*
 + *  include/asm-xen/asm-i386/mach-xen/mach_traps.h
@@ -60650,9 +65884,11 @@
 +static inline void reassert_nmi(void) {}
 +
 +#endif /* !_MACH_TRAPS_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/setup_arch_post.h linux-2.6-merge.hg/include/asm-i386/mach-xen/setup_arch_post.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/setup_arch_post.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/setup_arch_post.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/setup_arch_post.h b/include/asm-i386/mach-xen/setup_arch_post.h
+new file mode 100644
+index 0000000..49c3f2a
+--- /dev/null
++++ b/include/asm-i386/mach-xen/setup_arch_post.h
 @@ -0,0 +1,50 @@
 +/**
 + * machine_specific_memory_setup - Hook for machine specific memory setup.
@@ -60672,7 +65908,7 @@
 +	return "Xen";
 +}
 +
-+void __init machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
++void __devinit machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
 +{
 +	clear_bit(X86_FEATURE_VME, c->x86_capability);
 +	clear_bit(X86_FEATURE_DE, c->x86_capability);
@@ -60704,18 +65940,36 @@
 +				   &pp) == 0)
 +		set_fixaddr_top(pp.virt_start - PAGE_SIZE);
 +}
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/setup_arch_pre.h linux-2.6-merge.hg/include/asm-i386/mach-xen/setup_arch_pre.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mach-xen/setup_arch_pre.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mach-xen/setup_arch_pre.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mach-xen/setup_arch_pre.h b/include/asm-i386/mach-xen/setup_arch_pre.h
+new file mode 100644
+index 0000000..b18df68
+--- /dev/null
++++ b/include/asm-i386/mach-xen/setup_arch_pre.h
 @@ -0,0 +1,5 @@
 +/* Hook to call BIOS initialisation function */
 +
 +#define ARCH_SETUP machine_specific_arch_setup();
 +
 +static void __init machine_specific_arch_setup(void);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mmu_context.h linux-2.6-merge.hg/include/asm-i386/mmu_context.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mmu_context.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mmu_context.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/mmu.h b/include/asm-i386/mmu.h
+index f431a0b..1d67576 100644
+--- a/include/asm-i386/mmu.h
++++ b/include/asm-i386/mmu.h
+@@ -14,4 +14,10 @@ typedef struct { 
+ 	void *ldt;
+ } mm_context_t;
+ 
++#ifdef CONFIG_X86_XEN
++/* mm/memory.c:exit_mmap hook */
++extern void _arch_exit_mmap(struct mm_struct *mm);
++#define arch_exit_mmap(_mm) _arch_exit_mmap(_mm)
++#endif
++
+ #endif
+diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
+index bf08218..ea0f78a 100644
+--- a/include/asm-i386/mmu_context.h
++++ b/include/asm-i386/mmu_context.h
 @@ -6,6 +6,7 @@
  #include <asm/atomic.h>
  #include <asm/pgalloc.h>
@@ -60724,7 +65978,7 @@
  
  /*
   * Used for LDT copy/destruction.
-@@ -16,7 +17,7 @@
+@@ -16,7 +17,7 @@ void destroy_context(struct mm_struct *m
  
  static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  {
@@ -60733,7 +65987,7 @@
  	unsigned cpu = smp_processor_id();
  	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
  		per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_LAZY;
-@@ -28,26 +29,27 @@
+@@ -28,26 +29,27 @@ static inline void switch_mm(struct mm_s
  			     struct task_struct *tsk)
  {
  	int cpu = smp_processor_id();
@@ -60765,7 +66019,7 @@
  	else {
  		per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
  		BUG_ON(per_cpu(cpu_tlbstate, cpu).active_mm != next);
-@@ -56,11 +58,12 @@
+@@ -56,11 +58,12 @@ static inline void switch_mm(struct mm_s
  			/* We were in lazy tlb mode and leave_mm disabled 
  			 * tlb flush IPI delivery. We must reload %cr3.
  			 */
@@ -60780,23 +66034,10 @@
  }
  
  #define deactivate_mm(tsk, mm) \
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mmu.h linux-2.6-merge.hg/include/asm-i386/mmu.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/mmu.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/mmu.h	2006-02-11 17:25:36.000000000 +0000
-@@ -14,4 +14,10 @@
- 	void *ldt;
- } mm_context_t;
- 
-+#ifdef CONFIG_X86_XEN
-+/* mm/memory.c:exit_mmap hook */
-+extern void _arch_exit_mmap(struct mm_struct *mm);
-+#define arch_exit_mmap(_mm) _arch_exit_mmap(_mm)
-+#endif
-+
- #endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/page.h linux-2.6-merge.hg/include/asm-i386/page.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/page.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/page.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
+index 997ca5d..226f35a 100644
+--- a/include/asm-i386/page.h
++++ b/include/asm-i386/page.h
 @@ -36,9 +36,6 @@
  #define clear_user_page(page, vaddr, pg)	clear_page(page)
  #define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)
@@ -60807,7 +66048,7 @@
  /*
   * These are used to make use of C type-checking..
   */
-@@ -49,16 +46,12 @@
+@@ -49,16 +46,12 @@ typedef struct { unsigned long pte_low, 
  typedef struct { unsigned long long pmd; } pmd_t;
  typedef struct { unsigned long long pgd; } pgd_t;
  typedef struct { unsigned long long pgprot; } pgprot_t;
@@ -60824,7 +66065,7 @@
  #define HPAGE_SHIFT	22
  #endif
  #define PTE_MASK	PAGE_MASK
-@@ -70,15 +63,13 @@
+@@ -70,15 +63,13 @@ typedef struct { unsigned long pgprot; }
  #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  #endif
  
@@ -60842,7 +66083,7 @@
  /* to align the pointer to the (next) page boundary */
  #define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
  
-@@ -121,7 +112,7 @@
+@@ -121,7 +112,7 @@ extern int page_is_ram(unsigned long pag
  
  #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
  #define VMALLOC_RESERVE		((unsigned long)__VMALLOC_RESERVE)
@@ -60851,7 +66092,7 @@
  #define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
  #define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
  #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
-@@ -139,6 +130,8 @@
+@@ -139,6 +130,8 @@ extern int page_is_ram(unsigned long pag
  	((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
  		 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  
@@ -60860,10 +66101,11 @@
  #endif /* __KERNEL__ */
  
  #include <asm-generic/page.h>
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pci.h linux-2.6-merge.hg/include/asm-i386/pci.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pci.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/pci.h	2006-02-21 16:06:10.000000000 +0000
-@@ -43,6 +43,26 @@
+diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
+index 78c8598..ee1b338 100644
+--- a/include/asm-i386/pci.h
++++ b/include/asm-i386/pci.h
+@@ -43,6 +43,26 @@ int pcibios_set_irq_routing(struct pci_d
  
  struct pci_dev;
  
@@ -60890,7 +66132,7 @@
  /* The PCI address space does equal the physical memory
   * address space.  The networking and block device layers use
   * this boolean for bounce buffer decisions.
-@@ -57,6 +77,8 @@
+@@ -57,6 +77,8 @@ struct pci_dev;
  #define pci_unmap_len(PTR, LEN_NAME)		(0)
  #define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do { } while (0)
  
@@ -60899,7 +66141,7 @@
  /* This is always fine. */
  #define pci_dac_dma_supported(pci_dev, mask)	(1)
  
-@@ -111,10 +133,23 @@
+@@ -111,10 +133,23 @@ static inline void pci_dma_burst_advice(
  
  #endif /* __KERNEL__ */
  
@@ -60923,9 +66165,10 @@
 +#endif
 +
  #endif /* __i386_PCI_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgalloc.h linux-2.6-merge.hg/include/asm-i386/pgalloc.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgalloc.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/pgalloc.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h
+index 0380c3d..76a36fc 100644
+--- a/include/asm-i386/pgalloc.h
++++ b/include/asm-i386/pgalloc.h
 @@ -5,14 +5,37 @@
  #include <asm/fixmap.h>
  #include <linux/threads.h>
@@ -60964,7 +66207,7 @@
  /*
   * Allocate and free page tables.
   */
-@@ -25,13 +48,19 @@
+@@ -25,13 +48,19 @@ extern struct page *pte_alloc_one(struct
  static inline void pte_free_kernel(pte_t *pte)
  {
  	free_page((unsigned long)pte);
@@ -60985,9 +66228,10 @@
  
  #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgtable-2level.h linux-2.6-merge.hg/include/asm-i386/pgtable-2level.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgtable-2level.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/pgtable-2level.h	2006-02-18 12:03:39.000000000 +0000
+diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
+index 74ef721..5c4c93a 100644
+--- a/include/asm-i386/pgtable-2level.h
++++ b/include/asm-i386/pgtable-2level.h
 @@ -14,16 +14,18 @@
   * hook is made available.
   */
@@ -61012,10 +66256,11 @@
  #define pfn_pmd(pfn, prot)	__pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
  
  /*
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgtable-3level.h linux-2.6-merge.hg/include/asm-i386/pgtable-3level.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgtable-3level.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/pgtable-3level.h	2006-02-18 12:03:39.000000000 +0000
-@@ -56,15 +56,21 @@
+diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
+index f1a8b45..5f45788 100644
+--- a/include/asm-i386/pgtable-3level.h
++++ b/include/asm-i386/pgtable-3level.h
+@@ -56,15 +56,21 @@ static inline void set_pte(pte_t *ptep, 
  	smp_wmb();
  	ptep->pte_low = pte.pte_low;
  }
@@ -61041,7 +66286,7 @@
  
  /*
   * Pentium-II erratum A13: in PAE mode we explicitly have to flush
-@@ -109,28 +115,13 @@
+@@ -109,28 +115,13 @@ static inline int pte_none(pte_t pte)
  	return !pte.pte_low && !pte.pte_high;
  }
  
@@ -61073,10 +66318,11 @@
  	return __pmd((((unsigned long long)page_nr << PAGE_SHIFT) | \
  			pgprot_val(pgprot)) & __supported_pte_mask);
  }
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgtable.h linux-2.6-merge.hg/include/asm-i386/pgtable.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/pgtable.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/pgtable.h	2006-02-11 17:25:36.000000000 +0000
-@@ -34,7 +34,6 @@
+diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
+index 088a945..d933743 100644
+--- a/include/asm-i386/pgtable.h
++++ b/include/asm-i386/pgtable.h
+@@ -34,7 +34,6 @@ struct vm_area_struct;
   */
  #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
  extern unsigned long empty_zero_page[1024];
@@ -61084,7 +66330,7 @@
  extern kmem_cache_t *pgd_cache;
  extern kmem_cache_t *pmd_cache;
  extern spinlock_t pgd_lock;
-@@ -208,9 +207,7 @@
+@@ -208,9 +207,7 @@ extern unsigned long pg0[];
  
  /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
  #define pmd_none(x)	(!(unsigned long)pmd_val(x))
@@ -61094,7 +66340,7 @@
  
  
  #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
-@@ -249,6 +246,7 @@
+@@ -249,6 +246,7 @@ static inline pte_t pte_mkhuge(pte_t pte
  #else
  # include <asm/pgtable-2level.h>
  #endif
@@ -61102,7 +66348,7 @@
  
  static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
  {
-@@ -278,7 +276,8 @@
+@@ -278,7 +276,8 @@ static inline pte_t ptep_get_and_clear_f
  
  static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
  {
@@ -61112,7 +66358,7 @@
  }
  
  /*
-@@ -399,9 +398,9 @@
+@@ -399,9 +398,9 @@ extern void noexec_setup(const char *str
  
  #if defined(CONFIG_HIGHPTE)
  #define pte_offset_map(dir, address) \
@@ -61124,7 +66370,7 @@
  #define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
  #define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
  #else
-@@ -423,14 +422,6 @@
+@@ -423,14 +422,6 @@ extern void noexec_setup(const char *str
   * bit at the same time.
   */
  #define update_mmu_cache(vma,address,pte) do { } while (0)
@@ -61139,7 +66385,7 @@
  
  #endif /* !__ASSEMBLY__ */
  
-@@ -438,9 +429,6 @@
+@@ -438,9 +429,6 @@ extern void noexec_setup(const char *str
  #define kern_addr_valid(addr)	(1)
  #endif /* CONFIG_FLATMEM */
  
@@ -61149,10 +66395,11 @@
  #define MK_IOSPACE_PFN(space, pfn)	(pfn)
  #define GET_IOSPACE(pfn)		0
  #define GET_PFN(pfn)			(pfn)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/processor.h linux-2.6-merge.hg/include/asm-i386/processor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/processor.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/processor.h	2006-02-21 16:06:10.000000000 +0000
-@@ -90,8 +90,10 @@
+diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
+index feca5d9..2e7bec8 100644
+--- a/include/asm-i386/processor.h
++++ b/include/asm-i386/processor.h
+@@ -90,8 +90,10 @@ struct cpuinfo_x86 {
  
  extern struct cpuinfo_x86 boot_cpu_data;
  extern struct cpuinfo_x86 new_cpu_data;
@@ -61163,7 +66410,7 @@
  
  #ifdef CONFIG_SMP
  extern struct cpuinfo_x86 cpu_data[];
-@@ -232,24 +234,6 @@
+@@ -232,24 +234,6 @@ static inline unsigned int cpuid_edx(uns
   */
  extern unsigned long mmu_cr4_features;
  
@@ -61188,7 +66435,7 @@
  /*
   *      NSC/Cyrix CPU configuration register indexes
   */
-@@ -333,7 +317,9 @@
+@@ -333,7 +317,9 @@ extern int bootloader_type;
  #define IO_BITMAP_BITS  65536
  #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
  #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
@@ -61198,7 +66445,7 @@
  #define INVALID_IO_BITMAP_OFFSET 0x8000
  #define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000
  
-@@ -391,6 +377,7 @@
+@@ -391,6 +377,7 @@ typedef struct {
  
  struct thread_struct;
  
@@ -61206,7 +66453,7 @@
  struct tss_struct {
  	unsigned short	back_link,__blh;
  	unsigned long	esp0;
-@@ -436,6 +423,7 @@
+@@ -436,6 +423,7 @@ struct tss_struct {
  	 */
  	unsigned long stack[64];
  } __attribute__((packed));
@@ -61214,7 +66461,7 @@
  
  #define ARCH_MIN_TASKALIGN	16
  
-@@ -472,6 +460,9 @@
+@@ -472,6 +460,9 @@ struct thread_struct {
  	.io_bitmap_ptr = NULL,						\
  }
  
@@ -61224,7 +66471,7 @@
  /*
   * Note that the .io_bitmap member must be extra-big. This is because
   * the CPU will access an additional byte beyond the end of the IO
-@@ -486,15 +477,25 @@
+@@ -486,15 +477,25 @@ struct thread_struct {
  	.io_bitmap	= { [ 0 ... IO_BITMAP_LONGS] = ~0 },		\
  }
  
@@ -61251,7 +66498,7 @@
  
  #define start_thread(regs, new_eip, new_esp) do {		\
  	__asm__("movl %0,%%fs ; movl %0,%%gs": :"r" (0));	\
-@@ -507,33 +508,6 @@
+@@ -507,33 +508,6 @@ static inline void load_esp0(struct tss_
  	regs->esp = new_esp;					\
  } while (0)
  
@@ -61285,10 +66532,11 @@
  /* Forward declaration, a strange C thing */
  struct task_struct;
  struct mm_struct;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/ptrace.h linux-2.6-merge.hg/include/asm-i386/ptrace.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/ptrace.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/ptrace.h	2006-02-11 17:25:36.000000000 +0000
-@@ -60,6 +60,7 @@
+diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
+index f324c53..52eb791 100644
+--- a/include/asm-i386/ptrace.h
++++ b/include/asm-i386/ptrace.h
+@@ -60,6 +60,7 @@ struct pt_regs {
  #ifdef __KERNEL__
  
  #include <asm/vm86.h>
@@ -61296,7 +66544,7 @@
  
  struct task_struct;
  extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
-@@ -73,11 +74,11 @@
+@@ -73,11 +74,11 @@ extern void send_sigtrap(struct task_str
   */
  static inline int user_mode(struct pt_regs *regs)
  {
@@ -61310,9 +66558,10 @@
  }
  #define instruction_pointer(regs) ((regs)->eip)
  #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/rwsem.h linux-2.6-merge.hg/include/asm-i386/rwsem.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/rwsem.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/rwsem.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/rwsem.h b/include/asm-i386/rwsem.h
+index be4ab85..75751b7 100644
+--- a/include/asm-i386/rwsem.h
++++ b/include/asm-i386/rwsem.h
 @@ -40,6 +40,7 @@
  
  #include <linux/list.h>
@@ -61321,7 +66570,7 @@
  
  struct rwsem_waiter;
  
-@@ -99,7 +100,7 @@
+@@ -99,7 +100,7 @@ static inline void __down_read(struct rw
  {
  	__asm__ __volatile__(
  		"# beginning down_read\n\t"
@@ -61330,7 +66579,7 @@
  		"  js        2f\n\t" /* jump if we weren't granted the lock */
  		"1:\n\t"
  		LOCK_SECTION_START("")
-@@ -130,7 +131,7 @@
+@@ -130,7 +131,7 @@ static inline int __down_read_trylock(st
  		"  movl	     %1,%2\n\t"
  		"  addl      %3,%2\n\t"
  		"  jle	     2f\n\t"
@@ -61339,7 +66588,7 @@
  		"  jnz	     1b\n\t"
  		"2:\n\t"
  		"# ending __down_read_trylock\n\t"
-@@ -150,7 +151,7 @@
+@@ -150,7 +151,7 @@ static inline void __down_write(struct r
  	tmp = RWSEM_ACTIVE_WRITE_BIAS;
  	__asm__ __volatile__(
  		"# beginning down_write\n\t"
@@ -61348,7 +66597,7 @@
  		"  testl     %%edx,%%edx\n\t" /* was the count 0 before? */
  		"  jnz       2f\n\t" /* jump if we weren't granted the lock */
  		"1:\n\t"
-@@ -188,7 +189,7 @@
+@@ -188,7 +189,7 @@ static inline void __up_read(struct rw_s
  	__s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
  	__asm__ __volatile__(
  		"# beginning __up_read\n\t"
@@ -61357,7 +66606,7 @@
  		"  js        2f\n\t" /* jump if the lock is being waited upon */
  		"1:\n\t"
  		LOCK_SECTION_START("")
-@@ -214,7 +215,7 @@
+@@ -214,7 +215,7 @@ static inline void __up_write(struct rw_
  	__asm__ __volatile__(
  		"# beginning __up_write\n\t"
  		"  movl      %2,%%edx\n\t"
@@ -61366,7 +66615,7 @@
  		"  jnz       2f\n\t" /* jump if the lock is being waited upon */
  		"1:\n\t"
  		LOCK_SECTION_START("")
-@@ -239,7 +240,7 @@
+@@ -239,7 +240,7 @@ static inline void __downgrade_write(str
  {
  	__asm__ __volatile__(
  		"# beginning __downgrade_write\n\t"
@@ -61375,7 +66624,7 @@
  		"  js        2f\n\t" /* jump if the lock is being waited upon */
  		"1:\n\t"
  		LOCK_SECTION_START("")
-@@ -263,7 +264,7 @@
+@@ -263,7 +264,7 @@ LOCK_PREFIX	"  addl      %2,(%%eax)\n\t"
  static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
  {
  	__asm__ __volatile__(
@@ -61384,7 +66633,7 @@
  		: "=m"(sem->count)
  		: "ir"(delta), "m"(sem->count));
  }
-@@ -276,7 +277,7 @@
+@@ -276,7 +277,7 @@ static inline int rwsem_atomic_update(in
  	int tmp = delta;
  
  	__asm__ __volatile__(
@@ -61393,9 +66642,10 @@
  		: "+r"(tmp), "=m"(sem->count)
  		: "r"(sem), "m"(sem->count)
  		: "memory");
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/scatterlist.h linux-2.6-merge.hg/include/asm-i386/scatterlist.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/scatterlist.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/scatterlist.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/scatterlist.h b/include/asm-i386/scatterlist.h
+index 55d6c95..b6f8523 100644
+--- a/include/asm-i386/scatterlist.h
++++ b/include/asm-i386/scatterlist.h
 @@ -1,11 +1,16 @@
  #ifndef _I386_SCATTERLIST_H
  #define _I386_SCATTERLIST_H
@@ -61413,7 +66663,7 @@
  };
  
  /* These macros should be used after a pci_map_sg call has been done
-@@ -14,7 +19,11 @@
+@@ -14,7 +19,11 @@ struct scatterlist {
   * returns.
   */
  #define sg_dma_address(sg)	((sg)->dma_address)
@@ -61425,9 +66675,10 @@
  
  #define ISA_DMA_THRESHOLD (0x00ffffff)
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/segment.h linux-2.6-merge.hg/include/asm-i386/segment.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/segment.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/segment.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
+index faf9953..2fab8f8 100644
+--- a/include/asm-i386/segment.h
++++ b/include/asm-i386/segment.h
 @@ -1,6 +1,8 @@
  #ifndef _ASM_SEGMENT_H
  #define _ASM_SEGMENT_H
@@ -61482,9 +66733,10 @@
  /*
   * The interrupt descriptor table has room for 256 idt's,
   * the global descriptor table is dependent on the number
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/setup.h linux-2.6-merge.hg/include/asm-i386/setup.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/setup.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/setup.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
+index 826a8ca..62b1fea 100644
+--- a/include/asm-i386/setup.h
++++ b/include/asm-i386/setup.h
 @@ -16,51 +16,8 @@
  #define MAXMEM_PFN	PFN_DOWN(MAXMEM)
  #define MAX_NONPAE_PFN	(1 << 20)
@@ -61538,9 +66790,29 @@
 +#include <mach_setup.h>
  
  #endif /* _i386_SETUP_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/smp_alt.h linux-2.6-merge.hg/include/asm-i386/smp_alt.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/smp_alt.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/smp_alt.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
+index 61d3ab9..daf519a 100644
+--- a/include/asm-i386/smp.h
++++ b/include/asm-i386/smp.h
+@@ -59,8 +59,13 @@ extern void cpu_uninit(void);
+  */
+ #define raw_smp_processor_id() (current_thread_info()->cpu)
+ 
++#ifndef CONFIG_X86_XEN
+ extern cpumask_t cpu_callout_map;
+ extern cpumask_t cpu_callin_map;
++#else
++#define cpu_callout_map cpu_possible_map
++#define cpu_callin_map cpu_possible_map
++#endif
+ extern cpumask_t cpu_possible_map;
+ 
+ /* We don't mark CPUs online until __cpu_up(), so we need another measure */
+diff --git a/include/asm-i386/smp_alt.h b/include/asm-i386/smp_alt.h
+new file mode 100644
+index 0000000..67307c3
+--- /dev/null
++++ b/include/asm-i386/smp_alt.h
 @@ -0,0 +1,32 @@
 +#ifndef __ASM_SMP_ALT_H__
 +#define __ASM_SMP_ALT_H__
@@ -61574,26 +66846,10 @@
 +#endif
 +
 +#endif /* __ASM_SMP_ALT_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/smp.h linux-2.6-merge.hg/include/asm-i386/smp.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/smp.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/smp.h	2006-02-11 17:25:36.000000000 +0000
-@@ -59,8 +59,13 @@
-  */
- #define raw_smp_processor_id() (current_thread_info()->cpu)
- 
-+#ifndef CONFIG_X86_XEN
- extern cpumask_t cpu_callout_map;
- extern cpumask_t cpu_callin_map;
-+#else
-+#define cpu_callout_map cpu_possible_map
-+#define cpu_callin_map cpu_possible_map
-+#endif
- extern cpumask_t cpu_possible_map;
- 
- /* We don't mark CPUs online until __cpu_up(), so we need another measure */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/spinlock.h linux-2.6-merge.hg/include/asm-i386/spinlock.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/spinlock.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/spinlock.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
+index 2360435..fed8e97 100644
+--- a/include/asm-i386/spinlock.h
++++ b/include/asm-i386/spinlock.h
 @@ -6,6 +6,7 @@
  #include <asm/page.h>
  #include <linux/config.h>
@@ -61638,7 +66894,7 @@
  
  static inline void __raw_spin_lock(raw_spinlock_t *lock)
  {
-@@ -65,10 +72,34 @@
+@@ -65,10 +72,34 @@ static inline void __raw_spin_lock_flags
  static inline int __raw_spin_trylock(raw_spinlock_t *lock)
  {
  	char oldval;
@@ -61673,7 +66929,7 @@
  	return oldval > 0;
  }
  
-@@ -178,12 +209,12 @@
+@@ -178,12 +209,12 @@ static inline int __raw_write_trylock(ra
  
  static inline void __raw_read_unlock(raw_rwlock_t *rw)
  {
@@ -61688,9 +66944,11 @@
  				 : "=m" (rw->lock) : : "memory");
  }
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/swiotlb.h linux-2.6-merge.hg/include/asm-i386/swiotlb.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/swiotlb.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/swiotlb.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/asm-i386/swiotlb.h b/include/asm-i386/swiotlb.h
+new file mode 100644
+index 0000000..d5a9f13
+--- /dev/null
++++ b/include/asm-i386/swiotlb.h
 @@ -0,0 +1,60 @@
 +#ifndef _ASM_SWIOTLB_H
 +#define _ASM_SWIOTLB_H 1
@@ -61752,9 +67010,11 @@
 +	swiotlb_sync_single_for_device(dev, (dma_handle) + (offset), size, direction)
 +
 +#endif /* _ASM_SWIOTLB_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/synch_bitops.h linux-2.6-merge.hg/include/asm-i386/synch_bitops.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/synch_bitops.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/synch_bitops.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/synch_bitops.h b/include/asm-i386/synch_bitops.h
+new file mode 100644
+index 0000000..2d3f7a8
+--- /dev/null
++++ b/include/asm-i386/synch_bitops.h
 @@ -0,0 +1,143 @@
 +#ifndef __ASM_SYNCH_BITOPS_H__
 +#define __ASM_SYNCH_BITOPS_H__
@@ -61899,9 +67159,10 @@
 + synch_var_test_bit((nr),(addr)))
 +
 +#endif /* __ASM_SYNCH_BITOPS_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/system.h linux-2.6-merge.hg/include/asm-i386/system.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/system.h	2006-02-27 15:51:43.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/system.h	2006-02-18 12:03:39.000000000 +0000
+diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
+index 399145a..1e99ff8 100644
+--- a/include/asm-i386/system.h
++++ b/include/asm-i386/system.h
 @@ -5,7 +5,7 @@
  #include <linux/kernel.h>
  #include <asm/segment.h>
@@ -61911,7 +67172,7 @@
  
  #ifdef __KERNEL__
  
-@@ -83,64 +83,6 @@
+@@ -83,64 +83,6 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t"
  #define savesegment(seg, value) \
  	asm volatile("mov %%" #seg ",%0":"=rm" (value))
  
@@ -61976,7 +67237,7 @@
  #endif	/* __KERNEL__ */
  
  #define wbinvd() \
-@@ -271,19 +213,19 @@
+@@ -271,19 +213,19 @@ static inline unsigned long __cmpxchg(vo
  	unsigned long prev;
  	switch (size) {
  	case 1:
@@ -61999,7 +67260,7 @@
  				     : "=a"(prev)
  				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  				     : "memory");
-@@ -336,7 +278,7 @@
+@@ -336,7 +278,7 @@ static inline unsigned long long __cmpxc
  				      unsigned long long new)
  {
  	unsigned long long prev;
@@ -62008,7 +67269,7 @@
  			     : "=A"(prev)
  			     : "b"((unsigned long)new),
  			       "c"((unsigned long)(new >> 32)),
-@@ -503,11 +445,55 @@
+@@ -503,11 +445,55 @@ struct alt_instr { 
  #endif
  
  #ifdef CONFIG_SMP
@@ -62065,7 +67326,7 @@
  #else
  #define smp_mb()	barrier()
  #define smp_rmb()	barrier()
-@@ -518,25 +504,7 @@
+@@ -518,25 +504,7 @@ struct alt_instr { 
  
  #define set_wmb(var, value) do { var = value; wmb(); } while (0)
  
@@ -62092,9 +67353,10 @@
  
  /*
   * disable hlt during certain critical i/o operations
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/tlbflush.h linux-2.6-merge.hg/include/asm-i386/tlbflush.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/tlbflush.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/tlbflush.h	2006-02-11 17:25:36.000000000 +0000
+diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
+index ab216e1..98b7876 100644
+--- a/include/asm-i386/tlbflush.h
++++ b/include/asm-i386/tlbflush.h
 @@ -5,64 +5,11 @@
  #include <linux/mm.h>
  #include <asm/processor.h>
@@ -62133,50 +67395,1190 @@
 -
  extern unsigned long pgkern_mask;
  
--# define __flush_tlb_all()						\
--	do {								\
--		if (cpu_has_pge)					\
--			__flush_tlb_global();				\
--		else							\
--			__flush_tlb();					\
--	} while (0)
--
- #define cpu_has_invlpg	(boot_cpu_data.x86 > 3)
+-# define __flush_tlb_all()						\
+-	do {								\
+-		if (cpu_has_pge)					\
+-			__flush_tlb_global();				\
+-		else							\
+-			__flush_tlb();					\
+-	} while (0)
+-
+ #define cpu_has_invlpg	(boot_cpu_data.x86 > 3)
+ 
+-#define __flush_tlb_single(addr) \
+-	__asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))
+-
+-#ifdef CONFIG_X86_INVLPG
+-# define __flush_tlb_one(addr) __flush_tlb_single(addr)
+-#else
+-# define __flush_tlb_one(addr)						\
+-	do {								\
+-		if (cpu_has_invlpg)					\
+-			__flush_tlb_single(addr);			\
+-		else							\
+-			__flush_tlb();					\
+-	} while (0)
+-#endif
++#include <mach_tlbflush.h>
+ 
+ /*
+  * TLB flushing:
+diff --git a/include/asm-i386/vga.h b/include/asm-i386/vga.h
+index ef0c0e5..4de2ca6 100644
+--- a/include/asm-i386/vga.h
++++ b/include/asm-i386/vga.h
+@@ -12,7 +12,7 @@
+  *	access the videoram directly without any black magic.
+  */
+ 
+-#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x)
++#define VGA_MAP_MEM(x) ((unsigned long)isa_bus_to_virt(x))
+ 
+ #define vga_readb(x) (*(x))
+ #define vga_writeb(x,y) (*(y) = (x))
+diff --git a/include/asm-ia64/fixmap.h b/include/asm-ia64/fixmap.h
+new file mode 100644
+index 0000000..4b32a82
+--- /dev/null
++++ b/include/asm-ia64/fixmap.h
+@@ -0,0 +1,2 @@
++#define clear_fixmap(x)	do {} while (0)
++#define	set_fixmap(x,y)	do {} while (0)
+diff --git a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
+index 4fb4e43..b23a280 100644
+--- a/include/asm-ia64/gcc_intrin.h
++++ b/include/asm-ia64/gcc_intrin.h
+@@ -26,7 +26,7 @@ extern void ia64_bad_param_for_getreg (v
+ 
+ register unsigned long ia64_r13 asm ("r13") __attribute_used__;
+ 
+-#define ia64_setreg(regnum, val)						\
++#define __ia64_setreg(regnum, val)						\
+ ({										\
+ 	switch (regnum) {							\
+ 	    case _IA64_REG_PSR_L:						\
+@@ -55,7 +55,7 @@ register unsigned long ia64_r13 asm ("r1
+ 	}									\
+ })
+ 
+-#define ia64_getreg(regnum)							\
++#define __ia64_getreg(regnum)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 										\
+@@ -92,7 +92,7 @@ register unsigned long ia64_r13 asm ("r1
+ 
+ #define ia64_hint_pause 0
+ 
+-#define ia64_hint(mode)						\
++#define __ia64_hint(mode)						\
+ ({								\
+ 	switch (mode) {						\
+ 	case ia64_hint_pause:					\
+@@ -374,7 +374,7 @@ register unsigned long ia64_r13 asm ("r1
+ 
+ #define ia64_invala() asm volatile ("invala" ::: "memory")
+ 
+-#define ia64_thash(addr)							\
++#define __ia64_thash(addr)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 	asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr));	\
+@@ -394,18 +394,18 @@ register unsigned long ia64_r13 asm ("r1
+ 
+ #define ia64_nop(x)	asm volatile ("nop %0"::"i"(x));
+ 
+-#define ia64_itci(addr)	asm volatile ("itc.i %0;;" :: "r"(addr) : "memory")
++#define __ia64_itci(addr)	asm volatile ("itc.i %0;;" :: "r"(addr) : "memory")
+ 
+-#define ia64_itcd(addr)	asm volatile ("itc.d %0;;" :: "r"(addr) : "memory")
++#define __ia64_itcd(addr)	asm volatile ("itc.d %0;;" :: "r"(addr) : "memory")
+ 
+ 
+-#define ia64_itri(trnum, addr) asm volatile ("itr.i itr[%0]=%1"				\
++#define __ia64_itri(trnum, addr) asm volatile ("itr.i itr[%0]=%1"			\
+ 					     :: "r"(trnum), "r"(addr) : "memory")
+ 
+-#define ia64_itrd(trnum, addr) asm volatile ("itr.d dtr[%0]=%1"				\
++#define __ia64_itrd(trnum, addr) asm volatile ("itr.d dtr[%0]=%1"			\
+ 					     :: "r"(trnum), "r"(addr) : "memory")
+ 
+-#define ia64_tpa(addr)								\
++#define __ia64_tpa(addr)							\
+ ({										\
+ 	__u64 ia64_pa;								\
+ 	asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory");	\
+@@ -415,22 +415,22 @@ register unsigned long ia64_r13 asm ("r1
+ #define __ia64_set_dbr(index, val)						\
+ 	asm volatile ("mov dbr[%0]=%1" :: "r"(index), "r"(val) : "memory")
+ 
+-#define ia64_set_ibr(index, val)						\
++#define __ia64_set_ibr(index, val)						\
+ 	asm volatile ("mov ibr[%0]=%1" :: "r"(index), "r"(val) : "memory")
+ 
+-#define ia64_set_pkr(index, val)						\
++#define __ia64_set_pkr(index, val)						\
+ 	asm volatile ("mov pkr[%0]=%1" :: "r"(index), "r"(val) : "memory")
+ 
+-#define ia64_set_pmc(index, val)						\
++#define __ia64_set_pmc(index, val)						\
+ 	asm volatile ("mov pmc[%0]=%1" :: "r"(index), "r"(val) : "memory")
+ 
+-#define ia64_set_pmd(index, val)						\
++#define __ia64_set_pmd(index, val)						\
+ 	asm volatile ("mov pmd[%0]=%1" :: "r"(index), "r"(val) : "memory")
+ 
+-#define ia64_set_rr(index, val)							\
++#define __ia64_set_rr(index, val)							\
+ 	asm volatile ("mov rr[%0]=%1" :: "r"(index), "r"(val) : "memory");
+ 
+-#define ia64_get_cpuid(index)								\
++#define __ia64_get_cpuid(index)								\
+ ({											\
+ 	__u64 ia64_intri_res;								\
+ 	asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index));	\
+@@ -444,21 +444,21 @@ register unsigned long ia64_r13 asm ("r1
+ 	ia64_intri_res;								\
+ })
+ 
+-#define ia64_get_ibr(index)							\
++#define __ia64_get_ibr(index)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 	asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index));	\
+ 	ia64_intri_res;								\
+ })
+ 
+-#define ia64_get_pkr(index)							\
++#define __ia64_get_pkr(index)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 	asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index));	\
+ 	ia64_intri_res;								\
+ })
+ 
+-#define ia64_get_pmc(index)							\
++#define __ia64_get_pmc(index)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 	asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index));	\
+@@ -466,48 +466,48 @@ register unsigned long ia64_r13 asm ("r1
+ })
+ 
+ 
+-#define ia64_get_pmd(index)							\
++#define __ia64_get_pmd(index)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 	asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index));	\
+ 	ia64_intri_res;								\
+ })
+ 
+-#define ia64_get_rr(index)							\
++#define __ia64_get_rr(index)							\
+ ({										\
+ 	__u64 ia64_intri_res;							\
+ 	asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index));	\
+ 	ia64_intri_res;								\
+ })
+ 
+-#define ia64_fc(addr)	asm volatile ("fc %0" :: "r"(addr) : "memory")
++#define __ia64_fc(addr)	asm volatile ("fc %0" :: "r"(addr) : "memory")
+ 
+ 
+ #define ia64_sync_i()	asm volatile (";; sync.i" ::: "memory")
+ 
+-#define ia64_ssm(mask)	asm volatile ("ssm %0":: "i"((mask)) : "memory")
+-#define ia64_rsm(mask)	asm volatile ("rsm %0":: "i"((mask)) : "memory")
++#define __ia64_ssm(mask)	asm volatile ("ssm %0":: "i"((mask)) : "memory")
++#define __ia64_rsm(mask)	asm volatile ("rsm %0":: "i"((mask)) : "memory")
+ #define ia64_sum(mask)	asm volatile ("sum %0":: "i"((mask)) : "memory")
+ #define ia64_rum(mask)	asm volatile ("rum %0":: "i"((mask)) : "memory")
+ 
+-#define ia64_ptce(addr)	asm volatile ("ptc.e %0" :: "r"(addr))
++#define __ia64_ptce(addr)	asm volatile ("ptc.e %0" :: "r"(addr))
+ 
+-#define ia64_ptcga(addr, size)							\
++#define __ia64_ptcga(addr, size)							\
+ do {										\
+ 	asm volatile ("ptc.ga %0,%1" :: "r"(addr), "r"(size) : "memory");	\
+ 	ia64_dv_serialize_data();						\
+ } while (0)
+ 
+-#define ia64_ptcl(addr, size)							\
++#define __ia64_ptcl(addr, size)							\
+ do {										\
+ 	asm volatile ("ptc.l %0,%1" :: "r"(addr), "r"(size) : "memory");	\
+ 	ia64_dv_serialize_data();						\
+ } while (0)
+ 
+-#define ia64_ptri(addr, size)						\
++#define __ia64_ptri(addr, size)						\
+ 	asm volatile ("ptr.i %0,%1" :: "r"(addr), "r"(size) : "memory")
+ 
+-#define ia64_ptrd(addr, size)						\
++#define __ia64_ptrd(addr, size)						\
+ 	asm volatile ("ptr.d %0,%1" :: "r"(addr), "r"(size) : "memory")
+ 
+ /* Values for lfhint in ia64_lfetch and ia64_lfetch_fault */
+@@ -589,7 +589,7 @@ do {										\
+         }								\
+ })
+ 
+-#define ia64_intrin_local_irq_restore(x)			\
++#define __ia64_intrin_local_irq_restore(x)			\
+ do {								\
+ 	asm volatile (";;   cmp.ne p6,p7=%0,r0;;"		\
+ 		      "(p6) ssm psr.i;"				\
+@@ -598,4 +598,6 @@ do {								\
+ 		      :: "r"((x)) : "p6", "p7", "memory");	\
+ } while (0)
+ 
++#define __ia64_get_psr_i()	(__ia64_getreg(_IA64_REG_PSR) & 0x4000UL)
++
+ #endif /* _ASM_IA64_GCC_INTRIN_H */
+diff --git a/include/asm-ia64/hypercall.h b/include/asm-ia64/hypercall.h
+new file mode 100644
+index 0000000..fd57868
+--- /dev/null
++++ b/include/asm-ia64/hypercall.h
+@@ -0,0 +1,253 @@
++/******************************************************************************
++ * hypercall.h
++ * 
++ * Linux-specific hypervisor handling.
++ * 
++ * Copyright (c) 2002-2004, K A Fraser
++ * 
++ * This file may be distributed separately from the Linux kernel, or
++ * incorporated into other software packages, subject to the following license:
++ * 
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this source file (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy, modify,
++ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so, subject to
++ * the following conditions:
++ * 
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ * 
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * 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.
++ */
++
++#ifndef __HYPERCALL_H__
++#define __HYPERCALL_H__
++
++#include <xen/interface/xen.h>
++#include <xen/interface/sched.h>
++
++/* FIXME: temp place to hold these page related macros */
++#include <asm/page.h>
++#define virt_to_machine(v) __pa(v)
++#define machine_to_virt(m) __va(m)
++#define virt_to_mfn(v)	((__pa(v)) >> PAGE_SHIFT)
++#define mfn_to_virt(m)	(__va((m) << PAGE_SHIFT))
++
++/*
++ * Assembler stubs for hyper-calls.
++ */
++
++#define _hypercall0(type, name)					\
++({								\
++	long __res;						\
++	__asm__ __volatile__ (";;\n"				\
++			      "mov r2=%1\n"			\
++			      "break 0x1000 ;;\n"		\
++			      "mov %0=r8 ;;\n"			\
++			      : "=r" (__res)			\
++			      : "i" (__HYPERVISOR_##name)	\
++			      : "r2","r8",			\
++			        "memory" );			\
++	(type)__res;						\
++})
++
++#define _hypercall1(type, name, a1)				\
++({								\
++	long __res;						\
++	__asm__ __volatile__ (";;\n"				\
++			      "mov r14=%2\n"			\
++			      "mov r2=%1\n"			\
++			      "break 0x1000 ;;\n"		\
++			      "mov %0=r8 ;;\n"			\
++			      : "=r" (__res)			\
++			      : "i" (__HYPERVISOR_##name),	\
++				"r" ((unsigned long)(a1))	\
++			      : "r14","r2","r8",		\
++				"memory" );			\
++	(type)__res;						\
++})
++
++#define _hypercall2(type, name, a1, a2)				\
++({								\
++	long __res;						\
++	__asm__ __volatile__ (";;\n"				\
++			      "mov r14=%2\n"			\
++			      "mov r15=%3\n"			\
++			      "mov r2=%1\n"			\
++			      "break 0x1000 ;;\n"		\
++			      "mov %0=r8 ;;\n"			\
++			      : "=r" (__res)			\
++			      : "i" (__HYPERVISOR_##name),	\
++				"r" ((unsigned long)(a1)),	\
++				"r" ((unsigned long)(a2))	\
++			      : "r14","r15","r2","r8",		\
++				"memory" );			\
++	(type)__res;						\
++})
++
++#define _hypercall3(type, name, a1, a2, a3)			\
++({								\
++	long __res;						\
++	__asm__ __volatile__ (";;\n"                            \
++			      "mov r14=%2\n"                    \
++			      "mov r15=%3\n"                    \
++			      "mov r16=%4\n"                    \
++			      "mov r2=%1\n"                     \
++			      "break 0x1000 ;;\n"               \
++			      "mov %0=r8 ;;\n"                  \
++			      : "=r" (__res)                    \
++			      : "i" (__HYPERVISOR_##name),      \
++				"r" ((unsigned long)(a1)),	\
++				"r" ((unsigned long)(a2)),	\
++				"r" ((unsigned long)(a3))	\
++			      : "r14","r15","r16","r2","r8",	\
++			        "memory" );                     \
++	(type)__res;                                            \
++})
++
++#define _hypercall4(type, name, a1, a2, a3, a4)			\
++({								\
++	long __res;						\
++	__asm__ __volatile__ (";;\n"                            \
++			      "mov r14=%2\n"                    \
++			      "mov r15=%3\n"                    \
++			      "mov r16=%4\n"                    \
++			      "mov r17=%5\n"                    \
++			      "mov r2=%1\n"                     \
++			      "break 0x1000 ;;\n"               \
++			      "mov %0=r8 ;;\n"                  \
++			      : "=r" (__res)                    \
++			      : "i" (__HYPERVISOR_##name),      \
++				"r" ((unsigned long)(a1)),	\
++				"r" ((unsigned long)(a2)),	\
++				"r" ((unsigned long)(a3)),	\
++				"r" ((unsigned long)(a4))       \
++			      : "r14","r15","r16","r2","r8",	\
++			        "r17","memory" );               \
++	(type)__res;                                            \
++})
++
++#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
++({								\
++	long __res;						\
++	__asm__ __volatile__ (";;\n"                            \
++			      "mov r14=%2\n"                    \
++			      "mov r15=%3\n"                    \
++			      "mov r16=%4\n"                    \
++			      "mov r17=%5\n"                    \
++			      "mov r18=%6\n"                    \
++			      "mov r2=%1\n"                     \
++			      "break 0x1000 ;;\n"               \
++			      "mov %0=r8 ;;\n"                  \
++			      : "=r" (__res)                    \
++			      : "i" (__HYPERVISOR_##name),      \
++				"r" ((unsigned long)(a1)),	\
++				"r" ((unsigned long)(a2)),	\
++				"r" ((unsigned long)(a3)),	\
++				"r" ((unsigned long)(a4)),	\
++				"r" ((unsigned long)(a5))       \
++			      : "r14","r15","r16","r2","r8",	\
++			        "r17","r18","memory" );         \
++	(type)__res;                                            \
++})
++
++static inline int
++HYPERVISOR_sched_op(
++    int cmd, unsigned long arg)
++{
++	return _hypercall2(int, sched_op, cmd, arg);
++}
++
++static inline long
++HYPERVISOR_set_timer_op(
++    u64 timeout)
++{
++    unsigned long timeout_hi = (unsigned long)(timeout>>32);
++    unsigned long timeout_lo = (unsigned long)timeout;
++    return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
++}
++
++static inline int
++HYPERVISOR_dom0_op(
++    dom0_op_t *dom0_op)
++{
++    dom0_op->interface_version = DOM0_INTERFACE_VERSION;
++    return _hypercall1(int, dom0_op, dom0_op);
++}
++
++static inline int
++HYPERVISOR_multicall(
++    void *call_list, int nr_calls)
++{
++    return _hypercall2(int, multicall, call_list, nr_calls);
++}
++
++static inline int
++HYPERVISOR_memory_op(
++    unsigned int cmd, void *arg)
++{
++    return _hypercall2(int, memory_op, cmd, arg);
++}
++
++static inline int
++HYPERVISOR_event_channel_op(
++    void *op)
++{
++    return _hypercall1(int, event_channel_op, op);
++}
++
++static inline int
++HYPERVISOR_xen_version(
++    int cmd, void *arg)
++{
++    return _hypercall2(int, xen_version, cmd, arg);
++}
++
++static inline int
++HYPERVISOR_console_io(
++    int cmd, int count, char *str)
++{
++    return _hypercall3(int, console_io, cmd, count, str);
++}
++
++static inline int
++HYPERVISOR_physdev_op(
++    void *physdev_op)
++{
++    return _hypercall1(int, physdev_op, physdev_op);
++}
++
++static inline int
++HYPERVISOR_grant_table_op(
++    unsigned int cmd, void *uop, unsigned int count)
++{
++    return _hypercall3(int, grant_table_op, cmd, uop, count);
++}
++
++static inline int
++HYPERVISOR_vcpu_op(
++	int cmd, int vcpuid, void *extra_args)
++{
++    return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
++}
++
++static inline int
++HYPERVISOR_suspend(
++	unsigned long srec)
++{
++    return _hypercall3(int, sched_op, SCHEDOP_shutdown,
++			SHUTDOWN_suspend, srec);
++}
++
++extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
++static inline void exit_idle(void) {}
++#define do_IRQ(irq, regs) __do_IRQ((irq), (regs))
++
++#endif /* __HYPERCALL_H__ */
+diff --git a/include/asm-ia64/hypervisor.h b/include/asm-ia64/hypervisor.h
+new file mode 100644
+index 0000000..4771111
+--- /dev/null
++++ b/include/asm-ia64/hypervisor.h
+@@ -0,0 +1,70 @@
++/******************************************************************************
++ * hypervisor.h
++ * 
++ * Linux-specific hypervisor handling.
++ * 
++ * Copyright (c) 2002-2004, K A Fraser
++ * 
++ * This file may be distributed separately from the Linux kernel, or
++ * incorporated into other software packages, subject to the following license:
++ * 
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this source file (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy, modify,
++ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so, subject to
++ * the following conditions:
++ * 
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ * 
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * 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.
++ */
++
++#ifndef __HYPERVISOR_H__
++#define __HYPERVISOR_H__
++
++#include <linux/config.h>
++#include <linux/types.h>
++#include <linux/kernel.h>
++#include <linux/version.h>
++#include <xen/interface/xen.h>
++#include <xen/interface/dom0_ops.h>
++#include <asm/ptrace.h>
++#include <asm/page.h>
++
++extern shared_info_t *HYPERVISOR_shared_info;
++extern start_info_t *xen_start_info;
++
++void force_evtchn_callback(void);
++
++#include <asm/hypercall.h>
++
++// for drivers/xen/privcmd/privcmd.c
++#define direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
++#define	pfn_to_mfn(x)	(x)
++#define	mfn_to_pfn(x)	(x)
++#define machine_to_phys_mapping 0
++
++// for drivers/xen/balloon/balloon.c
++#ifdef CONFIG_XEN_SCRUB_PAGES
++#define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
++#else
++#define scrub_pages(_p,_n) ((void)0)
++#endif
++#define	pte_mfn(_x)	pte_pfn(_x)
++#define INVALID_P2M_ENTRY	(~0UL)
++#define __pte_ma(_x)	((pte_t) {(_x)})
++#define phys_to_machine_mapping_valid(_x)	(1)
++#define	kmap_flush_unused()	do {} while (0)
++#define set_phys_to_machine(_x,_y)	do {} while (0)
++#define xen_machphys_update(_x,_y)	do {} while (0)
++#define pfn_pte_ma(_x,_y)	__pte_ma(0)
++
++#endif /* __HYPERVISOR_H__ */
+diff --git a/include/asm-ia64/intel_intrin.h b/include/asm-ia64/intel_intrin.h
+index a7122d8..d4e5471 100644
+--- a/include/asm-ia64/intel_intrin.h
++++ b/include/asm-ia64/intel_intrin.h
+@@ -119,10 +119,10 @@ __s64 _m64_popcnt(__s64 a);
+ 		 	 * intrinsic
+ 		 	 */
+ 
+-#define ia64_getreg		__getReg
+-#define ia64_setreg		__setReg
++#define __ia64_getreg		__getReg
++#define __ia64_setreg		__setReg
+ 
+-#define ia64_hint(x)
++#define __ia64_hint(x)
+ 
+ #define ia64_mux1_brcst	 0
+ #define ia64_mux1_mix		 8
+@@ -135,16 +135,16 @@ __s64 _m64_popcnt(__s64 a);
+ #define ia64_getf_exp		__getf_exp
+ #define ia64_shrp		_m64_shrp
+ 
+-#define ia64_tpa		__tpa
++#define __ia64_tpa		__tpa
+ #define ia64_invala		__invala
+ #define ia64_invala_gr		__invala_gr
+ #define ia64_invala_fr		__invala_fr
+ #define ia64_nop		__nop
+ #define ia64_sum		__sum
+-#define ia64_ssm		__ssm
++#define __ia64_ssm		__ssm
+ #define ia64_rum		__rum
+-#define ia64_rsm		__rsm
+-#define ia64_fc 		__fc
++#define __ia64_rsm		__rsm
++#define __ia64_fc 		__fc
+ 
+ #define ia64_ldfs		__ldfs
+ #define ia64_ldfd		__ldfd
+@@ -182,24 +182,24 @@ __s64 _m64_popcnt(__s64 a);
+ 
+ #define __ia64_set_dbr(index, val)	\
+ 		__setIndReg(_IA64_REG_INDR_DBR, index, val)
+-#define ia64_set_ibr(index, val)	\
++#define __ia64_set_ibr(index, val)	\
+ 		__setIndReg(_IA64_REG_INDR_IBR, index, val)
+-#define ia64_set_pkr(index, val)	\
++#define __ia64_set_pkr(index, val)	\
+ 		__setIndReg(_IA64_REG_INDR_PKR, index, val)
+-#define ia64_set_pmc(index, val)	\
++#define __ia64_set_pmc(index, val)	\
+ 		__setIndReg(_IA64_REG_INDR_PMC, index, val)
+-#define ia64_set_pmd(index, val)	\
++#define __ia64_set_pmd(index, val)	\
+ 		__setIndReg(_IA64_REG_INDR_PMD, index, val)
+-#define ia64_set_rr(index, val)	\
++#define __ia64_set_rr(index, val)	\
+ 		__setIndReg(_IA64_REG_INDR_RR, index, val)
+ 
+-#define ia64_get_cpuid(index) 	__getIndReg(_IA64_REG_INDR_CPUID, index)
++#define __ia64_get_cpuid(index) 	__getIndReg(_IA64_REG_INDR_CPUID, index)
+ #define __ia64_get_dbr(index) 	__getIndReg(_IA64_REG_INDR_DBR, index)
+-#define ia64_get_ibr(index) 	__getIndReg(_IA64_REG_INDR_IBR, index)
+-#define ia64_get_pkr(index) 	__getIndReg(_IA64_REG_INDR_PKR, index)
+-#define ia64_get_pmc(index) 	__getIndReg(_IA64_REG_INDR_PMC, index)
+-#define ia64_get_pmd(index)  	__getIndReg(_IA64_REG_INDR_PMD, index)
+-#define ia64_get_rr(index) 	__getIndReg(_IA64_REG_INDR_RR, index)
++#define __ia64_get_ibr(index) 	__getIndReg(_IA64_REG_INDR_IBR, index)
++#define __ia64_get_pkr(index) 	__getIndReg(_IA64_REG_INDR_PKR, index)
++#define __ia64_get_pmc(index) 	__getIndReg(_IA64_REG_INDR_PMC, index)
++#define __ia64_get_pmd(index)  	__getIndReg(_IA64_REG_INDR_PMD, index)
++#define __ia64_get_rr(index) 	__getIndReg(_IA64_REG_INDR_RR, index)
+ 
+ #define ia64_srlz_d		__dsrlz
+ #define ia64_srlz_i		__isrlz
+@@ -218,18 +218,18 @@ __s64 _m64_popcnt(__s64 a);
+ #define ia64_ld8_acq		__ld8_acq
+ 
+ #define ia64_sync_i		__synci
+-#define ia64_thash		__thash
+-#define ia64_ttag		__ttag
+-#define ia64_itcd		__itcd
+-#define ia64_itci		__itci
+-#define ia64_itrd		__itrd
+-#define ia64_itri		__itri
+-#define ia64_ptce		__ptce
+-#define ia64_ptcl		__ptcl
+-#define ia64_ptcg		__ptcg
+-#define ia64_ptcga		__ptcga
+-#define ia64_ptri		__ptri
+-#define ia64_ptrd		__ptrd
++#define __ia64_thash		__thash
++#define __ia64_ttag		__ttag
++#define __ia64_itcd		__itcd
++#define __ia64_itci		__itci
++#define __ia64_itrd		__itrd
++#define __ia64_itri		__itri
++#define __ia64_ptce		__ptce
++#define __ia64_ptcl		__ptcl
++#define __ia64_ptcg		__ptcg
++#define __ia64_ptcga		__ptcga
++#define __ia64_ptri		__ptri
++#define __ia64_ptrd		__ptrd
+ #define ia64_dep_mi		_m64_dep_mi
+ 
+ /* Values for lfhint in __lfetch and __lfetch_fault */
+@@ -244,14 +244,16 @@ __s64 _m64_popcnt(__s64 a);
+ #define ia64_lfetch_fault	__lfetch_fault
+ #define ia64_lfetch_fault_excl	__lfetch_fault_excl
+ 
+-#define ia64_intrin_local_irq_restore(x)		\
++#define __ia64_intrin_local_irq_restore(x)		\
+ do {							\
+ 	if ((x) != 0) {					\
+-		ia64_ssm(IA64_PSR_I);			\
++		__ia64_ssm(IA64_PSR_I);			\
+ 		ia64_srlz_d();				\
+ 	} else {					\
+-		ia64_rsm(IA64_PSR_I);			\
++		__ia64_rsm(IA64_PSR_I);			\
+ 	}						\
+ } while (0)
+ 
++#define __ia64_get_psr_i()	(__ia64_getreg(_IA64_REG_PSR) & 0x4000UL)
++
+ #endif /* _ASM_IA64_INTEL_INTRIN_H */
+diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
+index 46501b0..9a4afc3 100644
+--- a/include/asm-ia64/meminit.h
++++ b/include/asm-ia64/meminit.h
+@@ -17,10 +17,15 @@
+  * 	- command line string
+  * 	- kernel code & data
+  * 	- Kernel memory map built from EFI memory map
++ *	- xen start info
+  *
+  * More could be added if necessary
+  */
++#ifndef CONFIG_XEN
+ #define IA64_MAX_RSVD_REGIONS 6
++#else
++#define IA64_MAX_RSVD_REGIONS 7
++#endif
  
--#define __flush_tlb_single(addr) \
--	__asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))
--
--#ifdef CONFIG_X86_INVLPG
--# define __flush_tlb_one(addr) __flush_tlb_single(addr)
--#else
--# define __flush_tlb_one(addr)						\
--	do {								\
--		if (cpu_has_invlpg)					\
--			__flush_tlb_single(addr);			\
--		else							\
--			__flush_tlb();					\
--	} while (0)
--#endif
-+#include <mach_tlbflush.h>
+ struct rsvd_region {
+ 	unsigned long start;	/* virtual address of beginning of element */
+diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
+index 7708ec6..e476c94 100644
+--- a/include/asm-ia64/pal.h
++++ b/include/asm-ia64/pal.h
+@@ -81,6 +81,7 @@
+ #ifndef __ASSEMBLY__
+ 
+ #include <linux/types.h>
++#include <asm/processor.h>
+ #include <asm/fpu.h>
  
  /*
-  * TLB flushing:
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/vga.h linux-2.6-merge.hg/include/asm-i386/vga.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-i386/vga.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-i386/vga.h	2006-02-11 17:25:36.000000000 +0000
-@@ -12,7 +12,7 @@
-  *	access the videoram directly without any black magic.
-  */
+diff --git a/include/asm-ia64/privop.h b/include/asm-ia64/privop.h
+new file mode 100644
+index 0000000..2a3f783
+--- /dev/null
++++ b/include/asm-ia64/privop.h
+@@ -0,0 +1,59 @@
++#ifndef _ASM_IA64_PRIVOP_H
++#define _ASM_IA64_PRIVOP_H
++
++/*
++ * Copyright (C) 2005 Hewlett-Packard Co
++ *	Dan Magenheimer <dan.magenheimer at hp.com>
++ *
++ */
++
++#include <linux/config.h>
++#ifdef CONFIG_XEN
++#include <asm/xen/privop.h>
++#endif
++
++#ifndef __ASSEMBLY
++
++#ifndef IA64_PARAVIRTUALIZED
++
++#define ia64_getreg			__ia64_getreg
++#define ia64_setreg			__ia64_setreg
++#define ia64_hint			__ia64_hint
++#define ia64_thash			__ia64_thash
++#define ia64_itci			__ia64_itci
++#define ia64_itcd			__ia64_itcd
++#define ia64_itri			__ia64_itri
++#define ia64_itrd			__ia64_itrd
++#define ia64_tpa			__ia64_tpa
++#define ia64_set_ibr			__ia64_set_ibr
++#define ia64_set_pkr			__ia64_set_pkr
++#define ia64_set_pmc			__ia64_set_pmc
++#define ia64_set_pmd			__ia64_set_pmd
++#define ia64_set_rr			__ia64_set_rr
++#define ia64_get_cpuid			__ia64_get_cpuid
++#define ia64_get_ibr			__ia64_get_ibr
++#define ia64_get_pkr			__ia64_get_pkr
++#define ia64_get_pmc			__ia64_get_pmc
++#define ia64_get_pmd			__ia64_get_pmd
++#define ia64_get_rr			__ia64_get_rr
++#define ia64_fc				__ia64_fc
++#define ia64_ssm			__ia64_ssm
++#define ia64_rsm			__ia64_rsm
++#define ia64_ptce			__ia64_ptce
++#define ia64_ptcga			__ia64_ptcga
++#define ia64_ptcl			__ia64_ptcl
++#define ia64_ptri			__ia64_ptri
++#define ia64_ptrd			__ia64_ptrd
++#define	ia64_get_psr_i			__ia64_get_psr_i
++#define ia64_intrin_local_irq_restore	__ia64_intrin_local_irq_restore
++#define ia64_pal_halt_light		__ia64_pal_halt_light
++#define	ia64_leave_kernel		__ia64_leave_kernel
++#define	ia64_leave_syscall		__ia64_leave_syscall
++#define	ia64_switch_to			__ia64_switch_to
++#define	ia64_pal_call_static		__ia64_pal_call_static
++
++#endif /* !IA64_PARAVIRTUALIZED */
++
++#endif /* !__ASSEMBLY */
++
++#endif /* _ASM_IA64_PRIVOP_H */
+diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
+index 23c8e1b..99a1de4 100644
+--- a/include/asm-ia64/processor.h
++++ b/include/asm-ia64/processor.h
+@@ -19,6 +19,7 @@
+ #include <asm/kregs.h>
+ #include <asm/ptrace.h>
+ #include <asm/ustack.h>
++#include <asm/privop.h>
  
--#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x)
-+#define VGA_MAP_MEM(x) ((unsigned long)isa_bus_to_virt(x))
+ #define IA64_NUM_DBG_REGS	8
+ /*
+diff --git a/include/asm-ia64/synch_bitops.h b/include/asm-ia64/synch_bitops.h
+new file mode 100644
+index 0000000..ee13306
+--- /dev/null
++++ b/include/asm-ia64/synch_bitops.h
+@@ -0,0 +1,61 @@
++#ifndef __XEN_SYNCH_BITOPS_H__
++#define __XEN_SYNCH_BITOPS_H__
++
++/*
++ * Copyright 1992, Linus Torvalds.
++ * Heavily modified to provide guaranteed strong synchronisation
++ * when communicating with Xen or other guest OSes running on other CPUs.
++ */
++
++#include <linux/config.h>
++
++#define ADDR (*(volatile long *) addr)
++
++static __inline__ void synch_set_bit(int nr, volatile void * addr)
++{
++	set_bit(nr, addr);
++}
++
++static __inline__ void synch_clear_bit(int nr, volatile void * addr)
++{
++	clear_bit(nr, addr);
++}
++
++static __inline__ void synch_change_bit(int nr, volatile void * addr)
++{
++	change_bit(nr, addr);
++}
++
++static __inline__ int synch_test_and_set_bit(int nr, volatile void * addr)
++{
++    return test_and_set_bit(nr, addr);
++}
++
++static __inline__ int synch_test_and_clear_bit(int nr, volatile void * addr)
++{
++    return test_and_clear_bit(nr, addr);
++}
++
++static __inline__ int synch_test_and_change_bit(int nr, volatile void * addr)
++{
++    return test_and_change_bit(nr, addr);
++}
++
++static __inline__ int synch_const_test_bit(int nr, const volatile void * addr)
++{
++    return test_bit(nr, addr);
++}
++
++static __inline__ int synch_var_test_bit(int nr, volatile void * addr)
++{
++    return test_bit(nr, addr);
++}
++
++#define synch_cmpxchg	ia64_cmpxchg4_acq
++
++#define synch_test_bit(nr,addr) \
++(__builtin_constant_p(nr) ? \
++ synch_const_test_bit((nr),(addr)) : \
++ synch_var_test_bit((nr),(addr)))
++
++#endif /* __XEN_SYNCH_BITOPS_H__ */
+diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
+index 0625387..349c8d1 100644
+--- a/include/asm-ia64/system.h
++++ b/include/asm-ia64/system.h
+@@ -125,7 +125,7 @@ extern struct ia64_boot_param {
+ #define __local_irq_save(x)			\
+ do {						\
+ 	ia64_stop();				\
+-	(x) = ia64_getreg(_IA64_REG_PSR);	\
++	(x) = ia64_get_psr_i();			\
+ 	ia64_stop();				\
+ 	ia64_rsm(IA64_PSR_I);			\
+ } while (0)
+@@ -173,7 +173,7 @@ do {								\
+ #endif /* !CONFIG_IA64_DEBUG_IRQ */
  
- #define vga_readb(x) (*(x))
- #define vga_writeb(x,y) (*(y) = (x))
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-um/page.h linux-2.6-merge.hg/include/asm-um/page.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-um/page.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-um/page.h	2006-02-11 17:25:43.000000000 +0000
-@@ -118,7 +118,7 @@
+ #define local_irq_enable()	({ ia64_stop(); ia64_ssm(IA64_PSR_I); ia64_srlz_d(); })
+-#define local_save_flags(flags)	({ ia64_stop(); (flags) = ia64_getreg(_IA64_REG_PSR); })
++#define local_save_flags(flags)	({ ia64_stop(); (flags) = ia64_get_psr_i(); })
+ 
+ #define irqs_disabled()				\
+ ({						\
+diff --git a/include/asm-ia64/xen/privop.h b/include/asm-ia64/xen/privop.h
+new file mode 100644
+index 0000000..235197b
+--- /dev/null
++++ b/include/asm-ia64/xen/privop.h
+@@ -0,0 +1,272 @@
++#ifndef _ASM_IA64_XEN_PRIVOP_H
++#define _ASM_IA64_XEN_PRIVOP_H
++
++/*
++ * Copyright (C) 2005 Hewlett-Packard Co
++ *	Dan Magenheimer <dan.magenheimer at hp.com>
++ *
++ * Paravirtualizations of privileged operations for Xen/ia64
++ *
++ */
++
++
++#include <asm/xen/asm-xsi-offsets.h>
++
++#define IA64_PARAVIRTUALIZED
++
++#ifdef __ASSEMBLY__
++#define	XEN_HYPER_RFI			break 0x1
++#define	XEN_HYPER_RSM_PSR_DT		break 0x2
++#define	XEN_HYPER_SSM_PSR_DT		break 0x3
++#define	XEN_HYPER_COVER			break 0x4
++#define	XEN_HYPER_ITC_D			break 0x5
++#define	XEN_HYPER_ITC_I			break 0x6
++#define	XEN_HYPER_SSM_I			break 0x7
++#define	XEN_HYPER_GET_IVR		break 0x8
++#define	XEN_HYPER_GET_TPR		break 0x9
++#define	XEN_HYPER_SET_TPR		break 0xa
++#define	XEN_HYPER_EOI			break 0xb
++#define	XEN_HYPER_SET_ITM		break 0xc
++#define	XEN_HYPER_THASH			break 0xd
++#define	XEN_HYPER_PTC_GA		break 0xe
++#define	XEN_HYPER_ITR_D			break 0xf
++#define	XEN_HYPER_GET_RR		break 0x10
++#define	XEN_HYPER_SET_RR		break 0x11
++#define	XEN_HYPER_SET_KR		break 0x12
++#endif
++
++#ifndef __ASSEMBLY__
++#ifdef MODULE
++extern int is_running_on_xen(void);
++#define running_on_xen (is_running_on_xen())
++#else
++extern int running_on_xen;
++#endif
++
++#define	XEN_HYPER_SSM_I			asm("break 0x7");
++#define	XEN_HYPER_GET_IVR		asm("break 0x8");
++
++/************************************************/
++/* Instructions paravirtualized for correctness */
++/************************************************/
++
++/* "fc" and "thash" are privilege-sensitive instructions, meaning they
++ *  may have different semantics depending on whether they are executed
++ *  at PL0 vs PL!=0.  When paravirtualized, these instructions mustn't
++ *  be allowed to execute directly, lest incorrect semantics result. */
++extern unsigned long xen_fc(unsigned long addr);
++#define ia64_fc(addr)			xen_fc((unsigned long)(addr))
++extern unsigned long xen_thash(unsigned long addr);
++#define ia64_thash(addr)		xen_thash((unsigned long)(addr))
++/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
++ * is not currently used (though it may be in a long-format VHPT system!)
++ * and the semantics of cover only change if psr.ic is off which is very
++ * rare (and currently non-existent outside of assembly code */
++
++/* There are also privilege-sensitive registers.  These registers are
++ * readable at any privilege level but only writable at PL0. */
++extern unsigned long xen_get_cpuid(int index);
++#define	ia64_get_cpuid(i)		xen_get_cpuid(i)
++extern unsigned long xen_get_pmd(int index);
++#define	ia64_get_pmd(i)			xen_get_pmd(i)
++extern unsigned long xen_get_eflag(void);	/* see xen_ia64_getreg */
++extern void xen_set_eflag(unsigned long);	/* see xen_ia64_setreg */
++
++/************************************************/
++/* Instructions paravirtualized for performance */
++/************************************************/
++
++/* Xen uses memory-mapped virtual privileged registers for access to many
++ * performance-sensitive privileged registers.  Some, like the processor
++ * status register (psr), are broken up into multiple memory locations.
++ * Others, like "pend", are abstractions based on privileged registers.
++ * "Pend" is guaranteed to be set if reading cr.ivr would return a
++ * (non-spurious) interrupt. */
++#define xen_get_virtual_psr_i()		(*(int *)(XSI_PSR_I))
++#define xen_set_virtual_psr_i(_val)	({ *(int *)(XSI_PSR_I) = _val ? 1:0; })
++#define xen_set_virtual_psr_ic(_val)	({ *(int *)(XSI_PSR_IC) = _val ? 1:0; })
++#define xen_get_virtual_pend()		(*(int *)(XSI_PEND))
++
++/* Hyperprivops are "break" instructions with a well-defined API.
++ * In particular, the virtual psr.ic bit must be off; in this way
++ * it is guaranteed to never conflict with a linux break instruction.
++ * Normally, this is done in a xen stub but this one is frequent enough
++ * that we inline it */
++#define xen_hyper_ssm_i()						\
++({									\
++	xen_set_virtual_psr_i(0);					\
++	xen_set_virtual_psr_ic(0);					\
++	XEN_HYPER_SSM_I;						\
++})
++
++/* turning off interrupts can be paravirtualized simply by writing
++ * to a memory-mapped virtual psr.i bit (implemented as a 16-bit bool) */
++#define xen_rsm_i()	xen_set_virtual_psr_i(0)
++
++/* turning on interrupts is a bit more complicated.. write to the
++ * memory-mapped virtual psr.i bit first (to avoid race condition),
++ * then if any interrupts were pending, we have to execute a hyperprivop
++ * to ensure the pending interrupt gets delivered; else we're done! */
++#define xen_ssm_i()							\
++({									\
++	int old = xen_get_virtual_psr_i();				\
++	xen_set_virtual_psr_i(1);					\
++	if (!old && xen_get_virtual_pend()) xen_hyper_ssm_i();		\
++})
++
++#define xen_ia64_intrin_local_irq_restore(x)				\
++{									\
++     if (running_on_xen) {						\
++	if ((x) & IA64_PSR_I) { xen_ssm_i(); }				\
++	else { xen_rsm_i(); }						\
++    }									\
++    else __ia64_intrin_local_irq_restore((x));				\
++}
++
++#define	xen_get_psr_i()							\
++(									\
++	(running_on_xen) ?						\
++		(xen_get_virtual_psr_i() ? IA64_PSR_I : 0)		\
++		: __ia64_get_psr_i()					\
++)
++
++#define xen_ia64_ssm(mask)						\
++{									\
++	if ((mask)==IA64_PSR_I) {					\
++		if (running_on_xen) { xen_ssm_i(); }			\
++		else { __ia64_ssm(mask); }				\
++	}								\
++	else { __ia64_ssm(mask); }					\
++}
++
++#define xen_ia64_rsm(mask)						\
++{									\
++	if ((mask)==IA64_PSR_I) {					\
++		if (running_on_xen) { xen_rsm_i(); }			\
++		else { __ia64_rsm(mask); }				\
++	}								\
++	else { __ia64_rsm(mask); }					\
++}
++
++
++/* Although all privileged operations can be left to trap and will
++ * be properly handled by Xen, some are frequent enough that we use
++ * hyperprivops for performance. */
++
++extern unsigned long xen_get_ivr(void);
++extern unsigned long xen_get_tpr(void);
++extern void xen_set_itm(unsigned long);
++extern void xen_set_tpr(unsigned long);
++extern void xen_eoi(void);
++extern void xen_set_rr(unsigned long index, unsigned long val);
++extern unsigned long xen_get_rr(unsigned long index);
++extern void xen_set_kr(unsigned long index, unsigned long val);
++
++/* Note: It may look wrong to test for running_on_xen in each case.
++ * However regnum is always a constant so, as written, the compiler
++ * eliminates the switch statement, whereas running_on_xen must be
++ * tested dynamically. */
++#define xen_ia64_getreg(regnum)						\
++({									\
++	__u64 ia64_intri_res;						\
++									\
++	switch(regnum) {						\
++	case _IA64_REG_CR_IVR:						\
++		ia64_intri_res = (running_on_xen) ?			\
++			xen_get_ivr() :					\
++			__ia64_getreg(regnum);				\
++		break;							\
++	case _IA64_REG_CR_TPR:						\
++		ia64_intri_res = (running_on_xen) ?			\
++			xen_get_tpr() :					\
++			__ia64_getreg(regnum);				\
++		break;							\
++	case _IA64_REG_AR_EFLAG:					\
++		ia64_intri_res = (running_on_xen) ?			\
++			xen_get_eflag() :				\
++			__ia64_getreg(regnum);				\
++		break;							\
++	default:							\
++		ia64_intri_res = __ia64_getreg(regnum);			\
++		break;							\
++	}								\
++	ia64_intri_res;							\
++})
++
++#define xen_ia64_setreg(regnum,val)					\
++({									\
++	switch(regnum) {						\
++	case _IA64_REG_AR_KR0 ... _IA64_REG_AR_KR7:			\
++		(running_on_xen) ?					\
++			xen_set_kr((regnum-_IA64_REG_AR_KR0), val) :	\
++			__ia64_setreg(regnum,val);			\
++		break;							\
++	case _IA64_REG_CR_ITM:						\
++		(running_on_xen) ?					\
++			xen_set_itm(val) :				\
++			__ia64_setreg(regnum,val);			\
++		break;							\
++	case _IA64_REG_CR_TPR:						\
++		(running_on_xen) ?					\
++			xen_set_tpr(val) :				\
++			__ia64_setreg(regnum,val);			\
++		break;							\
++	case _IA64_REG_CR_EOI:						\
++		(running_on_xen) ?					\
++			xen_eoi() :					\
++			__ia64_setreg(regnum,val);			\
++		break;							\
++	case _IA64_REG_AR_EFLAG:					\
++		(running_on_xen) ?					\
++			xen_set_eflag(val) :				\
++			__ia64_setreg(regnum,val);			\
++		break;							\
++	default:							\
++		__ia64_setreg(regnum,val);				\
++		break;							\
++	}								\
++})
++
++#define ia64_ssm			xen_ia64_ssm
++#define ia64_rsm			xen_ia64_rsm
++#define ia64_intrin_local_irq_restore	xen_ia64_intrin_local_irq_restore
++#define	ia64_ptcga			xen_ptcga
++#define	ia64_set_rr(index,val)		xen_set_rr(index,val)
++#define	ia64_get_rr(index)		xen_get_rr(index)
++#define ia64_getreg			xen_ia64_getreg
++#define ia64_setreg			xen_ia64_setreg
++#define	ia64_get_psr_i			xen_get_psr_i
++
++/* the remainder of these are not performance-sensitive so its
++ * OK to not paravirtualize and just take a privop trap and emulate */
++#define ia64_hint			__ia64_hint
++#define ia64_set_pmd			__ia64_set_pmd
++#define ia64_itci			__ia64_itci
++#define ia64_itcd			__ia64_itcd
++#define ia64_itri			__ia64_itri
++#define ia64_itrd			__ia64_itrd
++#define ia64_tpa			__ia64_tpa
++#define ia64_set_ibr			__ia64_set_ibr
++#define ia64_set_pkr			__ia64_set_pkr
++#define ia64_set_pmc			__ia64_set_pmc
++#define ia64_get_ibr			__ia64_get_ibr
++#define ia64_get_pkr			__ia64_get_pkr
++#define ia64_get_pmc			__ia64_get_pmc
++#define ia64_ptce			__ia64_ptce
++#define ia64_ptcl			__ia64_ptcl
++#define ia64_ptri			__ia64_ptri
++#define ia64_ptrd			__ia64_ptrd
++
++#endif /* !__ASSEMBLY__ */
++
++/* these routines utilize privilege-sensitive or performance-sensitive
++ * privileged instructions so the code must be replaced with
++ * paravirtualized versions */
++#define ia64_pal_halt_light		xen_pal_halt_light
++#define	ia64_leave_kernel		xen_leave_kernel
++#define	ia64_leave_syscall		xen_leave_syscall
++#define	ia64_trace_syscall		xen_trace_syscall
++#define	ia64_switch_to			xen_switch_to
++#define	ia64_pal_call_static		xen_pal_call_static
++
++#endif /* _ASM_IA64_XEN_PRIVOP_H */
+diff --git a/include/asm-um/page.h b/include/asm-um/page.h
+index 0229814..ee9bac8 100644
+--- a/include/asm-um/page.h
++++ b/include/asm-um/page.h
+@@ -118,7 +118,7 @@ extern unsigned long uml_physmem;
  extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
  #define HAVE_ARCH_VALIDATE
  
@@ -62185,10 +68587,11 @@
  #define HAVE_ARCH_FREE_PAGE
  
  #include <asm-generic/page.h>
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/apic.h linux-2.6-merge.hg/include/asm-x86_64/apic.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/apic.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/apic.h	2006-02-21 16:06:10.000000000 +0000
-@@ -105,11 +105,13 @@
+diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
+index bdbd893..79db75f 100644
+--- a/include/asm-x86_64/apic.h
++++ b/include/asm-x86_64/apic.h
+@@ -105,11 +105,13 @@ extern int disable_timer_pin_1;
  
  extern void setup_threshold_lvt(unsigned long lvt_off);
  
@@ -62202,9 +68605,11 @@
  
  #endif /* CONFIG_X86_LOCAL_APIC */
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/arch_hooks.h linux-2.6-merge.hg/include/asm-x86_64/arch_hooks.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/arch_hooks.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/arch_hooks.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/arch_hooks.h b/include/asm-x86_64/arch_hooks.h
+new file mode 100644
+index 0000000..b0647d6
+--- /dev/null
++++ b/include/asm-x86_64/arch_hooks.h
 @@ -0,0 +1,31 @@
 +#ifndef _ASM_ARCH_HOOKS_H
 +#define _ASM_ARCH_HOOKS_H
@@ -62237,9 +68642,10 @@
 +#endif
 +
 +#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/bootsetup.h linux-2.6-merge.hg/include/asm-x86_64/bootsetup.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/bootsetup.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/bootsetup.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/bootsetup.h b/include/asm-x86_64/bootsetup.h
+index b829f7b..d1c3fb8 100644
+--- a/include/asm-x86_64/bootsetup.h
++++ b/include/asm-x86_64/bootsetup.h
 @@ -2,6 +2,8 @@
  #ifndef _X86_64_BOOTSETUP_H
  #define _X86_64_BOOTSETUP_H 1
@@ -62249,7 +68655,7 @@
  #define BOOT_PARAM_SIZE		4096
  extern char x86_boot_params[BOOT_PARAM_SIZE];
  
-@@ -31,6 +33,14 @@
+@@ -31,6 +33,14 @@ extern char x86_boot_params[BOOT_PARAM_S
  #define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
  #define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
  #define EDD_BUF     ((struct edd_info *) (PARAM+EDDBUF))
@@ -62264,10 +68670,11 @@
  #define COMMAND_LINE saved_command_line
  
  #define RAMDISK_IMAGE_START_MASK  	0x07FF
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/desc.h linux-2.6-merge.hg/include/asm-x86_64/desc.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/desc.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/desc.h	2006-02-21 16:06:10.000000000 +0000
-@@ -67,16 +67,36 @@
+diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
+index eb7723a..0e1c0a4 100644
+--- a/include/asm-x86_64/desc.h
++++ b/include/asm-x86_64/desc.h
+@@ -67,16 +67,36 @@ struct desc_ptr {
  	unsigned long address;
  } __attribute__((packed)) ;
  
@@ -62304,7 +68711,7 @@
  extern struct desc_ptr cpu_gdt_descr[];
  
  /* the cpu gdt accessor */
-@@ -99,6 +119,7 @@
+@@ -99,6 +119,7 @@ static inline void _set_gate(void *adr, 
  	memcpy(adr, &s, 16); 
  } 
  
@@ -62312,7 +68719,7 @@
  static inline void set_intr_gate(int nr, void *func) 
  { 
  	BUG_ON((unsigned)nr > 0xFF);
-@@ -117,10 +138,13 @@
+@@ -117,10 +138,13 @@ static inline void set_system_gate(int n
  	_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); 
  } 
  
@@ -62326,7 +68733,7 @@
  
  static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 
  					 unsigned size) 
-@@ -138,6 +162,7 @@
+@@ -138,6 +162,7 @@ static inline void set_tssldt_descriptor
  	memcpy(ptr, &d, 16); 
  }
  
@@ -62334,7 +68741,7 @@
  static inline void set_tss_desc(unsigned cpu, void *addr)
  { 
  	/*
-@@ -151,6 +176,7 @@
+@@ -151,6 +176,7 @@ static inline void set_tss_desc(unsigned
  		(unsigned long)addr, DESC_TSS,
  		IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1);
  } 
@@ -62342,7 +68749,7 @@
  
  static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
  { 
-@@ -168,6 +194,8 @@
+@@ -168,6 +194,8 @@ static inline void set_seg_base(unsigned
  	d->base2 = (addr >> 24) & 0xff;
  } 
  
@@ -62351,7 +68758,7 @@
  #define LDT_entry_a(info) \
  	((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
  /* Don't allow setting of the lm bit. It is useless anyways because 
-@@ -202,10 +230,18 @@
+@@ -202,10 +230,18 @@ static inline void set_seg_base(unsigned
  
  static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
  {
@@ -62370,7 +68777,7 @@
  } 
  
  /*
-@@ -219,9 +255,13 @@
+@@ -219,9 +255,13 @@ static inline void load_LDT_nolock (mm_c
  		clear_LDT();
  		return;
  	}
@@ -62385,9 +68792,10 @@
  }
  
  static inline void load_LDT(mm_context_t *pc)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/dma-mapping.h linux-2.6-merge.hg/include/asm-x86_64/dma-mapping.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/dma-mapping.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/dma-mapping.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
+index 49a81a6..4e47ec0 100644
+--- a/include/asm-x86_64/dma-mapping.h
++++ b/include/asm-x86_64/dma-mapping.h
 @@ -8,6 +8,11 @@
  
  #include <linux/config.h>
@@ -62400,7 +68808,7 @@
  #include <asm/scatterlist.h>
  #include <asm/io.h>
  #include <asm/swiotlb.h>
-@@ -56,6 +61,8 @@
+@@ -56,6 +61,8 @@ extern dma_addr_t bad_dma_address;
  extern struct dma_mapping_ops* dma_ops;
  extern int iommu_merge;
  
@@ -62409,7 +68817,7 @@
  static inline int dma_mapping_error(dma_addr_t dma_addr)
  {
  	if (dma_ops->mapping_error)
-@@ -64,11 +71,40 @@
+@@ -64,11 +71,40 @@ static inline int dma_mapping_error(dma_
  	return (dma_addr == bad_dma_address);
  }
  
@@ -62450,7 +68858,7 @@
  static inline dma_addr_t
  dma_map_single(struct device *hwdev, void *ptr, size_t size,
  	       int direction)
-@@ -83,11 +119,33 @@
+@@ -83,11 +119,33 @@ dma_unmap_single(struct device *dev, dma
  	dma_ops->unmap_single(dev, addr, size, direction);
  }
  
@@ -62484,7 +68892,7 @@
  static inline void
  dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
  			size_t size, int direction)
-@@ -150,19 +208,31 @@
+@@ -150,19 +208,31 @@ dma_sync_sg_for_device(struct device *hw
  	flush_write_buffers();
  }
  
@@ -62518,7 +68926,7 @@
  extern int dma_supported(struct device *hwdev, u64 mask);
  
  /* same for gart, swiotlb, and nommu */
-@@ -173,7 +243,17 @@
+@@ -173,7 +243,17 @@ static inline int dma_get_cache_alignmen
  
  #define dma_is_consistent(h) 1
  
@@ -62536,7 +68944,7 @@
  
  static inline void
  dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir)
-@@ -184,4 +264,20 @@
+@@ -184,4 +264,20 @@ dma_cache_sync(void *vaddr, size_t size,
  extern struct device fallback_dev;
  extern int panic_on_overflow;
  
@@ -62557,9 +68965,10 @@
 +#endif
 +
  #endif /* _X8664_DMA_MAPPING_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/fixmap.h linux-2.6-merge.hg/include/asm-x86_64/fixmap.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/fixmap.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/fixmap.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
+index 7b286bd..beaf264 100644
+--- a/include/asm-x86_64/fixmap.h
++++ b/include/asm-x86_64/fixmap.h
 @@ -17,6 +17,10 @@
  #include <asm/page.h>
  #include <asm/vsyscall.h>
@@ -62571,7 +68980,7 @@
  
  /*
   * Here we define all the compile-time 'special' virtual
-@@ -45,6 +49,18 @@
+@@ -45,6 +49,18 @@ enum fixed_addresses {
  	FIX_IO_APIC_BASE_0,
  	FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
  #endif
@@ -62590,7 +68999,7 @@
  	__end_of_fixed_addresses
  };
  
-@@ -59,6 +75,9 @@
+@@ -59,6 +75,9 @@ extern void __set_fixmap (enum fixed_add
  #define set_fixmap_nocache(idx, phys) \
  		__set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
  
@@ -62600,9 +69009,10 @@
  #define FIXADDR_TOP	(VSYSCALL_END-PAGE_SIZE)
  #define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
  #define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/floppy.h linux-2.6-merge.hg/include/asm-x86_64/floppy.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/floppy.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/floppy.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/asm-x86_64/floppy.h b/include/asm-x86_64/floppy.h
+index af7ded6..a494286 100644
+--- a/include/asm-x86_64/floppy.h
++++ b/include/asm-x86_64/floppy.h
 @@ -6,13 +6,15 @@
   * for more details.
   *
@@ -62645,7 +69055,7 @@
  
  static int virtual_dma_count;
  static int virtual_dma_residue;
-@@ -153,11 +163,14 @@
+@@ -153,11 +163,14 @@ static int fd_request_irq(void)
  
  }
  
@@ -62660,7 +69070,7 @@
  
  static unsigned long vdma_mem_alloc(unsigned long size)
  {
-@@ -165,6 +178,8 @@
+@@ -165,6 +178,8 @@ static unsigned long vdma_mem_alloc(unsi
  
  }
  
@@ -62669,7 +69079,7 @@
  #define nodma_mem_alloc(size) vdma_mem_alloc(size)
  
  static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
-@@ -193,6 +208,11 @@
+@@ -193,6 +208,11 @@ static void _fd_chose_dma_mode(char *add
  
  #define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size)
  
@@ -62681,7 +69091,7 @@
  
  static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
  {
-@@ -205,6 +225,7 @@
+@@ -205,6 +225,7 @@ static int vdma_dma_setup(char *addr, un
  	return 0;
  }
  
@@ -62689,7 +69099,7 @@
  static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
  {
  #ifdef FLOPPY_SANITY_CHECK
-@@ -222,6 +243,7 @@
+@@ -222,6 +243,7 @@ static int hard_dma_setup(char *addr, un
  	enable_dma(FLOPPY_DMA);
  	return 0;
  }
@@ -62697,7 +69107,7 @@
  
  static struct fd_routine_l {
  	int (*_request_dma)(unsigned int dmanr, const char * device_id);
-@@ -231,11 +253,13 @@
+@@ -231,11 +253,13 @@ static struct fd_routine_l {
  	int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
  } fd_routine[] = {
  	{
@@ -62711,7 +69121,7 @@
  	},
  	{
  		vdma_request_dma,
-@@ -247,7 +271,18 @@
+@@ -247,7 +271,18 @@ static struct fd_routine_l {
  };
  
  
@@ -62730,7 +69140,7 @@
  static int FDC2 = -1;
  
  /*
-@@ -278,7 +313,9 @@
+@@ -278,7 +313,9 @@ static int FDC2 = -1;
  
  #define FLOPPY_MOTOR_MASK 0xf0
  
@@ -62740,10 +69150,11 @@
  
  #define EXTRA_FLOPPY_PARAMS
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/hw_irq.h linux-2.6-merge.hg/include/asm-x86_64/hw_irq.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/hw_irq.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/hw_irq.h	2006-02-11 17:25:43.000000000 +0000
-@@ -33,6 +33,10 @@
+diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
+index 0df1715..d3f6028 100644
+--- a/include/asm-x86_64/hw_irq.h
++++ b/include/asm-x86_64/hw_irq.h
+@@ -33,6 +33,10 @@ struct hw_interrupt_type;
   */
  #define FIRST_EXTERNAL_VECTOR	0x20
  
@@ -62754,7 +69165,7 @@
  #define IA32_SYSCALL_VECTOR	0x80
  
  
-@@ -49,6 +53,7 @@
+@@ -49,6 +53,7 @@ struct hw_interrupt_type;
   */
  #define SPURIOUS_APIC_VECTOR	0xff
  #define ERROR_APIC_VECTOR	0xfe
@@ -62762,7 +69173,7 @@
  #define RESCHEDULE_VECTOR	0xfd
  #define CALL_FUNCTION_VECTOR	0xfc
  /* fb free - please don't readd KDB here because it's useless
-@@ -60,6 +65,11 @@
+@@ -60,6 +65,11 @@ struct hw_interrupt_type;
  #define INVALIDATE_TLB_VECTOR_START	0xf0	/* f0-f7 used for TLB flush */
  
  #define NUM_INVALIDATE_TLB_VECTORS	8
@@ -62774,7 +69185,7 @@
  
  /*
   * Local APIC timer IRQ vector is on a different priority level,
-@@ -130,7 +140,9 @@
+@@ -130,7 +140,9 @@ __asm__( \
  	"push $" #nr "-256 ; " \
  	"jmp common_interrupt");
  
@@ -62785,9 +69196,11 @@
  static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
  	if (IO_APIC_IRQ(i))
  		send_IPI_self(IO_APIC_VECTOR(i));
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/hypercall.h linux-2.6-merge.hg/include/asm-x86_64/hypercall.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/hypercall.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/hypercall.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/hypercall.h b/include/asm-x86_64/hypercall.h
+new file mode 100644
+index 0000000..87bbfb4
+--- /dev/null
++++ b/include/asm-x86_64/hypercall.h
 @@ -0,0 +1,323 @@
 +/******************************************************************************
 + * hypercall.h
@@ -63112,16 +69525,19 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/hypervisor.h linux-2.6-merge.hg/include/asm-x86_64/hypervisor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/hypervisor.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/hypervisor.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/hypervisor.h b/include/asm-x86_64/hypervisor.h
+new file mode 100644
+index 0000000..dc3e5e5
+--- /dev/null
++++ b/include/asm-x86_64/hypervisor.h
 @@ -0,0 +1,2 @@
 +
 +#include <asm-i386/hypervisor.h>
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/i387.h linux-2.6-merge.hg/include/asm-x86_64/i387.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/i387.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/i387.h	2006-02-11 17:25:43.000000000 +0000
-@@ -170,10 +170,15 @@
+diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
+index 876eb9a..c58262d 100644
+--- a/include/asm-x86_64/i387.h
++++ b/include/asm-x86_64/i387.h
+@@ -170,10 +170,15 @@ static inline void kernel_fpu_end(void)
  	preempt_enable();
  }
  
@@ -63138,9 +69554,10 @@
  	stts();
  }
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/io.h linux-2.6-merge.hg/include/asm-x86_64/io.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/io.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/io.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
+index 9dac18d..78a85cd 100644
+--- a/include/asm-x86_64/io.h
++++ b/include/asm-x86_64/io.h
 @@ -2,6 +2,9 @@
  #define _ASM_IO_H
  
@@ -63151,7 +69568,7 @@
  
  /*
   * This file contains the definitions for the x86 IO instructions
-@@ -119,12 +122,33 @@
+@@ -119,12 +122,33 @@ static inline void * phys_to_virt(unsign
  {
  	return __va(address);
  }
@@ -63185,7 +69602,7 @@
  
  #include <asm-generic/iomap.h>
  
-@@ -151,9 +175,15 @@
+@@ -151,9 +175,15 @@ extern void iounmap(volatile void __iome
  /*
   * ISA I/O bus memory addresses are 1:1 with the physical address.
   */
@@ -63201,7 +69618,7 @@
  
  /*
   * However PCI ones are not necessarily 1:1 and therefore these interfaces
-@@ -161,8 +191,13 @@
+@@ -161,8 +191,13 @@ extern void iounmap(volatile void __iome
   *
   * Allow them on x86 for legacy drivers, though.
   */
@@ -63215,7 +69632,7 @@
  
  /*
   * readX/writeX() are used to access memory mapped devices. On some
-@@ -267,7 +302,11 @@
+@@ -267,7 +302,11 @@ void memset_io(volatile void __iomem *a,
   * used as the IO-area pointer (it can be iounmapped as well, so the
   * analogy with PCI is quite large):
   */
@@ -63227,7 +69644,7 @@
  
  #define isa_readb(a) readb(__ISA_IO_base + (a))
  #define isa_readw(a) readw(__ISA_IO_base + (a))
-@@ -338,4 +377,8 @@
+@@ -338,4 +377,8 @@ extern int iommu_bio_merge;
  
  #endif /* __KERNEL__ */
  
@@ -63236,9 +69653,10 @@
 +#endif
 +
  #endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/ipi.h linux-2.6-merge.hg/include/asm-x86_64/ipi.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/ipi.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/ipi.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h
+index 2a5c162..e61f2b2 100644
+--- a/include/asm-x86_64/ipi.h
++++ b/include/asm-x86_64/ipi.h
 @@ -23,6 +23,8 @@
  #include <asm/apicdef.h>
  #include <asm/genapic.h>
@@ -63248,7 +69666,7 @@
  /*
   * the following functions deal with sending IPIs between CPUs.
   *
-@@ -114,4 +116,10 @@
+@@ -114,4 +116,10 @@ static inline void send_IPI_mask_sequenc
  	local_irq_restore(flags);
  }
  
@@ -63259,9 +69677,10 @@
 +#endif
 +
  #endif /* __ASM_IPI_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/irq.h linux-2.6-merge.hg/include/asm-x86_64/irq.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/irq.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/irq.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h
+index 9db5a1b..232a5e3 100644
+--- a/include/asm-x86_64/irq.h
++++ b/include/asm-x86_64/irq.h
 @@ -10,7 +10,7 @@
   *	<tomsoft at informatik.tu-chemnitz.de>
   */
@@ -63318,7 +69737,7 @@
  static __inline__ int irq_canonicalize(int irq)
  {
  	return ((irq == 2) ? 9 : irq);
-@@ -48,6 +81,10 @@
+@@ -48,6 +81,10 @@ static __inline__ int irq_canonicalize(i
  #define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/nmi.h */
  #endif
  
@@ -63329,9 +69748,11 @@
  #ifdef CONFIG_HOTPLUG_CPU
  #include <linux/cpumask.h>
  extern void fixup_irqs(cpumask_t map);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/mach-xen/asm/nmi.h linux-2.6-merge.hg/include/asm-x86_64/mach-xen/asm/nmi.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/mach-xen/asm/nmi.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/mach-xen/asm/nmi.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/mach-xen/asm/nmi.h b/include/asm-x86_64/mach-xen/asm/nmi.h
+new file mode 100644
+index 0000000..545a192
+--- /dev/null
++++ b/include/asm-x86_64/mach-xen/asm/nmi.h
 @@ -0,0 +1,75 @@
 +/*
 + *  linux/include/asm-i386/nmi.h
@@ -63408,10 +69829,35 @@
 +extern int check_nmi_watchdog(void);
 + 
 +#endif /* ASM_NMI_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/mmu_context.h linux-2.6-merge.hg/include/asm-x86_64/mmu_context.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/mmu_context.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/mmu_context.h	2006-02-11 17:25:43.000000000 +0000
-@@ -17,35 +17,117 @@
+diff --git a/include/asm-x86_64/mmu.h b/include/asm-x86_64/mmu.h
+index 5dc6ed7..5a5547c 100644
+--- a/include/asm-x86_64/mmu.h
++++ b/include/asm-x86_64/mmu.h
+@@ -15,6 +15,19 @@ typedef struct { 
+ 	rwlock_t ldtlock; 
+ 	int size;
+ 	struct semaphore sem; 
++#ifdef CONFIG_XEN
++	unsigned pinned:1;
++	struct list_head unpinned;
++#endif
+ } mm_context_t;
+ 
++#ifdef CONFIG_XEN
++extern struct list_head mm_unpinned;
++extern spinlock_t mm_unpinned_lock;
++
++/* mm/memory.c:exit_mmap hook */
++extern void _arch_exit_mmap(struct mm_struct *mm);
++#define arch_exit_mmap(_mm) _arch_exit_mmap(_mm)
++#endif
++
+ #endif
+diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h
+index 16e4be4..ee83836 100644
+--- a/include/asm-x86_64/mmu_context.h
++++ b/include/asm-x86_64/mmu_context.h
+@@ -17,35 +17,117 @@ void destroy_context(struct mm_struct *m
  
  static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  {
@@ -63534,7 +69980,7 @@
  	else {
  		write_pda(mmu_state, TLBSTATE_OK);
  		if (read_pda(active_mm) != next)
-@@ -55,13 +137,19 @@
+@@ -55,13 +137,19 @@ static inline void switch_mm(struct mm_s
  			 * tlb flush IPI delivery. We must reload CR3
  			 * to make sure to use no freed page tables.
  			 */
@@ -63556,32 +70002,10 @@
  #define deactivate_mm(tsk,mm)	do { \
  	load_gs_index(0); \
  	asm volatile("movl %0,%%fs"::"r"(0));  \
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/mmu.h linux-2.6-merge.hg/include/asm-x86_64/mmu.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/mmu.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/mmu.h	2006-02-11 17:25:43.000000000 +0000
-@@ -15,6 +15,19 @@
- 	rwlock_t ldtlock; 
- 	int size;
- 	struct semaphore sem; 
-+#ifdef CONFIG_XEN
-+	unsigned pinned:1;
-+	struct list_head unpinned;
-+#endif
- } mm_context_t;
- 
-+#ifdef CONFIG_XEN
-+extern struct list_head mm_unpinned;
-+extern spinlock_t mm_unpinned_lock;
-+
-+/* mm/memory.c:exit_mmap hook */
-+extern void _arch_exit_mmap(struct mm_struct *mm);
-+#define arch_exit_mmap(_mm) _arch_exit_mmap(_mm)
-+#endif
-+
- #endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/page.h linux-2.6-merge.hg/include/asm-x86_64/page.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/page.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/page.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
+index 615e3e4..e62161d 100644
+--- a/include/asm-x86_64/page.h
++++ b/include/asm-x86_64/page.h
 @@ -3,6 +3,32 @@
  
  #include <linux/config.h>
@@ -63615,7 +70039,7 @@
  /* PAGE_SHIFT determines the page size */
  #define PAGE_SHIFT	12
  #ifdef __ASSEMBLY__
-@@ -54,6 +80,118 @@
+@@ -54,6 +80,119 @@ void copy_page(void *, void *);
  
  #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
  #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
@@ -63633,7 +70057,8 @@
 +{
 +	if (xen_feature(XENFEAT_auto_translated_physmap))
 +		return pfn;
-+	return phys_to_machine_mapping[(unsigned int)(pfn)] & ~FOREIGN_FRAME_BIT;
++	return phys_to_machine_mapping[(unsigned int)(pfn)] &
++		~FOREIGN_FRAME_BIT;
 +}
 +
 +static inline int phys_to_machine_mapping_valid(unsigned long pfn)
@@ -63734,7 +70159,7 @@
  /*
   * These are used to make use of C type-checking..
   */
-@@ -65,16 +203,78 @@
+@@ -65,16 +204,78 @@ typedef struct { unsigned long pgd; } pg
  
  typedef struct { unsigned long pgprot; } pgprot_t;
  
@@ -63813,7 +70238,7 @@
  #define __pgprot(x)	((pgprot_t) { (x) } )
  
  #define __PHYSICAL_START	((unsigned long)CONFIG_PHYSICAL_START)
-@@ -89,6 +289,13 @@
+@@ -89,6 +290,13 @@ typedef struct { unsigned long pgprot; }
  #define __PAGE_OFFSET           0xffff810000000000
  #endif /* !__ASSEMBLY__ */
  
@@ -63827,7 +70252,7 @@
  /* to align the pointer to the (next) page boundary */
  #define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
  
-@@ -101,12 +308,6 @@
+@@ -101,12 +309,6 @@ typedef struct { unsigned long pgprot; }
  #define KERNEL_TEXT_SIZE  (40UL*1024*1024)
  #define KERNEL_TEXT_START 0xffffffff80000000UL 
  
@@ -63840,10 +70265,11 @@
  #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
  
  /* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol.
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pci.h linux-2.6-merge.hg/include/asm-x86_64/pci.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pci.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/pci.h	2006-02-27 15:49:45.000000000 +0000
-@@ -76,6 +76,23 @@
+diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
+index 8a05af2..1a9904f 100644
+--- a/include/asm-x86_64/pci.h
++++ b/include/asm-x86_64/pci.h
+@@ -76,6 +76,23 @@ extern int iommu_sac_force;
  #define pci_unmap_len_set(PTR, LEN_NAME, VAL)		\
  	(((PTR)->LEN_NAME) = (VAL))
  
@@ -63867,7 +70293,7 @@
  #else
  /* No IOMMU */
  
-@@ -147,4 +164,13 @@
+@@ -147,4 +164,13 @@ static inline void pcibios_add_platform_
  #include <asm-generic/pci.h>
  #endif
  
@@ -63881,9 +70307,10 @@
 +#endif
 +
  #endif /* __x8664_PCI_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pda.h linux-2.6-merge.hg/include/asm-x86_64/pda.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pda.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/pda.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
+index c7ab38a..64dcbc5 100644
+--- a/include/asm-x86_64/pda.h
++++ b/include/asm-x86_64/pda.h
 @@ -2,6 +2,7 @@
  #define X86_64_PDA_H
  
@@ -63892,7 +70319,7 @@
  #include <linux/stddef.h>
  #include <linux/types.h>
  #include <linux/cache.h>
-@@ -22,8 +23,10 @@
+@@ -22,8 +23,10 @@ struct x8664_pda {
  	int nodenumber;		    /* number of current node */
  	unsigned int __softirq_pending;
  	unsigned int __nmi_count;	/* number of NMI on this CPUs */
@@ -63904,9 +70331,10 @@
  	unsigned apic_timer_irqs;
  } ____cacheline_aligned_in_smp;
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pgalloc.h linux-2.6-merge.hg/include/asm-x86_64/pgalloc.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pgalloc.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/pgalloc.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
+index 08cad24..ada72f7 100644
+--- a/include/asm-x86_64/pgalloc.h
++++ b/include/asm-x86_64/pgalloc.h
 @@ -6,26 +6,90 @@
  #include <linux/threads.h>
  #include <linux/mm.h>
@@ -64004,7 +70432,7 @@
  	free_page((unsigned long)pmd);
  }
  
-@@ -42,13 +106,28 @@
+@@ -42,13 +106,28 @@ static inline pud_t *pud_alloc_one(struc
  static inline void pud_free (pud_t *pud)
  {
  	BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
@@ -64033,7 +70461,7 @@
  	if (!pgd)
  		return NULL;
  	/*
-@@ -61,26 +140,56 @@
+@@ -61,26 +140,56 @@ static inline pgd_t *pgd_alloc(struct mm
  	memcpy(pgd + boundary,
  	       init_level4_pgt + boundary,
  	       (PTRS_PER_PGD - boundary) * sizeof(pgd_t));
@@ -64095,7 +70523,7 @@
  }
  
  /* Should really implement gc for free page table pages. This could be
-@@ -89,17 +198,33 @@
+@@ -89,17 +198,33 @@ static inline struct page *pte_alloc_one
  static inline void pte_free_kernel(pte_t *pte)
  {
  	BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
@@ -64130,9 +70558,10 @@
 +#endif
  
  #endif /* _X86_64_PGALLOC_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pgtable.h linux-2.6-merge.hg/include/asm-x86_64/pgtable.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/pgtable.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/pgtable.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
+index 715fd94..11dce27 100644
+--- a/include/asm-x86_64/pgtable.h
++++ b/include/asm-x86_64/pgtable.h
 @@ -10,6 +10,28 @@
  #include <asm/bitops.h>
  #include <linux/threads.h>
@@ -64162,7 +70591,7 @@
  
  extern pud_t level3_kernel_pgt[512];
  extern pud_t level3_physmem_pgt[512];
-@@ -70,10 +92,20 @@
+@@ -70,10 +92,20 @@ extern unsigned long empty_zero_page[PAG
  #define pgd_none(x)	(!pgd_val(x))
  #define pud_none(x)	(!pud_val(x))
  
@@ -64184,7 +70613,7 @@
  #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
  
  static inline void set_pmd(pmd_t *dst, pmd_t val)
-@@ -85,26 +117,49 @@
+@@ -85,26 +117,49 @@ static inline void set_pud(pud_t *dst, p
  {
  	pud_val(*dst) = pud_val(val);
  }
@@ -64234,7 +70663,7 @@
  
  struct mm_struct;
  
-@@ -168,7 +223,7 @@
+@@ -168,7 +223,7 @@ static inline pte_t ptep_get_and_clear_f
  #define _PAGE_NX        (1UL<<_PAGE_BIT_NX)
  
  #define _PAGE_TABLE	(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -64243,7 +70672,7 @@
  
  #define _PAGE_CHG_MASK	(PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
  
-@@ -181,23 +236,30 @@
+@@ -181,23 +236,30 @@ static inline pte_t ptep_get_and_clear_f
  #define PAGE_READONLY	__pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_NX)
  #define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
  #define __PAGE_KERNEL \
@@ -64282,7 +70711,7 @@
  
  #define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL)
  #define PAGE_KERNEL_EXEC MAKE_GLOBAL(__PAGE_KERNEL_EXEC)
-@@ -243,49 +305,62 @@
+@@ -243,49 +305,62 @@ static inline unsigned long pud_bad(pud_
         return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED);
  }
  
@@ -64371,7 +70800,7 @@
  
  struct vm_area_struct;
  
-@@ -331,20 +406,35 @@
+@@ -331,20 +406,35 @@ static inline int pmd_large(pmd_t pte) {
  #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
  #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address))
  #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
@@ -64408,7 +70837,7 @@
  /* PMD  - Level 2 access */
  #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
  #define pmd_page(pmd)		(pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
-@@ -353,9 +443,19 @@
+@@ -353,9 +443,19 @@ static inline pud_t *__pud_offset_k(pud_
  #define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \
  			pmd_index(address))
  #define pmd_none(x)	(!pmd_val(x))
@@ -64428,7 +70857,7 @@
  #define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
  #define pmd_pfn(x)  ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
  
-@@ -373,16 +473,16 @@
+@@ -373,16 +473,16 @@ static inline pud_t *__pud_offset_k(pud_
  static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
  { 
  	pte_t pte;
@@ -64449,7 +70878,7 @@
         return pte; 
  }
  
-@@ -405,6 +505,7 @@
+@@ -405,6 +505,7 @@ static inline pte_t pte_modify(pte_t pte
   * race with other CPU's that might be updating the dirty
   * bit at the same time. */
  #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
@@ -64457,7 +70886,7 @@
  #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
  	do {								  \
  		if (__dirty) {						  \
-@@ -412,6 +513,19 @@
+@@ -412,6 +513,19 @@ static inline pte_t pte_modify(pte_t pte
  			flush_tlb_page(__vma, __address);		  \
  		}							  \
  	} while (0)
@@ -64477,7 +70906,7 @@
  
  /* Encode and de-code a swap entry */
  #define __swp_type(x)			(((x).val >> 1) & 0x3f)
-@@ -424,8 +538,36 @@
+@@ -424,8 +538,36 @@ static inline pte_t pte_modify(pte_t pte
  
  extern int kern_addr_valid(unsigned long addr); 
  
@@ -64514,10 +70943,11 @@
  
  #define MK_IOSPACE_PFN(space, pfn)	(pfn)
  #define GET_IOSPACE(pfn)		0
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/processor.h linux-2.6-merge.hg/include/asm-x86_64/processor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/processor.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/processor.h	2006-02-21 16:06:10.000000000 +0000
-@@ -138,27 +138,51 @@
+diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
+index 8c8d88c..78cd5a3 100644
+--- a/include/asm-x86_64/processor.h
++++ b/include/asm-x86_64/processor.h
+@@ -138,27 +138,51 @@ extern unsigned int init_intel_cacheinfo
   */
  extern unsigned long mmu_cr4_features;
  
@@ -64570,7 +71000,7 @@
  /*
   * User space process size. 47bits minus one guard page.
   */
-@@ -180,7 +204,9 @@
+@@ -180,7 +204,9 @@ static inline void clear_in_cr4 (unsigne
  #define IO_BITMAP_BITS  65536
  #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
  #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
@@ -64580,7 +71010,7 @@
  #define INVALID_IO_BITMAP_OFFSET 0x8000
  
  struct i387_fxsave_struct {
-@@ -201,6 +227,7 @@
+@@ -201,6 +227,7 @@ union i387_union {
  	struct i387_fxsave_struct	fxsave;
  };
  
@@ -64588,7 +71018,7 @@
  struct tss_struct {
  	u32 reserved1;
  	u64 rsp0;	
-@@ -224,8 +251,10 @@
+@@ -224,8 +251,10 @@ struct tss_struct {
  	unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
  } __attribute__((packed)) ____cacheline_aligned;
  
@@ -64600,7 +71030,7 @@
  
  #ifdef CONFIG_X86_VSMP
  #define ARCH_MIN_TASKALIGN	(1 << INTERNODE_CACHE_SHIFT)
-@@ -256,6 +285,9 @@
+@@ -256,6 +285,9 @@ struct thread_struct {
  /* IO permissions. the bitmap could be moved into the GDT, that would make
     switch faster for a limited number of ioperm using tasks. -AK */
  	int		ioperm;
@@ -64610,7 +71040,7 @@
  	unsigned long	*io_bitmap_ptr;
  	unsigned io_bitmap_max;
  /* cached TLS descriptors. */
-@@ -266,9 +298,11 @@
+@@ -266,9 +298,11 @@ struct thread_struct {
  	.rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
  }
  
@@ -64622,7 +71052,7 @@
  
  #define INIT_MMAP \
  { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-@@ -285,6 +319,7 @@
+@@ -285,6 +319,7 @@ struct thread_struct {
  	set_fs(USER_DS);							 \
  } while(0) 
  
@@ -64630,7 +71060,7 @@
  #define get_debugreg(var, register)				\
  		__asm__("movq %%db" #register ", %0"		\
  			:"=r" (var))
-@@ -292,6 +327,12 @@
+@@ -292,6 +327,12 @@ struct thread_struct {
  		__asm__("movq %0,%%db" #register		\
  			: /* no output */			\
  			:"r" (value))
@@ -64643,10 +71073,29 @@
  
  struct task_struct;
  struct mm_struct;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/smp.h linux-2.6-merge.hg/include/asm-x86_64/smp.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/smp.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/smp.h	2006-02-11 17:25:43.000000000 +0000
-@@ -34,7 +34,11 @@
+@@ -479,4 +520,17 @@ extern int bootloader_type;
+ 
+ #define HAVE_ARCH_PICK_MMAP_LAYOUT 1
+ 
++static inline void modify_cpu_capabilities(struct cpuinfo_x86 *c)
++{
++#ifdef CONFIG_XEN
++	clear_bit(X86_FEATURE_VME, c->x86_capability);
++	clear_bit(X86_FEATURE_DE, c->x86_capability);
++	clear_bit(X86_FEATURE_PSE, c->x86_capability);
++	clear_bit(X86_FEATURE_PGE, c->x86_capability);
++	clear_bit(X86_FEATURE_SEP, c->x86_capability);
++	if (!(xen_start_info->flags & SIF_PRIVILEGED))
++		clear_bit(X86_FEATURE_MTRR, c->x86_capability);
++#endif
++}
++
+ #endif /* __ASM_X86_64_PROCESSOR_H */
+diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
+index 9ccbb2c..c838964 100644
+--- a/include/asm-x86_64/smp.h
++++ b/include/asm-x86_64/smp.h
+@@ -34,7 +34,11 @@ struct pt_regs;
  extern cpumask_t cpu_present_mask;
  extern cpumask_t cpu_possible_map;
  extern cpumask_t cpu_online_map;
@@ -64658,7 +71107,7 @@
  extern cpumask_t cpu_initialized;
  
  /*
-@@ -72,11 +76,13 @@
+@@ -72,11 +76,13 @@ static inline int num_booting_cpus(void)
  
  #define raw_smp_processor_id() read_pda(cpunumber)
  
@@ -64672,7 +71121,7 @@
  
  extern int safe_smp_processor_id(void);
  extern int __cpu_disable(void);
-@@ -100,6 +106,7 @@
+@@ -100,6 +106,7 @@ extern u8 x86_cpu_to_apicid[NR_CPUS];	/*
  extern u8 x86_cpu_to_log_apicid[NR_CPUS];
  extern u8 bios_cpu_apicid[];
  
@@ -64680,7 +71129,7 @@
  static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
  {
  	return cpus_addr(cpumask)[0];
-@@ -112,6 +119,7 @@
+@@ -112,6 +119,7 @@ static inline int cpu_present_to_apicid(
  	else
  		return BAD_APICID;
  }
@@ -64688,7 +71137,7 @@
  
  #endif /* !ASSEMBLY */
  
-@@ -129,7 +137,7 @@
+@@ -129,7 +137,7 @@ static inline int cpu_present_to_apicid(
  })
  #endif
  
@@ -64697,9 +71146,10 @@
  static __inline int logical_smp_processor_id(void)
  {
  	/* we don't want to mark this access volatile - bad code generation */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/swiotlb.h linux-2.6-merge.hg/include/asm-x86_64/swiotlb.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/swiotlb.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/swiotlb.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h
+index 60757ef..ba0a592 100644
+--- a/include/asm-x86_64/swiotlb.h
++++ b/include/asm-x86_64/swiotlb.h
 @@ -1,5 +1,5 @@
  #ifndef _ASM_SWIOTLB_H
 -#define _ASM_SWTIOLB_H 1
@@ -64707,7 +71157,7 @@
  
  #include <linux/config.h>
  
-@@ -51,4 +51,20 @@
+@@ -51,4 +51,20 @@ extern int swiotlb;
  
  extern void pci_swiotlb_init(void);
  
@@ -64728,14 +71178,17 @@
 +#endif
 +
  #endif /* _ASM_SWTIOLB_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/synch_bitops.h linux-2.6-merge.hg/include/asm-x86_64/synch_bitops.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/synch_bitops.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/synch_bitops.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/synch_bitops.h b/include/asm-x86_64/synch_bitops.h
+new file mode 100644
+index 0000000..bc77cb1
+--- /dev/null
++++ b/include/asm-x86_64/synch_bitops.h
 @@ -0,0 +1 @@
 +#include <asm-i386/synch_bitops.h>
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/system.h linux-2.6-merge.hg/include/asm-x86_64/system.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/system.h	2006-02-27 15:51:45.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/system.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
+index b7f6603..83203d5 100644
+--- a/include/asm-x86_64/system.h
++++ b/include/asm-x86_64/system.h
 @@ -4,10 +4,21 @@
  #include <linux/config.h>
  #include <linux/kernel.h>
@@ -64758,7 +71211,7 @@
  #define LOCK_PREFIX "lock ; "
  #else
  #define LOCK_PREFIX ""
-@@ -155,7 +166,13 @@
+@@ -155,7 +166,13 @@ struct alt_instr { 
  /*
   * Clear and set 'TS' bit respectively
   */
@@ -64772,7 +71225,7 @@
  
  static inline unsigned long read_cr0(void)
  { 
-@@ -164,17 +181,27 @@
+@@ -164,17 +181,27 @@ static inline unsigned long read_cr0(voi
  	return cr0;
  } 
  
@@ -64800,7 +71253,7 @@
  
  static inline unsigned long read_cr4(void)
  { 
-@@ -183,12 +210,12 @@
+@@ -183,12 +210,12 @@ static inline unsigned long read_cr4(voi
  	return cr4;
  } 
  
@@ -64815,7 +71268,7 @@
  
  #define wbinvd() \
  	__asm__ __volatile__ ("wbinvd": : :"memory");
-@@ -332,6 +359,8 @@
+@@ -332,6 +359,8 @@ static inline unsigned long __cmpxchg(vo
  
  #define warn_if_not_ulong(x) do { unsigned long foo; (void) (&(x) == &foo); } while (0)
  
@@ -64824,7 +71277,7 @@
  /* interrupt control.. */
  #define local_save_flags(x)	do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0)
  #define local_irq_restore(x) 	__asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc")
-@@ -370,6 +399,95 @@
+@@ -370,6 +399,95 @@ static inline unsigned long __cmpxchg(vo
  /* used when interrupts are already enabled or to shutdown the processor */
  #define halt()			__asm__ __volatile__("hlt": : :"memory")
  
@@ -64920,9 +71373,10 @@
  void cpu_idle_wait(void);
  
  extern unsigned long arch_align_stack(unsigned long sp);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/tlbflush.h linux-2.6-merge.hg/include/asm-x86_64/tlbflush.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/tlbflush.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/tlbflush.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h
+index 4a9c20e..c4519ee 100644
+--- a/include/asm-x86_64/tlbflush.h
++++ b/include/asm-x86_64/tlbflush.h
 @@ -5,6 +5,7 @@
  #include <linux/mm.h>
  #include <asm/processor.h>
@@ -64969,9 +71423,10 @@
  
  
  /*
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/vga.h linux-2.6-merge.hg/include/asm-x86_64/vga.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/vga.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/vga.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/vga.h b/include/asm-x86_64/vga.h
+index ef0c0e5..4de2ca6 100644
+--- a/include/asm-x86_64/vga.h
++++ b/include/asm-x86_64/vga.h
 @@ -12,7 +12,7 @@
   *	access the videoram directly without any black magic.
   */
@@ -64981,9 +71436,10 @@
  
  #define vga_readb(x) (*(x))
  #define vga_writeb(x,y) (*(y) = (x))
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/xor.h linux-2.6-merge.hg/include/asm-x86_64/xor.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/asm-x86_64/xor.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/asm-x86_64/xor.h	2006-02-11 17:25:43.000000000 +0000
+diff --git a/include/asm-x86_64/xor.h b/include/asm-x86_64/xor.h
+index f942fcc..cf90834 100644
+--- a/include/asm-x86_64/xor.h
++++ b/include/asm-x86_64/xor.h
 @@ -33,15 +33,31 @@
   * no advantages to be gotten from x86-64 here anyways.
   */
@@ -65018,7 +71474,7 @@
  		"movups %%xmm0,(%1)	;\n\t"	\
  		"movups %%xmm1,0x10(%1)	;\n\t"	\
  		"movups %%xmm2,0x20(%1)	;\n\t"	\
-@@ -58,10 +74,11 @@
+@@ -58,10 +74,11 @@ typedef struct { unsigned long a,b; } __
  		"movups 0x10(%1),%%xmm1	;\n\t"	\
  		"movups 0x20(%1),%%xmm2	;\n\t"	\
  		"movups 0x30(%1),%%xmm3	;\n\t"	\
@@ -65031,10 +71487,11 @@
  	preempt_enable();			\
  } while(0)
  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/gfp.h linux-2.6-merge.hg/include/linux/gfp.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/gfp.h	2006-02-27 15:51:46.000000000 +0000
-+++ linux-2.6-merge.hg/include/linux/gfp.h	2006-02-11 17:25:45.000000000 +0000
-@@ -98,7 +98,11 @@
+diff --git a/include/linux/gfp.h b/include/linux/gfp.h
+index 7851e6b..cba61ae 100644
+--- a/include/linux/gfp.h
++++ b/include/linux/gfp.h
+@@ -98,7 +98,11 @@ static inline int gfp_zone(gfp_t gfp)
   */
  
  #ifndef HAVE_ARCH_FREE_PAGE
@@ -65047,9 +71504,10 @@
  #endif
  
  extern struct page *
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/highmem.h linux-2.6-merge.hg/include/linux/highmem.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/highmem.h	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/include/linux/highmem.h	2006-02-11 17:25:45.000000000 +0000
+diff --git a/include/linux/highmem.h b/include/linux/highmem.h
+index 6bece92..42c6aa2 100644
+--- a/include/linux/highmem.h
++++ b/include/linux/highmem.h
 @@ -13,10 +13,16 @@
  
  /* declarations for linux/mm/highmem.c */
@@ -65067,10 +71525,11 @@
  
  static inline void *kmap(struct page *page)
  {
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/irq.h linux-2.6-merge.hg/include/linux/irq.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/irq.h	2006-02-27 15:51:46.000000000 +0000
-+++ linux-2.6-merge.hg/include/linux/irq.h	2006-02-11 17:25:45.000000000 +0000
-@@ -94,6 +94,9 @@
+diff --git a/include/linux/irq.h b/include/linux/irq.h
+index 6c5d4c8..4ffabba 100644
+--- a/include/linux/irq.h
++++ b/include/linux/irq.h
+@@ -94,6 +94,9 @@ irq_descp (int irq)
  #include <asm/hw_irq.h> /* the arch dependent stuff */
  
  extern int setup_irq(unsigned int irq, struct irqaction * new);
@@ -65080,10 +71539,11 @@
  
  #ifdef CONFIG_GENERIC_HARDIRQS
  extern cpumask_t irq_affinity[NR_IRQS];
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/mm.h linux-2.6-merge.hg/include/linux/mm.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/mm.h	2006-02-27 15:51:46.000000000 +0000
-+++ linux-2.6-merge.hg/include/linux/mm.h	2006-02-27 15:49:45.000000000 +0000
-@@ -166,6 +166,9 @@
+diff --git a/include/linux/mm.h b/include/linux/mm.h
+index 498ff87..4a05b8d 100644
+--- a/include/linux/mm.h
++++ b/include/linux/mm.h
+@@ -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) */
  #define VM_INSERTPAGE	0x02000000	/* The vma has had "vm_insert_page()" done on it */
@@ -65093,7 +71553,7 @@
  
  #ifndef VM_STACK_DEFAULT_FLAGS		/* arch can override this */
  #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
-@@ -245,6 +248,9 @@
+@@ -245,6 +248,9 @@ struct page {
  #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
  	    spinlock_t ptl;
  #endif
@@ -65103,24 +71563,25 @@
  	};
  	pgoff_t index;			/* Our offset within mapping. */
  	struct list_head lru;		/* Pageout list, eg. active_list
-@@ -1013,6 +1019,13 @@
+@@ -1013,6 +1019,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 */
  
 +#ifdef CONFIG_XEN
-+typedef int (*pte_fn_t)(pte_t *pte, struct page *pte_page, unsigned long addr, 
++typedef int (*pte_fn_t)(pte_t *pte, struct page *pte_page, unsigned long addr,
 +                        void *data);
-+extern int generic_page_range(struct mm_struct *mm, unsigned long address, 
++extern int generic_page_range(struct mm_struct *mm, unsigned long address,
 +                              unsigned long size, pte_fn_t fn, void *data);
 +#endif
 +
  #ifdef CONFIG_PROC_FS
  void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
  #else
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/skbuff.h linux-2.6-merge.hg/include/linux/skbuff.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/linux/skbuff.h	2006-02-27 15:51:47.000000000 +0000
-+++ linux-2.6-merge.hg/include/linux/skbuff.h	2006-02-11 17:25:46.000000000 +0000
-@@ -189,6 +189,8 @@
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
+index ad7cc22..0d20528 100644
+--- a/include/linux/skbuff.h
++++ b/include/linux/skbuff.h
+@@ -189,6 +189,8 @@ enum {
   *	@local_df: allow local fragmentation
   *	@cloned: Head may be cloned (check refcnt to be sure)
   *	@nohdr: Payload reference only, must not modify header
@@ -65129,7 +71590,7 @@
   *	@pkt_type: Packet class
   *	@fclone: skbuff clone status
   *	@ip_summed: Driver fed us an IP checksum
-@@ -265,7 +267,13 @@
+@@ -265,7 +267,13 @@ struct sk_buff {
  				nfctinfo:3;
  	__u8			pkt_type:3,
  				fclone:2,
@@ -65143,7 +71604,7 @@
  	__be16			protocol;
  
  	void			(*destructor)(struct sk_buff *skb);
-@@ -321,7 +329,8 @@
+@@ -321,7 +329,8 @@ static inline struct sk_buff *alloc_skb_
  
  extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
  					    unsigned int size,
@@ -65153,7 +71614,7 @@
  extern void	       kfree_skbmem(struct sk_buff *skb);
  extern struct sk_buff *skb_clone(struct sk_buff *skb,
  				 gfp_t priority);
-@@ -1051,7 +1060,7 @@
+@@ -1051,7 +1060,7 @@ static inline struct sk_buff *__dev_allo
  	return skb;
  }
  #else
@@ -65162,9 +71623,11 @@
  #endif
  
  /**
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/balloon.h linux-2.6-merge.hg/include/xen/balloon.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/balloon.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/balloon.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/balloon.h b/include/xen/balloon.h
+new file mode 100644
+index 0000000..7f2be02
+--- /dev/null
++++ b/include/xen/balloon.h
 @@ -0,0 +1,70 @@
 +/******************************************************************************
 + * balloon.h
@@ -65236,9 +71699,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/driver_util.h linux-2.6-merge.hg/include/xen/driver_util.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/driver_util.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/driver_util.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/driver_util.h b/include/xen/driver_util.h
+new file mode 100644
+index 0000000..fe45de5
+--- /dev/null
++++ b/include/xen/driver_util.h
 @@ -0,0 +1,26 @@
 +
 +#ifndef __ASM_XEN_DRIVER_UTIL_H__
@@ -65266,9 +71731,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/evtchn.h linux-2.6-merge.hg/include/xen/evtchn.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/evtchn.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/evtchn.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/evtchn.h b/include/xen/evtchn.h
+new file mode 100644
+index 0000000..594c1a6
+--- /dev/null
++++ b/include/xen/evtchn.h
 @@ -0,0 +1,123 @@
 +/******************************************************************************
 + * evtchn.h
@@ -65393,9 +71860,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/features.h linux-2.6-merge.hg/include/xen/features.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/features.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/features.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/features.h b/include/xen/features.h
+new file mode 100644
+index 0000000..fd47bef
+--- /dev/null
++++ b/include/xen/features.h
 @@ -0,0 +1,20 @@
 +/******************************************************************************
 + * features.h
@@ -65417,9 +71886,11 @@
 +#define xen_feature(flag)	(xen_features[flag])
 +
 +#endif /* __ASM_XEN_FEATURES_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/foreign_page.h linux-2.6-merge.hg/include/xen/foreign_page.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/foreign_page.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/foreign_page.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/foreign_page.h b/include/xen/foreign_page.h
+new file mode 100644
+index 0000000..0af4e13
+--- /dev/null
++++ b/include/xen/foreign_page.h
 @@ -0,0 +1,40 @@
 +/******************************************************************************
 + * foreign_page.h
@@ -65461,9 +71932,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/gnttab.h linux-2.6-merge.hg/include/xen/gnttab.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/gnttab.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/gnttab.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/gnttab.h b/include/xen/gnttab.h
+new file mode 100644
+index 0000000..58aeb49
+--- /dev/null
++++ b/include/xen/gnttab.h
 @@ -0,0 +1,120 @@
 +/******************************************************************************
 + * gnttab.h
@@ -65585,9 +72058,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/acm.h linux-2.6-merge.hg/include/xen/interface/acm.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/acm.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/acm.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/acm.h b/include/xen/interface/acm.h
+new file mode 100644
+index 0000000..a7a5a57
+--- /dev/null
++++ b/include/xen/interface/acm.h
 @@ -0,0 +1,181 @@
 +/*
 + * acm.h: Xen access control module interface defintions
@@ -65743,7 +72218,7 @@
 +    uint32_t ec_eval_count;
 +    uint32_t gt_eval_count;
 +    uint32_t ec_denied_count;
-+    uint32_t gt_denied_count; 
++    uint32_t gt_denied_count;
 +    uint32_t ec_cachehit_count;
 +    uint32_t gt_cachehit_count;
 +};
@@ -65770,9 +72245,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/acm_ops.h linux-2.6-merge.hg/include/xen/interface/acm_ops.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/acm_ops.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/acm_ops.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/acm_ops.h b/include/xen/interface/acm_ops.h
+new file mode 100644
+index 0000000..76c35db
+--- /dev/null
++++ b/include/xen/interface/acm_ops.h
 @@ -0,0 +1,96 @@
 +/*
 + * acm_ops.h: Xen access control module hypervisor commands
@@ -65870,10 +72347,12 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/arch-ia64.h linux-2.6-merge.hg/include/xen/interface/arch-ia64.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/arch-ia64.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/arch-ia64.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,279 @@
+diff --git a/include/xen/interface/arch-ia64.h b/include/xen/interface/arch-ia64.h
+new file mode 100644
+index 0000000..316df5c
+--- /dev/null
++++ b/include/xen/interface/arch-ia64.h
+@@ -0,0 +1,302 @@
 +/******************************************************************************
 + * arch-ia64/hypervisor-if.h
 + * 
@@ -65883,6 +72362,28 @@
 +#ifndef __HYPERVISOR_IF_IA64_H__
 +#define __HYPERVISOR_IF_IA64_H__
 +
++#ifdef __XEN__
++#define __DEFINE_GUEST_HANDLE(name, type) \
++    typedef struct { type *p; } __guest_handle_ ## name
++#else
++#define __DEFINE_GUEST_HANDLE(name, type) \
++    typedef type * __guest_handle_ ## name
++#endif
++
++#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
++#define GUEST_HANDLE(name)        __guest_handle_ ## name
++
++#ifndef __ASSEMBLY__
++/* Guest handles for primitive C types. */
++__DEFINE_GUEST_HANDLE(uchar, unsigned char);
++__DEFINE_GUEST_HANDLE(uint,  unsigned int);
++__DEFINE_GUEST_HANDLE(ulong, unsigned long);
++DEFINE_GUEST_HANDLE(char);
++DEFINE_GUEST_HANDLE(int);
++DEFINE_GUEST_HANDLE(long);
++DEFINE_GUEST_HANDLE(void);
++#endif
++
 +/* Maximum number of virtual CPUs in multi-processor guests. */
 +/* WARNING: before changing this, check that shared_info fits on a page */
 +#define MAX_VIRT_CPUS 4
@@ -66139,6 +72640,7 @@
 +    arch_vcpu_info_t vcpu;
 +    arch_shared_info_t shared;
 +} vcpu_guest_context_t;
++DEFINE_GUEST_HANDLE(vcpu_guest_context_t);
 +
 +#endif /* !__ASSEMBLY__ */
 +
@@ -66153,10 +72655,12 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/arch-x86_32.h linux-2.6-merge.hg/include/xen/interface/arch-x86_32.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/arch-x86_32.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/arch-x86_32.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,158 @@
+diff --git a/include/xen/interface/arch-x86_32.h b/include/xen/interface/arch-x86_32.h
+new file mode 100644
+index 0000000..f7079eb
+--- /dev/null
++++ b/include/xen/interface/arch-x86_32.h
+@@ -0,0 +1,181 @@
 +/******************************************************************************
 + * arch-x86_32.h
 + * 
@@ -66168,6 +72672,28 @@
 +#ifndef __XEN_PUBLIC_ARCH_X86_32_H__
 +#define __XEN_PUBLIC_ARCH_X86_32_H__
 +
++#ifdef __XEN__
++#define __DEFINE_GUEST_HANDLE(name, type) \
++    typedef struct { type *p; } __guest_handle_ ## name
++#else
++#define __DEFINE_GUEST_HANDLE(name, type) \
++    typedef type * __guest_handle_ ## name
++#endif
++
++#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
++#define GUEST_HANDLE(name)        __guest_handle_ ## name
++
++#ifndef __ASSEMBLY__
++/* Guest handles for primitive C types. */
++__DEFINE_GUEST_HANDLE(uchar, unsigned char);
++__DEFINE_GUEST_HANDLE(uint,  unsigned int);
++__DEFINE_GUEST_HANDLE(ulong, unsigned long);
++DEFINE_GUEST_HANDLE(char);
++DEFINE_GUEST_HANDLE(int);
++DEFINE_GUEST_HANDLE(long);
++DEFINE_GUEST_HANDLE(void);
++#endif
++
 +/*
 + * SEGMENT DESCRIPTOR TABLES
 + */
@@ -66289,11 +72815,12 @@
 +    unsigned long failsafe_callback_eip;
 +    unsigned long vm_assist;                /* VMASST_TYPE_* bitmap */
 +} vcpu_guest_context_t;
++DEFINE_GUEST_HANDLE(vcpu_guest_context_t);
 +
 +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. */
-+    unsigned long pfn_to_mfn_frame_list_list; 
++    unsigned long pfn_to_mfn_frame_list_list;
 +    unsigned long nmi_reason;
 +} arch_shared_info_t;
 +
@@ -66315,10 +72842,12 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/arch-x86_64.h linux-2.6-merge.hg/include/xen/interface/arch-x86_64.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/arch-x86_64.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/arch-x86_64.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,243 @@
+diff --git a/include/xen/interface/arch-x86_64.h b/include/xen/interface/arch-x86_64.h
+new file mode 100644
+index 0000000..f0ea2f5
+--- /dev/null
++++ b/include/xen/interface/arch-x86_64.h
+@@ -0,0 +1,266 @@
 +/******************************************************************************
 + * arch-x86_64.h
 + * 
@@ -66330,6 +72859,28 @@
 +#ifndef __XEN_PUBLIC_ARCH_X86_64_H__
 +#define __XEN_PUBLIC_ARCH_X86_64_H__
 +
++#ifdef __XEN__
++#define __DEFINE_GUEST_HANDLE(name, type) \
++    typedef struct { type *p; } __guest_handle_ ## name
++#else
++#define __DEFINE_GUEST_HANDLE(name, type) \
++    typedef type * __guest_handle_ ## name
++#endif
++
++#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
++#define GUEST_HANDLE(name)        __guest_handle_ ## name
++
++#ifndef __ASSEMBLY__
++/* Guest handles for primitive C types. */
++__DEFINE_GUEST_HANDLE(uchar, unsigned char);
++__DEFINE_GUEST_HANDLE(uint,  unsigned int);
++__DEFINE_GUEST_HANDLE(ulong, unsigned long);
++DEFINE_GUEST_HANDLE(char);
++DEFINE_GUEST_HANDLE(int);
++DEFINE_GUEST_HANDLE(long);
++DEFINE_GUEST_HANDLE(void);
++#endif
++
 +/*
 + * SEGMENT DESCRIPTOR TABLES
 + */
@@ -66536,11 +73087,12 @@
 +    uint64_t      gs_base_kernel;
 +    uint64_t      gs_base_user;
 +} vcpu_guest_context_t;
++DEFINE_GUEST_HANDLE(vcpu_guest_context_t);
 +
 +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. */
-+    unsigned long pfn_to_mfn_frame_list_list; 
++    unsigned long pfn_to_mfn_frame_list_list;
 +    unsigned long nmi_reason;
 +} arch_shared_info_t;
 +
@@ -66562,10 +73114,12 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/dom0_ops.h linux-2.6-merge.hg/include/xen/interface/dom0_ops.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/dom0_ops.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/dom0_ops.h	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,488 @@
+diff --git a/include/xen/interface/dom0_ops.h b/include/xen/interface/dom0_ops.h
+new file mode 100644
+index 0000000..89ea35c
+--- /dev/null
++++ b/include/xen/interface/dom0_ops.h
+@@ -0,0 +1,530 @@
 +/******************************************************************************
 + * dom0_ops.h
 + * 
@@ -66596,18 +73150,21 @@
 +    /* IN variables. */
 +    domid_t       domain;
 +    unsigned long max_pfns;
-+    void         *buffer;
++    GUEST_HANDLE(ulong) buffer;
 +    /* OUT variables. */
 +    unsigned long num_pfns;
 +} dom0_getmemlist_t;
++DEFINE_GUEST_HANDLE(dom0_getmemlist_t);
 +
 +#define DOM0_SCHEDCTL          6
 + /* struct sched_ctl_cmd is from sched-ctl.h   */
 +typedef struct sched_ctl_cmd dom0_schedctl_t;
++DEFINE_GUEST_HANDLE(dom0_schedctl_t);
 +
 +#define DOM0_ADJUSTDOM         7
 +/* struct sched_adjdom_cmd is from sched-ctl.h */
 +typedef struct sched_adjdom_cmd dom0_adjustdom_t;
++DEFINE_GUEST_HANDLE(dom0_adjustdom_t);
 +
 +#define DOM0_CREATEDOMAIN      8
 +typedef struct dom0_createdomain {
@@ -66618,24 +73175,28 @@
 +    /* Identifier for new domain (auto-allocate if zero is specified). */
 +    domid_t domain;
 +} dom0_createdomain_t;
++DEFINE_GUEST_HANDLE(dom0_createdomain_t);
 +
 +#define DOM0_DESTROYDOMAIN     9
 +typedef struct dom0_destroydomain {
 +    /* IN variables. */
 +    domid_t domain;
 +} dom0_destroydomain_t;
++DEFINE_GUEST_HANDLE(dom0_destroydomain_t);
 +
 +#define DOM0_PAUSEDOMAIN      10
 +typedef struct dom0_pausedomain {
 +    /* IN parameters. */
 +    domid_t domain;
 +} dom0_pausedomain_t;
++DEFINE_GUEST_HANDLE(dom0_pausedomain_t);
 +
 +#define DOM0_UNPAUSEDOMAIN    11
 +typedef struct dom0_unpausedomain {
 +    /* IN parameters. */
 +    domid_t domain;
 +} dom0_unpausedomain_t;
++DEFINE_GUEST_HANDLE(dom0_unpausedomain_t);
 +
 +#define DOM0_GETDOMAININFO    12
 +typedef struct dom0_getdomaininfo {
@@ -66661,6 +73222,7 @@
 +    uint32_t ssidref;
 +    xen_domain_handle_t handle;
 +} dom0_getdomaininfo_t;
++DEFINE_GUEST_HANDLE(dom0_getdomaininfo_t);
 +
 +#define DOM0_SETVCPUCONTEXT   13
 +typedef struct dom0_setvcpucontext {
@@ -66668,8 +73230,9 @@
 +    domid_t               domain;
 +    uint32_t              vcpu;
 +    /* IN/OUT parameters */
-+    vcpu_guest_context_t *ctxt;
++    GUEST_HANDLE(vcpu_guest_context_t) ctxt;
 +} dom0_setvcpucontext_t;
++DEFINE_GUEST_HANDLE(dom0_setvcpucontext_t);
 +
 +#define DOM0_MSR              15
 +typedef struct dom0_msr {
@@ -66683,6 +73246,7 @@
 +    uint32_t out1;
 +    uint32_t out2;
 +} dom0_msr_t;
++DEFINE_GUEST_HANDLE(dom0_msr_t);
 +
 +/*
 + * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
@@ -66695,6 +73259,7 @@
 +    uint32_t nsecs;
 +    uint64_t system_time;
 +} dom0_settime_t;
++DEFINE_GUEST_HANDLE(dom0_settime_t);
 +
 +#define DOM0_GETPAGEFRAMEINFO 18
 +#define NOTAB 0         /* normal page */
@@ -66715,6 +73280,7 @@
 +    /* Is the page PINNED to a type? */
 +    uint32_t type;         /* see above type defs */
 +} dom0_getpageframeinfo_t;
++DEFINE_GUEST_HANDLE(dom0_getpageframeinfo_t);
 +
 +/*
 + * Read console content from Xen buffer ring.
@@ -66722,13 +73288,14 @@
 +#define DOM0_READCONSOLE      19
 +typedef struct dom0_readconsole {
 +    /* IN variables. */
-+    uint32_t clear;        /* Non-zero -> clear after reading. */
++    uint32_t clear;            /* Non-zero -> clear after reading. */
 +    /* IN/OUT variables. */
-+    char    *buffer;       /* In: Buffer start; Out: Used buffer start */
-+    uint32_t count;        /* In: Buffer size;  Out: Used buffer size  */
++    GUEST_HANDLE(char) buffer; /* In: Buffer start; Out: Used buffer start */
++    uint32_t count;            /* In: Buffer size;  Out: Used buffer size  */
 +} dom0_readconsole_t;
++DEFINE_GUEST_HANDLE(dom0_readconsole_t);
 +
-+/* 
++/*
 + * Set which physical cpus a vcpu can execute on.
 + */
 +#define DOM0_SETVCPUAFFINITY  20
@@ -66738,6 +73305,7 @@
 +    uint32_t  vcpu;
 +    cpumap_t  cpumap;
 +} dom0_setvcpuaffinity_t;
++DEFINE_GUEST_HANDLE(dom0_setvcpuaffinity_t);
 +
 +/* Get trace buffers machine base address */
 +#define DOM0_TBUFCONTROL       21
@@ -66757,6 +73325,7 @@
 +    unsigned long buffer_mfn;
 +    uint32_t size;
 +} dom0_tbufcontrol_t;
++DEFINE_GUEST_HANDLE(dom0_tbufcontrol_t);
 +
 +/*
 + * Get physical information about the host machine
@@ -66772,6 +73341,7 @@
 +    unsigned long free_pages;
 +    uint32_t hw_cap[8];
 +} dom0_physinfo_t;
++DEFINE_GUEST_HANDLE(dom0_physinfo_t);
 +
 +/*
 + * Get the ID of the current scheduler.
@@ -66781,8 +73351,9 @@
 +    /* OUT variable */
 +    uint32_t sched_id;
 +} dom0_sched_id_t;
++DEFINE_GUEST_HANDLE(dom0_sched_id_t);
 +
-+/* 
++/*
 + * Control shadow pagetables operation
 + */
 +#define DOM0_SHADOW_CONTROL  25
@@ -66799,20 +73370,22 @@
 +typedef struct dom0_shadow_control_stats {
 +    uint32_t fault_count;
 +    uint32_t dirty_count;
-+    uint32_t dirty_net_count;     
-+    uint32_t dirty_block_count;     
++    uint32_t dirty_net_count;
++    uint32_t dirty_block_count;
 +} dom0_shadow_control_stats_t;
++DEFINE_GUEST_HANDLE(dom0_shadow_control_stats_t);
 +
 +typedef struct dom0_shadow_control {
 +    /* IN variables. */
 +    domid_t        domain;
 +    uint32_t       op;
-+    unsigned long *dirty_bitmap; /* pointer to locked buffer */
++    GUEST_HANDLE(ulong) dirty_bitmap;
 +    /* IN/OUT variables. */
 +    unsigned long  pages;        /* size of buffer, updated with actual size */
 +    /* OUT variables. */
 +    dom0_shadow_control_stats_t stats;
 +} dom0_shadow_control_t;
++DEFINE_GUEST_HANDLE(dom0_shadow_control_t);
 +
 +#define DOM0_SETDOMAINMAXMEM   28
 +typedef struct dom0_setdomainmaxmem {
@@ -66820,6 +73393,7 @@
 +    domid_t       domain;
 +    unsigned long max_memkb;
 +} dom0_setdomainmaxmem_t;
++DEFINE_GUEST_HANDLE(dom0_setdomainmaxmem_t);
 +
 +#define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
 +typedef struct dom0_getpageframeinfo2 {
@@ -66827,8 +73401,9 @@
 +    domid_t        domain;
 +    unsigned long  num;
 +    /* IN/OUT variables. */
-+    unsigned long *array;
++    GUEST_HANDLE(ulong) array;
 +} dom0_getpageframeinfo2_t;
++DEFINE_GUEST_HANDLE(dom0_getpageframeinfo2_t);
 +
 +/*
 + * Request memory range (@mfn, @mfn+ at nr_mfns-1) to have type @type.
@@ -66847,6 +73422,7 @@
 +    uint32_t      handle;
 +    uint32_t      reg;
 +} dom0_add_memtype_t;
++DEFINE_GUEST_HANDLE(dom0_add_memtype_t);
 +
 +/*
 + * Tear down an existing memory-range type. If @handle is remembered then it
@@ -66861,6 +73437,7 @@
 +    uint32_t handle;
 +    uint32_t reg;
 +} dom0_del_memtype_t;
++DEFINE_GUEST_HANDLE(dom0_del_memtype_t);
 +
 +/* Read current type of an MTRR (x86-specific). */
 +#define DOM0_READ_MEMTYPE        33
@@ -66872,6 +73449,7 @@
 +    unsigned long nr_mfns;
 +    uint32_t type;
 +} dom0_read_memtype_t;
++DEFINE_GUEST_HANDLE(dom0_read_memtype_t);
 +
 +/* Interface for controlling Xen software performance counters. */
 +#define DOM0_PERFCCONTROL        34
@@ -66883,20 +73461,23 @@
 +    uint32_t     nr_vals;              /* number of values for this counter */
 +    uint32_t     vals[64];             /* array of values */
 +} dom0_perfc_desc_t;
++DEFINE_GUEST_HANDLE(dom0_perfc_desc_t);
 +typedef struct dom0_perfccontrol {
 +    /* IN variables. */
 +    uint32_t       op;                /*  DOM0_PERFCCONTROL_OP_??? */
 +    /* OUT variables. */
 +    uint32_t       nr_counters;       /*  number of counters */
-+    dom0_perfc_desc_t *desc;          /*  counter information (or NULL) */
++    GUEST_HANDLE(dom0_perfc_desc_t) desc; /*  counter information (or NULL) */
 +} dom0_perfccontrol_t;
++DEFINE_GUEST_HANDLE(dom0_perfccontrol_t);
 +
 +#define DOM0_MICROCODE           35
 +typedef struct dom0_microcode {
 +    /* IN variables. */
-+    void    *data;                    /* Pointer to microcode data */
++    GUEST_HANDLE(void) data;          /* Pointer to microcode data */
 +    uint32_t length;                  /* Length of microcode data. */
 +} dom0_microcode_t;
++DEFINE_GUEST_HANDLE(dom0_microcode_t);
 +
 +#define DOM0_IOPORT_PERMISSION   36
 +typedef struct dom0_ioport_permission {
@@ -66905,6 +73486,7 @@
 +    uint32_t nr_ports;                /* size of port range */
 +    uint8_t  allow_access;            /* allow or deny access to range? */
 +} dom0_ioport_permission_t;
++DEFINE_GUEST_HANDLE(dom0_ioport_permission_t);
 +
 +#define DOM0_GETVCPUCONTEXT      37
 +typedef struct dom0_getvcpucontext {
@@ -66912,8 +73494,9 @@
 +    domid_t  domain;                  /* domain to be affected */
 +    uint32_t vcpu;                    /* vcpu # */
 +    /* OUT variables. */
-+    vcpu_guest_context_t *ctxt;
++    GUEST_HANDLE(vcpu_guest_context_t) ctxt;
 +} dom0_getvcpucontext_t;
++DEFINE_GUEST_HANDLE(dom0_getvcpucontext_t);
 +
 +#define DOM0_GETVCPUINFO         43
 +typedef struct dom0_getvcpuinfo {
@@ -66928,54 +73511,63 @@
 +    uint32_t cpu;                     /* current mapping   */
 +    cpumap_t cpumap;                  /* allowable mapping */
 +} dom0_getvcpuinfo_t;
++DEFINE_GUEST_HANDLE(dom0_getvcpuinfo_t);
 +
 +#define DOM0_GETDOMAININFOLIST   38
 +typedef struct dom0_getdomaininfolist {
 +    /* IN variables. */
 +    domid_t               first_domain;
 +    uint32_t              max_domains;
-+    dom0_getdomaininfo_t *buffer;
++    GUEST_HANDLE(dom0_getdomaininfo_t) buffer;
 +    /* OUT variables. */
 +    uint32_t              num_domains;
 +} dom0_getdomaininfolist_t;
++DEFINE_GUEST_HANDLE(dom0_getdomaininfolist_t);
 +
-+#define DOM0_PLATFORM_QUIRK      39  
++#define DOM0_PLATFORM_QUIRK      39
 +#define QUIRK_NOIRQBALANCING  1
 +typedef struct dom0_platform_quirk {
 +    /* IN variables. */
 +    uint32_t quirk_id;
 +} dom0_platform_quirk_t;
++DEFINE_GUEST_HANDLE(dom0_platform_quirk_t);
 +
 +#define DOM0_PHYSICAL_MEMORY_MAP 40
++typedef struct dom0_memory_map_entry {
++    uint64_t start, end;
++    uint32_t flags; /* reserved */
++    uint8_t  is_ram;
++} dom0_memory_map_entry_t;
++DEFINE_GUEST_HANDLE(dom0_memory_map_entry_t);
 +typedef struct dom0_physical_memory_map {
 +    /* IN variables. */
 +    uint32_t max_map_entries;
 +    /* OUT variables. */
 +    uint32_t nr_map_entries;
-+    struct dom0_memory_map_entry {
-+        uint64_t start, end;
-+        uint32_t flags; /* reserved */
-+        uint8_t  is_ram;
-+    } *memory_map;
++    GUEST_HANDLE(dom0_memory_map_entry_t) memory_map;
 +} dom0_physical_memory_map_t;
++DEFINE_GUEST_HANDLE(dom0_physical_memory_map_t);
 +
 +#define DOM0_MAX_VCPUS 41
 +typedef struct dom0_max_vcpus {
 +    domid_t  domain;        /* domain to be affected */
 +    uint32_t max;           /* maximum number of vcpus */
 +} dom0_max_vcpus_t;
++DEFINE_GUEST_HANDLE(dom0_max_vcpus_t);
 +
 +#define DOM0_SETDOMAINHANDLE 44
 +typedef struct dom0_setdomainhandle {
 +    domid_t domain;
 +    xen_domain_handle_t handle;
 +} dom0_setdomainhandle_t;
++DEFINE_GUEST_HANDLE(dom0_setdomainhandle_t);
 +
 +#define DOM0_SETDEBUGGING 45
 +typedef struct dom0_setdebugging {
 +    domid_t domain;
 +    uint8_t enable;
 +} dom0_setdebugging_t;
++DEFINE_GUEST_HANDLE(dom0_setdebugging_t);
 +
 +#define DOM0_IRQ_PERMISSION 46
 +typedef struct dom0_irq_permission {
@@ -66983,6 +73575,7 @@
 +    uint8_t pirq;
 +    uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
 +} dom0_irq_permission_t;
++DEFINE_GUEST_HANDLE(dom0_irq_permission_t);
 +
 +#define DOM0_IOMEM_PERMISSION 47
 +typedef struct dom0_iomem_permission {
@@ -66991,12 +73584,14 @@
 +    unsigned long 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);
 +
 +#define DOM0_HYPERCALL_INIT   48
 +typedef struct dom0_hypercall_init {
 +    domid_t  domain;          /* domain to be affected */
 +    unsigned long mfn;        /* machine frame to be initialised */
 +} dom0_hypercall_init_t;
++DEFINE_GUEST_HANDLE(dom0_hypercall_init_t);
 +
 +typedef struct dom0_op {
 +    uint32_t cmd;
@@ -67034,14 +73629,15 @@
 +        struct dom0_platform_quirk    platform_quirk;
 +        struct dom0_physical_memory_map physical_memory_map;
 +        struct dom0_max_vcpus         max_vcpus;
-+        struct dom0_setdomainhandle   setdomainhandle;        
++        struct dom0_setdomainhandle   setdomainhandle;
 +        struct dom0_setdebugging      setdebugging;
 +        struct dom0_irq_permission    irq_permission;
 +        struct dom0_iomem_permission  iomem_permission;
 +        struct dom0_hypercall_init    hypercall_init;
-+        uint8_t                  pad[128];
++        uint8_t                       pad[128];
 +    } u;
 +} dom0_op_t;
++DEFINE_GUEST_HANDLE(dom0_op_t);
 +
 +#endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
 +
@@ -67054,9 +73650,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/event_channel.h linux-2.6-merge.hg/include/xen/interface/event_channel.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/event_channel.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/event_channel.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h
+new file mode 100644
+index 0000000..03d2039
+--- /dev/null
++++ b/include/xen/interface/event_channel.h
 @@ -0,0 +1,203 @@
 +/******************************************************************************
 + * event_channel.h
@@ -67261,9 +73859,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/features.h linux-2.6-merge.hg/include/xen/interface/features.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/features.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/features.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
+new file mode 100644
+index 0000000..c46e3be
+--- /dev/null
++++ b/include/xen/interface/features.h
 @@ -0,0 +1,53 @@
 +/******************************************************************************
 + * features.h
@@ -67318,9 +73918,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/grant_table.h linux-2.6-merge.hg/include/xen/interface/grant_table.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/grant_table.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/grant_table.h	2006-02-18 12:03:40.000000000 +0000
+diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
+new file mode 100644
+index 0000000..e137953
+--- /dev/null
++++ b/include/xen/interface/grant_table.h
 @@ -0,0 +1,306 @@
 +/******************************************************************************
 + * grant_table.h
@@ -67586,7 +74188,7 @@
 +  * GNTMAP_contains_pte subflag:
 +  *  0 => This map request contains a host virtual address.
 +  *  1 => This map request contains the machine addess of the PTE to update.
-+  */ 
++  */
 +#define _GNTMAP_contains_pte    (4)
 +#define GNTMAP_contains_pte     (1<<_GNTMAP_contains_pte)
 +
@@ -67628,9 +74230,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/hvm/hvm_info_table.h linux-2.6-merge.hg/include/xen/interface/hvm/hvm_info_table.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/hvm/hvm_info_table.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/hvm/hvm_info_table.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/interface/hvm/hvm_info_table.h b/include/xen/interface/hvm/hvm_info_table.h
+new file mode 100644
+index 0000000..3891180
+--- /dev/null
++++ b/include/xen/interface/hvm/hvm_info_table.h
 @@ -0,0 +1,24 @@
 +/******************************************************************************
 + * hvm/hvm_info_table.h
@@ -67656,9 +74260,11 @@
 +};
 +
 +#endif /* __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/hvm/ioreq.h linux-2.6-merge.hg/include/xen/interface/hvm/ioreq.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/hvm/ioreq.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/hvm/ioreq.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/interface/hvm/ioreq.h b/include/xen/interface/hvm/ioreq.h
+new file mode 100644
+index 0000000..4897ba3
+--- /dev/null
++++ b/include/xen/interface/hvm/ioreq.h
 @@ -0,0 +1,93 @@
 +/*
 + * ioreq.h: I/O request definitions for device models
@@ -67733,8 +74339,8 @@
 +typedef struct {
 +    ioreq_t         vp_ioreq;
 +    /* Event channel port */
-+    unsigned long   vp_eport;   /* VMX vcpu uses this to notify DM */
-+    unsigned long   dm_eport;   /* DM uses this to notify VMX vcpu */
++    unsigned int    vp_eport;   /* VMX vcpu uses this to notify DM */
++    unsigned int    dm_eport;   /* DM uses this to notify VMX vcpu */
 +} vcpu_iodata_t;
 +
 +typedef struct {
@@ -67753,9 +74359,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/hvm/vmx_assist.h linux-2.6-merge.hg/include/xen/interface/hvm/vmx_assist.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/hvm/vmx_assist.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/hvm/vmx_assist.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/hvm/vmx_assist.h b/include/xen/interface/hvm/vmx_assist.h
+new file mode 100644
+index 0000000..9ef6648
+--- /dev/null
++++ b/include/xen/interface/hvm/vmx_assist.h
 @@ -0,0 +1,97 @@
 +/*
 + * vmx_assist.h: Context definitions for the VMXASSIST world switch.
@@ -67781,13 +74389,13 @@
 +        unsigned int seg_type : 4,
 +            s         : 1,
 +            dpl       : 2,
-+            p         : 1, 
++            p         : 1,
 +            reserved0 : 4,
 +            avl       : 1,
-+            reserved1 : 1,     
++            reserved1 : 1,
 +            default_ops_size: 1,
 +            g         : 1,
-+            null_bit  : 1, 
++            null_bit  : 1,
 +            reserved2 : 15;
 +    } fields;
 +    unsigned int bytes;
@@ -67854,9 +74462,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/blkif.h linux-2.6-merge.hg/include/xen/interface/io/blkif.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/blkif.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/blkif.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
+new file mode 100644
+index 0000000..bb92917
+--- /dev/null
++++ b/include/xen/interface/io/blkif.h
 @@ -0,0 +1,85 @@
 +/******************************************************************************
 + * blkif.h
@@ -67943,9 +74553,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/console.h linux-2.6-merge.hg/include/xen/interface/io/console.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/console.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/console.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/io/console.h b/include/xen/interface/io/console.h
+new file mode 100644
+index 0000000..cb59b24
+--- /dev/null
++++ b/include/xen/interface/io/console.h
 @@ -0,0 +1,33 @@
 +/******************************************************************************
 + * console.h
@@ -67980,9 +74592,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/netif.h linux-2.6-merge.hg/include/xen/interface/io/netif.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/netif.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/netif.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
+new file mode 100644
+index 0000000..dcb9b46
+--- /dev/null
++++ b/include/xen/interface/io/netif.h
 @@ -0,0 +1,76 @@
 +/******************************************************************************
 + * netif.h
@@ -68060,9 +74674,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/pciif.h linux-2.6-merge.hg/include/xen/interface/io/pciif.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/pciif.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/pciif.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/xen/interface/io/pciif.h b/include/xen/interface/io/pciif.h
+new file mode 100644
+index 0000000..a1c9ab7
+--- /dev/null
++++ b/include/xen/interface/io/pciif.h
 @@ -0,0 +1,55 @@
 +/*
 + * PCI Backend/Frontend Common Data Structures & Macros
@@ -68119,10 +74735,12 @@
 +};
 +
 +#endif /* __XEN_PCI_COMMON_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/ring.h linux-2.6-merge.hg/include/xen/interface/io/ring.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/ring.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/ring.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,270 @@
+diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
+new file mode 100644
+index 0000000..d9aac23
+--- /dev/null
++++ b/include/xen/interface/io/ring.h
+@@ -0,0 +1,265 @@
 +/******************************************************************************
 + * ring.h
 + * 
@@ -68164,7 +74782,7 @@
 + *
 + * These expand out to give you a set of types, as you can see below.
 + * The most important of these are:
-+ *  
++ * 
 + *     mytag_sring_t      - The shared ring.
 + *     mytag_front_ring_t - The 'front' half of the ring.
 + *     mytag_back_ring_t  - The 'back' half of the ring.
@@ -68183,7 +74801,7 @@
 + *     mytag_back_ring_t back_ring;
 + *     BACK_RING_INIT(&back_ring, (mytag_sring_t *)shared_page, PAGE_SIZE);
 + */
-+         
++
 +#define DEFINE_RING_TYPES(__name, __req_t, __rsp_t)                     \
 +                                                                        \
 +/* Shared ring entry */                                                 \
@@ -68222,7 +74840,7 @@
 +typedef struct __name##_back_ring __name##_back_ring_t
 +
 +/*
-+ * Macros for manipulating rings.  
++ * Macros for manipulating rings.
 + * 
 + * FRONT_RING_whatever works on the "front end" of a ring: here 
 + * requests are pushed on to the ring and responses taken off it.
@@ -68230,7 +74848,7 @@
 + * BACK_RING_whatever works on the "back end" of a ring: here 
 + * requests are taken off the ring and responses put on.
 + * 
-+ * N.B. these macros do NO INTERLOCKS OR FLOW CONTROL.  
++ * N.B. these macros do NO INTERLOCKS OR FLOW CONTROL. 
 + * This is OK in 1-for-1 request-response situations where the 
 + * requestor (front end) never has more than RING_SIZE()-1
 + * outstanding requests.
@@ -68276,7 +74894,7 @@
 +#define RING_SIZE(_r)                                                   \
 +    ((_r)->nr_ents)
 +
-+/* Test if there is an empty slot available on the front ring. 
++/* Test if there is an empty slot available on the front ring.
 + * (This is only meaningful from the front. )
 + */
 +#define RING_FULL(_r)                                                   \
@@ -68284,24 +74902,19 @@
 +
 +/* Test if there are outstanding messages to be processed on a ring. */
 +#define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \
-+   ( (_r)->rsp_cons != (_r)->sring->rsp_prod )
-+   
++    ((_r)->rsp_cons != (_r)->sring->rsp_prod)
++
 +#define RING_HAS_UNCONSUMED_REQUESTS(_r)                                \
-+   ( ((_r)->req_cons != (_r)->sring->req_prod ) &&                      \
-+     (((_r)->req_cons - (_r)->rsp_prod_pvt) !=                          \
-+      RING_SIZE(_r)) )
-+      
++    (((_r)->req_cons != (_r)->sring->req_prod) &&                       \
++     (((_r)->req_cons - (_r)->rsp_prod_pvt) != RING_SIZE(_r)))
++
 +/* Direct access to individual ring elements, by index. */
 +#define RING_GET_REQUEST(_r, _idx)                                      \
-+ (&((_r)->sring->ring[                                                  \
-+     ((_idx) & (RING_SIZE(_r) - 1))                                     \
-+     ].req))
++    (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))
 +
 +#define RING_GET_RESPONSE(_r, _idx)                                     \
-+ (&((_r)->sring->ring[                                                  \
-+     ((_idx) & (RING_SIZE(_r) - 1))                                     \
-+     ].rsp))   
-+    
++    (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp))
++
 +/* Loop termination condition: Would the specified index overflow the ring? */
 +#define RING_REQUEST_CONS_OVERFLOW(_r, _cons)                           \
 +    (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
@@ -68337,7 +74950,7 @@
 + *  The second argument is a boolean return value. True indicates that there
 + *  are pending messages on the ring (i.e., the connection should not be put
 + *  to sleep).
-+ *  
++ * 
 + *  These macros will set the req_event/rsp_event field to trigger a
 + *  notification on the very next message that is enqueued. If you want to
 + *  create batches of work (i.e., only receive a notification after several
@@ -68393,9 +75006,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/tpmif.h linux-2.6-merge.hg/include/xen/interface/io/tpmif.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/tpmif.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/tpmif.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/io/tpmif.h b/include/xen/interface/io/tpmif.h
+new file mode 100644
+index 0000000..6d02f33
+--- /dev/null
++++ b/include/xen/interface/io/tpmif.h
 @@ -0,0 +1,56 @@
 +/******************************************************************************
 + * tpmif.h
@@ -68420,7 +75035,7 @@
 +typedef struct {
 +    unsigned long addr;   /* Machine address of packet.   */
 +    grant_ref_t ref;      /* grant table access reference */
-+    uint16_t id;          /* Echoed in response message.  */
++    uint16_t unused;
 +    uint16_t size;        /* Packet size in bytes.        */
 +} tpmif_tx_request_t;
 +
@@ -68453,9 +75068,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/vmx_vlapic.h linux-2.6-merge.hg/include/xen/interface/io/vmx_vlapic.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/vmx_vlapic.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/vmx_vlapic.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/io/vmx_vlapic.h b/include/xen/interface/io/vmx_vlapic.h
+new file mode 100644
+index 0000000..f63a9aa
+--- /dev/null
++++ b/include/xen/interface/io/vmx_vlapic.h
 @@ -0,0 +1,58 @@
 +#ifndef _VMX_VLAPIC_H
 +#define _VMX_VLAPIC_H
@@ -68515,9 +75132,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/vmx_vpic.h linux-2.6-merge.hg/include/xen/interface/io/vmx_vpic.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/vmx_vpic.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/vmx_vpic.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/io/vmx_vpic.h b/include/xen/interface/io/vmx_vpic.h
+new file mode 100644
+index 0000000..256ac87
+--- /dev/null
++++ b/include/xen/interface/io/vmx_vpic.h
 @@ -0,0 +1,85 @@
 +/*
 + * QEMU System Emulator header
@@ -68604,10 +75223,12 @@
 +
 +/* APIC */
 +#endif  /* _VMX_VPIC_H */  
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/xenbus.h linux-2.6-merge.hg/include/xen/interface/io/xenbus.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/xenbus.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/xenbus.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,44 @@
+diff --git a/include/xen/interface/io/xenbus.h b/include/xen/interface/io/xenbus.h
+new file mode 100644
+index 0000000..472079c
+--- /dev/null
++++ b/include/xen/interface/io/xenbus.h
+@@ -0,0 +1,42 @@
 +/*****************************************************************************
 + * xenbus.h
 + *
@@ -68616,9 +75237,8 @@
 + * Copyright (C) 2005 XenSource Ltd.
 + */
 +
-+#ifndef _XEN_XENBUS_H
-+#define _XEN_XENBUS_H
-+
++#ifndef _XEN_PUBLIC_IO_XENBUS_H
++#define _XEN_PUBLIC_IO_XENBUS_H
 +
 +/* The state of either end of the Xenbus, i.e. the current communication
 +   status of initialisation across the bus.  States here imply nothing about
@@ -68640,8 +75260,7 @@
 +
 +} XenbusState;
 +
-+
-+#endif /* _XEN_XENBUS_H */
++#endif /* _XEN_PUBLIC_IO_XENBUS_H */
 +
 +/*
 + * Local variables:
@@ -68652,9 +75271,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/xs_wire.h linux-2.6-merge.hg/include/xen/interface/io/xs_wire.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/io/xs_wire.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/io/xs_wire.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h
+new file mode 100644
+index 0000000..3c642fd
+--- /dev/null
++++ b/include/xen/interface/io/xs_wire.h
 @@ -0,0 +1,97 @@
 +/*
 + * Details of the "wire" protocol between Xen Store Daemon and client
@@ -68753,10 +75374,12 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/memory.h linux-2.6-merge.hg/include/xen/interface/memory.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/memory.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/memory.h	2006-02-21 16:06:10.000000000 +0000
-@@ -0,0 +1,149 @@
+diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
+new file mode 100644
+index 0000000..f3f16fe
+--- /dev/null
++++ b/include/xen/interface/memory.h
+@@ -0,0 +1,153 @@
 +/******************************************************************************
 + * memory.h
 + * 
@@ -68788,7 +75411,7 @@
 +     *   OUT: GMFN bases of extents that were allocated
 +     *   (NB. This command also updates the mach_to_phys translation table)
 +     */
-+    unsigned long *extent_start;
++    GUEST_HANDLE(ulong) extent_start;
 +
 +    /* Number of extents, and size/alignment of each (2^extent_order pages). */
 +    unsigned long  nr_extents;
@@ -68809,6 +75432,7 @@
 +    domid_t        domid;
 +
 +} xen_memory_reservation_t;
++DEFINE_GUEST_HANDLE(xen_memory_reservation_t);
 +
 +/*
 + * Returns the maximum machine frame number of mapped RAM in this system.
@@ -68838,13 +75462,13 @@
 +     * machphys table is smaller than max_extents * 2MB.
 +     */
 +    unsigned int max_extents;
-+    
++
 +    /*
 +     * Pointer to buffer to fill with list of extent starts. If there are
 +     * any large discontiguities in the machine address space, 2MB gaps in
 +     * the machphys table will be represented by an MFN base of zero.
 +     */
-+    unsigned long *extent_start;
++    GUEST_HANDLE(ulong) extent_start;
 +
 +    /*
 +     * Number of extents written to the above array. This will be smaller
@@ -68852,6 +75476,7 @@
 +     */
 +    unsigned int nr_extents;
 +} xen_machphys_mfn_list_t;
++DEFINE_GUEST_HANDLE(xen_machphys_mfn_list_t);
 +
 +/*
 + * Returns the base and size of the specified reserved 'RAM hole' in the
@@ -68872,6 +75497,7 @@
 +    /* Base and size of the specified reserved area. */
 +    unsigned long first_gpfn, nr_gpfns;
 +} xen_reserved_phys_area_t;
++DEFINE_GUEST_HANDLE(xen_reserved_phys_area_t);
 +
 +/*
 + * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
@@ -68886,14 +75512,15 @@
 +    unsigned long nr_gpfns;
 +
 +    /* List of GPFNs to translate. */
-+    unsigned long *gpfn_list;
++    GUEST_HANDLE(ulong) gpfn_list;
 +
 +    /*
 +     * Output list to contain MFN translations. May be the same as the input
 +     * list (in which case each input GPFN is overwritten with the output MFN).
 +     */
-+    unsigned long *mfn_list;
++    GUEST_HANDLE(ulong) mfn_list;
 +} xen_translate_gpfn_list_t;
++DEFINE_GUEST_HANDLE(xen_translate_gpfn_list_t);
 +
 +#endif /* __XEN_PUBLIC_MEMORY_H__ */
 +
@@ -68906,9 +75533,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/nmi.h linux-2.6-merge.hg/include/xen/interface/nmi.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/nmi.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/nmi.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/nmi.h b/include/xen/interface/nmi.h
+new file mode 100644
+index 0000000..0c0c67b
+--- /dev/null
++++ b/include/xen/interface/nmi.h
 @@ -0,0 +1,54 @@
 +/******************************************************************************
 + * nmi.h
@@ -68964,9 +75593,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/physdev.h linux-2.6-merge.hg/include/xen/interface/physdev.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/physdev.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/physdev.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
+new file mode 100644
+index 0000000..2df68b4
+--- /dev/null
++++ b/include/xen/interface/physdev.h
 @@ -0,0 +1,70 @@
 +
 +#ifndef __XEN_PUBLIC_PHYSDEV_H__
@@ -69003,18 +75634,18 @@
 +
 +typedef struct physdevop_apic {
 +    /* IN */
-+    uint32_t apic;
-+    uint32_t offset;
++    unsigned long apic_physbase;
++    uint32_t reg;
 +    /* IN or OUT */
 +    uint32_t value;
-+} physdevop_apic_t; 
++} physdevop_apic_t;
 +
 +typedef struct physdevop_irq {
 +    /* IN */
 +    uint32_t irq;
 +    /* OUT */
 +    uint32_t vector;
-+} physdevop_irq_t; 
++} physdevop_irq_t;
 +
 +typedef struct physdev_op {
 +    uint32_t cmd;
@@ -69038,10 +75669,78 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/sched_ctl.h linux-2.6-merge.hg/include/xen/interface/sched_ctl.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/sched_ctl.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/sched_ctl.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,68 @@
+diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
+new file mode 100644
+index 0000000..a1a03de
+--- /dev/null
++++ b/include/xen/interface/sched.h
+@@ -0,0 +1,60 @@
++/******************************************************************************
++ * sched.h
++ * 
++ * Scheduler state interactions
++ * 
++ * Copyright (c) 2005, Keir Fraser <keir at xensource.com>
++ */
++
++#ifndef __XEN_PUBLIC_SCHED_H__
++#define __XEN_PUBLIC_SCHED_H__
++
++/*
++ * Prototype for this hypercall is:
++ *  int sched_op(int cmd, unsigned long arg)
++ * @cmd == SCHEDOP_??? (scheduler operation).
++ * @arg == Operation-specific extra argument(s).
++ */
++
++/*
++ * Voluntarily yield the CPU.
++ * @arg == 0.
++ */
++#define SCHEDOP_yield       0
++
++/*
++ * Block execution of this VCPU until an event is received for processing.
++ * If called with event upcalls masked, this operation will atomically
++ * reenable event delivery and check for pending events before blocking the
++ * VCPU. This avoids a "wakeup waiting" race.
++ * @arg == 0.
++ */
++#define SCHEDOP_block       1
++
++/*
++ * Halt execution of this domain (all VCPUs) and notify the system controller.
++ * @arg == SHUTDOWN_??? (reason for shutdown).
++ */
++#define SCHEDOP_shutdown    2
++
++/*
++ * Reason codes for SCHEDOP_shutdown. These may be interpreted by controller
++ * software to determine the appropriate action. For the most part, Xen does
++ * not care about the shutdown code.
++ */
++#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
++#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
++#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
++#define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
++
++#endif /* __XEN_PUBLIC_SCHED_H__ */
++
++/*
++ * Local variables:
++ * mode: C
++ * c-set-style: "BSD"
++ * c-basic-offset: 4
++ * tab-width: 4
++ * indent-tabs-mode: nil
++ * End:
++ */
+diff --git a/include/xen/interface/sched_ctl.h b/include/xen/interface/sched_ctl.h
+new file mode 100644
+index 0000000..600c43a
+--- /dev/null
++++ b/include/xen/interface/sched_ctl.h
+@@ -0,0 +1,64 @@
 +/******************************************************************************
 + * Generic scheduler control interface.
 + *
@@ -69078,24 +75777,20 @@
 +    uint32_t direction;
 +    domid_t  domain;
 +    union {
-+        struct bvt_adjdom
-+        {
++        struct bvt_adjdom {
 +            uint32_t mcu_adv;      /* mcu advance: inverse of weight */
 +            uint32_t warpback;     /* warp? */
 +            int32_t  warpvalue;    /* warp value */
 +            int64_t  warpl;        /* warp limit */
 +            int64_t  warpu;        /* unwarp time requirement */
 +        } bvt;
-+        
-+        struct sedf_adjdom
-+        {
++        struct sedf_adjdom {
 +            uint64_t period;
 +            uint64_t slice;
 +            uint64_t latency;
 +            uint32_t extratime;
 +            uint32_t weight;
 +        } sedf;
-+
 +    } u;
 +};
 +
@@ -69110,73 +75805,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/sched.h linux-2.6-merge.hg/include/xen/interface/sched.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/sched.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/sched.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,60 @@
-+/******************************************************************************
-+ * sched.h
-+ * 
-+ * Scheduler state interactions
-+ * 
-+ * Copyright (c) 2005, Keir Fraser <keir at xensource.com>
-+ */
-+
-+#ifndef __XEN_PUBLIC_SCHED_H__
-+#define __XEN_PUBLIC_SCHED_H__
-+
-+/*
-+ * Prototype for this hypercall is:
-+ *  int sched_op(int cmd, unsigned long arg)
-+ * @cmd == SCHEDOP_??? (scheduler operation).
-+ * @arg == Operation-specific extra argument(s).
-+ */
-+
-+/*
-+ * Voluntarily yield the CPU.
-+ * @arg == 0.
-+ */
-+#define SCHEDOP_yield       0
-+
-+/*
-+ * Block execution of this VCPU until an event is received for processing.
-+ * If called with event upcalls masked, this operation will atomically
-+ * reenable event delivery and check for pending events before blocking the
-+ * VCPU. This avoids a "wakeup waiting" race.
-+ * @arg == 0.
-+ */
-+#define SCHEDOP_block       1
-+
-+/*
-+ * Halt execution of this domain (all VCPUs) and notify the system controller.
-+ * @arg == SHUTDOWN_??? (reason for shutdown).
-+ */
-+#define SCHEDOP_shutdown    2
-+
-+/*
-+ * Reason codes for SCHEDOP_shutdown. These may be interpreted by controller
-+ * software to determine the appropriate action. For the most part, Xen does
-+ * not care about the shutdown code.
-+ */
-+#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
-+#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
-+#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
-+#define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
-+
-+#endif /* __XEN_PUBLIC_SCHED_H__ */
-+
-+/*
-+ * Local variables:
-+ * mode: C
-+ * c-set-style: "BSD"
-+ * c-basic-offset: 4
-+ * tab-width: 4
-+ * indent-tabs-mode: nil
-+ * End:
-+ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/trace.h linux-2.6-merge.hg/include/xen/interface/trace.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/trace.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/trace.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/trace.h b/include/xen/interface/trace.h
+new file mode 100644
+index 0000000..cba4b26
+--- /dev/null
++++ b/include/xen/interface/trace.h
 @@ -0,0 +1,90 @@
 +/******************************************************************************
 + * include/public/trace.h
@@ -69268,9 +75901,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/vcpu.h linux-2.6-merge.hg/include/xen/interface/vcpu.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/vcpu.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/vcpu.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/interface/vcpu.h b/include/xen/interface/vcpu.h
+new file mode 100644
+index 0000000..1c36f81
+--- /dev/null
++++ b/include/xen/interface/vcpu.h
 @@ -0,0 +1,119 @@
 +/******************************************************************************
 + * vcpu.h
@@ -69391,9 +76026,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/version.h linux-2.6-merge.hg/include/xen/interface/version.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/version.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/version.h	2006-02-27 15:49:45.000000000 +0000
+diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
+new file mode 100644
+index 0000000..9a496f9
+--- /dev/null
++++ b/include/xen/interface/version.h
 @@ -0,0 +1,64 @@
 +/******************************************************************************
 + * version.h
@@ -69459,9 +76096,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/xen.h linux-2.6-merge.hg/include/xen/interface/xen.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/interface/xen.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/interface/xen.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
+new file mode 100644
+index 0000000..6e1f366
+--- /dev/null
++++ b/include/xen/interface/xen.h
 @@ -0,0 +1,447 @@
 +/******************************************************************************
 + * xen.h
@@ -69845,8 +76484,8 @@
 + *      a. relocated kernel image
 + *      b. initial ram disk              [mod_start, mod_len]
 + *      c. list of allocated page frames [mfn_list, nr_pages]
-+ *      d. bootstrap page tables         [pt_base, CR3 (x86)]
-+ *      e. start_info_t structure        [register ESI (x86)]
++ *      d. start_info_t structure        [register ESI (x86)]
++ *      e. bootstrap page tables         [pt_base, CR3 (x86)]
 + *      f. bootstrap stack               [register ESP (x86)]
 + *  5. Bootstrap elements are packed together, but each is 4kB-aligned.
 + *  6. The initial ram disk may be omitted.
@@ -69910,9 +76549,11 @@
 + * indent-tabs-mode: nil
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/net_driver_util.h linux-2.6-merge.hg/include/xen/net_driver_util.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/net_driver_util.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/net_driver_util.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/net_driver_util.h b/include/xen/net_driver_util.h
+new file mode 100644
+index 0000000..130b4f0
+--- /dev/null
++++ b/include/xen/net_driver_util.h
 @@ -0,0 +1,56 @@
 +/*****************************************************************************
 + *
@@ -69970,9 +76611,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/pcifront.h linux-2.6-merge.hg/include/xen/pcifront.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/pcifront.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/pcifront.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/xen/pcifront.h b/include/xen/pcifront.h
+new file mode 100644
+index 0000000..51b170a
+--- /dev/null
++++ b/include/xen/pcifront.h
 @@ -0,0 +1,39 @@
 +/*
 + * PCI Frontend - arch-dependendent declarations
@@ -70013,9 +76656,11 @@
 +#endif /* __KERNEL__ */
 +
 +#endif /* __XEN_ASM_PCIFRONT_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/public/evtchn.h linux-2.6-merge.hg/include/xen/public/evtchn.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/public/evtchn.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/public/evtchn.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/public/evtchn.h b/include/xen/public/evtchn.h
+new file mode 100644
+index 0000000..456f246
+--- /dev/null
++++ b/include/xen/public/evtchn.h
 @@ -0,0 +1,98 @@
 +/******************************************************************************
 + * evtchn.h
@@ -70115,9 +76760,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/public/privcmd.h linux-2.6-merge.hg/include/xen/public/privcmd.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/public/privcmd.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/public/privcmd.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/public/privcmd.h b/include/xen/public/privcmd.h
+new file mode 100644
+index 0000000..074d66c
+--- /dev/null
++++ b/include/xen/public/privcmd.h
 @@ -0,0 +1,91 @@
 +/******************************************************************************
 + * privcmd.h
@@ -70210,102 +76857,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/public/xenstored.h linux-2.6-merge.hg/include/xen/public/xenstored.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/public/xenstored.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/public/xenstored.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,89 @@
-+/*
-+ * Simple prototyle Xen Store Daemon providing simple tree-like database.
-+ * Copyright (C) 2005 Rusty Russell IBM Corporation
-+ *
-+ * This file may be distributed separately from the Linux kernel, or
-+ * incorporated into other software packages, subject to the following license:
-+ * 
-+ * Permission is hereby granted, free of charge, to any person obtaining a copy
-+ * of this source file (the "Software"), to deal in the Software without
-+ * restriction, including without limitation the rights to use, copy, modify,
-+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
-+ * and to permit persons to whom the Software is furnished to do so, subject to
-+ * the following conditions:
-+ * 
-+ * The above copyright notice and this permission notice shall be included in
-+ * all copies or substantial portions of the Software.
-+ * 
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * 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.
-+ */
-+
-+#ifndef _XENSTORED_H
-+#define _XENSTORED_H
-+
-+enum xsd_sockmsg_type
-+{
-+	XS_DEBUG,
-+	XS_SHUTDOWN,
-+	XS_DIRECTORY,
-+	XS_READ,
-+	XS_GET_PERMS,
-+	XS_WATCH,
-+	XS_WATCH_ACK,
-+	XS_UNWATCH,
-+	XS_TRANSACTION_START,
-+	XS_TRANSACTION_END,
-+	XS_OP_READ_ONLY = XS_TRANSACTION_END,
-+	XS_INTRODUCE,
-+	XS_RELEASE,
-+	XS_GET_DOMAIN_PATH,
-+	XS_WRITE,
-+	XS_MKDIR,
-+	XS_RM,
-+	XS_SET_PERMS,
-+	XS_WATCH_EVENT,
-+	XS_ERROR,
-+};
-+
-+#define XS_WRITE_NONE "NONE"
-+#define XS_WRITE_CREATE "CREATE"
-+#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
-+
-+/* We hand errors as strings, for portability. */
-+struct xsd_errors
-+{
-+	int errnum;
-+	const char *errstring;
-+};
-+#define XSD_ERROR(x) { x, #x }
-+static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
-+	XSD_ERROR(EINVAL),
-+	XSD_ERROR(EACCES),
-+	XSD_ERROR(EEXIST),
-+	XSD_ERROR(EISDIR),
-+	XSD_ERROR(ENOENT),
-+	XSD_ERROR(ENOMEM),
-+	XSD_ERROR(ENOSPC),
-+	XSD_ERROR(EIO),
-+	XSD_ERROR(ENOTEMPTY),
-+	XSD_ERROR(ENOSYS),
-+	XSD_ERROR(EROFS),
-+	XSD_ERROR(EBUSY),
-+	XSD_ERROR(EAGAIN),
-+	XSD_ERROR(EISCONN),
-+};
-+struct xsd_sockmsg
-+{
-+	u32 type;
-+	u32 len; 		/* Length of data following this. */
-+
-+	/* Generally followed by nul-terminated string(s). */
-+};
-+
-+#endif /* _XENSTORED_H */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/tpmfe.h linux-2.6-merge.hg/include/xen/tpmfe.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/tpmfe.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/tpmfe.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/tpmfe.h b/include/xen/tpmfe.h
+new file mode 100644
+index 0000000..9b8ea7c
+--- /dev/null
++++ b/include/xen/tpmfe.h
 @@ -0,0 +1,40 @@
 +#ifndef TPM_FE_H
 +#define TPM_FE_H
@@ -70347,9 +76903,40 @@
 +void tpm_fe_unregister_receiver(void);
 +
 +#endif
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/xenbus.h linux-2.6-merge.hg/include/xen/xenbus.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/xenbus.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/xenbus.h	2006-02-21 16:06:10.000000000 +0000
+diff --git a/include/xen/xen_proc.h b/include/xen/xen_proc.h
+new file mode 100644
+index 0000000..dc89521
+--- /dev/null
++++ b/include/xen/xen_proc.h
+@@ -0,0 +1,23 @@
++
++#ifndef __ASM_XEN_PROC_H__
++#define __ASM_XEN_PROC_H__
++
++#include <linux/config.h>
++#include <linux/proc_fs.h>
++
++extern struct proc_dir_entry *create_xen_proc_entry(
++	const char *name, mode_t mode);
++extern void remove_xen_proc_entry(
++	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 --git a/include/xen/xenbus.h b/include/xen/xenbus.h
+new file mode 100644
+index 0000000..27b08d5
+--- /dev/null
++++ b/include/xen/xenbus.h
 @@ -0,0 +1,298 @@
 +/******************************************************************************
 + * xenbus.h
@@ -70381,8 +76968,8 @@
 + * IN THE SOFTWARE.
 + */
 +
-+#ifndef _ASM_XEN_XENBUS_H
-+#define _ASM_XEN_XENBUS_H
++#ifndef _XEN_XENBUS_H
++#define _XEN_XENBUS_H
 +
 +#include <linux/device.h>
 +#include <linux/notifier.h>
@@ -70416,7 +77003,7 @@
 +	int otherend_id;
 +	struct xenbus_watch otherend_watch;
 +	struct device dev;
-+	int has_error;
++	XenbusState state;
 +	void *data;
 +};
 +
@@ -70523,7 +77110,7 @@
 + * be saved in the store.
 + */
 +int xenbus_watch_path(struct xenbus_device *dev, const char *path,
-+		      struct xenbus_watch *watch, 
++		      struct xenbus_watch *watch,
 +		      void (*callback)(struct xenbus_watch *,
 +				       const char **, unsigned int));
 +
@@ -70538,7 +77125,7 @@
 + * saved in the store.
 + */
 +int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
-+		       const char *path2, struct xenbus_watch *watch, 
++		       const char *path2, struct xenbus_watch *watch,
 +		       void (*callback)(struct xenbus_watch *,
 +					const char **, unsigned int));
 +
@@ -70569,8 +77156,8 @@
 + * page to that address, and sets *vaddr to that address.
 + * xenbus_map_ring does not allocate the virtual address space (you must do
 + * this yourself!). It only maps in the page to the specified address.
-+ * Returns 0 on success, and GNTST_* (see xen/include/public/grant_table.h) or
-+ * -ENOMEM on error. If an error is returned, device will switch to
++ * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
++ * or -ENOMEM on error. If an error is returned, device will switch to
 + * XenbusStateClosing and the error message will be saved in XenStore.
 + */
 +int xenbus_map_ring_valloc(struct xenbus_device *dev,
@@ -70584,7 +77171,7 @@
 + * Use xenbus_unmap_ring_vfree if you mapped in your memory with
 + * xenbus_map_ring_valloc (it will free the virtual address space).
 + * Returns 0 on success and returns GNTST_* on error
-+ * (see xen/include/public/grant_table.h).
++ * (see xen/include/interface/grant_table.h).
 + */
 +int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr);
 +int xenbus_unmap_ring(struct xenbus_device *dev,
@@ -70638,7 +77225,7 @@
 +		      ...);
 +
 +
-+#endif /* _ASM_XEN_XENBUS_H */
++#endif /* _XEN_XENBUS_H */
 +
 +/*
 + * Local variables:
@@ -70649,9 +77236,11 @@
 + *  tab-width: 8
 + * End:
 + */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/xencons.h linux-2.6-merge.hg/include/xen/xencons.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/xencons.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/xencons.h	2006-02-11 17:25:48.000000000 +0000
+diff --git a/include/xen/xencons.h b/include/xen/xencons.h
+new file mode 100644
+index 0000000..fa2160d
+--- /dev/null
++++ b/include/xen/xencons.h
 @@ -0,0 +1,14 @@
 +#ifndef __ASM_XENCONS_H__
 +#define __ASM_XENCONS_H__
@@ -70667,37 +77256,11 @@
 +int xencons_ring_send(const char *data, unsigned len);
 +
 +#endif /* __ASM_XENCONS_H__ */
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/xen_proc.h linux-2.6-merge.hg/include/xen/xen_proc.h
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/include/xen/xen_proc.h	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/include/xen/xen_proc.h	2006-02-11 17:25:48.000000000 +0000
-@@ -0,0 +1,23 @@
-+
-+#ifndef __ASM_XEN_PROC_H__
-+#define __ASM_XEN_PROC_H__
-+
-+#include <linux/config.h>
-+#include <linux/proc_fs.h>
-+
-+extern struct proc_dir_entry *create_xen_proc_entry(
-+	const char *name, mode_t mode);
-+extern void remove_xen_proc_entry(
-+	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 -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/init/Kconfig linux-2.6-merge.hg/init/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/init/Kconfig	2006-02-27 15:51:48.000000000 +0000
-+++ linux-2.6-merge.hg/init/Kconfig	2006-02-18 12:03:40.000000000 +0000
-@@ -224,7 +224,7 @@
+diff --git a/init/Kconfig b/init/Kconfig
+index 38416a1..2c3ece9 100644
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -224,7 +224,7 @@ config UID16
  	  This enables the legacy 16-bit UID syscall wrappers.
  
  config VM86
@@ -70706,10 +77269,23 @@
  	default y
  	bool "Enable VM86 support" if EMBEDDED
  	help
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/kernel/irq/manage.c linux-2.6-merge.hg/kernel/irq/manage.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/kernel/irq/manage.c	2006-02-27 15:51:48.000000000 +0000
-+++ linux-2.6-merge.hg/kernel/irq/manage.c	2006-02-11 17:25:48.000000000 +0000
-@@ -164,9 +164,14 @@
+diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
+index 0b46a5d..17ab322 100644
+--- a/kernel/Kconfig.preempt
++++ b/kernel/Kconfig.preempt
+@@ -35,6 +35,7 @@ config PREEMPT_VOLUNTARY
+ 
+ config PREEMPT
+ 	bool "Preemptible Kernel (Low-Latency Desktop)"
++	depends on !XEN
+ 	help
+ 	  This option reduces the latency of the kernel by making
+ 	  all kernel code (that is not executing in a critical section)
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
+index 97d5559..0139444 100644
+--- a/kernel/irq/manage.c
++++ b/kernel/irq/manage.c
+@@ -164,9 +164,14 @@ int can_request_irq(unsigned int irq, un
  	return !action;
  }
  
@@ -70727,7 +77303,7 @@
   */
  int setup_irq(unsigned int irq, struct irqaction * new)
  {
-@@ -238,28 +243,30 @@
+@@ -238,28 +243,30 @@ int setup_irq(unsigned int irq, struct i
  	return 0;
  }
  
@@ -70770,7 +77346,7 @@
  
  	desc = irq_desc + irq;
  	spin_lock_irqsave(&desc->lock,flags);
-@@ -271,7 +278,7 @@
+@@ -271,7 +278,7 @@ void free_irq(unsigned int irq, void *de
  			struct irqaction **pp = p;
  
  			p = &action->next;
@@ -70779,7 +77355,7 @@
  				continue;
  
  			/* Found it - now remove it from the list of entries */
-@@ -295,13 +302,52 @@
+@@ -295,13 +302,52 @@ void free_irq(unsigned int irq, void *de
  
  			/* Make sure it's not being used on another CPU */
  			synchronize_irq(irq);
@@ -70835,21 +77411,11 @@
  }
  
  EXPORT_SYMBOL(free_irq);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/kernel/Kconfig.preempt linux-2.6-merge.hg/kernel/Kconfig.preempt
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/kernel/Kconfig.preempt	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/kernel/Kconfig.preempt	2006-02-11 17:25:48.000000000 +0000
-@@ -35,6 +35,7 @@
- 
- config PREEMPT
- 	bool "Preemptible Kernel (Low-Latency Desktop)"
-+	depends on !XEN
- 	help
- 	  This option reduces the latency of the kernel by making
- 	  all kernel code (that is not executing in a critical section)
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/lib/Kconfig.debug linux-2.6-merge.hg/lib/Kconfig.debug
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/lib/Kconfig.debug	2006-02-27 15:51:48.000000000 +0000
-+++ linux-2.6-merge.hg/lib/Kconfig.debug	2006-02-11 17:25:48.000000000 +0000
-@@ -145,7 +145,7 @@
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
+index a314e66..f50aa3a 100644
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -145,7 +145,7 @@ config DEBUG_BUGVERBOSE
  
  config DEBUG_INFO
  	bool "Compile the kernel with debug info"
@@ -70858,10 +77424,11 @@
  	help
            If you say Y here the resulting kernel image will include
  	  debugging info resulting in a larger kernel image.
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/lib/Makefile linux-2.6-merge.hg/lib/Makefile
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/lib/Makefile	2006-02-27 15:51:48.000000000 +0000
-+++ linux-2.6-merge.hg/lib/Makefile	2006-02-11 17:25:48.000000000 +0000
-@@ -45,6 +45,9 @@
+diff --git a/lib/Makefile b/lib/Makefile
+index 648b2c1..21cf76f 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -45,6 +45,9 @@ obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o
  obj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o
  
  obj-$(CONFIG_SWIOTLB) += swiotlb.o
@@ -70871,10 +77438,30 @@
  
  hostprogs-y	:= gen_crc32table
  clean-files	:= crc32table.h
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/highmem.c linux-2.6-merge.hg/mm/highmem.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/highmem.c	2006-01-03 03:21:10.000000000 +0000
-+++ linux-2.6-merge.hg/mm/highmem.c	2006-02-11 17:25:48.000000000 +0000
-@@ -152,6 +152,17 @@
+diff --git a/mm/Kconfig b/mm/Kconfig
+index a9cb80a..909b2a0 100644
+--- a/mm/Kconfig
++++ b/mm/Kconfig
+@@ -126,11 +126,14 @@ comment "Memory hotplug is currently inc
+ # Default to 4 for wider testing, though 8 might be more appropriate.
+ # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
+ # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
++# XEN uses the mapping field on pagetable pages to store a pointer to
++# the destructor.
+ #
+ config SPLIT_PTLOCK_CPUS
+ 	int
+ 	default "4096" if ARM && !CPU_CACHE_VIPT
+ 	default "4096" if PARISC && !PA20
++	default "4096" if XEN
+ 	default "4"
+ 
+ #
+diff --git a/mm/highmem.c b/mm/highmem.c
+index ce2e7e8..b29bf62 100644
+--- a/mm/highmem.c
++++ b/mm/highmem.c
+@@ -152,6 +152,17 @@ start:
  	return vaddr;
  }
  
@@ -70892,28 +77479,11 @@
  void fastcall *kmap_high(struct page *page)
  {
  	unsigned long vaddr;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/Kconfig linux-2.6-merge.hg/mm/Kconfig
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/Kconfig	2006-02-27 15:51:48.000000000 +0000
-+++ linux-2.6-merge.hg/mm/Kconfig	2006-02-11 17:25:48.000000000 +0000
-@@ -126,11 +126,14 @@
- # Default to 4 for wider testing, though 8 might be more appropriate.
- # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
- # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
-+# XEN uses the mapping field on pagetable pages to store a pointer to
-+# the destructor.
- #
- config SPLIT_PTLOCK_CPUS
- 	int
- 	default "4096" if ARM && !CPU_CACHE_VIPT
- 	default "4096" if PARISC && !PA20
-+	default "4096" if XEN
- 	default "4"
- 
- #
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/memory.c linux-2.6-merge.hg/mm/memory.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/memory.c	2006-02-27 15:51:49.000000000 +0000
-+++ linux-2.6-merge.hg/mm/memory.c	2006-02-27 15:49:45.000000000 +0000
-@@ -405,7 +405,8 @@
+diff --git a/mm/memory.c b/mm/memory.c
+index 9abc600..351b316 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -405,7 +405,8 @@ struct page *vm_normal_page(struct vm_ar
  	 * Remove this test eventually!
  	 */
  	if (unlikely(!pfn_valid(pfn))) {
@@ -70923,7 +77493,7 @@
  		return NULL;
  	}
  
-@@ -1019,6 +1020,23 @@
+@@ -1019,6 +1020,23 @@ int get_user_pages(struct task_struct *t
  			continue;
  		}
  
@@ -70947,7 +77517,7 @@
  		if (!vma || (vma->vm_flags & (VM_IO | VM_PFNMAP))
  				|| !(vm_flags & vma->vm_flags))
  			return i ? : -EFAULT;
-@@ -1358,6 +1376,98 @@
+@@ -1358,6 +1376,98 @@ int remap_pfn_range(struct vm_area_struc
  }
  EXPORT_SYMBOL(remap_pfn_range);
  
@@ -71046,10 +77616,11 @@
  /*
   * handle_pte_fault chooses page fault handler according to an entry
   * which was read non-atomically.  Before making any commitment, on
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/mmap.c linux-2.6-merge.hg/mm/mmap.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/mmap.c	2006-02-27 15:51:49.000000000 +0000
-+++ linux-2.6-merge.hg/mm/mmap.c	2006-02-11 17:25:49.000000000 +0000
-@@ -1937,6 +1937,10 @@
+diff --git a/mm/mmap.c b/mm/mmap.c
+index 47556d2..a01e3ff 100644
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -1937,6 +1937,10 @@ void exit_mmap(struct mm_struct *mm)
  	unsigned long nr_accounted = 0;
  	unsigned long end;
  
@@ -71060,10 +77631,11 @@
  	lru_add_drain();
  	flush_cache_mm(mm);
  	tlb = tlb_gather_mmu(mm, 1);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/page_alloc.c linux-2.6-merge.hg/mm/page_alloc.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/mm/page_alloc.c	2006-02-27 15:51:49.000000000 +0000
-+++ linux-2.6-merge.hg/mm/page_alloc.c	2006-02-27 15:49:45.000000000 +0000
-@@ -418,7 +418,8 @@
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index 234bd48..3ef8362 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -418,7 +418,8 @@ static void __free_pages_ok(struct page 
  	int i;
  	int reserved = 0;
  
@@ -71073,7 +77645,7 @@
  	if (!PageHighMem(page))
  		mutex_debug_check_no_locks_freed(page_address(page),
  						 PAGE_SIZE<<order);
-@@ -712,7 +713,8 @@
+@@ -711,7 +712,8 @@ static void fastcall free_hot_cold_page(
  	struct per_cpu_pages *pcp;
  	unsigned long flags;
  
@@ -71083,9 +77655,10 @@
  
  	if (PageAnon(page))
  		page->mapping = NULL;
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/net/core/dev.c linux-2.6-merge.hg/net/core/dev.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/net/core/dev.c	2006-02-27 15:51:50.000000000 +0000
-+++ linux-2.6-merge.hg/net/core/dev.c	2006-02-18 12:03:41.000000000 +0000
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 2afb0de..30baa34 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
 @@ -116,6 +116,12 @@
  #endif	/* CONFIG_NET_RADIO */
  #include <asm/current.h>
@@ -71099,7 +77672,7 @@
  /*
   *	The list of packet types we will receive (as opposed to discard)
   *	and the routines to invoke.
-@@ -1260,6 +1266,37 @@
+@@ -1260,6 +1266,37 @@ int dev_queue_xmit(struct sk_buff *skb)
  	    __skb_linearize(skb, GFP_ATOMIC))
  		goto out_kfree_skb;
  
@@ -71137,7 +77710,7 @@
  	/* If packet is not checksummed and device does not support
  	 * checksumming for this protocol, complete checksumming here.
  	 */
-@@ -1609,6 +1646,19 @@
+@@ -1609,6 +1646,19 @@ int netif_receive_skb(struct sk_buff *sk
  	}
  #endif
  
@@ -71157,10 +77730,11 @@
  	list_for_each_entry_rcu(ptype, &ptype_all, list) {
  		if (!ptype->dev || ptype->dev == skb->dev) {
  			if (pt_prev) 
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/net/core/skbuff.c linux-2.6-merge.hg/net/core/skbuff.c
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/net/core/skbuff.c	2006-02-27 15:51:50.000000000 +0000
-+++ linux-2.6-merge.hg/net/core/skbuff.c	2006-02-27 15:49:45.000000000 +0000
-@@ -132,6 +132,7 @@
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c
+index 2144952..dadc9cf 100644
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -132,6 +132,7 @@ void skb_under_panic(struct sk_buff *skb
   *	Buffers may only be allocated from interrupts using a @gfp_mask of
   *	%GFP_ATOMIC.
   */
@@ -71168,7 +77742,7 @@
  struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
  			    int fclone)
  {
-@@ -186,6 +187,7 @@
+@@ -186,6 +187,7 @@ nodata:
  	skb = NULL;
  	goto out;
  }
@@ -71176,7 +77750,7 @@
  
  /**
   *	alloc_skb_from_cache	-	allocate a network buffer
-@@ -203,14 +205,18 @@
+@@ -203,14 +205,18 @@ nodata:
   */
  struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
  				     unsigned int size,
@@ -71198,7 +77772,7 @@
  	if (!skb)
  		goto out;
  
-@@ -227,16 +233,29 @@
+@@ -227,16 +233,29 @@ struct sk_buff *alloc_skb_from_cache(kme
  	skb->data = data;
  	skb->tail = data;
  	skb->end  = data + size;
@@ -71234,7 +77808,7 @@
  	skb = NULL;
  	goto out;
  }
-@@ -408,6 +427,10 @@
+@@ -408,6 +427,10 @@ struct sk_buff *skb_clone(struct sk_buff
  	C(local_df);
  	n->cloned = 1;
  	n->nohdr = 0;
@@ -71245,9 +77819,11 @@
  	C(pkt_type);
  	C(ip_summed);
  	C(priority);
-diff -x .hg -urN /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/scripts/Makefile.xen linux-2.6-merge.hg/scripts/Makefile.xen
---- /home/waldi/debian/kernel/orig/gen/linux-2.6.16-rc5/scripts/Makefile.xen	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6-merge.hg/scripts/Makefile.xen	2006-02-11 17:25:52.000000000 +0000
+diff --git a/scripts/Makefile.xen b/scripts/Makefile.xen
+new file mode 100644
+index 0000000..b3ec53a
+--- /dev/null
++++ b/scripts/Makefile.xen
 @@ -0,0 +1,14 @@
 +
 +# cherrypickxen($1 = allobj)



More information about the Kernel-svn-changes mailing list