ia64/xen-unstable

changeset 8997:6c43118bdba8

merge
author awilliam@xenbuild.aw
date Fri Feb 24 15:41:08 2006 -0700 (2006-02-24)
parents d940ec92958d 0807931dfa54
children 21f633fd90e4
files linux-2.6-xen-sparse/arch/ia64/kernel/setup.c linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/segment.h patches/linux-2.6.16-rc3/i386-mach-io-check-nmi.patch patches/linux-2.6.16-rc3/net-csum.patch patches/linux-2.6.16-rc3/pmd-shared.patch patches/linux-2.6.16-rc3/smp-alts.patch xen/arch/ia64/vmx/mmio.c xen/arch/ia64/vmx/vmx_init.c xen/arch/ia64/xen/process.c xen/arch/ia64/xen/xenmisc.c xen/include/asm-ia64/vmx.h
line diff
     1.1 --- a/buildconfigs/linux-defconfig_xen0_ia64	Fri Feb 24 14:03:07 2006 -0700
     1.2 +++ b/buildconfigs/linux-defconfig_xen0_ia64	Fri Feb 24 15:41:08 2006 -0700
     1.3 @@ -113,10 +113,10 @@ CONFIG_IA64_PAGE_SIZE_16KB=y
     1.4  # CONFIG_IA64_PAGE_SIZE_64KB is not set
     1.5  CONFIG_PGTABLE_3=y
     1.6  # CONFIG_PGTABLE_4 is not set
     1.7 -# CONFIG_HZ_100 is not set
     1.8 -CONFIG_HZ_250=y
     1.9 +CONFIG_HZ_100=y
    1.10 +# CONFIG_HZ_250 is not set
    1.11  # CONFIG_HZ_1000 is not set
    1.12 -CONFIG_HZ=250
    1.13 +CONFIG_HZ=100
    1.14  CONFIG_IA64_L1_CACHE_SHIFT=7
    1.15  CONFIG_IA64_CYCLONE=y
    1.16  CONFIG_IOSAPIC=y
     2.1 --- a/buildconfigs/linux-defconfig_xen0_x86_32	Fri Feb 24 14:03:07 2006 -0700
     2.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_32	Fri Feb 24 15:41:08 2006 -0700
     2.3 @@ -175,10 +175,10 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096
     2.4  CONFIG_MTRR=y
     2.5  # CONFIG_REGPARM is not set
     2.6  CONFIG_SECCOMP=y
     2.7 -# CONFIG_HZ_100 is not set
     2.8 -CONFIG_HZ_250=y
     2.9 +CONFIG_HZ_100=y
    2.10 +# CONFIG_HZ_250 is not set
    2.11  # CONFIG_HZ_1000 is not set
    2.12 -CONFIG_HZ=250
    2.13 +CONFIG_HZ=100
    2.14  # CONFIG_CRASH_DUMP is not set
    2.15  CONFIG_PHYSICAL_START=0x100000
    2.16  
     3.1 --- a/buildconfigs/linux-defconfig_xen0_x86_64	Fri Feb 24 14:03:07 2006 -0700
     3.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_64	Fri Feb 24 15:41:08 2006 -0700
     3.3 @@ -1,7 +1,7 @@
     3.4  #
     3.5  # Automatically generated make config: don't edit
     3.6  # Linux kernel version: 2.6.16-rc3-xen0
     3.7 -# Thu Feb 16 22:55:30 2006
     3.8 +# Mon Feb 20 11:37:43 2006
     3.9  #
    3.10  CONFIG_X86_64=y
    3.11  CONFIG_64BIT=y
    3.12 @@ -126,10 +126,10 @@ CONFIG_SWIOTLB=y
    3.13  # CONFIG_CRASH_DUMP is not set
    3.14  CONFIG_PHYSICAL_START=0x100000
    3.15  CONFIG_SECCOMP=y
    3.16 -# CONFIG_HZ_100 is not set
    3.17 -CONFIG_HZ_250=y
    3.18 +CONFIG_HZ_100=y
    3.19 +# CONFIG_HZ_250 is not set
    3.20  # CONFIG_HZ_1000 is not set
    3.21 -CONFIG_HZ=250
    3.22 +CONFIG_HZ=100
    3.23  CONFIG_GENERIC_HARDIRQS=y
    3.24  CONFIG_GENERIC_IRQ_PROBE=y
    3.25  CONFIG_ISA_DMA_API=y
    3.26 @@ -162,6 +162,11 @@ CONFIG_ACPI_SYSTEM=y
    3.27  # CONFIG_ACPI_CONTAINER is not set
    3.28  
    3.29  #
    3.30 +# CPU Frequency scaling
    3.31 +#
    3.32 +# CONFIG_CPU_FREQ is not set
    3.33 +
    3.34 +#
    3.35  # Bus options (PCI etc.)
    3.36  #
    3.37  CONFIG_PCI=y
     4.1 --- a/buildconfigs/linux-defconfig_xenU_ia64	Fri Feb 24 14:03:07 2006 -0700
     4.2 +++ b/buildconfigs/linux-defconfig_xenU_ia64	Fri Feb 24 15:41:08 2006 -0700
     4.3 @@ -110,10 +110,10 @@ CONFIG_IA64_PAGE_SIZE_16KB=y
     4.4  # CONFIG_IA64_PAGE_SIZE_64KB is not set
     4.5  CONFIG_PGTABLE_3=y
     4.6  # CONFIG_PGTABLE_4 is not set
     4.7 -# CONFIG_HZ_100 is not set
     4.8 -CONFIG_HZ_250=y
     4.9 +CONFIG_HZ_100=y
    4.10 +# CONFIG_HZ_250 is not set
    4.11  # CONFIG_HZ_1000 is not set
    4.12 -CONFIG_HZ=250
    4.13 +CONFIG_HZ=100
    4.14  CONFIG_IA64_L1_CACHE_SHIFT=7
    4.15  # CONFIG_IA64_CYCLONE is not set
    4.16  CONFIG_IOSAPIC=y
     5.1 --- a/buildconfigs/linux-defconfig_xenU_x86_32	Fri Feb 24 14:03:07 2006 -0700
     5.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_32	Fri Feb 24 15:41:08 2006 -0700
     5.3 @@ -174,10 +174,10 @@ CONFIG_FLAT_NODE_MEM_MAP=y
     5.4  CONFIG_SPLIT_PTLOCK_CPUS=4096
     5.5  # CONFIG_REGPARM is not set
     5.6  CONFIG_SECCOMP=y
     5.7 -# CONFIG_HZ_100 is not set
     5.8 -CONFIG_HZ_250=y
     5.9 +CONFIG_HZ_100=y
    5.10 +# CONFIG_HZ_250 is not set
    5.11  # CONFIG_HZ_1000 is not set
    5.12 -CONFIG_HZ=250
    5.13 +CONFIG_HZ=100
    5.14  # CONFIG_CRASH_DUMP is not set
    5.15  CONFIG_PHYSICAL_START=0x100000
    5.16  CONFIG_HOTPLUG_CPU=y
     6.1 --- a/buildconfigs/linux-defconfig_xenU_x86_64	Fri Feb 24 14:03:07 2006 -0700
     6.2 +++ b/buildconfigs/linux-defconfig_xenU_x86_64	Fri Feb 24 15:41:08 2006 -0700
     6.3 @@ -131,10 +131,10 @@ CONFIG_SWIOTLB=y
     6.4  # CONFIG_CRASH_DUMP is not set
     6.5  CONFIG_PHYSICAL_START=0x100000
     6.6  CONFIG_SECCOMP=y
     6.7 -# CONFIG_HZ_100 is not set
     6.8 -CONFIG_HZ_250=y
     6.9 +CONFIG_HZ_100=y
    6.10 +# CONFIG_HZ_250 is not set
    6.11  # CONFIG_HZ_1000 is not set
    6.12 -CONFIG_HZ=250
    6.13 +CONFIG_HZ=100
    6.14  CONFIG_GENERIC_HARDIRQS=y
    6.15  CONFIG_GENERIC_IRQ_PROBE=y
    6.16  CONFIG_ISA_DMA_API=y
     7.1 --- a/buildconfigs/linux-defconfig_xen_x86_32	Fri Feb 24 14:03:07 2006 -0700
     7.2 +++ b/buildconfigs/linux-defconfig_xen_x86_32	Fri Feb 24 15:41:08 2006 -0700
     7.3 @@ -180,10 +180,10 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096
     7.4  CONFIG_MTRR=y
     7.5  # CONFIG_REGPARM is not set
     7.6  CONFIG_SECCOMP=y
     7.7 -# CONFIG_HZ_100 is not set
     7.8 -CONFIG_HZ_250=y
     7.9 +CONFIG_HZ_100=y
    7.10 +# CONFIG_HZ_250 is not set
    7.11  # CONFIG_HZ_1000 is not set
    7.12 -CONFIG_HZ=250
    7.13 +CONFIG_HZ=100
    7.14  # CONFIG_CRASH_DUMP is not set
    7.15  CONFIG_PHYSICAL_START=0x100000
    7.16  CONFIG_HOTPLUG_CPU=y
     8.1 --- a/buildconfigs/linux-defconfig_xen_x86_64	Fri Feb 24 14:03:07 2006 -0700
     8.2 +++ b/buildconfigs/linux-defconfig_xen_x86_64	Fri Feb 24 15:41:08 2006 -0700
     8.3 @@ -1,7 +1,7 @@
     8.4  #
     8.5  # Automatically generated make config: don't edit
     8.6 -# Linux kernel version: 2.6.16-rc3-xen0
     8.7 -# Thu Feb 16 22:56:25 2006
     8.8 +# Linux kernel version: 2.6.16-rc3-xen
     8.9 +# Mon Feb 20 11:37:11 2006
    8.10  #
    8.11  CONFIG_X86_64=y
    8.12  CONFIG_64BIT=y
    8.13 @@ -132,10 +132,10 @@ CONFIG_SWIOTLB=y
    8.14  # CONFIG_CRASH_DUMP is not set
    8.15  CONFIG_PHYSICAL_START=0x100000
    8.16  CONFIG_SECCOMP=y
    8.17 -# CONFIG_HZ_100 is not set
    8.18 -CONFIG_HZ_250=y
    8.19 +CONFIG_HZ_100=y
    8.20 +# CONFIG_HZ_250 is not set
    8.21  # CONFIG_HZ_1000 is not set
    8.22 -CONFIG_HZ=250
    8.23 +CONFIG_HZ=100
    8.24  CONFIG_GENERIC_HARDIRQS=y
    8.25  CONFIG_GENERIC_IRQ_PROBE=y
    8.26  CONFIG_ISA_DMA_API=y
    8.27 @@ -170,6 +170,11 @@ CONFIG_ACPI_SYSTEM=y
    8.28  CONFIG_ACPI_CONTAINER=m
    8.29  
    8.30  #
    8.31 +# CPU Frequency scaling
    8.32 +#
    8.33 +# CONFIG_CPU_FREQ is not set
    8.34 +
    8.35 +#
    8.36  # Bus options (PCI etc.)
    8.37  #
    8.38  CONFIG_PCI=y
     9.1 --- a/buildconfigs/mk.linux-2.6-xen	Fri Feb 24 14:03:07 2006 -0700
     9.2 +++ b/buildconfigs/mk.linux-2.6-xen	Fri Feb 24 15:41:08 2006 -0700
     9.3 @@ -2,8 +2,8 @@
     9.4  OS           = linux
     9.5  
     9.6  LINUX_SERIES = 2.6
     9.7 -LINUX_VER    = 2.6.16-rc3
     9.8 -LINUX_SRCS = linux-2.6.15.tar.bz2 patch-2.6.16-rc3.bz2
     9.9 +LINUX_VER    = 2.6.16-rc4
    9.10 +LINUX_SRCS = linux-2.6.15.tar.bz2 patch-2.6.16-rc4.bz2
    9.11  LINUX_PDIR = linux-$(LINUX_VER)
    9.12  
    9.13  EXTRAVERSION ?= xen
    9.14 @@ -34,7 +34,7 @@ pristine-$(LINUX_PDIR)/.valid-srcs: $(LI
    9.15  	touch $(@D)/.hgskip
    9.16  	touch $@
    9.17  
    9.18 -pristine-linux-%.16-rc3/.valid-pristine: pristine-$(LINUX_PDIR)/.valid-srcs
    9.19 +pristine-linux-%.16-rc4/.valid-pristine: pristine-$(LINUX_PDIR)/.valid-srcs
    9.20  	touch $@ # update timestamp to avoid rebuild
    9.21  
    9.22  $(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)/.valid-ref
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/extras/mini-os/include/hypercall-x86_32.h	Fri Feb 24 15:41:08 2006 -0700
    10.3 @@ -0,0 +1,326 @@
    10.4 +/******************************************************************************
    10.5 + * hypercall-x86_32.h
    10.6 + * 
    10.7 + * Copied from XenLinux.
    10.8 + * 
    10.9 + * Copyright (c) 2002-2004, K A Fraser
   10.10 + * 
   10.11 + * This file may be distributed separately from the Linux kernel, or
   10.12 + * incorporated into other software packages, subject to the following license:
   10.13 + * 
   10.14 + * Permission is hereby granted, free of charge, to any person obtaining a copy
   10.15 + * of this source file (the "Software"), to deal in the Software without
   10.16 + * restriction, including without limitation the rights to use, copy, modify,
   10.17 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
   10.18 + * and to permit persons to whom the Software is furnished to do so, subject to
   10.19 + * the following conditions:
   10.20 + * 
   10.21 + * The above copyright notice and this permission notice shall be included in
   10.22 + * all copies or substantial portions of the Software.
   10.23 + * 
   10.24 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   10.25 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   10.26 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   10.27 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   10.28 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   10.29 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   10.30 + * IN THE SOFTWARE.
   10.31 + */
   10.32 +
   10.33 +#ifndef __HYPERCALL_X86_32_H__
   10.34 +#define __HYPERCALL_X86_32_H__
   10.35 +
   10.36 +#include <xen/xen.h>
   10.37 +#include <xen/sched.h>
   10.38 +#include <xen/nmi.h>
   10.39 +#include <mm.h>
   10.40 +
   10.41 +#define __STR(x) #x
   10.42 +#define STR(x) __STR(x)
   10.43 +
   10.44 +extern char hypercall_page[PAGE_SIZE];
   10.45 +
   10.46 +#define _hypercall0(type, name)			\
   10.47 +({						\
   10.48 +	long __res;				\
   10.49 +	asm volatile (				\
   10.50 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   10.51 +		: "=a" (__res)			\
   10.52 +		:				\
   10.53 +		: "memory" );			\
   10.54 +	(type)__res;				\
   10.55 +})
   10.56 +
   10.57 +#define _hypercall1(type, name, a1)				\
   10.58 +({								\
   10.59 +	long __res, __ign1;					\
   10.60 +	asm volatile (						\
   10.61 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   10.62 +		: "=a" (__res), "=b" (__ign1)			\
   10.63 +		: "1" ((long)(a1))				\
   10.64 +		: "memory" );					\
   10.65 +	(type)__res;						\
   10.66 +})
   10.67 +
   10.68 +#define _hypercall2(type, name, a1, a2)				\
   10.69 +({								\
   10.70 +	long __res, __ign1, __ign2;				\
   10.71 +	asm volatile (						\
   10.72 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   10.73 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)	\
   10.74 +		: "1" ((long)(a1)), "2" ((long)(a2))		\
   10.75 +		: "memory" );					\
   10.76 +	(type)__res;						\
   10.77 +})
   10.78 +
   10.79 +#define _hypercall3(type, name, a1, a2, a3)			\
   10.80 +({								\
   10.81 +	long __res, __ign1, __ign2, __ign3;			\
   10.82 +	asm volatile (						\
   10.83 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   10.84 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
   10.85 +		"=d" (__ign3)					\
   10.86 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
   10.87 +		"3" ((long)(a3))				\
   10.88 +		: "memory" );					\
   10.89 +	(type)__res;						\
   10.90 +})
   10.91 +
   10.92 +#define _hypercall4(type, name, a1, a2, a3, a4)			\
   10.93 +({								\
   10.94 +	long __res, __ign1, __ign2, __ign3, __ign4;		\
   10.95 +	asm volatile (						\
   10.96 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   10.97 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
   10.98 +		"=d" (__ign3), "=S" (__ign4)			\
   10.99 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
  10.100 +		"3" ((long)(a3)), "4" ((long)(a4))		\
  10.101 +		: "memory" );					\
  10.102 +	(type)__res;						\
  10.103 +})
  10.104 +
  10.105 +#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
  10.106 +({								\
  10.107 +	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;	\
  10.108 +	asm volatile (						\
  10.109 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
  10.110 +		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
  10.111 +		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)	\
  10.112 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
  10.113 +		"3" ((long)(a3)), "4" ((long)(a4)),		\
  10.114 +		"5" ((long)(a5))				\
  10.115 +		: "memory" );					\
  10.116 +	(type)__res;						\
  10.117 +})
  10.118 +
  10.119 +static inline int
  10.120 +HYPERVISOR_set_trap_table(
  10.121 +	trap_info_t *table)
  10.122 +{
  10.123 +	return _hypercall1(int, set_trap_table, table);
  10.124 +}
  10.125 +
  10.126 +static inline int
  10.127 +HYPERVISOR_mmu_update(
  10.128 +	mmu_update_t *req, int count, int *success_count, domid_t domid)
  10.129 +{
  10.130 +	return _hypercall4(int, mmu_update, req, count, success_count, domid);
  10.131 +}
  10.132 +
  10.133 +static inline int
  10.134 +HYPERVISOR_mmuext_op(
  10.135 +	struct mmuext_op *op, int count, int *success_count, domid_t domid)
  10.136 +{
  10.137 +	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
  10.138 +}
  10.139 +
  10.140 +static inline int
  10.141 +HYPERVISOR_set_gdt(
  10.142 +	unsigned long *frame_list, int entries)
  10.143 +{
  10.144 +	return _hypercall2(int, set_gdt, frame_list, entries);
  10.145 +}
  10.146 +
  10.147 +static inline int
  10.148 +HYPERVISOR_stack_switch(
  10.149 +	unsigned long ss, unsigned long esp)
  10.150 +{
  10.151 +	return _hypercall2(int, stack_switch, ss, esp);
  10.152 +}
  10.153 +
  10.154 +static inline int
  10.155 +HYPERVISOR_set_callbacks(
  10.156 +	unsigned long event_selector, unsigned long event_address,
  10.157 +	unsigned long failsafe_selector, unsigned long failsafe_address)
  10.158 +{
  10.159 +	return _hypercall4(int, set_callbacks,
  10.160 +			   event_selector, event_address,
  10.161 +			   failsafe_selector, failsafe_address);
  10.162 +}
  10.163 +
  10.164 +static inline int
  10.165 +HYPERVISOR_fpu_taskswitch(
  10.166 +	int set)
  10.167 +{
  10.168 +	return _hypercall1(int, fpu_taskswitch, set);
  10.169 +}
  10.170 +
  10.171 +static inline int
  10.172 +HYPERVISOR_sched_op(
  10.173 +	int cmd, unsigned long arg)
  10.174 +{
  10.175 +	return _hypercall2(int, sched_op, cmd, arg);
  10.176 +}
  10.177 +
  10.178 +static inline long
  10.179 +HYPERVISOR_set_timer_op(
  10.180 +	u64 timeout)
  10.181 +{
  10.182 +	unsigned long timeout_hi = (unsigned long)(timeout>>32);
  10.183 +	unsigned long timeout_lo = (unsigned long)timeout;
  10.184 +	return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
  10.185 +}
  10.186 +
  10.187 +static inline int
  10.188 +HYPERVISOR_dom0_op(
  10.189 +	dom0_op_t *dom0_op)
  10.190 +{
  10.191 +	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
  10.192 +	return _hypercall1(int, dom0_op, dom0_op);
  10.193 +}
  10.194 +
  10.195 +static inline int
  10.196 +HYPERVISOR_set_debugreg(
  10.197 +	int reg, unsigned long value)
  10.198 +{
  10.199 +	return _hypercall2(int, set_debugreg, reg, value);
  10.200 +}
  10.201 +
  10.202 +static inline unsigned long
  10.203 +HYPERVISOR_get_debugreg(
  10.204 +	int reg)
  10.205 +{
  10.206 +	return _hypercall1(unsigned long, get_debugreg, reg);
  10.207 +}
  10.208 +
  10.209 +static inline int
  10.210 +HYPERVISOR_update_descriptor(
  10.211 +	u64 ma, u64 desc)
  10.212 +{
  10.213 +	return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
  10.214 +}
  10.215 +
  10.216 +static inline int
  10.217 +HYPERVISOR_memory_op(
  10.218 +	unsigned int cmd, void *arg)
  10.219 +{
  10.220 +	return _hypercall2(int, memory_op, cmd, arg);
  10.221 +}
  10.222 +
  10.223 +static inline int
  10.224 +HYPERVISOR_multicall(
  10.225 +	void *call_list, int nr_calls)
  10.226 +{
  10.227 +	return _hypercall2(int, multicall, call_list, nr_calls);
  10.228 +}
  10.229 +
  10.230 +static inline int
  10.231 +HYPERVISOR_update_va_mapping(
  10.232 +	unsigned long va, pte_t new_val, unsigned long flags)
  10.233 +{
  10.234 +	unsigned long pte_hi = 0;
  10.235 +#ifdef CONFIG_X86_PAE
  10.236 +	pte_hi = new_val.pte_high;
  10.237 +#endif
  10.238 +	return _hypercall4(int, update_va_mapping, va,
  10.239 +			   new_val.pte_low, pte_hi, flags);
  10.240 +}
  10.241 +
  10.242 +static inline int
  10.243 +HYPERVISOR_event_channel_op(
  10.244 +	void *op)
  10.245 +{
  10.246 +	return _hypercall1(int, event_channel_op, op);
  10.247 +}
  10.248 +
  10.249 +static inline int
  10.250 +HYPERVISOR_xen_version(
  10.251 +	int cmd, void *arg)
  10.252 +{
  10.253 +	return _hypercall2(int, xen_version, cmd, arg);
  10.254 +}
  10.255 +
  10.256 +static inline int
  10.257 +HYPERVISOR_console_io(
  10.258 +	int cmd, int count, char *str)
  10.259 +{
  10.260 +	return _hypercall3(int, console_io, cmd, count, str);
  10.261 +}
  10.262 +
  10.263 +static inline int
  10.264 +HYPERVISOR_physdev_op(
  10.265 +	void *physdev_op)
  10.266 +{
  10.267 +	return _hypercall1(int, physdev_op, physdev_op);
  10.268 +}
  10.269 +
  10.270 +static inline int
  10.271 +HYPERVISOR_grant_table_op(
  10.272 +	unsigned int cmd, void *uop, unsigned int count)
  10.273 +{
  10.274 +	return _hypercall3(int, grant_table_op, cmd, uop, count);
  10.275 +}
  10.276 +
  10.277 +static inline int
  10.278 +HYPERVISOR_update_va_mapping_otherdomain(
  10.279 +	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
  10.280 +{
  10.281 +	unsigned long pte_hi = 0;
  10.282 +#ifdef CONFIG_X86_PAE
  10.283 +	pte_hi = new_val.pte_high;
  10.284 +#endif
  10.285 +	return _hypercall5(int, update_va_mapping_otherdomain, va,
  10.286 +			   new_val.pte_low, pte_hi, flags, domid);
  10.287 +}
  10.288 +
  10.289 +static inline int
  10.290 +HYPERVISOR_vm_assist(
  10.291 +	unsigned int cmd, unsigned int type)
  10.292 +{
  10.293 +	return _hypercall2(int, vm_assist, cmd, type);
  10.294 +}
  10.295 +
  10.296 +static inline int
  10.297 +HYPERVISOR_vcpu_op(
  10.298 +	int cmd, int vcpuid, void *extra_args)
  10.299 +{
  10.300 +	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
  10.301 +}
  10.302 +
  10.303 +static inline int
  10.304 +HYPERVISOR_suspend(
  10.305 +	unsigned long srec)
  10.306 +{
  10.307 +	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
  10.308 +			   SHUTDOWN_suspend, srec);
  10.309 +}
  10.310 +
  10.311 +static inline int
  10.312 +HYPERVISOR_nmi_op(
  10.313 +	unsigned long op,
  10.314 +	unsigned long arg)
  10.315 +{
  10.316 +	return _hypercall2(int, nmi_op, op, arg);
  10.317 +}
  10.318 +
  10.319 +#endif /* __HYPERCALL_X86_32_H__ */
  10.320 +
  10.321 +/*
  10.322 + * Local variables:
  10.323 + *  c-file-style: "linux"
  10.324 + *  indent-tabs-mode: t
  10.325 + *  c-indent-level: 8
  10.326 + *  c-basic-offset: 8
  10.327 + *  tab-width: 8
  10.328 + * End:
  10.329 + */
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/extras/mini-os/include/hypercall-x86_64.h	Fri Feb 24 15:41:08 2006 -0700
    11.3 @@ -0,0 +1,326 @@
    11.4 +/******************************************************************************
    11.5 + * hypercall-x86_64.h
    11.6 + * 
    11.7 + * Copied from XenLinux.
    11.8 + * 
    11.9 + * Copyright (c) 2002-2004, K A Fraser
   11.10 + * 
   11.11 + * 64-bit updates:
   11.12 + *   Benjamin Liu <benjamin.liu@intel.com>
   11.13 + *   Jun Nakajima <jun.nakajima@intel.com>
   11.14 + * 
   11.15 + * This file may be distributed separately from the Linux kernel, or
   11.16 + * incorporated into other software packages, subject to the following license:
   11.17 + * 
   11.18 + * Permission is hereby granted, free of charge, to any person obtaining a copy
   11.19 + * of this source file (the "Software"), to deal in the Software without
   11.20 + * restriction, including without limitation the rights to use, copy, modify,
   11.21 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
   11.22 + * and to permit persons to whom the Software is furnished to do so, subject to
   11.23 + * the following conditions:
   11.24 + * 
   11.25 + * The above copyright notice and this permission notice shall be included in
   11.26 + * all copies or substantial portions of the Software.
   11.27 + * 
   11.28 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   11.29 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   11.30 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   11.31 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   11.32 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   11.33 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   11.34 + * IN THE SOFTWARE.
   11.35 + */
   11.36 +
   11.37 +#ifndef __HYPERCALL_X86_64_H__
   11.38 +#define __HYPERCALL_X86_64_H__
   11.39 +
   11.40 +#include <xen/xen.h>
   11.41 +#include <xen/sched.h>
   11.42 +#include <mm.h>
   11.43 +
   11.44 +#define __STR(x) #x
   11.45 +#define STR(x) __STR(x)
   11.46 +
   11.47 +extern char hypercall_page[PAGE_SIZE];
   11.48 +
   11.49 +#define _hypercall0(type, name)			\
   11.50 +({						\
   11.51 +	long __res;				\
   11.52 +	asm volatile (				\
   11.53 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   11.54 +		: "=a" (__res)			\
   11.55 +		:				\
   11.56 +		: "memory" );			\
   11.57 +	(type)__res;				\
   11.58 +})
   11.59 +
   11.60 +#define _hypercall1(type, name, a1)				\
   11.61 +({								\
   11.62 +	long __res, __ign1;					\
   11.63 +	asm volatile (						\
   11.64 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   11.65 +		: "=a" (__res), "=D" (__ign1)			\
   11.66 +		: "1" ((long)(a1))				\
   11.67 +		: "memory" );					\
   11.68 +	(type)__res;						\
   11.69 +})
   11.70 +
   11.71 +#define _hypercall2(type, name, a1, a2)				\
   11.72 +({								\
   11.73 +	long __res, __ign1, __ign2;				\
   11.74 +	asm volatile (						\
   11.75 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   11.76 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2)	\
   11.77 +		: "1" ((long)(a1)), "2" ((long)(a2))		\
   11.78 +		: "memory" );					\
   11.79 +	(type)__res;						\
   11.80 +})
   11.81 +
   11.82 +#define _hypercall3(type, name, a1, a2, a3)			\
   11.83 +({								\
   11.84 +	long __res, __ign1, __ign2, __ign3;			\
   11.85 +	asm volatile (						\
   11.86 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
   11.87 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2), 	\
   11.88 +		"=d" (__ign3)					\
   11.89 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
   11.90 +		"3" ((long)(a3))				\
   11.91 +		: "memory" );					\
   11.92 +	(type)__res;						\
   11.93 +})
   11.94 +
   11.95 +#define _hypercall4(type, name, a1, a2, a3, a4)			\
   11.96 +({								\
   11.97 +	long __res, __ign1, __ign2, __ign3;			\
   11.98 +	asm volatile (						\
   11.99 +		"movq %7,%%r10; "				\
  11.100 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
  11.101 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
  11.102 +		"=d" (__ign3)					\
  11.103 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
  11.104 +		"3" ((long)(a3)), "g" ((long)(a4))		\
  11.105 +		: "memory", "r10" );				\
  11.106 +	(type)__res;						\
  11.107 +})
  11.108 +
  11.109 +#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
  11.110 +({								\
  11.111 +	long __res, __ign1, __ign2, __ign3;			\
  11.112 +	asm volatile (						\
  11.113 +		"movq %7,%%r10; movq %8,%%r8; "			\
  11.114 +		"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
  11.115 +		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
  11.116 +		"=d" (__ign3)					\
  11.117 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
  11.118 +		"3" ((long)(a3)), "g" ((long)(a4)),		\
  11.119 +		"g" ((long)(a5))				\
  11.120 +		: "memory", "r10", "r8" );			\
  11.121 +	(type)__res;						\
  11.122 +})
  11.123 +
  11.124 +static inline int
  11.125 +HYPERVISOR_set_trap_table(
  11.126 +	trap_info_t *table)
  11.127 +{
  11.128 +	return _hypercall1(int, set_trap_table, table);
  11.129 +}
  11.130 +
  11.131 +static inline int
  11.132 +HYPERVISOR_mmu_update(
  11.133 +	mmu_update_t *req, int count, int *success_count, domid_t domid)
  11.134 +{
  11.135 +	return _hypercall4(int, mmu_update, req, count, success_count, domid);
  11.136 +}
  11.137 +
  11.138 +static inline int
  11.139 +HYPERVISOR_mmuext_op(
  11.140 +	struct mmuext_op *op, int count, int *success_count, domid_t domid)
  11.141 +{
  11.142 +	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
  11.143 +}
  11.144 +
  11.145 +static inline int
  11.146 +HYPERVISOR_set_gdt(
  11.147 +	unsigned long *frame_list, int entries)
  11.148 +{
  11.149 +	return _hypercall2(int, set_gdt, frame_list, entries);
  11.150 +}
  11.151 +
  11.152 +static inline int
  11.153 +HYPERVISOR_stack_switch(
  11.154 +	unsigned long ss, unsigned long esp)
  11.155 +{
  11.156 +	return _hypercall2(int, stack_switch, ss, esp);
  11.157 +}
  11.158 +
  11.159 +static inline int
  11.160 +HYPERVISOR_set_callbacks(
  11.161 +	unsigned long event_address, unsigned long failsafe_address, 
  11.162 +	unsigned long syscall_address)
  11.163 +{
  11.164 +	return _hypercall3(int, set_callbacks,
  11.165 +			   event_address, failsafe_address, syscall_address);
  11.166 +}
  11.167 +
  11.168 +static inline int
  11.169 +HYPERVISOR_fpu_taskswitch(
  11.170 +	int set)
  11.171 +{
  11.172 +	return _hypercall1(int, fpu_taskswitch, set);
  11.173 +}
  11.174 +
  11.175 +static inline int
  11.176 +HYPERVISOR_sched_op(
  11.177 +	int cmd, unsigned long arg)
  11.178 +{
  11.179 +	return _hypercall2(int, sched_op, cmd, arg);
  11.180 +}
  11.181 +
  11.182 +static inline long
  11.183 +HYPERVISOR_set_timer_op(
  11.184 +	u64 timeout)
  11.185 +{
  11.186 +	return _hypercall1(long, set_timer_op, timeout);
  11.187 +}
  11.188 +
  11.189 +static inline int
  11.190 +HYPERVISOR_dom0_op(
  11.191 +	dom0_op_t *dom0_op)
  11.192 +{
  11.193 +	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
  11.194 +	return _hypercall1(int, dom0_op, dom0_op);
  11.195 +}
  11.196 +
  11.197 +static inline int
  11.198 +HYPERVISOR_set_debugreg(
  11.199 +	int reg, unsigned long value)
  11.200 +{
  11.201 +	return _hypercall2(int, set_debugreg, reg, value);
  11.202 +}
  11.203 +
  11.204 +static inline unsigned long
  11.205 +HYPERVISOR_get_debugreg(
  11.206 +	int reg)
  11.207 +{
  11.208 +	return _hypercall1(unsigned long, get_debugreg, reg);
  11.209 +}
  11.210 +
  11.211 +static inline int
  11.212 +HYPERVISOR_update_descriptor(
  11.213 +	unsigned long ma, unsigned long word)
  11.214 +{
  11.215 +	return _hypercall2(int, update_descriptor, ma, word);
  11.216 +}
  11.217 +
  11.218 +static inline int
  11.219 +HYPERVISOR_memory_op(
  11.220 +	unsigned int cmd, void *arg)
  11.221 +{
  11.222 +	return _hypercall2(int, memory_op, cmd, arg);
  11.223 +}
  11.224 +
  11.225 +static inline int
  11.226 +HYPERVISOR_multicall(
  11.227 +	void *call_list, int nr_calls)
  11.228 +{
  11.229 +	return _hypercall2(int, multicall, call_list, nr_calls);
  11.230 +}
  11.231 +
  11.232 +static inline int
  11.233 +HYPERVISOR_update_va_mapping(
  11.234 +	unsigned long va, pte_t new_val, unsigned long flags)
  11.235 +{
  11.236 +	return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
  11.237 +}
  11.238 +
  11.239 +static inline int
  11.240 +HYPERVISOR_event_channel_op(
  11.241 +	void *op)
  11.242 +{
  11.243 +	return _hypercall1(int, event_channel_op, op);
  11.244 +}
  11.245 +
  11.246 +static inline int
  11.247 +HYPERVISOR_xen_version(
  11.248 +	int cmd, void *arg)
  11.249 +{
  11.250 +	return _hypercall2(int, xen_version, cmd, arg);
  11.251 +}
  11.252 +
  11.253 +static inline int
  11.254 +HYPERVISOR_console_io(
  11.255 +	int cmd, int count, char *str)
  11.256 +{
  11.257 +	return _hypercall3(int, console_io, cmd, count, str);
  11.258 +}
  11.259 +
  11.260 +static inline int
  11.261 +HYPERVISOR_physdev_op(
  11.262 +	void *physdev_op)
  11.263 +{
  11.264 +	return _hypercall1(int, physdev_op, physdev_op);
  11.265 +}
  11.266 +
  11.267 +static inline int
  11.268 +HYPERVISOR_grant_table_op(
  11.269 +	unsigned int cmd, void *uop, unsigned int count)
  11.270 +{
  11.271 +	return _hypercall3(int, grant_table_op, cmd, uop, count);
  11.272 +}
  11.273 +
  11.274 +static inline int
  11.275 +HYPERVISOR_update_va_mapping_otherdomain(
  11.276 +	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
  11.277 +{
  11.278 +	return _hypercall4(int, update_va_mapping_otherdomain, va,
  11.279 +			   new_val.pte, flags, domid);
  11.280 +}
  11.281 +
  11.282 +static inline int
  11.283 +HYPERVISOR_vm_assist(
  11.284 +	unsigned int cmd, unsigned int type)
  11.285 +{
  11.286 +	return _hypercall2(int, vm_assist, cmd, type);
  11.287 +}
  11.288 +
  11.289 +static inline int
  11.290 +HYPERVISOR_vcpu_op(
  11.291 +	int cmd, int vcpuid, void *extra_args)
  11.292 +{
  11.293 +	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
  11.294 +}
  11.295 +
  11.296 +static inline int
  11.297 +HYPERVISOR_set_segment_base(
  11.298 +	int reg, unsigned long value)
  11.299 +{
  11.300 +	return _hypercall2(int, set_segment_base, reg, value);
  11.301 +}
  11.302 +
  11.303 +static inline int
  11.304 +HYPERVISOR_suspend(
  11.305 +	unsigned long srec)
  11.306 +{
  11.307 +	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
  11.308 +			   SHUTDOWN_suspend, srec);
  11.309 +}
  11.310 +
  11.311 +static inline int
  11.312 +HYPERVISOR_nmi_op(
  11.313 +	unsigned long op,
  11.314 +	unsigned long arg)
  11.315 +{
  11.316 +	return _hypercall2(int, nmi_op, op, arg);
  11.317 +}
  11.318 +
  11.319 +#endif /* __HYPERCALL_X86_64_H__ */
  11.320 +
  11.321 +/*
  11.322 + * Local variables:
  11.323 + *  c-file-style: "linux"
  11.324 + *  indent-tabs-mode: t
  11.325 + *  c-indent-level: 8
  11.326 + *  c-basic-offset: 8
  11.327 + *  tab-width: 8
  11.328 + * End:
  11.329 + */
    12.1 --- a/extras/mini-os/include/hypervisor.h	Fri Feb 24 14:03:07 2006 -0700
    12.2 +++ b/extras/mini-os/include/hypervisor.h	Fri Feb 24 15:41:08 2006 -0700
    12.3 @@ -3,10 +3,10 @@
    12.4   * 
    12.5   * Hypervisor handling.
    12.6   * 
    12.7 - * TODO - x86_64 broken!
    12.8   *
    12.9   * Copyright (c) 2002, K A Fraser
   12.10   * Copyright (c) 2005, Grzegorz Milos
   12.11 + * Updates: Aravindh Puthiyaparambil <aravindh.puthiyaparambil@unisys.com>
   12.12   */
   12.13  
   12.14  #ifndef _HYPERVISOR_H_
   12.15 @@ -15,6 +15,13 @@
   12.16  #include <types.h>
   12.17  #include <xen/xen.h>
   12.18  #include <xen/dom0_ops.h>
   12.19 +#if defined(__i386__)
   12.20 +#include <hypercall-x86_32.h>
   12.21 +#elif defined(__x86_64__)
   12.22 +#include <hypercall-x86_64.h>
   12.23 +#else
   12.24 +#error "Unsupported architecture"
   12.25 +#endif
   12.26  
   12.27  /*
   12.28   * a placeholder for the start of day information passed up from the hypervisor
   12.29 @@ -27,503 +34,10 @@ union start_info_union
   12.30  extern union start_info_union start_info_union;
   12.31  #define start_info (start_info_union.start_info)
   12.32  
   12.33 -
   12.34  /* hypervisor.c */
   12.35  //void do_hypervisor_callback(struct pt_regs *regs);
   12.36  void mask_evtchn(u32 port);
   12.37  void unmask_evtchn(u32 port);
   12.38  void clear_evtchn(u32 port);
   12.39  
   12.40 -/*
   12.41 - * Assembler stubs for hyper-calls.
   12.42 - */
   12.43 -#if defined(__i386__)
   12.44 -/* Taken from Linux */
   12.45 -
   12.46 -#ifndef __HYPERCALL_H__
   12.47 -#define __HYPERCALL_H__
   12.48 -
   12.49 -#include <xen/sched.h>
   12.50 -
   12.51 -#define _hypercall0(type, name)			\
   12.52 -({						\
   12.53 -	long __res;				\
   12.54 -	asm volatile (				\
   12.55 -		TRAP_INSTR			\
   12.56 -		: "=a" (__res)			\
   12.57 -		: "0" (__HYPERVISOR_##name)	\
   12.58 -		: "memory" );			\
   12.59 -	(type)__res;				\
   12.60 -})
   12.61 -
   12.62 -#define _hypercall1(type, name, a1)				\
   12.63 -({								\
   12.64 -	long __res, __ign1;					\
   12.65 -	asm volatile (						\
   12.66 -		TRAP_INSTR					\
   12.67 -		: "=a" (__res), "=b" (__ign1)			\
   12.68 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1))	\
   12.69 -		: "memory" );					\
   12.70 -	(type)__res;						\
   12.71 -})
   12.72 -
   12.73 -#define _hypercall2(type, name, a1, a2)				\
   12.74 -({								\
   12.75 -	long __res, __ign1, __ign2;				\
   12.76 -	asm volatile (						\
   12.77 -		TRAP_INSTR					\
   12.78 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)	\
   12.79 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
   12.80 -		"2" ((long)(a2))				\
   12.81 -		: "memory" );					\
   12.82 -	(type)__res;						\
   12.83 -})
   12.84 -
   12.85 -#define _hypercall3(type, name, a1, a2, a3)			\
   12.86 -({								\
   12.87 -	long __res, __ign1, __ign2, __ign3;			\
   12.88 -	asm volatile (						\
   12.89 -		TRAP_INSTR					\
   12.90 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
   12.91 -		"=d" (__ign3)					\
   12.92 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
   12.93 -		"2" ((long)(a2)), "3" ((long)(a3))		\
   12.94 -		: "memory" );					\
   12.95 -	(type)__res;						\
   12.96 -})
   12.97 -
   12.98 -#define _hypercall4(type, name, a1, a2, a3, a4)			\
   12.99 -({								\
  12.100 -	long __res, __ign1, __ign2, __ign3, __ign4;		\
  12.101 -	asm volatile (						\
  12.102 -		TRAP_INSTR					\
  12.103 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
  12.104 -		"=d" (__ign3), "=S" (__ign4)			\
  12.105 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
  12.106 -		"2" ((long)(a2)), "3" ((long)(a3)),		\
  12.107 -		"4" ((long)(a4))				\
  12.108 -		: "memory" );					\
  12.109 -	(type)__res;						\
  12.110 -})
  12.111 -
  12.112 -#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
  12.113 -({								\
  12.114 -	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;	\
  12.115 -	asm volatile (						\
  12.116 -		TRAP_INSTR					\
  12.117 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
  12.118 -		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)	\
  12.119 -		: "0" (__HYPERVISOR_##name), "1" ((long)(a1)),	\
  12.120 -		"2" ((long)(a2)), "3" ((long)(a3)),		\
  12.121 -		"4" ((long)(a4)), "5" ((long)(a5))		\
  12.122 -		: "memory" );					\
  12.123 -	(type)__res;						\
  12.124 -})
  12.125 -
  12.126 -static inline int
  12.127 -HYPERVISOR_set_trap_table(
  12.128 -	trap_info_t *table)
  12.129 -{
  12.130 -	return _hypercall1(int, set_trap_table, table);
  12.131 -}
  12.132 -
  12.133 -static inline int
  12.134 -HYPERVISOR_mmu_update(
  12.135 -	mmu_update_t *req, int count, int *success_count, domid_t domid)
  12.136 -{
  12.137 -	return _hypercall4(int, mmu_update, req, count, success_count, domid);
  12.138 -}
  12.139 -
  12.140 -static inline int
  12.141 -HYPERVISOR_mmuext_op(
  12.142 -	struct mmuext_op *op, int count, int *success_count, domid_t domid)
  12.143 -{
  12.144 -	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
  12.145 -}
  12.146 -
  12.147 -static inline int
  12.148 -HYPERVISOR_set_gdt(
  12.149 -	unsigned long *frame_list, int entries)
  12.150 -{
  12.151 -	return _hypercall2(int, set_gdt, frame_list, entries);
  12.152 -}
  12.153 -
  12.154 -static inline int
  12.155 -HYPERVISOR_stack_switch(
  12.156 -	unsigned long ss, unsigned long esp)
  12.157 -{
  12.158 -	return _hypercall2(int, stack_switch, ss, esp);
  12.159 -}
  12.160 -
  12.161 -static inline int
  12.162 -HYPERVISOR_set_callbacks(
  12.163 -	unsigned long event_selector, unsigned long event_address,
  12.164 -	unsigned long failsafe_selector, unsigned long failsafe_address)
  12.165 -{
  12.166 -	return _hypercall4(int, set_callbacks,
  12.167 -			   event_selector, event_address,
  12.168 -			   failsafe_selector, failsafe_address);
  12.169 -}
  12.170 -
  12.171 -static inline int
  12.172 -HYPERVISOR_fpu_taskswitch(
  12.173 -	int set)
  12.174 -{
  12.175 -	return _hypercall1(int, fpu_taskswitch, set);
  12.176 -}
  12.177 -
  12.178 -static inline int
  12.179 -HYPERVISOR_sched_op(
  12.180 -	int cmd, unsigned long arg)
  12.181 -{
  12.182 -	return _hypercall2(int, sched_op, cmd, arg);
  12.183 -}
  12.184 -
  12.185 -static inline long
  12.186 -HYPERVISOR_set_timer_op(
  12.187 -	u64 timeout)
  12.188 -{
  12.189 -	unsigned long timeout_hi = (unsigned long)(timeout>>32);
  12.190 -	unsigned long timeout_lo = (unsigned long)timeout;
  12.191 -	return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
  12.192 -}
  12.193 -
  12.194 -static inline int
  12.195 -HYPERVISOR_dom0_op(
  12.196 -	dom0_op_t *dom0_op)
  12.197 -{
  12.198 -	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
  12.199 -	return _hypercall1(int, dom0_op, dom0_op);
  12.200 -}
  12.201 -
  12.202 -static inline int
  12.203 -HYPERVISOR_set_debugreg(
  12.204 -	int reg, unsigned long value)
  12.205 -{
  12.206 -	return _hypercall2(int, set_debugreg, reg, value);
  12.207 -}
  12.208 -
  12.209 -static inline unsigned long
  12.210 -HYPERVISOR_get_debugreg(
  12.211 -	int reg)
  12.212 -{
  12.213 -	return _hypercall1(unsigned long, get_debugreg, reg);
  12.214 -}
  12.215 -
  12.216 -static inline int
  12.217 -HYPERVISOR_update_descriptor(
  12.218 -	u64 ma, u64 desc)
  12.219 -{
  12.220 -	return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
  12.221 -}
  12.222 -
  12.223 -static inline int
  12.224 -HYPERVISOR_memory_op(
  12.225 -	unsigned int cmd, void *arg)
  12.226 -{
  12.227 -	return _hypercall2(int, memory_op, cmd, arg);
  12.228 -}
  12.229 -
  12.230 -static inline int
  12.231 -HYPERVISOR_multicall(
  12.232 -	void *call_list, int nr_calls)
  12.233 -{
  12.234 -	return _hypercall2(int, multicall, call_list, nr_calls);
  12.235 -}
  12.236 -
  12.237 -static inline int
  12.238 -HYPERVISOR_update_va_mapping(
  12.239 -	unsigned long va, pte_t new_val, unsigned long flags)
  12.240 -{
  12.241 -	unsigned long pte_hi = 0;
  12.242 -#ifdef CONFIG_X86_PAE
  12.243 -	pte_hi = new_val.pte_high;
  12.244 -#endif
  12.245 -	return _hypercall4(int, update_va_mapping, va,
  12.246 -			   new_val.pte_low, pte_hi, flags);
  12.247 -}
  12.248 -
  12.249 -static inline int
  12.250 -HYPERVISOR_event_channel_op(
  12.251 -	void *op)
  12.252 -{
  12.253 -	return _hypercall1(int, event_channel_op, op);
  12.254 -}
  12.255 -
  12.256 -static inline int
  12.257 -HYPERVISOR_xen_version(
  12.258 -	int cmd, void *arg)
  12.259 -{
  12.260 -	return _hypercall2(int, xen_version, cmd, arg);
  12.261 -}
  12.262 -
  12.263 -static inline int
  12.264 -HYPERVISOR_console_io(
  12.265 -	int cmd, int count, char *str)
  12.266 -{
  12.267 -	return _hypercall3(int, console_io, cmd, count, str);
  12.268 -}
  12.269 -
  12.270 -static inline int
  12.271 -HYPERVISOR_physdev_op(
  12.272 -	void *physdev_op)
  12.273 -{
  12.274 -	return _hypercall1(int, physdev_op, physdev_op);
  12.275 -}
  12.276 -
  12.277 -static inline int
  12.278 -HYPERVISOR_grant_table_op(
  12.279 -	unsigned int cmd, void *uop, unsigned int count)
  12.280 -{
  12.281 -	return _hypercall3(int, grant_table_op, cmd, uop, count);
  12.282 -}
  12.283 -
  12.284 -static inline int
  12.285 -HYPERVISOR_update_va_mapping_otherdomain(
  12.286 -	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
  12.287 -{
  12.288 -	unsigned long pte_hi = 0;
  12.289 -#ifdef CONFIG_X86_PAE
  12.290 -	pte_hi = new_val.pte_high;
  12.291 -#endif
  12.292 -	return _hypercall5(int, update_va_mapping_otherdomain, va,
  12.293 -			   new_val.pte_low, pte_hi, flags, domid);
  12.294 -}
  12.295 -
  12.296 -static inline int
  12.297 -HYPERVISOR_vm_assist(
  12.298 -	unsigned int cmd, unsigned int type)
  12.299 -{
  12.300 -	return _hypercall2(int, vm_assist, cmd, type);
  12.301 -}
  12.302 -
  12.303 -static inline int
  12.304 -HYPERVISOR_vcpu_op(
  12.305 -	int cmd, int vcpuid, void *extra_args)
  12.306 -{
  12.307 -	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
  12.308 -}
  12.309 -
  12.310 -static inline int
  12.311 -HYPERVISOR_suspend(
  12.312 -	unsigned long srec)
  12.313 -{
  12.314 -	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
  12.315 -			   SHUTDOWN_suspend, srec);
  12.316 -}
  12.317 -
  12.318 -#endif /* __HYPERCALL_H__ */
  12.319 -#elif defined(__x86_64__)
  12.320 -
  12.321 -#define __syscall_clobber "r11","rcx","memory"
  12.322 -
  12.323 -/*
  12.324 - * Assembler stubs for hyper-calls.
  12.325 - */
  12.326 -static inline int
  12.327 -HYPERVISOR_set_trap_table(
  12.328 -    trap_info_t *table)
  12.329 -{
  12.330 -    int ret;
  12.331 -
  12.332 -    __asm__ __volatile__ (
  12.333 -        TRAP_INSTR
  12.334 -        : "=a" (ret)
  12.335 -	: "0" ((unsigned long)__HYPERVISOR_set_trap_table), "D" (table)
  12.336 -	: __syscall_clobber );
  12.337 -
  12.338 -    return ret;
  12.339 -}
  12.340 -
  12.341 -static inline int
  12.342 -HYPERVISOR_mmu_update(
  12.343 -    mmu_update_t *req, int count, int *success_count, domid_t domid)
  12.344 -{
  12.345 -    int ret;
  12.346 -
  12.347 -    __asm__ __volatile__ (
  12.348 -        "movq %5, %%r10;" TRAP_INSTR
  12.349 -        : "=a" (ret)
  12.350 -	: "0" ((unsigned long)__HYPERVISOR_mmu_update), "D" (req), "S" ((long)count),
  12.351 -	  "d" (success_count), "g" ((unsigned long)domid)
  12.352 -	: __syscall_clobber, "r10" );
  12.353 -
  12.354 -    return ret;
  12.355 -}
  12.356 -
  12.357 -static inline int
  12.358 -HYPERVISOR_mmuext_op(
  12.359 -    struct mmuext_op *op, int count, int *success_count, domid_t domid)
  12.360 -{
  12.361 -    int ret;
  12.362 -
  12.363 -    __asm__ __volatile__ (
  12.364 -        "movq %5, %%r10;" TRAP_INSTR
  12.365 -        : "=a" (ret)
  12.366 -        : "0" (__HYPERVISOR_mmuext_op), "D" (op), "S" ((long)count), 
  12.367 -          "d" (success_count), "g" ((unsigned long)domid)
  12.368 -        : __syscall_clobber, "r10" );
  12.369 -
  12.370 -    return ret;
  12.371 -}
  12.372 -
  12.373 -static inline int
  12.374 -HYPERVISOR_set_gdt(
  12.375 -    unsigned long *frame_list, int entries)
  12.376 -{
  12.377 -    int ret;
  12.378 -
  12.379 -    __asm__ __volatile__ (
  12.380 -        TRAP_INSTR
  12.381 -        : "=a" (ret)
  12.382 -	: "0" ((unsigned long)__HYPERVISOR_set_gdt), "D" (frame_list), "S" ((long)entries)
  12.383 -	: __syscall_clobber );
  12.384 -
  12.385 -
  12.386 -    return ret;
  12.387 -}
  12.388 -static inline int
  12.389 -HYPERVISOR_stack_switch(
  12.390 -    unsigned long ss, unsigned long esp)
  12.391 -{
  12.392 -    int ret;
  12.393 -
  12.394 -    __asm__ __volatile__ (
  12.395 -        TRAP_INSTR
  12.396 -        : "=a" (ret)
  12.397 -	: "0" ((unsigned long)__HYPERVISOR_stack_switch), "D" (ss), "S" (esp)
  12.398 -	: __syscall_clobber );
  12.399 -
  12.400 -    return ret;
  12.401 -}
  12.402 -
  12.403 -static inline int
  12.404 -HYPERVISOR_set_callbacks(
  12.405 -    unsigned long event_address, unsigned long failsafe_address, 
  12.406 -    unsigned long syscall_address)
  12.407 -{
  12.408 -    int ret;
  12.409 -
  12.410 -    __asm__ __volatile__ (
  12.411 -        TRAP_INSTR
  12.412 -        : "=a" (ret)
  12.413 -	: "0" ((unsigned long)__HYPERVISOR_set_callbacks), "D" (event_address),
  12.414 -	  "S" (failsafe_address), "d" (syscall_address)
  12.415 -	: __syscall_clobber );
  12.416 -
  12.417 -    return ret;
  12.418 -}
  12.419 -
  12.420 -static inline int
  12.421 -HYPERVISOR_fpu_taskswitch(
  12.422 -    int set)
  12.423 -{
  12.424 -    int ret;
  12.425 -    __asm__ __volatile__ (
  12.426 -        TRAP_INSTR
  12.427 -        : "=a" (ret) : "0" ((unsigned long)__HYPERVISOR_fpu_taskswitch),
  12.428 -          "D" ((unsigned long) set) : __syscall_clobber );
  12.429 -
  12.430 -    return ret;
  12.431 -}
  12.432 -
  12.433 -static inline int
  12.434 -HYPERVISOR_yield(
  12.435 -    void)
  12.436 -{
  12.437 -    int ret;
  12.438 -
  12.439 -    __asm__ __volatile__ (
  12.440 -        TRAP_INSTR
  12.441 -        : "=a" (ret)
  12.442 -	: "0" ((unsigned long)__HYPERVISOR_sched_op), "D" ((unsigned long)SCHEDOP_yield)
  12.443 -	: __syscall_clobber );
  12.444 -
  12.445 -    return ret;
  12.446 -}
  12.447 -
  12.448 -static inline int
  12.449 -HYPERVISOR_block(
  12.450 -    void)
  12.451 -{
  12.452 -    int ret;
  12.453 -    __asm__ __volatile__ (
  12.454 -        TRAP_INSTR
  12.455 -        : "=a" (ret)
  12.456 -	: "0" ((unsigned long)__HYPERVISOR_sched_op), "D" ((unsigned long)SCHEDOP_block)
  12.457 -	: __syscall_clobber );
  12.458 -
  12.459 -    return ret;
  12.460 -}
  12.461 -
  12.462 -static inline int
  12.463 -HYPERVISOR_shutdown(
  12.464 -    void)
  12.465 -{
  12.466 -    int ret;
  12.467 -    __asm__ __volatile__ (
  12.468 -        TRAP_INSTR
  12.469 -        : "=a" (ret)
  12.470 -	: "0" ((unsigned long)__HYPERVISOR_sched_op),
  12.471 -	  "D" ((unsigned long)(SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift)))
  12.472 -	: __syscall_clobber );
  12.473 -
  12.474 -    return ret;
  12.475 -}
  12.476 -
  12.477 -static inline int
  12.478 -HYPERVISOR_reboot(
  12.479 -    void)
  12.480 -{
  12.481 -    int ret;
  12.482 -
  12.483 -    __asm__ __volatile__ (
  12.484 -        TRAP_INSTR
  12.485 -        : "=a" (ret)
  12.486 -	: "0" ((unsigned long)__HYPERVISOR_sched_op),
  12.487 -	  "D" ((unsigned long)(SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift)))
  12.488 -	: __syscall_clobber );
  12.489 -
  12.490 -    return ret;
  12.491 -}
  12.492 -
  12.493 -static inline int
  12.494 -HYPERVISOR_suspend(
  12.495 -    unsigned long srec)
  12.496 -{
  12.497 -    int ret;
  12.498 -
  12.499 -    /* NB. On suspend, control software expects a suspend record in %esi. */
  12.500 -    __asm__ __volatile__ (
  12.501 -        TRAP_INSTR
  12.502 -        : "=a" (ret)
  12.503 -	: "0" ((unsigned long)__HYPERVISOR_sched_op),
  12.504 -        "D" ((unsigned long)(SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift))), 
  12.505 -        "S" (srec)
  12.506 -	: __syscall_clobber );
  12.507 -
  12.508 -    return ret;
  12.509 -}
  12.510 -
  12.511 -/*
  12.512 - * We can have the timeout value in a single argument for the hypercall, but
  12.513 - * that will break the common code. 
  12.514 - */
  12.515 -static inline long
  12.516 -HYPERVISOR_set_timer_op(
  12.517 -    u64 timeout)
  12.518 -{
  12.519 -    int ret;
  12.520 -
  12.521 -    __asm__ __volatile__ (
  12.522 -        TRAP_INSTR
  12.523 -        : "=a" (ret)
  12.524 -	: "0" ((unsigned long)__HYPERVISOR_set_timer_op),
  12.525 -	  "D" (timeout)
  12.526 -	: __syscall_clobber );
  12.527 -
  12.528 -    return ret;
  12.529 -}
  12.530 -#endif
  12.531 -
  12.532  #endif /* __HYPERVISOR_H__ */
    13.1 --- a/extras/mini-os/x86_32.S	Fri Feb 24 14:03:07 2006 -0700
    13.2 +++ b/extras/mini-os/x86_32.S	Fri Feb 24 15:41:08 2006 -0700
    13.3 @@ -1,16 +1,16 @@
    13.4  #include <os.h>
    13.5  #include <xen/arch-x86_32.h>
    13.6  
    13.7 -
    13.8  .section __xen_guest
    13.9  	.ascii	"GUEST_OS=Mini-OS"
   13.10  	.ascii	",XEN_VER=xen-3.0"
   13.11 +	.ascii	",HYPERCALL_PAGE=0x2"
   13.12  	.ascii	",LOADER=generic"
   13.13  	.ascii	",PT_MODE_WRITABLE"
   13.14  	.byte	0
   13.15  .text
   13.16  
   13.17 -.globl _start, shared_info
   13.18 +.globl _start, shared_info, hypercall_page
   13.19                          
   13.20  _start:
   13.21          cld
   13.22 @@ -26,7 +26,9 @@ stack_start:
   13.23          .org 0x1000
   13.24  shared_info:
   13.25          .org 0x2000
   13.26 -        
   13.27 +
   13.28 +hypercall_page:
   13.29 +        .org 0x3000
   13.30  
   13.31  ES		= 0x20
   13.32  ORIG_EAX	= 0x24
    14.1 --- a/extras/mini-os/x86_64.S	Fri Feb 24 14:03:07 2006 -0700
    14.2 +++ b/extras/mini-os/x86_64.S	Fri Feb 24 15:41:08 2006 -0700
    14.3 @@ -1,11 +1,16 @@
    14.4  #include <os.h>
    14.5  
    14.6  .section __xen_guest
    14.7 -        .asciz  "XEN_VER=3.0,LOADER=generic,PT_MODE_WRITABLE"
    14.8 +	.ascii	"GUEST_OS=Mini-OS"
    14.9 +	.ascii	",XEN_VER=xen-3.0"
   14.10 +	.ascii	",HYPERCALL_PAGE=0x2"
   14.11 +	.ascii	",LOADER=generic"
   14.12 +	.ascii	",PT_MODE_WRITABLE"
   14.13 +	.byte	0
   14.14  .text
   14.15  
   14.16  #define ENTRY(X) .globl X ; X :
   14.17 -.globl _start, shared_info
   14.18 +.globl _start, shared_info, hypercall_page
   14.19  
   14.20  #define SAVE_ALL \
   14.21          cld; \
   14.22 @@ -57,6 +62,9 @@ stack_start:
   14.23  shared_info:
   14.24          .org 0x2000
   14.25  
   14.26 +hypercall_page:
   14.27 +        .org 0x3000
   14.28 +
   14.29  ENTRY(hypervisor_callback)
   14.30          popq  %rcx
   14.31          popq  %r11
    15.1 --- a/linux-2.6-xen-sparse/arch/i386/Kconfig	Fri Feb 24 14:03:07 2006 -0700
    15.2 +++ b/linux-2.6-xen-sparse/arch/i386/Kconfig	Fri Feb 24 15:41:08 2006 -0700
    15.3 @@ -780,7 +780,7 @@ config HOTPLUG_CPU
    15.4  config DOUBLEFAULT
    15.5  	default y
    15.6  	bool "Enable doublefault exception handler" if EMBEDDED
    15.7 -	depends on !XEN
    15.8 +	depends on !X86_NO_TSS
    15.9  	help
   15.10            This option allows trapping of rare doublefault exceptions that
   15.11            would otherwise cause a system to silently reboot. Disabling this
   15.12 @@ -1176,6 +1176,21 @@ config X86_TRAMPOLINE
   15.13  	depends on X86_SMP || (X86_VOYAGER && SMP)
   15.14  	default y
   15.15  
   15.16 +config X86_NO_TSS
   15.17 +	bool
   15.18 +	depends on X86_XEN
   15.19 +	default y
   15.20 +
   15.21 +config X86_SYSENTER
   15.22 +	bool
   15.23 +	depends on !X86_NO_TSS
   15.24 +	default y
   15.25 +
   15.26 +config X86_NO_IDT
   15.27 +	bool
   15.28 +	depends on X86_XEN
   15.29 +	default y
   15.30 +
   15.31  config KTIME_SCALAR
   15.32  	bool
   15.33  	default y
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/linux-2.6-xen-sparse/arch/i386/Kconfig.cpu	Fri Feb 24 15:41:08 2006 -0700
    16.3 @@ -0,0 +1,315 @@
    16.4 +# Put here option for CPU selection and depending optimization
    16.5 +if !X86_ELAN
    16.6 +
    16.7 +choice
    16.8 +	prompt "Processor family"
    16.9 +	default M686
   16.10 +
   16.11 +config M386
   16.12 +	bool "386"
   16.13 +	---help---
   16.14 +	  This is the processor type of your CPU. This information is used for
   16.15 +	  optimizing purposes. In order to compile a kernel that can run on
   16.16 +	  all x86 CPU types (albeit not optimally fast), you can specify
   16.17 +	  "386" here.
   16.18 +
   16.19 +	  The kernel will not necessarily run on earlier architectures than
   16.20 +	  the one you have chosen, e.g. a Pentium optimized kernel will run on
   16.21 +	  a PPro, but not necessarily on a i486.
   16.22 +
   16.23 +	  Here are the settings recommended for greatest speed:
   16.24 +	  - "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI
   16.25 +	  486DLC/DLC2, UMC 486SX-S and NexGen Nx586.  Only "386" kernels
   16.26 +	  will run on a 386 class machine.
   16.27 +	  - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or
   16.28 +	  SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
   16.29 +	  - "586" for generic Pentium CPUs lacking the TSC
   16.30 +	  (time stamp counter) register.
   16.31 +	  - "Pentium-Classic" for the Intel Pentium.
   16.32 +	  - "Pentium-MMX" for the Intel Pentium MMX.
   16.33 +	  - "Pentium-Pro" for the Intel Pentium Pro.
   16.34 +	  - "Pentium-II" for the Intel Pentium II or pre-Coppermine Celeron.
   16.35 +	  - "Pentium-III" for the Intel Pentium III or Coppermine Celeron.
   16.36 +	  - "Pentium-4" for the Intel Pentium 4 or P4-based Celeron.
   16.37 +	  - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
   16.38 +	  - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
   16.39 +	  - "Crusoe" for the Transmeta Crusoe series.
   16.40 +	  - "Efficeon" for the Transmeta Efficeon series.
   16.41 +	  - "Winchip-C6" for original IDT Winchip.
   16.42 +	  - "Winchip-2" for IDT Winchip 2.
   16.43 +	  - "Winchip-2A" for IDT Winchips with 3dNow! capabilities.
   16.44 +	  - "GeodeGX1" for Geode GX1 (Cyrix MediaGX).
   16.45 +	  - "Geode GX/LX" For AMD Geode GX and LX processors.
   16.46 +	  - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
   16.47 +	  - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above).
   16.48 +
   16.49 +	  If you don't know what to do, choose "386".
   16.50 +
   16.51 +config M486
   16.52 +	bool "486"
   16.53 +	help
   16.54 +	  Select this for a 486 series processor, either Intel or one of the
   16.55 +	  compatible processors from AMD, Cyrix, IBM, or Intel.  Includes DX,
   16.56 +	  DX2, and DX4 variants; also SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or
   16.57 +	  U5S.
   16.58 +
   16.59 +config M586
   16.60 +	bool "586/K5/5x86/6x86/6x86MX"
   16.61 +	help
   16.62 +	  Select this for an 586 or 686 series processor such as the AMD K5,
   16.63 +	  the Cyrix 5x86, 6x86 and 6x86MX.  This choice does not
   16.64 +	  assume the RDTSC (Read Time Stamp Counter) instruction.
   16.65 +
   16.66 +config M586TSC
   16.67 +	bool "Pentium-Classic"
   16.68 +	help
   16.69 +	  Select this for a Pentium Classic processor with the RDTSC (Read
   16.70 +	  Time Stamp Counter) instruction for benchmarking.
   16.71 +
   16.72 +config M586MMX
   16.73 +	bool "Pentium-MMX"
   16.74 +	help
   16.75 +	  Select this for a Pentium with the MMX graphics/multimedia
   16.76 +	  extended instructions.
   16.77 +
   16.78 +config M686
   16.79 +	bool "Pentium-Pro"
   16.80 +	help
   16.81 +	  Select this for Intel Pentium Pro chips.  This enables the use of
   16.82 +	  Pentium Pro extended instructions, and disables the init-time guard
   16.83 +	  against the f00f bug found in earlier Pentiums.
   16.84 +
   16.85 +config MPENTIUMII
   16.86 +	bool "Pentium-II/Celeron(pre-Coppermine)"
   16.87 +	help
   16.88 +	  Select this for Intel chips based on the Pentium-II and
   16.89 +	  pre-Coppermine Celeron core.  This option enables an unaligned
   16.90 +	  copy optimization, compiles the kernel with optimization flags
   16.91 +	  tailored for the chip, and applies any applicable Pentium Pro
   16.92 +	  optimizations.
   16.93 +
   16.94 +config MPENTIUMIII
   16.95 +	bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon"
   16.96 +	help
   16.97 +	  Select this for Intel chips based on the Pentium-III and
   16.98 +	  Celeron-Coppermine core.  This option enables use of some
   16.99 +	  extended prefetch instructions in addition to the Pentium II
  16.100 +	  extensions.
  16.101 +
  16.102 +config MPENTIUMM
  16.103 +	bool "Pentium M"
  16.104 +	help
  16.105 +	  Select this for Intel Pentium M (not Pentium-4 M)
  16.106 +	  notebook chips.
  16.107 +
  16.108 +config MPENTIUM4
  16.109 +	bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon"
  16.110 +	help
  16.111 +	  Select this for Intel Pentium 4 chips.  This includes the
  16.112 +	  Pentium 4, P4-based Celeron and Xeon, and Pentium-4 M
  16.113 +	  (not Pentium M) chips.  This option enables compile flags
  16.114 +	  optimized for the chip, uses the correct cache shift, and
  16.115 +	  applies any applicable Pentium III optimizations.
  16.116 +
  16.117 +config MK6
  16.118 +	bool "K6/K6-II/K6-III"
  16.119 +	help
  16.120 +	  Select this for an AMD K6-family processor.  Enables use of
  16.121 +	  some extended instructions, and passes appropriate optimization
  16.122 +	  flags to GCC.
  16.123 +
  16.124 +config MK7
  16.125 +	bool "Athlon/Duron/K7"
  16.126 +	help
  16.127 +	  Select this for an AMD Athlon K7-family processor.  Enables use of
  16.128 +	  some extended instructions, and passes appropriate optimization
  16.129 +	  flags to GCC.
  16.130 +
  16.131 +config MK8
  16.132 +	bool "Opteron/Athlon64/Hammer/K8"
  16.133 +	help
  16.134 +	  Select this for an AMD Opteron or Athlon64 Hammer-family processor.  Enables
  16.135 +	  use of some extended instructions, and passes appropriate optimization
  16.136 +	  flags to GCC.
  16.137 +
  16.138 +config MCRUSOE
  16.139 +	bool "Crusoe"
  16.140 +	help
  16.141 +	  Select this for a Transmeta Crusoe processor.  Treats the processor
  16.142 +	  like a 586 with TSC, and sets some GCC optimization flags (like a
  16.143 +	  Pentium Pro with no alignment requirements).
  16.144 +
  16.145 +config MEFFICEON
  16.146 +	bool "Efficeon"
  16.147 +	help
  16.148 +	  Select this for a Transmeta Efficeon processor.
  16.149 +
  16.150 +config MWINCHIPC6
  16.151 +	bool "Winchip-C6"
  16.152 +	help
  16.153 +	  Select this for an IDT Winchip C6 chip.  Linux and GCC
  16.154 +	  treat this chip as a 586TSC with some extended instructions
  16.155 +	  and alignment requirements.
  16.156 +
  16.157 +config MWINCHIP2
  16.158 +	bool "Winchip-2"
  16.159 +	help
  16.160 +	  Select this for an IDT Winchip-2.  Linux and GCC
  16.161 +	  treat this chip as a 586TSC with some extended instructions
  16.162 +	  and alignment requirements.
  16.163 +
  16.164 +config MWINCHIP3D
  16.165 +	bool "Winchip-2A/Winchip-3"
  16.166 +	help
  16.167 +	  Select this for an IDT Winchip-2A or 3.  Linux and GCC
  16.168 +	  treat this chip as a 586TSC with some extended instructions
  16.169 +	  and alignment reqirements.  Also enable out of order memory
  16.170 +	  stores for this CPU, which can increase performance of some
  16.171 +	  operations.
  16.172 +
  16.173 +config MGEODEGX1
  16.174 +	bool "GeodeGX1"
  16.175 +	help
  16.176 +	  Select this for a Geode GX1 (Cyrix MediaGX) chip.
  16.177 +
  16.178 +config MGEODE_LX
  16.179 +       bool "Geode GX/LX"
  16.180 +       help
  16.181 +         Select this for AMD Geode GX and LX processors.
  16.182 +
  16.183 +config MCYRIXIII
  16.184 +	bool "CyrixIII/VIA-C3"
  16.185 +	help
  16.186 +	  Select this for a Cyrix III or C3 chip.  Presently Linux and GCC
  16.187 +	  treat this chip as a generic 586. Whilst the CPU is 686 class,
  16.188 +	  it lacks the cmov extension which gcc assumes is present when
  16.189 +	  generating 686 code.
  16.190 +	  Note that Nehemiah (Model 9) and above will not boot with this
  16.191 +	  kernel due to them lacking the 3DNow! instructions used in earlier
  16.192 +	  incarnations of the CPU.
  16.193 +
  16.194 +config MVIAC3_2
  16.195 +	bool "VIA C3-2 (Nehemiah)"
  16.196 +	help
  16.197 +	  Select this for a VIA C3 "Nehemiah". Selecting this enables usage
  16.198 +	  of SSE and tells gcc to treat the CPU as a 686.
  16.199 +	  Note, this kernel will not boot on older (pre model 9) C3s.
  16.200 +
  16.201 +endchoice
  16.202 +
  16.203 +config X86_GENERIC
  16.204 +       bool "Generic x86 support"
  16.205 +       help
  16.206 +	  Instead of just including optimizations for the selected
  16.207 +	  x86 variant (e.g. PII, Crusoe or Athlon), include some more
  16.208 +	  generic optimizations as well. This will make the kernel
  16.209 +	  perform better on x86 CPUs other than that selected.
  16.210 +
  16.211 +	  This is really intended for distributors who need more
  16.212 +	  generic optimizations.
  16.213 +
  16.214 +endif
  16.215 +
  16.216 +#
  16.217 +# Define implied options from the CPU selection here
  16.218 +#
  16.219 +config X86_CMPXCHG
  16.220 +	bool
  16.221 +	depends on !M386
  16.222 +	default y
  16.223 +
  16.224 +config X86_XADD
  16.225 +	bool
  16.226 +	depends on !M386
  16.227 +	default y
  16.228 +
  16.229 +config X86_L1_CACHE_SHIFT
  16.230 +	int
  16.231 +	default "7" if MPENTIUM4 || X86_GENERIC
  16.232 +	default "4" if X86_ELAN || M486 || M386 || MGEODEGX1
  16.233 +	default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
  16.234 +	default "6" if MK7 || MK8 || MPENTIUMM
  16.235 +
  16.236 +config RWSEM_GENERIC_SPINLOCK
  16.237 +	bool
  16.238 +	depends on M386
  16.239 +	default y
  16.240 +
  16.241 +config RWSEM_XCHGADD_ALGORITHM
  16.242 +	bool
  16.243 +	depends on !M386
  16.244 +	default y
  16.245 +
  16.246 +config GENERIC_CALIBRATE_DELAY
  16.247 +	bool
  16.248 +	default y
  16.249 +
  16.250 +config X86_PPRO_FENCE
  16.251 +	bool
  16.252 +	depends on M686 || M586MMX || M586TSC || M586 || M486 || M386 || MGEODEGX1
  16.253 +	default y
  16.254 +
  16.255 +config X86_F00F_BUG
  16.256 +	bool
  16.257 +	depends on (M586MMX || M586TSC || M586 || M486 || M386) && !X86_NO_IDT
  16.258 +	default y
  16.259 +
  16.260 +config X86_WP_WORKS_OK
  16.261 +	bool
  16.262 +	depends on !M386
  16.263 +	default y
  16.264 +
  16.265 +config X86_INVLPG
  16.266 +	bool
  16.267 +	depends on !M386
  16.268 +	default y
  16.269 +
  16.270 +config X86_BSWAP
  16.271 +	bool
  16.272 +	depends on !M386
  16.273 +	default y
  16.274 +
  16.275 +config X86_POPAD_OK
  16.276 +	bool
  16.277 +	depends on !M386
  16.278 +	default y
  16.279 +
  16.280 +config X86_CMPXCHG64
  16.281 +	bool
  16.282 +	depends on !M386 && !M486
  16.283 +	default y
  16.284 +
  16.285 +config X86_ALIGNMENT_16
  16.286 +	bool
  16.287 +	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || X86_ELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 || MGEODEGX1
  16.288 +	default y
  16.289 +
  16.290 +config X86_GOOD_APIC
  16.291 +	bool
  16.292 +	depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON
  16.293 +	default y
  16.294 +
  16.295 +config X86_INTEL_USERCOPY
  16.296 +	bool
  16.297 +	depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON
  16.298 +	default y
  16.299 +
  16.300 +config X86_USE_PPRO_CHECKSUM
  16.301 +	bool
  16.302 +	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MEFFICEON || MGEODE_LX
  16.303 +	default y
  16.304 +
  16.305 +config X86_USE_3DNOW
  16.306 +	bool
  16.307 +	depends on MCYRIXIII || MK7 || MGEODE_LX
  16.308 +	default y
  16.309 +
  16.310 +config X86_OOSTORE
  16.311 +	bool
  16.312 +	depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR
  16.313 +	default y
  16.314 +
  16.315 +config X86_TSC
  16.316 +	bool
  16.317 +	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODEGX1) && !X86_NUMAQ
  16.318 +	default y
    17.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/Makefile	Fri Feb 24 14:03:07 2006 -0700
    17.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/Makefile	Fri Feb 24 15:41:08 2006 -0700
    17.3 @@ -49,11 +49,13 @@ else
    17.4  vsyscall_note := vsyscall-note.o
    17.5  endif
    17.6  
    17.7 +VSYSCALL_TYPES-y			:= int80
    17.8 +VSYSCALL_TYPES-$(CONFIG_X86_SYSENTER)	+= sysenter
    17.9  # vsyscall.o contains the vsyscall DSO images as __initdata.
   17.10  # We must build both images before we can assemble it.
   17.11  # Note: kbuild does not track this dependency due to usage of .incbin
   17.12 -$(obj)/vsyscall.o: $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so
   17.13 -targets += $(foreach F,int80 sysenter,vsyscall-$F.o vsyscall-$F.so)
   17.14 +$(obj)/vsyscall.o: $(foreach F,$(VSYSCALL_TYPES-y),$(obj)/vsyscall-$F.so)
   17.15 +targets += $(foreach F,$(VSYSCALL_TYPES-y),vsyscall-$F.o vsyscall-$F.so)
   17.16  targets += $(vsyscall_note) vsyscall.lds
   17.17  
   17.18  # The DSO images are built using a special linker script.
   17.19 @@ -81,7 +83,8 @@ extra-y += vsyscall-syms.o
   17.20  
   17.21  SYSCFLAGS_vsyscall-syms.o = -r
   17.22  $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
   17.23 -			$(obj)/vsyscall-sysenter.o $(obj)/$(vsyscall_note) FORCE
   17.24 +			$(foreach F,$(VSYSCALL_TYPES-y),$(obj)/vsyscall-$F.o) \
   17.25 +			$(obj)/$(vsyscall_note) FORCE
   17.26  	$(call if_changed,syscall)
   17.27  
   17.28  ifdef CONFIG_XEN
    18.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/apic-xen.c	Fri Feb 24 14:03:07 2006 -0700
    18.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/apic-xen.c	Fri Feb 24 15:41:08 2006 -0700
    18.3 @@ -85,13 +85,6 @@ int get_physical_broadcast(void)
    18.4          return 0xff;
    18.5  }
    18.6  
    18.7 -#ifdef CONFIG_XEN
    18.8 -void switch_APIC_timer_to_ipi(void *cpumask) { }
    18.9 -EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
   18.10 -void switch_ipi_to_APIC_timer(void *cpumask) { }
   18.11 -EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
   18.12 -#endif
   18.13 -
   18.14  #ifndef CONFIG_XEN
   18.15  #ifndef CONFIG_SMP
   18.16  static void up_apic_timer_interrupt_call(struct pt_regs *regs)
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/asm-offsets.c	Fri Feb 24 15:41:08 2006 -0700
    19.3 @@ -0,0 +1,75 @@
    19.4 +/*
    19.5 + * Generate definitions needed by assembly language modules.
    19.6 + * This code generates raw asm output which is post-processed
    19.7 + * to extract and format the required data.
    19.8 + */
    19.9 +
   19.10 +#include <linux/sched.h>
   19.11 +#include <linux/signal.h>
   19.12 +#include <linux/personality.h>
   19.13 +#include <linux/suspend.h>
   19.14 +#include <asm/ucontext.h>
   19.15 +#include "sigframe.h"
   19.16 +#include <asm/fixmap.h>
   19.17 +#include <asm/processor.h>
   19.18 +#include <asm/thread_info.h>
   19.19 +#include <asm/elf.h>
   19.20 +
   19.21 +#define DEFINE(sym, val) \
   19.22 +        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
   19.23 +
   19.24 +#define BLANK() asm volatile("\n->" : : )
   19.25 +
   19.26 +#define OFFSET(sym, str, mem) \
   19.27 +	DEFINE(sym, offsetof(struct str, mem));
   19.28 +
   19.29 +void foo(void)
   19.30 +{
   19.31 +	OFFSET(SIGCONTEXT_eax, sigcontext, eax);
   19.32 +	OFFSET(SIGCONTEXT_ebx, sigcontext, ebx);
   19.33 +	OFFSET(SIGCONTEXT_ecx, sigcontext, ecx);
   19.34 +	OFFSET(SIGCONTEXT_edx, sigcontext, edx);
   19.35 +	OFFSET(SIGCONTEXT_esi, sigcontext, esi);
   19.36 +	OFFSET(SIGCONTEXT_edi, sigcontext, edi);
   19.37 +	OFFSET(SIGCONTEXT_ebp, sigcontext, ebp);
   19.38 +	OFFSET(SIGCONTEXT_esp, sigcontext, esp);
   19.39 +	OFFSET(SIGCONTEXT_eip, sigcontext, eip);
   19.40 +	BLANK();
   19.41 +
   19.42 +	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
   19.43 +	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
   19.44 +	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
   19.45 +	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
   19.46 +	OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
   19.47 +	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
   19.48 +	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
   19.49 +	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
   19.50 +	BLANK();
   19.51 +
   19.52 +	OFFSET(TI_task, thread_info, task);
   19.53 +	OFFSET(TI_exec_domain, thread_info, exec_domain);
   19.54 +	OFFSET(TI_flags, thread_info, flags);
   19.55 +	OFFSET(TI_status, thread_info, status);
   19.56 +	OFFSET(TI_cpu, thread_info, cpu);
   19.57 +	OFFSET(TI_preempt_count, thread_info, preempt_count);
   19.58 +	OFFSET(TI_addr_limit, thread_info, addr_limit);
   19.59 +	OFFSET(TI_restart_block, thread_info, restart_block);
   19.60 +	BLANK();
   19.61 +
   19.62 +	OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
   19.63 +	OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
   19.64 +	BLANK();
   19.65 +
   19.66 +	OFFSET(pbe_address, pbe, address);
   19.67 +	OFFSET(pbe_orig_address, pbe, orig_address);
   19.68 +	OFFSET(pbe_next, pbe, next);
   19.69 +
   19.70 +#ifdef CONFIG_X86_SYSENTER
   19.71 +	/* Offset from the sysenter stack to tss.esp0 */
   19.72 +	DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, esp0) -
   19.73 +		 sizeof(struct tss_struct));
   19.74 +#endif
   19.75 +
   19.76 +	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
   19.77 +	DEFINE(VSYSCALL_BASE, VSYSCALL_BASE);
   19.78 +}
    20.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/cpu/common-xen.c	Fri Feb 24 14:03:07 2006 -0700
    20.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/cpu/common-xen.c	Fri Feb 24 15:41:08 2006 -0700
    20.3 @@ -583,7 +583,6 @@ void __cpuinit cpu_gdt_init(struct Xgt_d
    20.4  	}
    20.5  	if (HYPERVISOR_set_gdt(frames, gdt_descr->size / 8))
    20.6  		BUG();
    20.7 -	lgdt_finish();
    20.8  }
    20.9  
   20.10  /*
   20.11 @@ -595,7 +594,9 @@ void __cpuinit cpu_gdt_init(struct Xgt_d
   20.12  void __cpuinit cpu_init(void)
   20.13  {
   20.14  	int cpu = smp_processor_id();
   20.15 +#ifndef CONFIG_X86_NO_TSS
   20.16  	struct tss_struct * t = &per_cpu(init_tss, cpu);
   20.17 +#endif
   20.18  	struct thread_struct *thread = &current->thread;
   20.19  
   20.20  	if (cpu_test_and_set(cpu, cpu_initialized)) {
    21.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S	Fri Feb 24 14:03:07 2006 -0700
    21.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S	Fri Feb 24 15:41:08 2006 -0700
    21.3 @@ -223,6 +223,7 @@ need_resched:
    21.4  	jmp need_resched
    21.5  #endif
    21.6  
    21.7 +#ifdef CONFIG_X86_SYSENTER
    21.8  /* SYSENTER_RETURN points to after the "sysenter" instruction in
    21.9     the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
   21.10  
   21.11 @@ -270,6 +271,7 @@ 1:	movl (%ebp),%ebp
   21.12  	xorl %ebp,%ebp
   21.13  	sti
   21.14  	sysexit
   21.15 +#endif /* CONFIG_X86_SYSENTER */
   21.16  
   21.17  
   21.18  	# system call handler stub
   21.19 @@ -662,6 +664,7 @@ ENTRY(device_not_available)
   21.20  	call math_state_restore
   21.21  	jmp ret_from_exception
   21.22  
   21.23 +#ifdef CONFIG_X86_SYSENTER
   21.24  /*
   21.25   * Debug traps and NMI can happen at the one SYSENTER instruction
   21.26   * that sets up the real kernel stack. Check here, since we can't
   21.27 @@ -683,12 +686,15 @@ label:						\
   21.28  	pushfl;					\
   21.29  	pushl $__KERNEL_CS;			\
   21.30  	pushl $sysenter_past_esp
   21.31 +#endif /* CONFIG_X86_SYSENTER */
   21.32  
   21.33  KPROBE_ENTRY(debug)
   21.34 +#ifdef CONFIG_X86_SYSENTER
   21.35  	cmpl $sysenter_entry,(%esp)
   21.36  	jne debug_stack_correct
   21.37  	FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
   21.38  debug_stack_correct:
   21.39 +#endif /* !CONFIG_X86_SYSENTER */
   21.40  	pushl $-1			# mark this as an int
   21.41  	SAVE_ALL
   21.42  	xorl %edx,%edx			# error code 0
    22.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S	Fri Feb 24 14:03:07 2006 -0700
    22.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S	Fri Feb 24 15:41:08 2006 -0700
    22.3 @@ -1,23 +1,11 @@
    22.4 -
    22.5 -#include <linux/config.h>
    22.6  
    22.7 -.section __xen_guest
    22.8 -	.ascii	"GUEST_OS=linux,GUEST_VER=2.6"
    22.9 -	.ascii	",XEN_VER=xen-3.0"
   22.10 -	.ascii	",VIRT_BASE=0xC0000000"
   22.11 -	.ascii	",HYPERCALL_PAGE=0x104" /* __pa(hypercall_page) >> 12 */
   22.12 -#ifdef CONFIG_X86_PAE
   22.13 -	.ascii	",PAE=yes"
   22.14 -#else
   22.15 -	.ascii	",PAE=no"
   22.16 -#endif
   22.17 -	.ascii	",LOADER=generic"
   22.18 -	.byte	0
   22.19  
   22.20  .text
   22.21 +#include <linux/config.h>
   22.22  #include <linux/threads.h>
   22.23  #include <linux/linkage.h>
   22.24  #include <asm/segment.h>
   22.25 +#include <asm/page.h>
   22.26  #include <asm/thread_info.h>
   22.27  #include <asm/asm-offsets.h>
   22.28  #include <xen/interface/arch-x86_32.h>
   22.29 @@ -37,15 +25,10 @@
   22.30  
   22.31  ENTRY(startup_32)
   22.32  	movl %esi,xen_start_info
   22.33 -
   22.34 -#if 0
   22.35 -ENTRY(startup_32_smp)
   22.36 -#endif /* CONFIG_SMP */
   22.37 -
   22.38  	cld
   22.39  
   22.40  	/* Set up the stack pointer */
   22.41 -	lss stack_start,%esp
   22.42 +	movl $(init_thread_union+THREAD_SIZE),%esp
   22.43  
   22.44  checkCPUtype:
   22.45  
   22.46 @@ -69,66 +52,54 @@ checkCPUtype:
   22.47  	movb %cl,X86_MASK
   22.48  	movl %edx,X86_CAPABILITY
   22.49  
   22.50 +	movb $1,X86_HARD_MATH
   22.51 +
   22.52  	xorl %eax,%eax			# Clear FS/GS and LDT
   22.53  	movl %eax,%fs
   22.54  	movl %eax,%gs
   22.55  	cld			# gcc2 wants the direction flag cleared at all times
   22.56  
   22.57 -#if 0
   22.58 -	movb ready, %cl
   22.59 -	movb $1, ready
   22.60 -	cmpb $0,%cl
   22.61 -	je 1f			# the first CPU calls start_kernel
   22.62 -				# all other CPUs call initialize_secondary
   22.63 -	call initialize_secondary
   22.64 -	jmp L6
   22.65 -1:
   22.66 -#endif /* CONFIG_SMP */
   22.67  	call start_kernel
   22.68  L6:
   22.69  	jmp L6			# main should never return here, but
   22.70  				# just in case, we know what happens.
   22.71  
   22.72 -ENTRY(lgdt_finish)
   22.73 -	movl $(__KERNEL_DS),%eax	# reload all the segment registers
   22.74 -	movw %ax,%ss			# after changing gdt.
   22.75 -
   22.76 -	movl $(__USER_DS),%eax		# DS/ES contains default USER segment
   22.77 -	movw %ax,%ds
   22.78 -	movw %ax,%es
   22.79 +#define HYPERCALL_PAGE_OFFSET 0x1000
   22.80 +.org HYPERCALL_PAGE_OFFSET
   22.81 +ENTRY(hypercall_page)
   22.82 +.skip 0x1000
   22.83  
   22.84 -	popl %eax			# reload CS by intersegment return
   22.85 -	pushl $(__KERNEL_CS)
   22.86 -	pushl %eax
   22.87 -	lret
   22.88 +/*
   22.89 + * Real beginning of normal "text" segment
   22.90 + */
   22.91 +ENTRY(stext)
   22.92 +ENTRY(_stext)
   22.93  
   22.94 -ENTRY(stack_start)
   22.95 -	.long init_thread_union+THREAD_SIZE
   22.96 -	.long __BOOT_DS
   22.97 +/*
   22.98 + * BSS section
   22.99 + */
  22.100 +.section ".bss.page_aligned","w"
  22.101 +ENTRY(empty_zero_page)
  22.102 +	.fill 4096,1,0
  22.103  
  22.104 -ready:	.byte 0
  22.105 -
  22.106 -.globl idt_descr
  22.107 -.globl cpu_gdt_descr
  22.108 +/*
  22.109 + * This starts the data section.
  22.110 + */
  22.111 +.data
  22.112  
  22.113  	ALIGN
  22.114 -	.word 0				# 32-bit align idt_desc.address
  22.115 -idt_descr:
  22.116 -	.word IDT_ENTRIES*8-1		# idt contains 256 entries
  22.117 -	.long idt_table
  22.118 -
  22.119 -# boot GDT descriptor (later on used by CPU#0):
  22.120  	.word 0				# 32 bit align gdt_desc.address
  22.121 +	.globl cpu_gdt_descr
  22.122  cpu_gdt_descr:
  22.123  	.word GDT_SIZE
  22.124  	.long cpu_gdt_table
  22.125  
  22.126  	.fill NR_CPUS-1,8,0		# space for the other GDT descriptors
  22.127  
  22.128 -.org 0x1000
  22.129 -ENTRY(empty_zero_page)
  22.130 -
  22.131 -.org 0x2000
  22.132 +/*
  22.133 + * The Global Descriptor Table contains 28 quadwords, per-CPU.
  22.134 + */
  22.135 +	.align PAGE_SIZE_asm
  22.136  ENTRY(cpu_gdt_table)
  22.137  	.quad 0x0000000000000000	/* NULL descriptor */
  22.138  	.quad 0x0000000000000000	/* 0x0b reserved */
  22.139 @@ -143,17 +114,10 @@ ENTRY(cpu_gdt_table)
  22.140  	.quad 0x0000000000000000	/* 0x53 reserved */
  22.141  	.quad 0x0000000000000000	/* 0x5b reserved */
  22.142  
  22.143 -#ifdef CONFIG_X86_PAE
  22.144 -	.quad 0x00cfbb00000067ff	/* 0x60 kernel 4GB code at 0x00000000 */
  22.145 -	.quad 0x00cfb300000067ff	/* 0x68 kernel 4GB data at 0x00000000 */
  22.146 -	.quad 0x00cffb00000067ff	/* 0x73 user 4GB code at 0x00000000 */
  22.147 -	.quad 0x00cff300000067ff	/* 0x7b user 4GB data at 0x00000000 */
  22.148 -#else
  22.149 -	.quad 0x00cfbb000000c3ff	/* 0x60 kernel 4GB code at 0x00000000 */
  22.150 -	.quad 0x00cfb3000000c3ff	/* 0x68 kernel 4GB data at 0x00000000 */
  22.151 -	.quad 0x00cffb000000c3ff	/* 0x73 user 4GB code at 0x00000000 */
  22.152 -	.quad 0x00cff3000000c3ff	/* 0x7b user 4GB data at 0x00000000 */
  22.153 -#endif
  22.154 +	.quad 0x00cf9a000000ffff	/* 0x60 kernel 4GB code at 0x00000000 */
  22.155 +	.quad 0x00cf92000000ffff	/* 0x68 kernel 4GB data at 0x00000000 */
  22.156 +	.quad 0x00cffa000000ffff	/* 0x73 user 4GB code at 0x00000000 */
  22.157 +	.quad 0x00cff2000000ffff	/* 0x7b user 4GB data at 0x00000000 */
  22.158  
  22.159  	.quad 0x0000000000000000	/* 0x80 TSS descriptor */
  22.160  	.quad 0x0000000000000000	/* 0x88 LDT descriptor */
  22.161 @@ -187,15 +151,36 @@ ENTRY(cpu_gdt_table)
  22.162  	/* Be sure this is zeroed to avoid false validations in Xen */
  22.163  	.fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
  22.164  
  22.165 -.org 0x3000
  22.166 -ENTRY(default_ldt)
  22.167 -
  22.168 -.org 0x4000
  22.169 -ENTRY(hypercall_page)
  22.170  
  22.171 -.org 0x5000
  22.172  /*
  22.173 - * Real beginning of normal "text" segment
  22.174 + * __xen_guest information
  22.175   */
  22.176 -ENTRY(stext)
  22.177 -ENTRY(_stext)
  22.178 +.macro utoa value
  22.179 + .if (\value) < 0 || (\value) >= 0x10
  22.180 +	utoa (((\value)>>4)&0x0fffffff)
  22.181 + .endif
  22.182 + .if ((\value) & 0xf) < 10
  22.183 +  .byte '0' + ((\value) & 0xf)
  22.184 + .else
  22.185 +  .byte 'A' + ((\value) & 0xf) - 10
  22.186 + .endif
  22.187 +.endm
  22.188 +
  22.189 +.section __xen_guest
  22.190 +	.ascii	"GUEST_OS=linux,GUEST_VER=2.6"
  22.191 +	.ascii	",XEN_VER=xen-3.0"
  22.192 +	.ascii	",VIRT_BASE=0x"
  22.193 +		utoa __PAGE_OFFSET
  22.194 +	.ascii	",HYPERCALL_PAGE=0x"
  22.195 +		utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
  22.196 +	.ascii  ",FEATURES=writable_page_tables"
  22.197 +	.ascii	         "|writable_descriptor_tables"
  22.198 +	.ascii	         "|auto_translated_physmap"
  22.199 +	.ascii	         "|supervisor_mode_kernel"
  22.200 +#ifdef CONFIG_X86_PAE
  22.201 +	.ascii	",PAE=yes"
  22.202 +#else
  22.203 +	.ascii	",PAE=no"
  22.204 +#endif
  22.205 +	.ascii	",LOADER=generic"
  22.206 +	.byte	0
    23.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/init_task-xen.c	Fri Feb 24 14:03:07 2006 -0700
    23.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/init_task-xen.c	Fri Feb 24 15:41:08 2006 -0700
    23.3 @@ -41,9 +41,11 @@ struct task_struct init_task = INIT_TASK
    23.4  
    23.5  EXPORT_SYMBOL(init_task);
    23.6  
    23.7 +#ifndef CONFIG_X86_NO_TSS
    23.8  /*
    23.9   * per-CPU TSS segments. Threads are completely 'soft' on Linux,
   23.10   * no more per-task TSS's.
   23.11   */ 
   23.12  DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
   23.13 +#endif
   23.14  
    24.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c	Fri Feb 24 14:03:07 2006 -0700
    24.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c	Fri Feb 24 15:41:08 2006 -0700
    24.3 @@ -272,7 +272,7 @@ int kernel_thread(int (*fn)(void *), voi
    24.4  	regs.xes = __USER_DS;
    24.5  	regs.orig_eax = -1;
    24.6  	regs.eip = (unsigned long) kernel_thread_helper;
    24.7 -	regs.xcs = __KERNEL_CS;
    24.8 +	regs.xcs = GET_KERNEL_CS();
    24.9  	regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;
   24.10  
   24.11  	/* Ok, create the new process.. */
   24.12 @@ -518,7 +518,9 @@ struct task_struct fastcall * __switch_t
   24.13  	struct thread_struct *prev = &prev_p->thread,
   24.14  				 *next = &next_p->thread;
   24.15  	int cpu = smp_processor_id();
   24.16 +#ifndef CONFIG_X86_NO_TSS
   24.17  	struct tss_struct *tss = &per_cpu(init_tss, cpu);
   24.18 +#endif
   24.19  	physdev_op_t iopl_op, iobmp_op;
   24.20  	multicall_entry_t _mcl[8], *mcl = _mcl;
   24.21  
   24.22 @@ -543,10 +545,9 @@ struct task_struct fastcall * __switch_t
   24.23  	 * Reload esp0.
   24.24  	 * This is load_esp0(tss, next) with a multicall.
   24.25  	 */
   24.26 -	tss->esp0 = next->esp0;
   24.27  	mcl->op      = __HYPERVISOR_stack_switch;
   24.28 -	mcl->args[0] = tss->ss0;
   24.29 -	mcl->args[1] = tss->esp0;
   24.30 +	mcl->args[0] = __KERNEL_DS;
   24.31 +	mcl->args[1] = next->esp0;
   24.32  	mcl++;
   24.33  
   24.34  	/*
    25.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Fri Feb 24 14:03:07 2006 -0700
    25.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Fri Feb 24 15:41:08 2006 -0700
    25.3 @@ -94,9 +94,9 @@ EXPORT_SYMBOL(efi_enabled);
    25.4  #endif
    25.5  
    25.6  /* cpu data as detected by the assembly code in head.S */
    25.7 -struct cpuinfo_x86 new_cpu_data __initdata = { 0, 0, 0, 0, -1, 0, 1, 0, -1 };
    25.8 +struct cpuinfo_x86 new_cpu_data __initdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
    25.9  /* common cpu data for all cpus */
   25.10 -struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 0, 1, 0, -1 };
   25.11 +struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
   25.12  EXPORT_SYMBOL(boot_cpu_data);
   25.13  
   25.14  unsigned long mmu_cr4_features;
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/sysenter.c	Fri Feb 24 15:41:08 2006 -0700
    26.3 @@ -0,0 +1,137 @@
    26.4 +/*
    26.5 + * linux/arch/i386/kernel/sysenter.c
    26.6 + *
    26.7 + * (C) Copyright 2002 Linus Torvalds
    26.8 + *
    26.9 + * This file contains the needed initializations to support sysenter.
   26.10 + */
   26.11 +
   26.12 +#include <linux/init.h>
   26.13 +#include <linux/smp.h>
   26.14 +#include <linux/thread_info.h>
   26.15 +#include <linux/sched.h>
   26.16 +#include <linux/gfp.h>
   26.17 +#include <linux/string.h>
   26.18 +#include <linux/elf.h>
   26.19 +#include <linux/mm.h>
   26.20 +
   26.21 +#include <asm/cpufeature.h>
   26.22 +#include <asm/msr.h>
   26.23 +#include <asm/pgtable.h>
   26.24 +#include <asm/unistd.h>
   26.25 +
   26.26 +extern asmlinkage void sysenter_entry(void);
   26.27 +
   26.28 +void enable_sep_cpu(void)
   26.29 +{
   26.30 +#ifdef CONFIG_X86_SYSENTER
   26.31 +	int cpu = get_cpu();
   26.32 +	struct tss_struct *tss = &per_cpu(init_tss, cpu);
   26.33 +
   26.34 +	if (!boot_cpu_has(X86_FEATURE_SEP)) {
   26.35 +		put_cpu();
   26.36 +		return;
   26.37 +	}
   26.38 +
   26.39 +	tss->ss1 = __KERNEL_CS;
   26.40 +	tss->esp1 = sizeof(struct tss_struct) + (unsigned long) tss;
   26.41 +	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
   26.42 +	wrmsr(MSR_IA32_SYSENTER_ESP, tss->esp1, 0);
   26.43 +	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0);
   26.44 +	put_cpu();	
   26.45 +#endif
   26.46 +}
   26.47 +
   26.48 +/*
   26.49 + * These symbols are defined by vsyscall.o to mark the bounds
   26.50 + * of the ELF DSO images included therein.
   26.51 + */
   26.52 +extern const char vsyscall_int80_start, vsyscall_int80_end;
   26.53 +extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
   26.54 +static void *syscall_page;
   26.55 +
   26.56 +int __init sysenter_setup(void)
   26.57 +{
   26.58 +	syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
   26.59 +
   26.60 +#ifdef CONFIG_X86_SYSENTER
   26.61 +	if (boot_cpu_has(X86_FEATURE_SEP)) {
   26.62 +		memcpy(syscall_page,
   26.63 +		       &vsyscall_sysenter_start,
   26.64 +		       &vsyscall_sysenter_end - &vsyscall_sysenter_start);
   26.65 +		return 0;
   26.66 +	}
   26.67 +#endif
   26.68 +
   26.69 +	memcpy(syscall_page,
   26.70 +	       &vsyscall_int80_start,
   26.71 +	       &vsyscall_int80_end - &vsyscall_int80_start);
   26.72 +
   26.73 +	return 0;
   26.74 +}
   26.75 +
   26.76 +static struct page*
   26.77 +syscall_nopage(struct vm_area_struct *vma, unsigned long adr, int *type)
   26.78 +{
   26.79 +	struct page *p = virt_to_page(adr - vma->vm_start + syscall_page);
   26.80 +	get_page(p);
   26.81 +	return p;
   26.82 +}
   26.83 +
   26.84 +/* Prevent VMA merging */
   26.85 +static void syscall_vma_close(struct vm_area_struct *vma)
   26.86 +{
   26.87 +}
   26.88 +
   26.89 +static struct vm_operations_struct syscall_vm_ops = {
   26.90 +	.close = syscall_vma_close,
   26.91 +	.nopage = syscall_nopage,
   26.92 +};
   26.93 +
   26.94 +/* Setup a VMA at program startup for the vsyscall page */
   26.95 +int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
   26.96 +{
   26.97 +	struct vm_area_struct *vma;
   26.98 +	struct mm_struct *mm = current->mm;
   26.99 +	int ret;
  26.100 +
  26.101 +	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
  26.102 +	if (!vma)
  26.103 +		return -ENOMEM;
  26.104 +
  26.105 +	memset(vma, 0, sizeof(struct vm_area_struct));
  26.106 +	/* Could randomize here */
  26.107 +	vma->vm_start = VSYSCALL_BASE;
  26.108 +	vma->vm_end = VSYSCALL_BASE + PAGE_SIZE;
  26.109 +	/* MAYWRITE to allow gdb to COW and set breakpoints */
  26.110 +	vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
  26.111 +	vma->vm_flags |= mm->def_flags;
  26.112 +	vma->vm_page_prot = protection_map[vma->vm_flags & 7];
  26.113 +	vma->vm_ops = &syscall_vm_ops;
  26.114 +	vma->vm_mm = mm;
  26.115 +
  26.116 +	down_write(&mm->mmap_sem);
  26.117 +	if ((ret = insert_vm_struct(mm, vma))) {
  26.118 +		up_write(&mm->mmap_sem);
  26.119 +		kmem_cache_free(vm_area_cachep, vma);
  26.120 +		return ret;
  26.121 +	}
  26.122 +	mm->total_vm++;
  26.123 +	up_write(&mm->mmap_sem);
  26.124 +	return 0;
  26.125 +}
  26.126 +
  26.127 +struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
  26.128 +{
  26.129 +	return NULL;
  26.130 +}
  26.131 +
  26.132 +int in_gate_area(struct task_struct *task, unsigned long addr)
  26.133 +{
  26.134 +	return 0;
  26.135 +}
  26.136 +
  26.137 +int in_gate_area_no_task(unsigned long addr)
  26.138 +{
  26.139 +	return 0;
  26.140 +}
    27.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/traps-xen.c	Fri Feb 24 14:03:07 2006 -0700
    27.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/traps-xen.c	Fri Feb 24 15:41:08 2006 -0700
    27.3 @@ -58,15 +58,20 @@
    27.4  
    27.5  asmlinkage int system_call(void);
    27.6  
    27.7 +struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
    27.8 +		{ 0, 0 }, { 0, 0 } };
    27.9 +
   27.10  /* Do we ignore FPU interrupts ? */
   27.11  char ignore_fpu_irq = 0;
   27.12  
   27.13 +#ifndef CONFIG_X86_NO_IDT
   27.14  /*
   27.15   * The IDT has to be page-aligned to simplify the Pentium
   27.16   * F0 0F bug workaround.. We have a special link segment
   27.17   * for this.
   27.18   */
   27.19  struct desc_struct idt_table[256] __attribute__((__section__(".data.idt"))) = { {0, 0}, };
   27.20 +#endif
   27.21  
   27.22  asmlinkage void divide_error(void);
   27.23  asmlinkage void debug(void);
   27.24 @@ -496,20 +501,6 @@ DO_ERROR_INFO(32, SIGSEGV, "iret excepti
   27.25  fastcall void __kprobes do_general_protection(struct pt_regs * regs,
   27.26  					      long error_code)
   27.27  {
   27.28 -	/*
   27.29 -	 * If we trapped on an LDT access then ensure that the default_ldt is
   27.30 -	 * loaded, if nothing else. We load default_ldt lazily because LDT
   27.31 -	 * switching costs time and many applications don't need it.
   27.32 -	 */
   27.33 -	if (unlikely((error_code & 6) == 4)) {
   27.34 -		unsigned long ldt;
   27.35 -		__asm__ __volatile__ ("sldt %0" : "=r" (ldt));
   27.36 -		if (ldt == 0) {
   27.37 -			xen_set_ldt((unsigned long)&default_ldt[0], 5);
   27.38 -			return;
   27.39 -		}
   27.40 -	}
   27.41 -
   27.42  	current->thread.error_code = error_code;
   27.43  	current->thread.trap_no = 13;
   27.44  
   27.45 @@ -1079,13 +1070,6 @@ void __init trap_init(void)
   27.46  	}
   27.47  
   27.48  	/*
   27.49 -	 * default LDT is a single-entry callgate to lcall7 for iBCS
   27.50 -	 * and a callgate to lcall27 for Solaris/x86 binaries
   27.51 -	 */
   27.52 -	make_lowmem_page_readonly(
   27.53 -		&default_ldt[0], XENFEAT_writable_descriptor_tables);
   27.54 -
   27.55 -	/*
   27.56  	 * Should be a barrier for any external CPU state.
   27.57  	 */
   27.58  	cpu_init();
   27.59 @@ -1094,12 +1078,6 @@ void __init trap_init(void)
   27.60  void smp_trap_init(trap_info_t *trap_ctxt)
   27.61  {
   27.62  	trap_info_t *t = trap_table;
   27.63 -	int i;
   27.64 -
   27.65 -	for (i = 0; i < 256; i++) {
   27.66 -		trap_ctxt[i].vector = i;
   27.67 -		trap_ctxt[i].cs     = FLAT_KERNEL_CS;
   27.68 -	}
   27.69  
   27.70  	for (t = trap_table; t->address; t++) {
   27.71  		trap_ctxt[t->vector].flags = t->flags;
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/vm86.c	Fri Feb 24 15:41:08 2006 -0700
    28.3 @@ -0,0 +1,817 @@
    28.4 +/*
    28.5 + *  linux/kernel/vm86.c
    28.6 + *
    28.7 + *  Copyright (C) 1994  Linus Torvalds
    28.8 + *
    28.9 + *  29 dec 2001 - Fixed oopses caused by unchecked access to the vm86
   28.10 + *                stack - Manfred Spraul <manfred@colorfullife.com>
   28.11 + *
   28.12 + *  22 mar 2002 - Manfred detected the stackfaults, but didn't handle
   28.13 + *                them correctly. Now the emulation will be in a
   28.14 + *                consistent state after stackfaults - Kasper Dupont
   28.15 + *                <kasperd@daimi.au.dk>
   28.16 + *
   28.17 + *  22 mar 2002 - Added missing clear_IF in set_vflags_* Kasper Dupont
   28.18 + *                <kasperd@daimi.au.dk>
   28.19 + *
   28.20 + *  ?? ??? 2002 - Fixed premature returns from handle_vm86_fault
   28.21 + *                caused by Kasper Dupont's changes - Stas Sergeev
   28.22 + *
   28.23 + *   4 apr 2002 - Fixed CHECK_IF_IN_TRAP broken by Stas' changes.
   28.24 + *                Kasper Dupont <kasperd@daimi.au.dk>
   28.25 + *
   28.26 + *   9 apr 2002 - Changed syntax of macros in handle_vm86_fault.
   28.27 + *                Kasper Dupont <kasperd@daimi.au.dk>
   28.28 + *
   28.29 + *   9 apr 2002 - Changed stack access macros to jump to a label
   28.30 + *                instead of returning to userspace. This simplifies
   28.31 + *                do_int, and is needed by handle_vm6_fault. Kasper
   28.32 + *                Dupont <kasperd@daimi.au.dk>
   28.33 + *
   28.34 + */
   28.35 +
   28.36 +#include <linux/capability.h>
   28.37 +#include <linux/config.h>
   28.38 +#include <linux/errno.h>
   28.39 +#include <linux/interrupt.h>
   28.40 +#include <linux/sched.h>
   28.41 +#include <linux/kernel.h>
   28.42 +#include <linux/signal.h>
   28.43 +#include <linux/string.h>
   28.44 +#include <linux/mm.h>
   28.45 +#include <linux/smp.h>
   28.46 +#include <linux/smp_lock.h>
   28.47 +#include <linux/highmem.h>
   28.48 +#include <linux/ptrace.h>
   28.49 +
   28.50 +#include <asm/uaccess.h>
   28.51 +#include <asm/io.h>
   28.52 +#include <asm/tlbflush.h>
   28.53 +#include <asm/irq.h>
   28.54 +
   28.55 +/*
   28.56 + * Known problems:
   28.57 + *
   28.58 + * Interrupt handling is not guaranteed:
   28.59 + * - a real x86 will disable all interrupts for one instruction
   28.60 + *   after a "mov ss,xx" to make stack handling atomic even without
   28.61 + *   the 'lss' instruction. We can't guarantee this in v86 mode,
   28.62 + *   as the next instruction might result in a page fault or similar.
   28.63 + * - a real x86 will have interrupts disabled for one instruction
   28.64 + *   past the 'sti' that enables them. We don't bother with all the
   28.65 + *   details yet.
   28.66 + *
   28.67 + * Let's hope these problems do not actually matter for anything.
   28.68 + */
   28.69 +
   28.70 +
   28.71 +#define KVM86	((struct kernel_vm86_struct *)regs)
   28.72 +#define VMPI 	KVM86->vm86plus
   28.73 +
   28.74 +
   28.75 +/*
   28.76 + * 8- and 16-bit register defines..
   28.77 + */
   28.78 +#define AL(regs)	(((unsigned char *)&((regs)->eax))[0])
   28.79 +#define AH(regs)	(((unsigned char *)&((regs)->eax))[1])
   28.80 +#define IP(regs)	(*(unsigned short *)&((regs)->eip))
   28.81 +#define SP(regs)	(*(unsigned short *)&((regs)->esp))
   28.82 +
   28.83 +/*
   28.84 + * virtual flags (16 and 32-bit versions)
   28.85 + */
   28.86 +#define VFLAGS	(*(unsigned short *)&(current->thread.v86flags))
   28.87 +#define VEFLAGS	(current->thread.v86flags)
   28.88 +
   28.89 +#define set_flags(X,new,mask) \
   28.90 +((X) = ((X) & ~(mask)) | ((new) & (mask)))
   28.91 +
   28.92 +#define SAFE_MASK	(0xDD5)
   28.93 +#define RETURN_MASK	(0xDFF)
   28.94 +
   28.95 +#define VM86_REGS_PART2 orig_eax
   28.96 +#define VM86_REGS_SIZE1 \
   28.97 +        ( (unsigned)( & (((struct kernel_vm86_regs *)0)->VM86_REGS_PART2) ) )
   28.98 +#define VM86_REGS_SIZE2 (sizeof(struct kernel_vm86_regs) - VM86_REGS_SIZE1)
   28.99 +
  28.100 +struct pt_regs * FASTCALL(save_v86_state(struct kernel_vm86_regs * regs));
  28.101 +struct pt_regs * fastcall save_v86_state(struct kernel_vm86_regs * regs)
  28.102 +{
  28.103 +#ifndef CONFIG_X86_NO_TSS
  28.104 +	struct tss_struct *tss;
  28.105 +#endif
  28.106 +	struct pt_regs *ret;
  28.107 +	unsigned long tmp;
  28.108 +
  28.109 +	/*
  28.110 +	 * This gets called from entry.S with interrupts disabled, but
  28.111 +	 * from process context. Enable interrupts here, before trying
  28.112 +	 * to access user space.
  28.113 +	 */
  28.114 +	local_irq_enable();
  28.115 +
  28.116 +	if (!current->thread.vm86_info) {
  28.117 +		printk("no vm86_info: BAD\n");
  28.118 +		do_exit(SIGSEGV);
  28.119 +	}
  28.120 +	set_flags(regs->eflags, VEFLAGS, VIF_MASK | current->thread.v86mask);
  28.121 +	tmp = copy_to_user(&current->thread.vm86_info->regs,regs, VM86_REGS_SIZE1);
  28.122 +	tmp += copy_to_user(&current->thread.vm86_info->regs.VM86_REGS_PART2,
  28.123 +		&regs->VM86_REGS_PART2, VM86_REGS_SIZE2);
  28.124 +	tmp += put_user(current->thread.screen_bitmap,&current->thread.vm86_info->screen_bitmap);
  28.125 +	if (tmp) {
  28.126 +		printk("vm86: could not access userspace vm86_info\n");
  28.127 +		do_exit(SIGSEGV);
  28.128 +	}
  28.129 +
  28.130 +#ifndef CONFIG_X86_NO_TSS
  28.131 +	tss = &per_cpu(init_tss, get_cpu());
  28.132 +#endif
  28.133 +	current->thread.esp0 = current->thread.saved_esp0;
  28.134 +	current->thread.sysenter_cs = __KERNEL_CS;
  28.135 +	load_esp0(tss, &current->thread);
  28.136 +	current->thread.saved_esp0 = 0;
  28.137 +	put_cpu();
  28.138 +
  28.139 +	loadsegment(fs, current->thread.saved_fs);
  28.140 +	loadsegment(gs, current->thread.saved_gs);
  28.141 +	ret = KVM86->regs32;
  28.142 +	return ret;
  28.143 +}
  28.144 +
  28.145 +static void mark_screen_rdonly(struct mm_struct *mm)
  28.146 +{
  28.147 +	pgd_t *pgd;
  28.148 +	pud_t *pud;
  28.149 +	pmd_t *pmd;
  28.150 +	pte_t *pte;
  28.151 +	spinlock_t *ptl;
  28.152 +	int i;
  28.153 +
  28.154 +	pgd = pgd_offset(mm, 0xA0000);
  28.155 +	if (pgd_none_or_clear_bad(pgd))
  28.156 +		goto out;
  28.157 +	pud = pud_offset(pgd, 0xA0000);
  28.158 +	if (pud_none_or_clear_bad(pud))
  28.159 +		goto out;
  28.160 +	pmd = pmd_offset(pud, 0xA0000);
  28.161 +	if (pmd_none_or_clear_bad(pmd))
  28.162 +		goto out;
  28.163 +	pte = pte_offset_map_lock(mm, pmd, 0xA0000, &ptl);
  28.164 +	for (i = 0; i < 32; i++) {
  28.165 +		if (pte_present(*pte))
  28.166 +			set_pte(pte, pte_wrprotect(*pte));
  28.167 +		pte++;
  28.168 +	}
  28.169 +	pte_unmap_unlock(pte, ptl);
  28.170 +out:
  28.171 +	flush_tlb();
  28.172 +}
  28.173 +
  28.174 +
  28.175 +
  28.176 +static int do_vm86_irq_handling(int subfunction, int irqnumber);
  28.177 +static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk);
  28.178 +
  28.179 +asmlinkage int sys_vm86old(struct pt_regs regs)
  28.180 +{
  28.181 +	struct vm86_struct __user *v86 = (struct vm86_struct __user *)regs.ebx;
  28.182 +	struct kernel_vm86_struct info; /* declare this _on top_,
  28.183 +					 * this avoids wasting of stack space.
  28.184 +					 * This remains on the stack until we
  28.185 +					 * return to 32 bit user space.
  28.186 +					 */
  28.187 +	struct task_struct *tsk;
  28.188 +	int tmp, ret = -EPERM;
  28.189 +
  28.190 +	tsk = current;
  28.191 +	if (tsk->thread.saved_esp0)
  28.192 +		goto out;
  28.193 +	tmp  = copy_from_user(&info, v86, VM86_REGS_SIZE1);
  28.194 +	tmp += copy_from_user(&info.regs.VM86_REGS_PART2, &v86->regs.VM86_REGS_PART2,
  28.195 +		(long)&info.vm86plus - (long)&info.regs.VM86_REGS_PART2);
  28.196 +	ret = -EFAULT;
  28.197 +	if (tmp)
  28.198 +		goto out;
  28.199 +	memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus);
  28.200 +	info.regs32 = &regs;
  28.201 +	tsk->thread.vm86_info = v86;
  28.202 +	do_sys_vm86(&info, tsk);
  28.203 +	ret = 0;	/* we never return here */
  28.204 +out:
  28.205 +	return ret;
  28.206 +}
  28.207 +
  28.208 +
  28.209 +asmlinkage int sys_vm86(struct pt_regs regs)
  28.210 +{
  28.211 +	struct kernel_vm86_struct info; /* declare this _on top_,
  28.212 +					 * this avoids wasting of stack space.
  28.213 +					 * This remains on the stack until we
  28.214 +					 * return to 32 bit user space.
  28.215 +					 */
  28.216 +	struct task_struct *tsk;
  28.217 +	int tmp, ret;
  28.218 +	struct vm86plus_struct __user *v86;
  28.219 +
  28.220 +	tsk = current;
  28.221 +	switch (regs.ebx) {
  28.222 +		case VM86_REQUEST_IRQ:
  28.223 +		case VM86_FREE_IRQ:
  28.224 +		case VM86_GET_IRQ_BITS:
  28.225 +		case VM86_GET_AND_RESET_IRQ:
  28.226 +			ret = do_vm86_irq_handling(regs.ebx, (int)regs.ecx);
  28.227 +			goto out;
  28.228 +		case VM86_PLUS_INSTALL_CHECK:
  28.229 +			/* NOTE: on old vm86 stuff this will return the error
  28.230 +			   from access_ok(), because the subfunction is
  28.231 +			   interpreted as (invalid) address to vm86_struct.
  28.232 +			   So the installation check works.
  28.233 +			 */
  28.234 +			ret = 0;
  28.235 +			goto out;
  28.236 +	}
  28.237 +
  28.238 +	/* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */
  28.239 +	ret = -EPERM;
  28.240 +	if (tsk->thread.saved_esp0)
  28.241 +		goto out;
  28.242 +	v86 = (struct vm86plus_struct __user *)regs.ecx;
  28.243 +	tmp  = copy_from_user(&info, v86, VM86_REGS_SIZE1);
  28.244 +	tmp += copy_from_user(&info.regs.VM86_REGS_PART2, &v86->regs.VM86_REGS_PART2,
  28.245 +		(long)&info.regs32 - (long)&info.regs.VM86_REGS_PART2);
  28.246 +	ret = -EFAULT;
  28.247 +	if (tmp)
  28.248 +		goto out;
  28.249 +	info.regs32 = &regs;
  28.250 +	info.vm86plus.is_vm86pus = 1;
  28.251 +	tsk->thread.vm86_info = (struct vm86_struct __user *)v86;
  28.252 +	do_sys_vm86(&info, tsk);
  28.253 +	ret = 0;	/* we never return here */
  28.254 +out:
  28.255 +	return ret;
  28.256 +}
  28.257 +
  28.258 +
  28.259 +static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk)
  28.260 +{
  28.261 +#ifndef CONFIG_X86_NO_TSS
  28.262 +	struct tss_struct *tss;
  28.263 +#endif
  28.264 +/*
  28.265 + * make sure the vm86() system call doesn't try to do anything silly
  28.266 + */
  28.267 +	info->regs.__null_ds = 0;
  28.268 +	info->regs.__null_es = 0;
  28.269 +
  28.270 +/* we are clearing fs,gs later just before "jmp resume_userspace",
  28.271 + * because starting with Linux 2.1.x they aren't no longer saved/restored
  28.272 + */
  28.273 +
  28.274 +/*
  28.275 + * The eflags register is also special: we cannot trust that the user
  28.276 + * has set it up safely, so this makes sure interrupt etc flags are
  28.277 + * inherited from protected mode.
  28.278 + */
  28.279 + 	VEFLAGS = info->regs.eflags;
  28.280 +	info->regs.eflags &= SAFE_MASK;
  28.281 +	info->regs.eflags |= info->regs32->eflags & ~SAFE_MASK;
  28.282 +	info->regs.eflags |= VM_MASK;
  28.283 +
  28.284 +	switch (info->cpu_type) {
  28.285 +		case CPU_286:
  28.286 +			tsk->thread.v86mask = 0;
  28.287 +			break;
  28.288 +		case CPU_386:
  28.289 +			tsk->thread.v86mask = NT_MASK | IOPL_MASK;
  28.290 +			break;
  28.291 +		case CPU_486:
  28.292 +			tsk->thread.v86mask = AC_MASK | NT_MASK | IOPL_MASK;
  28.293 +			break;
  28.294 +		default:
  28.295 +			tsk->thread.v86mask = ID_MASK | AC_MASK | NT_MASK | IOPL_MASK;
  28.296 +			break;
  28.297 +	}
  28.298 +
  28.299 +/*
  28.300 + * Save old state, set default return value (%eax) to 0
  28.301 + */
  28.302 +	info->regs32->eax = 0;
  28.303 +	tsk->thread.saved_esp0 = tsk->thread.esp0;
  28.304 +	savesegment(fs, tsk->thread.saved_fs);
  28.305 +	savesegment(gs, tsk->thread.saved_gs);
  28.306 +
  28.307 +#ifndef CONFIG_X86_NO_TSS
  28.308 +	tss = &per_cpu(init_tss, get_cpu());
  28.309 +#endif
  28.310 +	tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
  28.311 +	if (cpu_has_sep)
  28.312 +		tsk->thread.sysenter_cs = 0;
  28.313 +	load_esp0(tss, &tsk->thread);
  28.314 +	put_cpu();
  28.315 +
  28.316 +	tsk->thread.screen_bitmap = info->screen_bitmap;
  28.317 +	if (info->flags & VM86_SCREEN_BITMAP)
  28.318 +		mark_screen_rdonly(tsk->mm);
  28.319 +	__asm__ __volatile__(
  28.320 +		"xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs\n\t"
  28.321 +		"movl %0,%%esp\n\t"
  28.322 +		"movl %1,%%ebp\n\t"
  28.323 +		"jmp resume_userspace"
  28.324 +		: /* no outputs */
  28.325 +		:"r" (&info->regs), "r" (task_thread_info(tsk)) : "ax");
  28.326 +	/* we never return here */
  28.327 +}
  28.328 +
  28.329 +static inline void return_to_32bit(struct kernel_vm86_regs * regs16, int retval)
  28.330 +{
  28.331 +	struct pt_regs * regs32;
  28.332 +
  28.333 +	regs32 = save_v86_state(regs16);
  28.334 +	regs32->eax = retval;
  28.335 +	__asm__ __volatile__("movl %0,%%esp\n\t"
  28.336 +		"movl %1,%%ebp\n\t"
  28.337 +		"jmp resume_userspace"
  28.338 +		: : "r" (regs32), "r" (current_thread_info()));
  28.339 +}
  28.340 +
  28.341 +static inline void set_IF(struct kernel_vm86_regs * regs)
  28.342 +{
  28.343 +	VEFLAGS |= VIF_MASK;
  28.344 +	if (VEFLAGS & VIP_MASK)
  28.345 +		return_to_32bit(regs, VM86_STI);
  28.346 +}
  28.347 +
  28.348 +static inline void clear_IF(struct kernel_vm86_regs * regs)
  28.349 +{
  28.350 +	VEFLAGS &= ~VIF_MASK;
  28.351 +}
  28.352 +
  28.353 +static inline void clear_TF(struct kernel_vm86_regs * regs)
  28.354 +{
  28.355 +	regs->eflags &= ~TF_MASK;
  28.356 +}
  28.357 +
  28.358 +static inline void clear_AC(struct kernel_vm86_regs * regs)
  28.359 +{
  28.360 +	regs->eflags &= ~AC_MASK;
  28.361 +}
  28.362 +
  28.363 +/* It is correct to call set_IF(regs) from the set_vflags_*
  28.364 + * functions. However someone forgot to call clear_IF(regs)
  28.365 + * in the opposite case.
  28.366 + * After the command sequence CLI PUSHF STI POPF you should
  28.367 + * end up with interrups disabled, but you ended up with
  28.368 + * interrupts enabled.
  28.369 + *  ( I was testing my own changes, but the only bug I
  28.370 + *    could find was in a function I had not changed. )
  28.371 + * [KD]
  28.372 + */
  28.373 +
  28.374 +static inline void set_vflags_long(unsigned long eflags, struct kernel_vm86_regs * regs)
  28.375 +{
  28.376 +	set_flags(VEFLAGS, eflags, current->thread.v86mask);
  28.377 +	set_flags(regs->eflags, eflags, SAFE_MASK);
  28.378 +	if (eflags & IF_MASK)
  28.379 +		set_IF(regs);
  28.380 +	else
  28.381 +		clear_IF(regs);
  28.382 +}
  28.383 +
  28.384 +static inline void set_vflags_short(unsigned short flags, struct kernel_vm86_regs * regs)
  28.385 +{
  28.386 +	set_flags(VFLAGS, flags, current->thread.v86mask);
  28.387 +	set_flags(regs->eflags, flags, SAFE_MASK);
  28.388 +	if (flags & IF_MASK)
  28.389 +		set_IF(regs);
  28.390 +	else
  28.391 +		clear_IF(regs);
  28.392 +}
  28.393 +
  28.394 +static inline unsigned long get_vflags(struct kernel_vm86_regs * regs)
  28.395 +{
  28.396 +	unsigned long flags = regs->eflags & RETURN_MASK;
  28.397 +
  28.398 +	if (VEFLAGS & VIF_MASK)
  28.399 +		flags |= IF_MASK;
  28.400 +	flags |= IOPL_MASK;
  28.401 +	return flags | (VEFLAGS & current->thread.v86mask);
  28.402 +}
  28.403 +
  28.404 +static inline int is_revectored(int nr, struct revectored_struct * bitmap)
  28.405 +{
  28.406 +	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
  28.407 +		:"=r" (nr)
  28.408 +		:"m" (*bitmap),"r" (nr));
  28.409 +	return nr;
  28.410 +}
  28.411 +
  28.412 +#define val_byte(val, n) (((__u8 *)&val)[n])
  28.413 +
  28.414 +#define pushb(base, ptr, val, err_label) \
  28.415 +	do { \
  28.416 +		__u8 __val = val; \
  28.417 +		ptr--; \
  28.418 +		if (put_user(__val, base + ptr) < 0) \
  28.419 +			goto err_label; \
  28.420 +	} while(0)
  28.421 +
  28.422 +#define pushw(base, ptr, val, err_label) \
  28.423 +	do { \
  28.424 +		__u16 __val = val; \
  28.425 +		ptr--; \
  28.426 +		if (put_user(val_byte(__val, 1), base + ptr) < 0) \
  28.427 +			goto err_label; \
  28.428 +		ptr--; \
  28.429 +		if (put_user(val_byte(__val, 0), base + ptr) < 0) \
  28.430 +			goto err_label; \
  28.431 +	} while(0)
  28.432 +
  28.433 +#define pushl(base, ptr, val, err_label) \
  28.434 +	do { \
  28.435 +		__u32 __val = val; \
  28.436 +		ptr--; \
  28.437 +		if (put_user(val_byte(__val, 3), base + ptr) < 0) \
  28.438 +			goto err_label; \
  28.439 +		ptr--; \
  28.440 +		if (put_user(val_byte(__val, 2), base + ptr) < 0) \
  28.441 +			goto err_label; \
  28.442 +		ptr--; \
  28.443 +		if (put_user(val_byte(__val, 1), base + ptr) < 0) \
  28.444 +			goto err_label; \
  28.445 +		ptr--; \
  28.446 +		if (put_user(val_byte(__val, 0), base + ptr) < 0) \
  28.447 +			goto err_label; \
  28.448 +	} while(0)
  28.449 +
  28.450 +#define popb(base, ptr, err_label) \
  28.451 +	({ \
  28.452 +		__u8 __res; \
  28.453 +		if (get_user(__res, base + ptr) < 0) \
  28.454 +			goto err_label; \
  28.455 +		ptr++; \
  28.456 +		__res; \
  28.457 +	})
  28.458 +
  28.459 +#define popw(base, ptr, err_label) \
  28.460 +	({ \
  28.461 +		__u16 __res; \
  28.462 +		if (get_user(val_byte(__res, 0), base + ptr) < 0) \
  28.463 +			goto err_label; \
  28.464 +		ptr++; \
  28.465 +		if (get_user(val_byte(__res, 1), base + ptr) < 0) \
  28.466 +			goto err_label; \
  28.467 +		ptr++; \
  28.468 +		__res; \
  28.469 +	})
  28.470 +
  28.471 +#define popl(base, ptr, err_label) \
  28.472 +	({ \
  28.473 +		__u32 __res; \
  28.474 +		if (get_user(val_byte(__res, 0), base + ptr) < 0) \
  28.475 +			goto err_label; \
  28.476 +		ptr++; \
  28.477 +		if (get_user(val_byte(__res, 1), base + ptr) < 0) \
  28.478 +			goto err_label; \
  28.479 +		ptr++; \
  28.480 +		if (get_user(val_byte(__res, 2), base + ptr) < 0) \
  28.481 +			goto err_label; \
  28.482 +		ptr++; \
  28.483 +		if (get_user(val_byte(__res, 3), base + ptr) < 0) \
  28.484 +			goto err_label; \
  28.485 +		ptr++; \
  28.486 +		__res; \
  28.487 +	})
  28.488 +
  28.489 +/* There are so many possible reasons for this function to return
  28.490 + * VM86_INTx, so adding another doesn't bother me. We can expect
  28.491 + * userspace programs to be able to handle it. (Getting a problem
  28.492 + * in userspace is always better than an Oops anyway.) [KD]
  28.493 + */
  28.494 +static void do_int(struct kernel_vm86_regs *regs, int i,
  28.495 +    unsigned char __user * ssp, unsigned short sp)
  28.496 +{
  28.497 +	unsigned long __user *intr_ptr;
  28.498 +	unsigned long segoffs;
  28.499 +
  28.500 +	if (regs->cs == BIOSSEG)
  28.501 +		goto cannot_handle;
  28.502 +	if (is_revectored(i, &KVM86->int_revectored))
  28.503 +		goto cannot_handle;
  28.504 +	if (i==0x21 && is_revectored(AH(regs),&KVM86->int21_revectored))
  28.505 +		goto cannot_handle;
  28.506 +	intr_ptr = (unsigned long __user *) (i << 2);
  28.507 +	if (get_user(segoffs, intr_ptr))
  28.508 +		goto cannot_handle;
  28.509 +	if ((segoffs >> 16) == BIOSSEG)
  28.510 +		goto cannot_handle;
  28.511 +	pushw(ssp, sp, get_vflags(regs), cannot_handle);
  28.512 +	pushw(ssp, sp, regs->cs, cannot_handle);
  28.513 +	pushw(ssp, sp, IP(regs), cannot_handle);
  28.514 +	regs->cs = segoffs >> 16;
  28.515 +	SP(regs) -= 6;
  28.516 +	IP(regs) = segoffs & 0xffff;
  28.517 +	clear_TF(regs);
  28.518 +	clear_IF(regs);
  28.519 +	clear_AC(regs);
  28.520 +	return;
  28.521 +
  28.522 +cannot_handle:
  28.523 +	return_to_32bit(regs, VM86_INTx + (i << 8));
  28.524 +}
  28.525 +
  28.526 +int handle_vm86_trap(struct kernel_vm86_regs * regs, long error_code, int trapno)
  28.527 +{
  28.528 +	if (VMPI.is_vm86pus) {
  28.529 +		if ( (trapno==3) || (trapno==1) )
  28.530 +			return_to_32bit(regs, VM86_TRAP + (trapno << 8));
  28.531 +		do_int(regs, trapno, (unsigned char __user *) (regs->ss << 4), SP(regs));
  28.532 +		return 0;
  28.533 +	}
  28.534 +	if (trapno !=1)
  28.535 +		return 1; /* we let this handle by the calling routine */
  28.536 +	if (current->ptrace & PT_PTRACED) {
  28.537 +		unsigned long flags;
  28.538 +		spin_lock_irqsave(&current->sighand->siglock, flags);
  28.539 +		sigdelset(&current->blocked, SIGTRAP);
  28.540 +		recalc_sigpending();
  28.541 +		spin_unlock_irqrestore(&current->sighand->siglock, flags);
  28.542 +	}
  28.543 +	send_sig(SIGTRAP, current, 1);
  28.544 +	current->thread.trap_no = trapno;
  28.545 +	current->thread.error_code = error_code;
  28.546 +	return 0;
  28.547 +}
  28.548 +
  28.549 +void handle_vm86_fault(struct kernel_vm86_regs * regs, long error_code)
  28.550 +{
  28.551 +	unsigned char opcode;
  28.552 +	unsigned char __user *csp;
  28.553 +	unsigned char __user *ssp;
  28.554 +	unsigned short ip, sp, orig_flags;
  28.555 +	int data32, pref_done;
  28.556 +
  28.557 +#define CHECK_IF_IN_TRAP \
  28.558 +	if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \
  28.559 +		newflags |= TF_MASK
  28.560 +#define VM86_FAULT_RETURN do { \
  28.561 +	if (VMPI.force_return_for_pic  && (VEFLAGS & (IF_MASK | VIF_MASK))) \
  28.562 +		return_to_32bit(regs, VM86_PICRETURN); \
  28.563 +	if (orig_flags & TF_MASK) \
  28.564 +		handle_vm86_trap(regs, 0, 1); \
  28.565 +	return; } while (0)
  28.566 +
  28.567 +	orig_flags = *(unsigned short *)&regs->eflags;
  28.568 +
  28.569 +	csp = (unsigned char __user *) (regs->cs << 4);
  28.570 +	ssp = (unsigned char __user *) (regs->ss << 4);
  28.571 +	sp = SP(regs);
  28.572 +	ip = IP(regs);
  28.573 +
  28.574 +	data32 = 0;
  28.575 +	pref_done = 0;
  28.576 +	do {
  28.577 +		switch (opcode = popb(csp, ip, simulate_sigsegv)) {
  28.578 +			case 0x66:      /* 32-bit data */     data32=1; break;
  28.579 +			case 0x67:      /* 32-bit address */  break;
  28.580 +			case 0x2e:      /* CS */              break;
  28.581 +			case 0x3e:      /* DS */              break;
  28.582 +			case 0x26:      /* ES */              break;
  28.583 +			case 0x36:      /* SS */              break;
  28.584 +			case 0x65:      /* GS */              break;
  28.585 +			case 0x64:      /* FS */              break;
  28.586 +			case 0xf2:      /* repnz */       break;
  28.587 +			case 0xf3:      /* rep */             break;
  28.588 +			default: pref_done = 1;
  28.589 +		}
  28.590 +	} while (!pref_done);
  28.591 +
  28.592 +	switch (opcode) {
  28.593 +
  28.594 +	/* pushf */
  28.595 +	case 0x9c:
  28.596 +		if (data32) {
  28.597 +			pushl(ssp, sp, get_vflags(regs), simulate_sigsegv);
  28.598 +			SP(regs) -= 4;
  28.599 +		} else {
  28.600 +			pushw(ssp, sp, get_vflags(regs), simulate_sigsegv);
  28.601 +			SP(regs) -= 2;
  28.602 +		}
  28.603 +		IP(regs) = ip;
  28.604 +		VM86_FAULT_RETURN;
  28.605 +
  28.606 +	/* popf */
  28.607 +	case 0x9d:
  28.608 +		{
  28.609 +		unsigned long newflags;
  28.610 +		if (data32) {
  28.611 +			newflags=popl(ssp, sp, simulate_sigsegv);
  28.612 +			SP(regs) += 4;
  28.613 +		} else {
  28.614 +			newflags = popw(ssp, sp, simulate_sigsegv);
  28.615 +			SP(regs) += 2;
  28.616 +		}
  28.617 +		IP(regs) = ip;
  28.618 +		CHECK_IF_IN_TRAP;
  28.619 +		if (data32) {
  28.620 +			set_vflags_long(newflags, regs);
  28.621 +		} else {
  28.622 +			set_vflags_short(newflags, regs);
  28.623 +		}
  28.624 +		VM86_FAULT_RETURN;
  28.625 +		}
  28.626 +
  28.627 +	/* int xx */
  28.628 +	case 0xcd: {
  28.629 +		int intno=popb(csp, ip, simulate_sigsegv);
  28.630 +		IP(regs) = ip;
  28.631 +		if (VMPI.vm86dbg_active) {
  28.632 +			if ( (1 << (intno &7)) & VMPI.vm86dbg_intxxtab[intno >> 3] )
  28.633 +				return_to_32bit(regs, VM86_INTx + (intno << 8));
  28.634 +		}
  28.635 +		do_int(regs, intno, ssp, sp);
  28.636 +		return;
  28.637 +	}
  28.638 +
  28.639 +	/* iret */
  28.640 +	case 0xcf:
  28.641 +		{
  28.642 +		unsigned long newip;
  28.643 +		unsigned long newcs;
  28.644 +		unsigned long newflags;
  28.645 +		if (data32) {
  28.646 +			newip=popl(ssp, sp, simulate_sigsegv);
  28.647 +			newcs=popl(ssp, sp, simulate_sigsegv);
  28.648 +			newflags=popl(ssp, sp, simulate_sigsegv);
  28.649 +			SP(regs) += 12;
  28.650 +		} else {
  28.651 +			newip = popw(ssp, sp, simulate_sigsegv);
  28.652 +			newcs = popw(ssp, sp, simulate_sigsegv);
  28.653 +			newflags = popw(ssp, sp, simulate_sigsegv);
  28.654 +			SP(regs) += 6;
  28.655 +		}
  28.656 +		IP(regs) = newip;
  28.657 +		regs->cs = newcs;
  28.658 +		CHECK_IF_IN_TRAP;
  28.659 +		if (data32) {
  28.660 +			set_vflags_long(newflags, regs);
  28.661 +		} else {
  28.662 +			set_vflags_short(newflags, regs);
  28.663 +		}
  28.664 +		VM86_FAULT_RETURN;
  28.665 +		}
  28.666 +
  28.667 +	/* cli */
  28.668 +	case 0xfa:
  28.669 +		IP(regs) = ip;
  28.670 +		clear_IF(regs);
  28.671 +		VM86_FAULT_RETURN;
  28.672 +
  28.673 +	/* sti */
  28.674 +	/*
  28.675 +	 * Damn. This is incorrect: the 'sti' instruction should actually
  28.676 +	 * enable interrupts after the /next/ instruction. Not good.
  28.677 +	 *
  28.678 +	 * Probably needs some horsing around with the TF flag. Aiee..
  28.679 +	 */
  28.680 +	case 0xfb:
  28.681 +		IP(regs) = ip;
  28.682 +		set_IF(regs);
  28.683 +		VM86_FAULT_RETURN;
  28.684 +
  28.685 +	default:
  28.686 +		return_to_32bit(regs, VM86_UNKNOWN);
  28.687 +	}
  28.688 +
  28.689 +	return;
  28.690 +
  28.691 +simulate_sigsegv:
  28.692 +	/* FIXME: After a long discussion with Stas we finally
  28.693 +	 *        agreed, that this is wrong. Here we should
  28.694 +	 *        really send a SIGSEGV to the user program.
  28.695 +	 *        But how do we create the correct context? We
  28.696 +	 *        are inside a general protection fault handler
  28.697 +	 *        and has just returned from a page fault handler.
  28.698 +	 *        The correct context for the signal handler
  28.699 +	 *        should be a mixture of the two, but how do we
  28.700 +	 *        get the information? [KD]
  28.701 +	 */
  28.702 +	return_to_32bit(regs, VM86_UNKNOWN);
  28.703 +}
  28.704 +
  28.705 +/* ---------------- vm86 special IRQ passing stuff ----------------- */
  28.706 +
  28.707 +#define VM86_IRQNAME		"vm86irq"
  28.708 +
  28.709 +static struct vm86_irqs {
  28.710 +	struct task_struct *tsk;
  28.711 +	int sig;
  28.712 +} vm86_irqs[16];
  28.713 +
  28.714 +static DEFINE_SPINLOCK(irqbits_lock);
  28.715 +static int irqbits;
  28.716 +
  28.717 +#define ALLOWED_SIGS ( 1 /* 0 = don't send a signal */ \
  28.718 +	| (1 << SIGUSR1) | (1 << SIGUSR2) | (1 << SIGIO)  | (1 << SIGURG) \
  28.719 +	| (1 << SIGUNUSED) )
  28.720 +	
  28.721 +static irqreturn_t irq_handler(int intno, void *dev_id, struct pt_regs * regs)
  28.722 +{
  28.723 +	int irq_bit;
  28.724 +	unsigned long flags;
  28.725 +
  28.726 +	spin_lock_irqsave(&irqbits_lock, flags);	
  28.727 +	irq_bit = 1 << intno;
  28.728 +	if ((irqbits & irq_bit) || ! vm86_irqs[intno].tsk)
  28.729 +		goto out;
  28.730 +	irqbits |= irq_bit;
  28.731 +	if (vm86_irqs[intno].sig)
  28.732 +		send_sig(vm86_irqs[intno].sig, vm86_irqs[intno].tsk, 1);
  28.733 +	/*
  28.734 +	 * IRQ will be re-enabled when user asks for the irq (whether
  28.735 +	 * polling or as a result of the signal)
  28.736 +	 */
  28.737 +	disable_irq_nosync(intno);
  28.738 +	spin_unlock_irqrestore(&irqbits_lock, flags);
  28.739 +	return IRQ_HANDLED;
  28.740 +
  28.741 +out:
  28.742 +	spin_unlock_irqrestore(&irqbits_lock, flags);	
  28.743 +	return IRQ_NONE;
  28.744 +}
  28.745 +
  28.746 +static inline void free_vm86_irq(int irqnumber)
  28.747 +{
  28.748 +	unsigned long flags;
  28.749 +
  28.750 +	free_irq(irqnumber, NULL);
  28.751 +	vm86_irqs[irqnumber].tsk = NULL;
  28.752 +
  28.753 +	spin_lock_irqsave(&irqbits_lock, flags);	
  28.754 +	irqbits &= ~(1 << irqnumber);
  28.755 +	spin_unlock_irqrestore(&irqbits_lock, flags);	
  28.756 +}
  28.757 +
  28.758 +void release_vm86_irqs(struct task_struct *task)
  28.759 +{
  28.760 +	int i;
  28.761 +	for (i = FIRST_VM86_IRQ ; i <= LAST_VM86_IRQ; i++)
  28.762 +	    if (vm86_irqs[i].tsk == task)
  28.763 +		free_vm86_irq(i);
  28.764 +}
  28.765 +
  28.766 +static inline int get_and_reset_irq(int irqnumber)
  28.767 +{
  28.768 +	int bit;
  28.769 +	unsigned long flags;
  28.770 +	int ret = 0;
  28.771 +	
  28.772 +	if (invalid_vm86_irq(irqnumber)) return 0;
  28.773 +	if (vm86_irqs[irqnumber].tsk != current) return 0;
  28.774 +	spin_lock_irqsave(&irqbits_lock, flags);	
  28.775 +	bit = irqbits & (1 << irqnumber);
  28.776 +	irqbits &= ~bit;
  28.777 +	if (bit) {
  28.778 +		enable_irq(irqnumber);
  28.779 +		ret = 1;
  28.780 +	}
  28.781 +
  28.782 +	spin_unlock_irqrestore(&irqbits_lock, flags);	
  28.783 +	return ret;
  28.784 +}
  28.785 +
  28.786 +
  28.787 +static int do_vm86_irq_handling(int subfunction, int irqnumber)
  28.788 +{
  28.789 +	int ret;
  28.790 +	switch (subfunction) {
  28.791 +		case VM86_GET_AND_RESET_IRQ: {
  28.792 +			return get_and_reset_irq(irqnumber);
  28.793 +		}
  28.794 +		case VM86_GET_IRQ_BITS: {
  28.795 +			return irqbits;
  28.796 +		}
  28.797 +		case VM86_REQUEST_IRQ: {
  28.798 +			int sig = irqnumber >> 8;
  28.799 +			int irq = irqnumber & 255;
  28.800 +			if (!capable(CAP_SYS_ADMIN)) return -EPERM;
  28.801 +			if (!((1 << sig) & ALLOWED_SIGS)) return -EPERM;
  28.802 +			if (invalid_vm86_irq(irq)) return -EPERM;
  28.803 +			if (vm86_irqs[irq].tsk) return -EPERM;
  28.804 +			ret = request_irq(irq, &irq_handler, 0, VM86_IRQNAME, NULL);
  28.805 +			if (ret) return ret;
  28.806 +			vm86_irqs[irq].sig = sig;
  28.807 +			vm86_irqs[irq].tsk = current;
  28.808 +			return irq;
  28.809 +		}
  28.810 +		case  VM86_FREE_IRQ: {
  28.811 +			if (invalid_vm86_irq(irqnumber)) return -EPERM;
  28.812 +			if (!vm86_irqs[irqnumber].tsk) return 0;
  28.813 +			if (vm86_irqs[irqnumber].tsk != current) return -EPERM;
  28.814 +			free_vm86_irq(irqnumber);
  28.815 +			return 0;
  28.816 +		}
  28.817 +	}
  28.818 +	return -EINVAL;
  28.819 +}
  28.820 +
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/vsyscall.S	Fri Feb 24 15:41:08 2006 -0700
    29.3 @@ -0,0 +1,17 @@
    29.4 +#include <linux/init.h>
    29.5 +
    29.6 +__INITDATA
    29.7 +
    29.8 +	.globl vsyscall_int80_start, vsyscall_int80_end
    29.9 +vsyscall_int80_start:
   29.10 +	.incbin "arch/i386/kernel/vsyscall-int80.so"
   29.11 +vsyscall_int80_end:
   29.12 +
   29.13 +#ifdef CONFIG_X86_SYSENTER
   29.14 +	.globl vsyscall_sysenter_start, vsyscall_sysenter_end
   29.15 +vsyscall_sysenter_start:
   29.16 +	.incbin "arch/i386/kernel/vsyscall-sysenter.so"
   29.17 +vsyscall_sysenter_end:
   29.18 +#endif
   29.19 +
   29.20 +__FINIT
    30.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/fault-xen.c	Fri Feb 24 14:03:07 2006 -0700
    30.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/fault-xen.c	Fri Feb 24 15:41:08 2006 -0700
    30.3 @@ -85,7 +85,7 @@ static inline unsigned long get_segment_
    30.4  		return eip + (seg << 4);
    30.5  	
    30.6  	/* By far the most common cases. */
    30.7 -	if (likely(seg == __USER_CS || seg == __KERNEL_CS))
    30.8 +	if (likely(seg == __USER_CS || seg == GET_KERNEL_CS()))
    30.9  		return eip;
   30.10  
   30.11  	/* Check the segment exists, is within the current LDT/GDT size,
   30.12 @@ -396,7 +396,7 @@ good_area:
   30.13  	switch (error_code & 3) {
   30.14  		default:	/* 3: write, present */
   30.15  #ifdef TEST_VERIFY_AREA
   30.16 -			if (regs->cs == KERNEL_CS)
   30.17 +			if (regs->cs == GET_KERNEL_CS())
   30.18  				printk("WP fault at %08lx\n", regs->eip);
   30.19  #endif
   30.20  			/* fall through */
    31.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Fri Feb 24 14:03:07 2006 -0700
    31.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Fri Feb 24 15:41:08 2006 -0700
    31.3 @@ -324,10 +324,13 @@ int xen_create_contiguous_region(
    31.4  		.domid        = DOMID_SELF
    31.5  	};
    31.6  
    31.7 -	if (xen_feature(XENFEAT_auto_translated_physmap)) {
    31.8 -		BUG_ON(order >= 1);
    31.9 +	/*
   31.10 +	 * Currently an auto-translated guest will not perform I/O, nor will
   31.11 +	 * it require PAE page directories below 4GB. Therefore any calls to
   31.12 +	 * this function are redundant and can be ignored.
   31.13 +	 */
   31.14 +	if (xen_feature(XENFEAT_auto_translated_physmap))
   31.15  		return 0;
   31.16 -	}
   31.17  
   31.18  	scrub_pages(vstart, 1 << order);
   31.19  
    32.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c	Fri Feb 24 14:03:07 2006 -0700
    32.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c	Fri Feb 24 15:41:08 2006 -0700
    32.3 @@ -759,7 +759,7 @@ void __init pgtable_cache_init(void)
    32.4  #endif
    32.5  				0,
    32.6  				pgd_ctor,
    32.7 -				PTRS_PER_PMD == 1 ? pgd_dtor : NULL);
    32.8 +				pgd_dtor);
    32.9  	if (!pgd_cache)
   32.10  		panic("pgtable_cache_init(): Cannot create pgd cache");
   32.11  }
    33.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Fri Feb 24 14:03:07 2006 -0700
    33.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Fri Feb 24 15:41:08 2006 -0700
    33.3 @@ -13,6 +13,7 @@
    33.4  #include <linux/slab.h>
    33.5  #include <linux/pagemap.h>
    33.6  #include <linux/spinlock.h>
    33.7 +#include <linux/module.h>
    33.8  
    33.9  #include <asm/system.h>
   33.10  #include <asm/pgtable.h>
   33.11 @@ -184,6 +185,10 @@ void set_pmd_pfn(unsigned long vaddr, un
   33.12  	__flush_tlb_one(vaddr);
   33.13  }
   33.14  
   33.15 +static int nr_fixmaps = 0;
   33.16 +unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE);
   33.17 +EXPORT_SYMBOL(__FIXADDR_TOP);
   33.18 +
   33.19  void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags)
   33.20  {
   33.21  	unsigned long address = __fix_to_virt(idx);
   33.22 @@ -194,7 +199,6 @@ void __set_fixmap (enum fixed_addresses 
   33.23  	}
   33.24  	switch (idx) {
   33.25  	case FIX_WP_TEST:
   33.26 -	case FIX_VSYSCALL:
   33.27  #ifdef CONFIG_X86_F00F_BUG
   33.28  	case FIX_F00F_IDT:
   33.29  #endif
   33.30 @@ -204,6 +208,13 @@ void __set_fixmap (enum fixed_addresses 
   33.31  		set_pte_pfn_ma(address, phys >> PAGE_SHIFT, flags);
   33.32  		break;
   33.33  	}
   33.34 +	nr_fixmaps++;
   33.35 +}
   33.36 +
   33.37 +void set_fixaddr_top(unsigned long top)
   33.38 +{
   33.39 +	BUG_ON(nr_fixmaps > 0);
   33.40 +	__FIXADDR_TOP = top - PAGE_SIZE;
   33.41  }
   33.42  
   33.43  pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
   33.44 @@ -289,10 +300,11 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
   33.45  	unsigned long flags;
   33.46  
   33.47  	if (PTRS_PER_PMD > 1) {
   33.48 -		/* Ensure pgd resides below 4GB. */
   33.49 -		int rc = xen_create_contiguous_region(
   33.50 -			(unsigned long)pgd, 0, 32);
   33.51 -		BUG_ON(rc);
   33.52 +		if (!xen_feature(XENFEAT_pae_pgdir_above_4gb)) {
   33.53 +			int rc = xen_create_contiguous_region(
   33.54 +				(unsigned long)pgd, 0, 32);
   33.55 +			BUG_ON(rc);
   33.56 +		}
   33.57  		if (HAVE_SHARED_KERNEL_PMD)
   33.58  			memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD,
   33.59  			       swapper_pg_dir + USER_PTRS_PER_PGD,
   33.60 @@ -308,16 +320,20 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
   33.61  	}
   33.62  }
   33.63  
   33.64 -/* never called when PTRS_PER_PMD > 1 */
   33.65  void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
   33.66  {
   33.67  	unsigned long flags; /* can be called from interrupt context */
   33.68  
   33.69 -	spin_lock_irqsave(&pgd_lock, flags);
   33.70 -	pgd_list_del(pgd);
   33.71 -	spin_unlock_irqrestore(&pgd_lock, flags);
   33.72 +	if (PTRS_PER_PMD > 1) {
   33.73 +		if (!xen_feature(XENFEAT_pae_pgdir_above_4gb))
   33.74 +			xen_destroy_contiguous_region((unsigned long)pgd, 0);
   33.75 +	} else {
   33.76 +		spin_lock_irqsave(&pgd_lock, flags);
   33.77 +		pgd_list_del(pgd);
   33.78 +		spin_unlock_irqrestore(&pgd_lock, flags);
   33.79  
   33.80 -	pgd_test_and_unpin(pgd);
   33.81 +		pgd_test_and_unpin(pgd);
   33.82 +	}
   33.83  }
   33.84  
   33.85  pgd_t *pgd_alloc(struct mm_struct *mm)
    34.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S	Fri Feb 24 14:03:07 2006 -0700
    34.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S	Fri Feb 24 15:41:08 2006 -0700
    34.3 @@ -569,7 +569,9 @@ GLOBAL_ENTRY(__ia64_trace_syscall)
    34.4  .mem.offset 0,0; st8.spill [r2]=r8		// store return value in slot for r8
    34.5  .mem.offset 8,0; st8.spill [r3]=r10		// clear error indication in slot for r10
    34.6  	br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
    34.7 -.ret3:	br.cond.sptk .work_pending_syscall_end
    34.8 +.ret3:
    34.9 +(pUStk)	cmp.eq.unc p6,p0=r0,r0			// p6 <- pUStk
   34.10 +	br.cond.sptk .work_pending_syscall_end
   34.11  
   34.12  strace_error:
   34.13  	ld8 r3=[r2]				// load pt_regs.r8
    35.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Fri Feb 24 14:03:07 2006 -0700
    35.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Fri Feb 24 15:41:08 2006 -0700
    35.3 @@ -446,6 +446,7 @@ setup_arch (char **cmdline_p)
    35.4  	if (early_console_setup(*cmdline_p) == 0)
    35.5  		mark_bsp_online();
    35.6  
    35.7 +	parse_early_param();
    35.8  #ifdef CONFIG_ACPI
    35.9  	/* Initialize the ACPI boot-time table parser */
   35.10  	acpi_table_init();
   35.11 @@ -704,6 +705,9 @@ void
   35.12  setup_per_cpu_areas (void)
   35.13  {
   35.14  	/* start_kernel() requires this... */
   35.15 +#ifdef CONFIG_ACPI_HOTPLUG_CPU
   35.16 +	prefill_possible_map();
   35.17 +#endif
   35.18  }
   35.19  
   35.20  /*
    36.1 --- a/linux-2.6-xen-sparse/arch/x86_64/Kconfig	Fri Feb 24 14:03:07 2006 -0700
    36.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/Kconfig	Fri Feb 24 15:41:08 2006 -0700
    36.3 @@ -125,6 +125,16 @@ config X86_64_XEN
    36.4  	help
    36.5  	  This option will compile a kernel compatible with Xen hypervisor
    36.6  
    36.7 +config X86_NO_TSS
    36.8 +	bool
    36.9 +	depends on X86_64_XEN
   36.10 +	default y
   36.11 +
   36.12 +config X86_NO_IDT
   36.13 +	bool
   36.14 +	depends on X86_64_XEN
   36.15 +	default y
   36.16 +
   36.17  #
   36.18  # Define implied options from the CPU selection here
   36.19  #
   36.20 @@ -529,9 +539,7 @@ endif
   36.21  
   36.22  source "drivers/acpi/Kconfig"
   36.23  
   36.24 -if !X86_64_XEN
   36.25  source "arch/x86_64/kernel/cpufreq/Kconfig"
   36.26 -endif
   36.27  
   36.28  endmenu
   36.29  
    37.1 --- a/linux-2.6-xen-sparse/arch/x86_64/ia32/syscall32-xen.c	Fri Feb 24 14:03:07 2006 -0700
    37.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/ia32/syscall32-xen.c	Fri Feb 24 15:41:08 2006 -0700
    37.3 @@ -119,7 +119,7 @@ void syscall32_cpu_init(void)
    37.4  
    37.5  	/* Load these always in case some future AMD CPU supports
    37.6  	   SYSENTER from compat mode too. */
    37.7 -	checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)(__KERNEL_CS | 3));
    37.8 +	checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
    37.9  	checking_wrmsrl(MSR_IA32_SYSENTER_ESP, 0ULL);
   37.10  	checking_wrmsrl(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
   37.11  
    38.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/apic-xen.c	Fri Feb 24 14:03:07 2006 -0700
    38.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/apic-xen.c	Fri Feb 24 15:41:08 2006 -0700
    38.3 @@ -58,13 +58,6 @@ void ack_bad_irq(unsigned int irq)
    38.4  		ack_APIC_irq();
    38.5  }
    38.6  
    38.7 -#ifdef CONFIG_XEN
    38.8 -void switch_APIC_timer_to_ipi(void *cpumask) { }
    38.9 -EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
   38.10 -void switch_ipi_to_APIC_timer(void *cpumask) { }
   38.11 -EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
   38.12 -#endif
   38.13 -
   38.14  int setup_profiling_timer(unsigned int multiplier)
   38.15  {
   38.16  	return -EINVAL;
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/asm-offsets.c	Fri Feb 24 15:41:08 2006 -0700
    39.3 @@ -0,0 +1,74 @@
    39.4 +/*
    39.5 + * Generate definitions needed by assembly language modules.
    39.6 + * This code generates raw asm output which is post-processed to extract
    39.7 + * and format the required data.
    39.8 + */
    39.9 +
   39.10 +#include <linux/sched.h> 
   39.11 +#include <linux/stddef.h>
   39.12 +#include <linux/errno.h> 
   39.13 +#include <linux/hardirq.h>
   39.14 +#include <linux/suspend.h>
   39.15 +#include <asm/pda.h>
   39.16 +#include <asm/processor.h>
   39.17 +#include <asm/segment.h>
   39.18 +#include <asm/thread_info.h>
   39.19 +#include <asm/ia32.h>
   39.20 +
   39.21 +#define DEFINE(sym, val) \
   39.22 +        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
   39.23 +
   39.24 +#define BLANK() asm volatile("\n->" : : )
   39.25 +
   39.26 +int main(void)
   39.27 +{
   39.28 +#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
   39.29 +	ENTRY(state);
   39.30 +	ENTRY(flags); 
   39.31 +	ENTRY(thread); 
   39.32 +	ENTRY(pid);
   39.33 +	BLANK();
   39.34 +#undef ENTRY
   39.35 +#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
   39.36 +	ENTRY(flags);
   39.37 +	ENTRY(addr_limit);
   39.38 +	ENTRY(preempt_count);
   39.39 +	ENTRY(status);
   39.40 +	BLANK();
   39.41 +#undef ENTRY
   39.42 +#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
   39.43 +	ENTRY(kernelstack); 
   39.44 +	ENTRY(oldrsp); 
   39.45 +	ENTRY(pcurrent); 
   39.46 +	ENTRY(irqcount);
   39.47 +	ENTRY(cpunumber);
   39.48 +	ENTRY(irqstackptr);
   39.49 +	ENTRY(data_offset);
   39.50 +	BLANK();
   39.51 +#undef ENTRY
   39.52 +#ifdef CONFIG_IA32_EMULATION
   39.53 +#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
   39.54 +	ENTRY(eax);
   39.55 +	ENTRY(ebx);
   39.56 +	ENTRY(ecx);
   39.57 +	ENTRY(edx);
   39.58 +	ENTRY(esi);
   39.59 +	ENTRY(edi);
   39.60 +	ENTRY(ebp);
   39.61 +	ENTRY(esp);
   39.62 +	ENTRY(eip);
   39.63 +	BLANK();
   39.64 +#undef ENTRY
   39.65 +	DEFINE(IA32_RT_SIGFRAME_sigcontext,
   39.66 +	       offsetof (struct rt_sigframe32, uc.uc_mcontext));
   39.67 +	BLANK();
   39.68 +#endif
   39.69 +	DEFINE(pbe_address, offsetof(struct pbe, address));
   39.70 +	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
   39.71 +	DEFINE(pbe_next, offsetof(struct pbe, next));
   39.72 +#ifndef CONFIG_X86_NO_TSS
   39.73 +	BLANK();
   39.74 +	DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
   39.75 +#endif
   39.76 +	return 0;
   39.77 +}
    40.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S	Fri Feb 24 14:03:07 2006 -0700
    40.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S	Fri Feb 24 15:41:08 2006 -0700
    40.3 @@ -61,6 +61,8 @@
    40.4  #ifndef CONFIG_PREEMPT
    40.5  #define retint_kernel retint_restore_args
    40.6  #endif	
    40.7 +
    40.8 +NMI_MASK = 0x80000000
    40.9  	
   40.10  /*
   40.11   * C code is not supposed to know about undefined top of stack. Every time 
   40.12 @@ -143,6 +145,18 @@
   40.13           * #define VGCF_IN_SYSCALL (1<<8) 
   40.14           */
   40.15  	.macro HYPERVISOR_IRET flag
   40.16 +	testb $3,1*8(%rsp)
   40.17 +	jnz   1f
   40.18 +	testl $NMI_MASK,2*8(%rsp)
   40.19 +	jnz   1f
   40.20 +
   40.21 +	/* Direct iret to kernel space. Correct CS and SS. */
   40.22 +	orb   $3,1*8(%rsp)
   40.23 +	orb   $3,4*8(%rsp)
   40.24 +	iretq
   40.25 +
   40.26 +1:	/* Slow iret via hypervisor. */
   40.27 +	andl  $~NMI_MASK, 16(%rsp)
   40.28  	pushq $\flag
   40.29  	jmp  hypercall_page + (__HYPERVISOR_iret * 32)
   40.30  	.endm
   40.31 @@ -510,13 +524,7 @@ retint_restore_args:
   40.32  	jnz restore_all_enable_events	# != 0 => reenable event delivery      
   40.33          XEN_PUT_VCPU_INFO(%rsi)
   40.34  		
   40.35 -	RESTORE_ARGS 0,8,0						
   40.36 -	testb $3,8(%rsp)                # check CS
   40.37 -	jnz  user_mode
   40.38 -kernel_mode:
   40.39 -        orb   $3,1*8(%rsp)
   40.40 -	iretq
   40.41 -user_mode:
   40.42 +	RESTORE_ARGS 0,8,0
   40.43  	HYPERVISOR_IRET 0
   40.44  	
   40.45  	/* edi: workmask, edx: work */
   40.46 @@ -811,6 +819,7 @@ ENTRY(nmi)
   40.47  ENTRY(do_nmi_callback)
   40.48          addq $8, %rsp
   40.49          call do_nmi
   40.50 +        orl  $NMI_MASK,EFLAGS(%rsp)
   40.51          RESTORE_REST
   40.52          XEN_BLOCK_EVENTS(%rsi)
   40.53          GET_THREAD_INFO(%rcx)
   40.54 @@ -826,11 +835,6 @@ scrit:	/**** START OF CRITICAL REGION **
   40.55  	jnz  14f			# process more events if necessary...
   40.56  	XEN_PUT_VCPU_INFO(%rsi)
   40.57          RESTORE_ARGS 0,8,0
   40.58 -        testb $3,8(%rsp)                # check CS
   40.59 -        jnz  crit_user_mode
   40.60 -        orb   $3,1*8(%rsp)
   40.61 -        iretq
   40.62 -crit_user_mode:
   40.63          HYPERVISOR_IRET 0
   40.64          
   40.65  14:	XEN_LOCKED_BLOCK_EVENTS(%rsi)
    41.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S	Fri Feb 24 14:03:07 2006 -0700
    41.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S	Fri Feb 24 15:41:08 2006 -0700
    41.3 @@ -14,15 +14,6 @@
    41.4  
    41.5  
    41.6  #include <linux/linkage.h>
    41.7 -
    41.8 -.section __xen_guest
    41.9 -	.ascii	"GUEST_OS=linux,GUEST_VER=2.6"
   41.10 -	.ascii	",XEN_VER=xen-3.0"
   41.11 -	.ascii	",VIRT_BASE=0xffffffff80000000"
   41.12 -	.ascii	",HYPERCALL_PAGE=0x10a" /* __pa(hypercall_page) >> 12 */
   41.13 -	.ascii	",LOADER=generic"
   41.14 -	.byte	0
   41.15 -      
   41.16  #include <linux/threads.h>
   41.17  #include <linux/init.h>
   41.18  #include <asm/desc.h>
   41.19 @@ -30,64 +21,21 @@
   41.20  #include <asm/page.h>
   41.21  #include <asm/msr.h>
   41.22  #include <asm/cache.h>
   41.23 -	
   41.24 -/* we are not able to switch in one step to the final KERNEL ADRESS SPACE
   41.25 - * because we need identity-mapped pages on setup so define __START_KERNEL to
   41.26 - * 0x100000 for this stage
   41.27 - * 
   41.28 - */
   41.29  
   41.30  	.text
   41.31  	.code64
   41.32  	.globl startup_64
   41.33  startup_64:
   41.34  ENTRY(_start)
   41.35 -	movq %rsi,xen_start_info(%rip)
   41.36 -
   41.37 -#ifdef CONFIG_SMP
   41.38 -ENTRY(startup_64_smp)
   41.39 -#endif /* CONFIG_SMP */
   41.40 -
   41.41 -	cld
   41.42 -
   41.43 -	movq init_rsp(%rip),%rsp
   41.44 +	movq $(init_thread_union+THREAD_SIZE-8),%rsp
   41.45  	/* zero EFLAGS after setting rsp */
   41.46  	pushq $0
   41.47  	popfq
   41.48 -	movq	initial_code(%rip),%rax
   41.49 -	jmp	*%rax
   41.50 -
   41.51 -	/* SMP bootup changes these two */	
   41.52 -	.globl	initial_code
   41.53 -initial_code:
   41.54 -	.quad	x86_64_start_kernel
   41.55 -	.globl init_rsp
   41.56 -init_rsp:
   41.57 -	.quad  init_thread_union+THREAD_SIZE-8
   41.58  
   41.59 -ENTRY(early_idt_handler)
   41.60 -	xorl %eax,%eax
   41.61 -	movq 8(%rsp),%rsi	# get rip
   41.62 -	movq (%rsp),%rdx
   41.63 -	leaq early_idt_msg(%rip),%rdi
   41.64 -1:	hlt                     # generate #GP
   41.65 -	jmp 1b
   41.66 -
   41.67 -early_idt_msg:
   41.68 -	.asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n"
   41.69 -
   41.70 -#if 0
   41.71 -ENTRY(lgdt_finish)
   41.72 -        movl $(__USER_DS),%eax          # DS/ES contains default USER segment
   41.73 -        movw %ax,%ds
   41.74 -        movw %ax,%es
   41.75 -        movl $(__KERNEL_DS),%eax        
   41.76 -        movw %ax,%ss                    # after changing gdt.
   41.77 -        popq %rax                       # get the retrun address
   41.78 -        pushq $(__KERNEL_CS)
   41.79 -        pushq %rax
   41.80 -        lretq
   41.81 -#endif 
   41.82 +	/* rsi is pointer to startup info structure.
   41.83 +	   pass it to C */
   41.84 +	movq %rsi,%rdi
   41.85 +	jmp x86_64_start_kernel
   41.86  
   41.87  ENTRY(stext)
   41.88  ENTRY(_stext)
   41.89 @@ -113,39 +61,9 @@ NEXT_PAGE(init_level4_pgt)
   41.90  NEXT_PAGE(init_level4_user_pgt)
   41.91  	.fill	512,8,0
   41.92  
   41.93 -	/*
   41.94 -	 * In Xen the following pre-initialized pgt entries are re-initialized.
   41.95 -	 */
   41.96  NEXT_PAGE(level3_kernel_pgt)
   41.97 -	.fill	510,8,0
   41.98 -	/* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */
   41.99 -	.quad	phys_level2_kernel_pgt | 0x007
  41.100 -	.fill	1,8,0
  41.101 +	.fill	512,8,0
  41.102  
  41.103 -NEXT_PAGE(level2_ident_pgt)
  41.104 -	/* 40MB for bootup. 	*/
  41.105 -	i = 0
  41.106 -	.rept 20
  41.107 -	.quad	i << 21 | 0x083
  41.108 -	i = i + 1
  41.109 -	.endr
  41.110 -	/* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */
  41.111 -	.globl temp_boot_pmds
  41.112 -temp_boot_pmds:
  41.113 -	.fill	492,8,0
  41.114 -
  41.115 -NEXT_PAGE(level2_kernel_pgt)
  41.116 -	/* 40MB kernel mapping. The kernel code cannot be bigger than that.
  41.117 -	   When you change this change KERNEL_TEXT_SIZE in page.h too. */
  41.118 -	/* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */
  41.119 -	i = 0
  41.120 -	.rept 20
  41.121 -	.quad	i << 21 | 0x183
  41.122 -	i = i + 1
  41.123 -	.endr
  41.124 -	/* Module mapping starts here */
  41.125 -	.fill	492,8,0
  41.126 -	
  41.127          /*
  41.128           * This is used for vsyscall area mapping as we have a different
  41.129           * level4 page table for user.
  41.130 @@ -153,81 +71,19 @@ NEXT_PAGE(level2_kernel_pgt)
  41.131  NEXT_PAGE(level3_user_pgt)
  41.132          .fill	512,8,0
  41.133  
  41.134 -NEXT_PAGE(cpu_gdt_table)
  41.135 -/* The TLS descriptors are currently at a different place compared to i386.
  41.136 -   Hopefully nobody expects them at a fixed place (Wine?) */
  41.137 -	.quad	0x0000000000000000	/* NULL descriptor */
  41.138 -	.quad	0x0			/* unused */
  41.139 -	.quad	0x00affa000000ffff	/* __KERNEL_CS */
  41.140 -	.quad	0x00cff2000000ffff	/* __KERNEL_DS */
  41.141 -       	.quad	0x00cffa000000ffff	/* __USER32_CS */
  41.142 -	.quad	0x00cff2000000ffff	/* __USER_DS, __USER32_DS  */		
  41.143 -	.quad	0x00affa000000ffff	/* __USER_CS */
  41.144 -	.quad	0x00cffa000000ffff	/* __KERNEL32_CS */        
  41.145 -	.quad	0,0			/* TSS */
  41.146 -	.quad	0,0			/* LDT */
  41.147 -	.quad   0,0,0			/* three TLS descriptors */ 
  41.148 -	.quad	0			/* unused */
  41.149 -gdt_end:
  41.150 -#if 0
  41.151 -	/* asm/segment.h:GDT_ENTRIES must match this */	
  41.152 -	/* This should be a multiple of the cache line size */
  41.153 -	/* GDTs of other CPUs are now dynamically allocated */
  41.154 -
  41.155 -	/* zero the remaining page */
  41.156 -	.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
  41.157 -#endif
  41.158 +NEXT_PAGE(level2_kernel_pgt)
  41.159 +	.fill	512,8,0
  41.160  
  41.161  NEXT_PAGE(empty_zero_page)
  41.162 -
  41.163 -NEXT_PAGE(level3_physmem_pgt)
  41.164 -	.quad	phys_level2_kernel_pgt | 0x007	/* so that __va works even before pagetable_init */
  41.165 +	.skip PAGE_SIZE
  41.166  
  41.167  NEXT_PAGE(hypercall_page)
  41.168 -.if (phys_hypercall_page - 0x10a000)
  41.169 -	/* cause compiler error if the hypercall_page is at a
  41.170 -	 * different address than expected. */
  41.171 -	.quad	__adjust_hypercall_page_in_header
  41.172 -.endif
  41.173  	.fill	512,8,0
  41.174  
  41.175  #undef NEXT_PAGE
  41.176  
  41.177  	.data
  41.178  
  41.179 -#ifndef CONFIG_XEN
  41.180 -#ifdef CONFIG_ACPI_SLEEP
  41.181 -	.align PAGE_SIZE
  41.182 -ENTRY(wakeup_level4_pgt)
  41.183 -	.quad	phys_level3_ident_pgt | 0x007
  41.184 -	.fill	255,8,0
  41.185 -	.quad	phys_level3_physmem_pgt | 0x007
  41.186 -	.fill	254,8,0
  41.187 -	/* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
  41.188 -	.quad	phys_level3_kernel_pgt | 0x007
  41.189 -#endif
  41.190 -
  41.191 -#ifndef CONFIG_HOTPLUG_CPU
  41.192 -	__INITDATA
  41.193 -#endif
  41.194 -	/*
  41.195 -	 * This default setting generates an ident mapping at address 0x100000
  41.196 -	 * and a mapping for the kernel that precisely maps virtual address
  41.197 -	 * 0xffffffff80000000 to physical address 0x000000. (always using
  41.198 -	 * 2Mbyte large pages provided by PAE mode)
  41.199 -	 */
  41.200 -	.align PAGE_SIZE
  41.201 -ENTRY(boot_level4_pgt)
  41.202 -	.quad	phys_level3_ident_pgt | 0x007
  41.203 -	.fill	255,8,0
  41.204 -	.quad	phys_level3_physmem_pgt | 0x007
  41.205 -	.fill	254,8,0
  41.206 -	/* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
  41.207 -	.quad	phys_level3_kernel_pgt | 0x007
  41.208 -#endif
  41.209 -
  41.210 -	.data
  41.211 -
  41.212  	.align 16
  41.213  	.globl cpu_gdt_descr
  41.214  cpu_gdt_descr:
  41.215 @@ -246,11 +102,55 @@ gdt:
  41.216   * Also sysret mandates a special GDT layout 
  41.217   */
  41.218  		 		
  41.219 -.align PAGE_SIZE
  41.220 +	.section .data.page_aligned, "aw"
  41.221 +	.align PAGE_SIZE
  41.222  
  41.223 -ENTRY(idt_table)	
  41.224 -	.rept   256
  41.225 -	.quad   0
  41.226 -	.quad 	0
  41.227 -	.endr
  41.228 +/* The TLS descriptors are currently at a different place compared to i386.
  41.229 +   Hopefully nobody expects them at a fixed place (Wine?) */
  41.230  
  41.231 +ENTRY(cpu_gdt_table)
  41.232 +	.quad	0x0000000000000000	/* NULL descriptor */
  41.233 +	.quad	0x0			/* unused */
  41.234 +	.quad	0x00af9a000000ffff	/* __KERNEL_CS */
  41.235 +	.quad	0x00cf92000000ffff	/* __KERNEL_DS */
  41.236 +	.quad	0x00cffa000000ffff	/* __USER32_CS */
  41.237 +	.quad	0x00cff2000000ffff	/* __USER_DS, __USER32_DS  */
  41.238 +	.quad	0x00affa000000ffff	/* __USER_CS */
  41.239 +	.quad	0x00cf9a000000ffff	/* __KERNEL32_CS */
  41.240 +	.quad	0,0			/* TSS */
  41.241 +	.quad	0,0			/* LDT */
  41.242 +	.quad   0,0,0			/* three TLS descriptors */
  41.243 +	.quad	0			/* unused */
  41.244 +gdt_end:
  41.245 +	/* asm/segment.h:GDT_ENTRIES must match this */
  41.246 +	/* This should be a multiple of the cache line size */
  41.247 +	/* GDTs of other CPUs are now dynamically allocated */
  41.248 +
  41.249 +	/* zero the remaining page */
  41.250 +	.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
  41.251 +
  41.252 +/*
  41.253 + * __xen_guest information
  41.254 + */
  41.255 +.macro utoh value
  41.256 + .if (\value) < 0 || (\value) >= 0x10
  41.257 +	utoh (((\value)>>4)&0x0fffffffffffffff)
  41.258 + .endif
  41.259 + .if ((\value) & 0xf) < 10
  41.260 +  .byte '0' + ((\value) & 0xf)
  41.261 + .else
  41.262 +  .byte 'A' + ((\value) & 0xf) - 10
  41.263 + .endif
  41.264 +.endm
  41.265 +
  41.266 +.section __xen_guest
  41.267 +	.ascii	"GUEST_OS=linux,GUEST_VER=2.6"
  41.268 +	.ascii	",XEN_VER=xen-3.0"
  41.269 +	.ascii	",VIRT_BASE=0x"; utoh __START_KERNEL_map
  41.270 +	.ascii	",HYPERCALL_PAGE=0x"; utoh (phys_hypercall_page >> PAGE_SHIFT)
  41.271 +	.ascii  ",FEATURES=writable_page_tables"
  41.272 +	.ascii		 "|writable_descriptor_tables"
  41.273 +	.ascii		 "|auto_translated_physmap"
  41.274 +	.ascii	         "|supervisor_mode_kernel"
  41.275 +	.ascii	",LOADER=generic"
  41.276 +	.byte	0
    42.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c	Fri Feb 24 14:03:07 2006 -0700
    42.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c	Fri Feb 24 15:41:08 2006 -0700
    42.3 @@ -47,7 +47,7 @@ extern char saved_command_line[];
    42.4  
    42.5  static void __init copy_bootdata(char *real_mode_data)
    42.6  {
    42.7 -#if 0
    42.8 +#ifndef CONFIG_XEN
    42.9  	int new_data;
   42.10  	char * command_line;
   42.11  
   42.12 @@ -63,7 +63,6 @@ static void __init copy_bootdata(char *r
   42.13  	}
   42.14  	command_line = (char *) ((u64)(new_data));
   42.15  	memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
   42.16 -	printk("Bootdata ok (command line is %s)\n", saved_command_line);
   42.17  #else
   42.18  	int max_cmdline;
   42.19  	
   42.20 @@ -71,8 +70,8 @@ static void __init copy_bootdata(char *r
   42.21  		max_cmdline = COMMAND_LINE_SIZE;
   42.22  	memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline);
   42.23  	saved_command_line[max_cmdline-1] = '\0';
   42.24 +#endif
   42.25  	printk("Bootdata ok (command line is %s)\n", saved_command_line);
   42.26 -#endif
   42.27  }
   42.28  
   42.29  static void __init setup_boot_cpu_data(void)
   42.30 @@ -98,6 +97,7 @@ void __init x86_64_start_kernel(char * r
   42.31  	char *s;
   42.32  	int i;
   42.33  
   42.34 +	xen_start_info = (struct start_info *)real_mode_data;
   42.35  	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
   42.36  		phys_to_machine_mapping =
   42.37  			(unsigned long *)xen_start_info->mfn_list;
   42.38 @@ -105,9 +105,9 @@ void __init x86_64_start_kernel(char * r
   42.39  			xen_start_info->nr_pt_frames;
   42.40  	}
   42.41  
   42.42 +#if 0
   42.43  	for (i = 0; i < 256; i++)
   42.44  		set_intr_gate(i, early_idt_handler);
   42.45 -#if 0
   42.46  	asm volatile("lidt %0" :: "m" (idt_descr));
   42.47  #endif
   42.48  
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/init_task.c	Fri Feb 24 15:41:08 2006 -0700
    43.3 @@ -0,0 +1,52 @@
    43.4 +#include <linux/mm.h>
    43.5 +#include <linux/module.h>
    43.6 +#include <linux/sched.h>
    43.7 +#include <linux/init.h>
    43.8 +#include <linux/init_task.h>
    43.9 +#include <linux/fs.h>
   43.10 +#include <linux/mqueue.h>
   43.11 +
   43.12 +#include <asm/uaccess.h>
   43.13 +#include <asm/pgtable.h>
   43.14 +#include <asm/desc.h>
   43.15 +
   43.16 +static struct fs_struct init_fs = INIT_FS;
   43.17 +static struct files_struct init_files = INIT_FILES;
   43.18 +static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
   43.19 +static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
   43.20 +struct mm_struct init_mm = INIT_MM(init_mm);
   43.21 +
   43.22 +EXPORT_SYMBOL(init_mm);
   43.23 +
   43.24 +/*
   43.25 + * Initial task structure.
   43.26 + *
   43.27 + * We need to make sure that this is 8192-byte aligned due to the
   43.28 + * way process stacks are handled. This is done by having a special
   43.29 + * "init_task" linker map entry..
   43.30 + */
   43.31 +union thread_union init_thread_union 
   43.32 +	__attribute__((__section__(".data.init_task"))) =
   43.33 +		{ INIT_THREAD_INFO(init_task) };
   43.34 +
   43.35 +/*
   43.36 + * Initial task structure.
   43.37 + *
   43.38 + * All other task structs will be allocated on slabs in fork.c
   43.39 + */
   43.40 +struct task_struct init_task = INIT_TASK(init_task);
   43.41 +
   43.42 +EXPORT_SYMBOL(init_task);
   43.43 +
   43.44 +#ifndef CONFIG_X86_NO_TSS
   43.45 +/*
   43.46 + * per-CPU TSS segments. Threads are completely 'soft' on Linux,
   43.47 + * no more per-task TSS's. The TSS size is kept cacheline-aligned
   43.48 + * so they are allowed to end up in the .data.cacheline_aligned
   43.49 + * section. Since TSS's are completely CPU-local, we want them
   43.50 + * on exact cacheline boundaries, to eliminate cacheline ping-pong.
   43.51 + */ 
   43.52 +DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
   43.53 +#endif
   43.54 +
   43.55 +#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
    44.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/io_apic-xen.c	Fri Feb 24 14:03:07 2006 -0700
    44.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/io_apic-xen.c	Fri Feb 24 15:41:08 2006 -0700
    44.3 @@ -30,6 +30,9 @@
    44.4  #include <linux/mc146818rtc.h>
    44.5  #include <linux/acpi.h>
    44.6  #include <linux/sysdev.h>
    44.7 +#ifdef CONFIG_ACPI
    44.8 +#include <acpi/acpi_bus.h>
    44.9 +#endif
   44.10  
   44.11  #include <asm/io.h>
   44.12  #include <asm/smp.h>
   44.13 @@ -310,6 +313,8 @@ static int __init enable_ioapic_setup(ch
   44.14  
   44.15     And another hack to disable the IOMMU on VIA chipsets.
   44.16  
   44.17 +   ... and others. Really should move this somewhere else.
   44.18 +
   44.19     Kludge-O-Rama. */
   44.20  void __init check_ioapic(void) 
   44.21  { 
   44.22 @@ -358,6 +363,17 @@ void __init check_ioapic(void)
   44.23  #ifndef CONFIG_XEN
   44.24  					if (apic_runs_main_timer != 0)
   44.25  						break;
   44.26 +#ifdef CONFIG_ACPI
   44.27 +					/* Don't do this for laptops right
   44.28 +					   right now because their timer
   44.29 +					   doesn't necessarily tick in C2/3 */
   44.30 +					if (acpi_fadt.revision >= 3 &&
   44.31 +			(acpi_fadt.plvl2_lat + acpi_fadt.plvl3_lat) < 1100) {
   44.32 +						printk(KERN_INFO
   44.33 +"ATI board detected, but seems to be a laptop. Timer might be shakey, sorry\n");
   44.34 +						break;
   44.35 +					}
   44.36 +#endif					
   44.37  					printk(KERN_INFO
   44.38  	     "ATI board detected. Using APIC/PM timer.\n");
   44.39  					apic_runs_main_timer = 1;
    45.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/mpparse-xen.c	Fri Feb 24 14:03:07 2006 -0700
    45.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/mpparse-xen.c	Fri Feb 24 15:41:08 2006 -0700
    45.3 @@ -295,9 +295,9 @@ static int __init smp_read_mpc(struct mp
    45.4  
    45.5  	memcpy(str,mpc->mpc_productid,12);
    45.6  	str[12]=0;
    45.7 -	printk(KERN_INFO "Product ID: %s ",str);
    45.8 +	printk("Product ID: %s ",str);
    45.9  
   45.10 -	printk(KERN_INFO "APIC at: 0x%X\n",mpc->mpc_lapic);
   45.11 +	printk("APIC at: 0x%X\n",mpc->mpc_lapic);
   45.12  
   45.13  	/* save the local APIC address, it might be non-default */
   45.14  	if (!acpi_lapic)
    46.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c	Fri Feb 24 14:03:07 2006 -0700
    46.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c	Fri Feb 24 15:41:08 2006 -0700
    46.3 @@ -289,16 +289,28 @@ void exit_thread(void)
    46.4  	kprobe_flush_task(me);
    46.5  
    46.6  	if (me->thread.io_bitmap_ptr) { 
    46.7 +#ifndef CONFIG_X86_NO_TSS
    46.8  		struct tss_struct *tss = &per_cpu(init_tss, get_cpu());
    46.9 +#endif
   46.10 +#ifdef CONFIG_XEN
   46.11 +		static physdev_op_t iobmp_op = {
   46.12 +			.cmd = PHYSDEVOP_SET_IOBITMAP
   46.13 +		};
   46.14 +#endif
   46.15  
   46.16  		kfree(t->io_bitmap_ptr);
   46.17  		t->io_bitmap_ptr = NULL;
   46.18  		/*
   46.19  		 * Careful, clear this in the TSS too:
   46.20  		 */
   46.21 +#ifndef CONFIG_X86_NO_TSS
   46.22  		memset(tss->io_bitmap, 0xff, t->io_bitmap_max);
   46.23 +		put_cpu();
   46.24 +#endif
   46.25 +#ifdef CONFIG_XEN
   46.26 +		HYPERVISOR_physdev_op(&iobmp_op);
   46.27 +#endif
   46.28  		t->io_bitmap_max = 0;
   46.29 -		put_cpu();
   46.30  	}
   46.31  }
   46.32  
   46.33 @@ -463,7 +475,9 @@ static inline void __save_init_fpu( stru
   46.34  	struct thread_struct *prev = &prev_p->thread,
   46.35  				 *next = &next_p->thread;
   46.36  	int cpu = smp_processor_id();  
   46.37 +#ifndef CONFIG_X86_NO_TSS
   46.38  	struct tss_struct *tss = &per_cpu(init_tss, cpu);
   46.39 +#endif
   46.40  	physdev_op_t iopl_op, iobmp_op;
   46.41  	multicall_entry_t _mcl[8], *mcl = _mcl;
   46.42  
   46.43 @@ -482,10 +496,9 @@ static inline void __save_init_fpu( stru
   46.44  	/*
   46.45  	 * Reload esp0, LDT and the page table pointer:
   46.46  	 */
   46.47 -	tss->rsp0 = next->rsp0;
   46.48  	mcl->op      = __HYPERVISOR_stack_switch;
   46.49  	mcl->args[0] = __KERNEL_DS;
   46.50 -	mcl->args[1] = tss->rsp0;
   46.51 +	mcl->args[1] = next->rsp0;
   46.52  	mcl++;
   46.53  
   46.54  	/*
    47.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c	Fri Feb 24 14:03:07 2006 -0700
    47.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c	Fri Feb 24 15:41:08 2006 -0700
    47.3 @@ -40,7 +40,9 @@ cpumask_t cpu_initialized __cpuinitdata 
    47.4  struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
    47.5  struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
    47.6  
    47.7 +#ifndef CONFIG_X86_NO_IDT
    47.8  struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
    47.9 +#endif
   47.10  
   47.11  char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
   47.12  
   47.13 @@ -155,13 +157,7 @@ static void switch_pt(void)
   47.14  
   47.15  void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
   47.16  {
   47.17 -#ifdef CONFIG_SMP
   47.18 -	int cpu = stack_smp_processor_id();
   47.19 -#else
   47.20 -	int cpu = smp_processor_id();
   47.21 -#endif
   47.22 -
   47.23 -	asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
   47.24 +	asm volatile("lgdt %0" :: "m" (*gdt_descr));
   47.25  	asm volatile("lidt %0" :: "m" (idt_descr));
   47.26  }
   47.27  #endif
   47.28 @@ -203,8 +199,10 @@ void pda_init(int cpu)
   47.29  	pda->irqstackptr += IRQSTACKSIZE-64;
   47.30  } 
   47.31  
   47.32 +#ifndef CONFIG_X86_NO_TSS
   47.33  char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]
   47.34  __attribute__((section(".bss.page_aligned")));
   47.35 +#endif
   47.36  
   47.37  /* May not be marked __init: used by software suspend */
   47.38  void syscall_init(void)
   47.39 @@ -246,18 +244,23 @@ void __cpuinit check_efer(void)
   47.40  void __cpuinit cpu_init (void)
   47.41  {
   47.42  	int cpu = stack_smp_processor_id();
   47.43 +#ifndef CONFIG_X86_NO_TSS
   47.44  	struct tss_struct *t = &per_cpu(init_tss, cpu);
   47.45  	unsigned long v; 
   47.46  	char *estacks = NULL; 
   47.47 +	unsigned i;
   47.48 +#endif
   47.49  	struct task_struct *me;
   47.50 -	int i;
   47.51  
   47.52  	/* CPU 0 is initialised in head64.c */
   47.53  	if (cpu != 0) {
   47.54  		pda_init(cpu);
   47.55  		zap_low_mappings(cpu);
   47.56 -	} else 
   47.57 +	}
   47.58 +#ifndef CONFIG_X86_NO_TSS
   47.59 +	else
   47.60  		estacks = boot_exception_stacks; 
   47.61 +#endif
   47.62  
   47.63  	me = current;
   47.64  
   47.65 @@ -278,12 +281,7 @@ void __cpuinit cpu_init (void)
   47.66  #endif
   47.67  
   47.68  	cpu_gdt_descr[cpu].size = GDT_SIZE;
   47.69 -#ifndef CONFIG_XEN 
   47.70 - 	asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
   47.71 - 	asm volatile("lidt %0" :: "m" (idt_descr));
   47.72 -#else
   47.73  	cpu_gdt_init(&cpu_gdt_descr[cpu]);
   47.74 -#endif
   47.75  
   47.76  	memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
   47.77  	syscall_init();
   47.78 @@ -294,6 +292,7 @@ void __cpuinit cpu_init (void)
   47.79  
   47.80  	check_efer();
   47.81  
   47.82 +#ifndef CONFIG_X86_NO_TSS
   47.83  	/*
   47.84  	 * set up and load the per-CPU TSS
   47.85  	 */
   47.86 @@ -330,6 +329,7 @@ void __cpuinit cpu_init (void)
   47.87  	 */
   47.88  	for (i = 0; i <= IO_BITMAP_LONGS; i++)
   47.89  		t->io_bitmap[i] = ~0UL;
   47.90 +#endif
   47.91  
   47.92  	atomic_inc(&init_mm.mm_count);
   47.93  	me->active_mm = &init_mm;
   47.94 @@ -337,8 +337,10 @@ void __cpuinit cpu_init (void)
   47.95  		BUG();
   47.96  	enter_lazy_tlb(&init_mm, me);
   47.97  
   47.98 +#ifndef CONFIG_X86_NO_TSS
   47.99 +	set_tss_desc(cpu, t);
  47.100 +#endif
  47.101  #ifndef CONFIG_XEN
  47.102 -	set_tss_desc(cpu, t);
  47.103  	load_TR_desc();
  47.104  #endif
  47.105  	load_LDT(&init_mm.context);
    48.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/traps-xen.c	Fri Feb 24 14:03:07 2006 -0700
    48.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/traps-xen.c	Fri Feb 24 15:41:08 2006 -0700
    48.3 @@ -47,7 +47,9 @@
    48.4  #include <asm/proto.h>
    48.5  #include <asm/nmi.h>
    48.6  
    48.7 +#ifndef CONFIG_X86_NO_IDT
    48.8  extern struct gate_struct idt_table[256]; 
    48.9 +#endif
   48.10  
   48.11  asmlinkage void divide_error(void);
   48.12  asmlinkage void debug(void);
   48.13 @@ -134,6 +136,7 @@ int printk_address(unsigned long address
   48.14  static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
   48.15  					unsigned *usedp, const char **idp)
   48.16  {
   48.17 +#ifndef CONFIG_X86_NO_TSS
   48.18  	static char ids[][8] = {
   48.19  		[DEBUG_STACK - 1] = "#DB",
   48.20  		[NMI_STACK - 1] = "NMI",
   48.21 @@ -185,6 +188,7 @@ static unsigned long *in_exception_stack
   48.22  		}
   48.23  #endif
   48.24  	}
   48.25 +#endif
   48.26  	return NULL;
   48.27  }
   48.28  
   48.29 @@ -948,28 +952,28 @@ asmlinkage void math_state_restore(void)
   48.30   * specify <dpl>|4 in the second field.
   48.31   */
   48.32  static trap_info_t trap_table[] = {
   48.33 -        {  0, 0|4, (__KERNEL_CS|0x3), (unsigned long)divide_error               },
   48.34 -        {  1, 0|4, (__KERNEL_CS|0x3), (unsigned long)debug                      },
   48.35 -        {  3, 3|4, (__KERNEL_CS|0x3), (unsigned long)int3                       },
   48.36 -        {  4, 3|4, (__KERNEL_CS|0x3), (unsigned long)overflow                   },
   48.37 -        {  5, 0|4, (__KERNEL_CS|0x3), (unsigned long)bounds                     },
   48.38 -        {  6, 0|4, (__KERNEL_CS|0x3), (unsigned long)invalid_op                 },
   48.39 -        {  7, 0|4, (__KERNEL_CS|0x3), (unsigned long)device_not_available       },
   48.40 -        {  9, 0|4, (__KERNEL_CS|0x3), (unsigned long)coprocessor_segment_overrun},
   48.41 -        { 10, 0|4, (__KERNEL_CS|0x3), (unsigned long)invalid_TSS                },
   48.42 -        { 11, 0|4, (__KERNEL_CS|0x3), (unsigned long)segment_not_present        },
   48.43 -        { 12, 0|4, (__KERNEL_CS|0x3), (unsigned long)stack_segment              },
   48.44 -        { 13, 0|4, (__KERNEL_CS|0x3), (unsigned long)general_protection         },
   48.45 -        { 14, 0|4, (__KERNEL_CS|0x3), (unsigned long)page_fault                 },
   48.46 -        { 15, 0|4, (__KERNEL_CS|0x3), (unsigned long)spurious_interrupt_bug     },
   48.47 -        { 16, 0|4, (__KERNEL_CS|0x3), (unsigned long)coprocessor_error          },
   48.48 -        { 17, 0|4, (__KERNEL_CS|0x3), (unsigned long)alignment_check            },
   48.49 +        {  0, 0|4, __KERNEL_CS, (unsigned long)divide_error               },
   48.50 +        {  1, 0|4, __KERNEL_CS, (unsigned long)debug                      },
   48.51 +        {  3, 3|4, __KERNEL_CS, (unsigned long)int3                       },
   48.52 +        {  4, 3|4, __KERNEL_CS, (unsigned long)overflow                   },
   48.53 +        {  5, 0|4, __KERNEL_CS, (unsigned long)bounds                     },
   48.54 +        {  6, 0|4, __KERNEL_CS, (unsigned long)invalid_op                 },
   48.55 +        {  7, 0|4, __KERNEL_CS, (unsigned long)device_not_available       },
   48.56 +        {  9, 0|4, __KERNEL_CS, (unsigned long)coprocessor_segment_overrun},
   48.57 +        { 10, 0|4, __KERNEL_CS, (unsigned long)invalid_TSS                },
   48.58 +        { 11, 0|4, __KERNEL_CS, (unsigned long)segment_not_present        },
   48.59 +        { 12, 0|4, __KERNEL_CS, (unsigned long)stack_segment              },
   48.60 +        { 13, 0|4, __KERNEL_CS, (unsigned long)general_protection         },
   48.61 +        { 14, 0|4, __KERNEL_CS, (unsigned long)page_fault                 },
   48.62 +        { 15, 0|4, __KERNEL_CS, (unsigned long)spurious_interrupt_bug     },
   48.63 +        { 16, 0|4, __KERNEL_CS, (unsigned long)coprocessor_error          },
   48.64 +        { 17, 0|4, __KERNEL_CS, (unsigned long)alignment_check            },
   48.65  #ifdef CONFIG_X86_MCE
   48.66 -        { 18, 0|4, (__KERNEL_CS|0x3), (unsigned long)machine_check              },
   48.67 +        { 18, 0|4, __KERNEL_CS, (unsigned long)machine_check              },
   48.68  #endif
   48.69 -        { 19, 0|4, (__KERNEL_CS|0x3), (unsigned long)simd_coprocessor_error     },
   48.70 +        { 19, 0|4, __KERNEL_CS, (unsigned long)simd_coprocessor_error     },
   48.71  #ifdef CONFIG_IA32_EMULATION
   48.72 -	{ IA32_SYSCALL_VECTOR, 3|4, (__KERNEL_CS|0x3), (unsigned long)ia32_syscall},
   48.73 +	{ IA32_SYSCALL_VECTOR, 3|4, __KERNEL_CS, (unsigned long)ia32_syscall},
   48.74  #endif
   48.75          {  0, 0,           0, 0                                              }
   48.76  };
   48.77 @@ -984,10 +988,6 @@ void __init trap_init(void)
   48.78                  printk("HYPERVISOR_set_trap_table faild: error %d\n",
   48.79                         ret);
   48.80  
   48.81 -#ifdef CONFIG_IA32_EMULATION
   48.82 -	set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
   48.83 -#endif
   48.84 -       
   48.85  	/*
   48.86  	 * Should be a barrier for any external CPU state.
   48.87  	 */
   48.88 @@ -997,12 +997,6 @@ void __init trap_init(void)
   48.89  void smp_trap_init(trap_info_t *trap_ctxt)
   48.90  {
   48.91  	trap_info_t *t = trap_table;
   48.92 -	int i;
   48.93 -
   48.94 -	for (i = 0; i < 256; i++) {
   48.95 -		trap_ctxt[i].vector = i;
   48.96 -		trap_ctxt[i].cs     = FLAT_KERNEL_CS;
   48.97 -	}
   48.98  
   48.99  	for (t = trap_table; t->address; t++) {
  48.100  		trap_ctxt[t->vector].flags = t->flags;
    49.1 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c	Fri Feb 24 14:03:07 2006 -0700
    49.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/fault-xen.c	Fri Feb 24 15:41:08 2006 -0700
    49.3 @@ -152,10 +152,7 @@ void dump_pagetable(unsigned long addres
    49.4  	pmd_t *pmd;
    49.5  	pte_t *pte;
    49.6  
    49.7 -	asm("movq %%cr3,%0" : "=r" (pgd));
    49.8 -	pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
    49.9 -
   49.10 -	pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); 
   49.11 +	pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
   49.12  	pgd += pgd_index(address);
   49.13  	if (bad_address(pgd)) goto bad;
   49.14  	printk("PGD %lx ", pgd_val(*pgd));
   49.15 @@ -261,9 +258,7 @@ static int vmalloc_fault(unsigned long a
   49.16  
   49.17  	/* On Xen the line below does not always work. Needs investigating! */
   49.18  	/*pgd = pgd_offset(current->mm ?: &init_mm, address);*/
   49.19 -	asm("movq %%cr3,%0" : "=r" (pgd));
   49.20 -	pgd = (pgd_t *)machine_to_phys((maddr_t)pgd);
   49.21 -	pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK);
   49.22 +	pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
   49.23  	pgd += pgd_index(address);
   49.24  	pgd_ref = pgd_offset_k(address);
   49.25  	if (pgd_none(*pgd_ref))
    50.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm.c	Fri Feb 24 14:03:07 2006 -0700
    50.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm.c	Fri Feb 24 15:41:08 2006 -0700
    50.3 @@ -53,7 +53,7 @@ static void timeout_work(void * ptr)
    50.4  
    50.5  	down(&chip->buffer_mutex);
    50.6  	atomic_set(&chip->data_pending, 0);
    50.7 -	memset(chip->data_buffer, 0, chip->vendor->buffersize);
    50.8 +	memset(chip->data_buffer, 0, get_chip_buffersize(chip));
    50.9  	up(&chip->buffer_mutex);
   50.10  }
   50.11  
   50.12 @@ -352,7 +352,7 @@ int tpm_open(struct inode *inode, struct
   50.13  
   50.14  	spin_unlock(&driver_lock);
   50.15  
   50.16 -	chip->data_buffer = kmalloc(chip->vendor->buffersize * sizeof(u8), GFP_KERNEL);
   50.17 +	chip->data_buffer = kmalloc(get_chip_buffersize(chip) * sizeof(u8), GFP_KERNEL);
   50.18  	if (chip->data_buffer == NULL) {
   50.19  		chip->num_opens--;
   50.20  		put_device(chip->dev);
   50.21 @@ -400,8 +400,8 @@ ssize_t tpm_write(struct file *file, con
   50.22  
   50.23  	down(&chip->buffer_mutex);
   50.24  
   50.25 -	if (in_size > chip->vendor->buffersize)
   50.26 -		in_size = chip->vendor->buffersize;
   50.27 +	if (in_size > get_chip_buffersize(chip))
   50.28 +		in_size = get_chip_buffersize(chip);
   50.29  
   50.30  	if (copy_from_user
   50.31  	    (chip->data_buffer, (void __user *) buf, in_size)) {
   50.32 @@ -411,7 +411,7 @@ ssize_t tpm_write(struct file *file, con
   50.33  
   50.34  	/* atomic tpm command send and result receive */
   50.35  	out_size = tpm_transmit(chip, chip->data_buffer, 
   50.36 -	                        chip->vendor->buffersize);
   50.37 +	                        get_chip_buffersize(chip));
   50.38  
   50.39  	atomic_set(&chip->data_pending, out_size);
   50.40  	atomic_set(&chip->data_position, 0);
   50.41 @@ -432,8 +432,6 @@ ssize_t tpm_read(struct file * file, cha
   50.42  	int ret_size;
   50.43  	int pos, pending = 0;
   50.44  
   50.45 -	del_singleshot_timer_sync(&chip->user_read_timer);
   50.46 -	flush_scheduled_work();
   50.47  	ret_size = atomic_read(&chip->data_pending);
   50.48  	if (ret_size > 0) {	/* relay data */
   50.49  		if (size < ret_size)
   50.50 @@ -457,6 +455,7 @@ ssize_t tpm_read(struct file * file, cha
   50.51  	if ( ret_size <= 0 || pending == 0 ) {
   50.52  		atomic_set( &chip->data_pending, 0 );
   50.53  		del_singleshot_timer_sync(&chip->user_read_timer);
   50.54 +		flush_scheduled_work();
   50.55  	}
   50.56  
   50.57  	return ret_size;
    51.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm.h	Fri Feb 24 14:03:07 2006 -0700
    51.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm.h	Fri Feb 24 15:41:08 2006 -0700
    51.3 @@ -101,6 +101,11 @@ static inline void tpm_write_index(int b
    51.4  	outb(value & 0xFF, base+1);
    51.5  }
    51.6  
    51.7 +static inline u32 get_chip_buffersize(struct tpm_chip *chip)
    51.8 +{
    51.9 +	return chip->vendor->buffersize;
   51.10 +}
   51.11 +
   51.12  extern int tpm_register_hardware(struct device *,
   51.13  				 struct tpm_vendor_specific *);
   51.14  extern int tpm_open(struct inode *, struct file *);
    52.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Fri Feb 24 14:03:07 2006 -0700
    52.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Fri Feb 24 15:41:08 2006 -0700
    52.3 @@ -25,6 +25,7 @@
    52.4  #include <xen/tpmfe.h>
    52.5  #include <linux/device.h>
    52.6  #include <linux/interrupt.h>
    52.7 +#include <linux/platform_device.h>
    52.8  #include "tpm.h"
    52.9  
   52.10  /* read status bits */
   52.11 @@ -455,9 +456,7 @@ static struct tpm_vendor_specific tpm_xe
   52.12  	.buffersize = 64 * 1024,
   52.13  };
   52.14  
   52.15 -static struct device tpm_device = {
   52.16 -	.bus_id = "vtpm",
   52.17 -};
   52.18 +static struct platform_device *pdev;
   52.19  
   52.20  static struct tpmfe_device tpmfe = {
   52.21  	.receive = tpm_recv,
   52.22 @@ -477,23 +476,22 @@ static int __init init_xen(void)
   52.23  	 * driver
   52.24  	 */
   52.25  	if ((rc = tpm_fe_register_receiver(&tpmfe)) < 0) {
   52.26 -		return rc;
   52.27 +		goto err_exit;
   52.28  	}
   52.29  
   52.30  	/*
   52.31  	 * Register our device with the system.
   52.32  	 */
   52.33 -	if ((rc = device_register(&tpm_device)) < 0) {
   52.34 -		tpm_fe_unregister_receiver();
   52.35 -		return rc;
   52.36 +	pdev = platform_device_register_simple("tpm_vtpm", -1, NULL, 0);
   52.37 +	if (IS_ERR(pdev)) {
   52.38 +		rc = PTR_ERR(pdev);
   52.39 +		goto err_unreg_fe;
   52.40  	}
   52.41  
   52.42  	tpm_xen.buffersize = tpmfe.max_tx_size;
   52.43  
   52.44 -	if ((rc = tpm_register_hardware(&tpm_device, &tpm_xen)) < 0) {
   52.45 -		device_unregister(&tpm_device);
   52.46 -		tpm_fe_unregister_receiver();
   52.47 -		return rc;
   52.48 +	if ((rc = tpm_register_hardware(&pdev->dev, &tpm_xen)) < 0) {
   52.49 +		goto err_unreg_pdev;
   52.50  	}
   52.51  
   52.52  	dataex.current_request = NULL;
   52.53 @@ -508,13 +506,25 @@ static int __init init_xen(void)
   52.54  	disconnect_time = jiffies;
   52.55  
   52.56  	return 0;
   52.57 +
   52.58 +
   52.59 +err_unreg_pdev:
   52.60 +	platform_device_unregister(pdev);
   52.61 +err_unreg_fe:
   52.62 +	tpm_fe_unregister_receiver();
   52.63 +
   52.64 +err_exit:
   52.65 +	return rc;
   52.66  }
   52.67  
   52.68  static void __exit cleanup_xen(void)
   52.69  {
   52.70 -	tpm_remove_hardware(&tpm_device);
   52.71 -	device_unregister(&tpm_device);
   52.72 -	tpm_fe_unregister_receiver();
   52.73 +	struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);
   52.74 +	if (chip) {
   52.75 +		tpm_remove_hardware(chip->dev);
   52.76 +		platform_device_unregister(pdev);
   52.77 +		tpm_fe_unregister_receiver();
   52.78 +	}
   52.79  }
   52.80  
   52.81  module_init(init_xen);
    53.1 --- a/linux-2.6-xen-sparse/drivers/char/tty_io.c	Fri Feb 24 14:03:07 2006 -0700
    53.2 +++ b/linux-2.6-xen-sparse/drivers/char/tty_io.c	Fri Feb 24 15:41:08 2006 -0700
    53.3 @@ -1843,7 +1843,6 @@ static void release_dev(struct file * fi
    53.4  		tty_closing = tty->count <= 1;
    53.5  		o_tty_closing = o_tty &&
    53.6  			(o_tty->count <= (pty_master ? 1 : 0));
    53.7 -		up(&tty_sem);
    53.8  		do_sleep = 0;
    53.9  
   53.10  		if (tty_closing) {
   53.11 @@ -1871,6 +1870,7 @@ static void release_dev(struct file * fi
   53.12  
   53.13  		printk(KERN_WARNING "release_dev: %s: read/write wait queue "
   53.14  				    "active!\n", tty_name(tty, buf));
   53.15 +		up(&tty_sem);
   53.16  		schedule();
   53.17  	}	
   53.18  
   53.19 @@ -1879,8 +1879,6 @@ static void release_dev(struct file * fi
   53.20  	 * both sides, and we've completed the last operation that could 
   53.21  	 * block, so it's safe to proceed with closing.
   53.22  	 */
   53.23 -	 
   53.24 -	down(&tty_sem);
   53.25  	if (pty_master) {
   53.26  		if (--o_tty->count < 0) {
   53.27  			printk(KERN_WARNING "release_dev: bad pty slave count "
   53.28 @@ -1894,7 +1892,6 @@ static void release_dev(struct file * fi
   53.29  		       tty->count, tty_name(tty, buf));
   53.30  		tty->count = 0;
   53.31  	}
   53.32 -	up(&tty_sem);
   53.33  	
   53.34  	/*
   53.35  	 * We've decremented tty->count, so we need to remove this file
   53.36 @@ -1939,6 +1936,8 @@ static void release_dev(struct file * fi
   53.37  		read_unlock(&tasklist_lock);
   53.38  	}
   53.39  
   53.40 +	up(&tty_sem);
   53.41 +
   53.42  	/* check whether both sides are closing ... */
   53.43  	if (!tty_closing || (o_tty && !o_tty_closing))
   53.44  		return;
    54.1 --- a/linux-2.6-xen-sparse/drivers/serial/Kconfig	Fri Feb 24 14:03:07 2006 -0700
    54.2 +++ b/linux-2.6-xen-sparse/drivers/serial/Kconfig	Fri Feb 24 15:41:08 2006 -0700
    54.3 @@ -903,8 +903,8 @@ config SERIAL_JSM
    54.4  	  something like this to connect more than two modems to your Linux
    54.5  	  box, for instance in order to become a dial-in server. This driver
    54.6  	  supports PCI boards only.
    54.7 -	  If you have a card like this, say Y here and read the file
    54.8 -	  <file:Documentation/jsm.txt>.
    54.9 +
   54.10 +	  If you have a card like this, say Y here, otherwise say N.
   54.11  
   54.12  	  To compile this driver as a module, choose M here: the
   54.13  	  module will be called jsm.
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/linux-2.6-xen-sparse/drivers/video/Kconfig	Fri Feb 24 15:41:08 2006 -0700
    55.3 @@ -0,0 +1,1462 @@
    55.4 +#
    55.5 +# Video configuration
    55.6 +#
    55.7 +
    55.8 +menu "Graphics support"
    55.9 +
   55.10 +config FB
   55.11 +	tristate "Support for frame buffer devices"
   55.12 +	---help---
   55.13 +	  The frame buffer device provides an abstraction for the graphics
   55.14 +	  hardware. It represents the frame buffer of some video hardware and
   55.15 +	  allows application software to access the graphics hardware through
   55.16 +	  a well-defined interface, so the software doesn't need to know
   55.17 +	  anything about the low-level (hardware register) stuff.
   55.18 +
   55.19 +	  Frame buffer devices work identically across the different
   55.20 +	  architectures supported by Linux and make the implementation of
   55.21 +	  application programs easier and more portable; at this point, an X
   55.22 +	  server exists which uses the frame buffer device exclusively.
   55.23 +	  On several non-X86 architectures, the frame buffer device is the
   55.24 +	  only way to use the graphics hardware.
   55.25 +
   55.26 +	  The device is accessed through special device nodes, usually located
   55.27 +	  in the /dev directory, i.e. /dev/fb*.
   55.28 +
   55.29 +	  You need an utility program called fbset to make full use of frame
   55.30 +	  buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
   55.31 +	  and the Framebuffer-HOWTO at
   55.32 +	  <http://www.tahallah.demon.co.uk/programming/prog.html> for more
   55.33 +	  information.
   55.34 +
   55.35 +	  Say Y here and to the driver for your graphics board below if you
   55.36 +	  are compiling a kernel for a non-x86 architecture.
   55.37 +
   55.38 +	  If you are compiling for the x86 architecture, you can say Y if you
   55.39 +	  want to play with it, but it is not essential. Please note that
   55.40 +	  running graphical applications that directly touch the hardware
   55.41 +	  (e.g. an accelerated X server) and that are not frame buffer
   55.42 +	  device-aware may cause unexpected results. If unsure, say N.
   55.43 +
   55.44 +config FB_CFB_FILLRECT
   55.45 +	tristate
   55.46 +	depends on FB
   55.47 +	default n
   55.48 +	---help---
   55.49 +	  Include the cfb_fillrect function for generic software rectangle
   55.50 +	  filling. This is used by drivers that don't provide their own
   55.51 +	  (accelerated) version.
   55.52 +
   55.53 +config FB_CFB_COPYAREA
   55.54 +	tristate
   55.55 +	depends on FB
   55.56 +	default n
   55.57 +	---help---
   55.58 +	  Include the cfb_copyarea function for generic software area copying.
   55.59 +	  This is used by drivers that don't provide their own (accelerated)
   55.60 +	  version.
   55.61 +
   55.62 +config FB_CFB_IMAGEBLIT
   55.63 +	tristate
   55.64 +	depends on FB
   55.65 +	default n
   55.66 +	---help---
   55.67 +	  Include the cfb_imageblit function for generic software image
   55.68 +	  blitting. This is used by drivers that don't provide their own
   55.69 +	  (accelerated) version.
   55.70 +
   55.71 +config FB_MACMODES
   55.72 +       tristate
   55.73 +       depends on FB
   55.74 +       default n
   55.75 +
   55.76 +config FB_MODE_HELPERS
   55.77 +        bool "Enable Video Mode Handling Helpers"
   55.78 +        depends on FB
   55.79 +	default n
   55.80 +	---help---
   55.81 +	  This enables functions for handling video modes using the
   55.82 +	  Generalized Timing Formula and the EDID parser. A few drivers rely
   55.83 +          on this feature such as the radeonfb, rivafb, and the i810fb. If
   55.84 +	  your driver does not take advantage of this feature, choosing Y will
   55.85 +	  just increase the kernel size by about 5K.
   55.86 +
   55.87 +config FB_TILEBLITTING
   55.88 +       bool "Enable Tile Blitting Support"
   55.89 +       depends on FB
   55.90 +       default n
   55.91 +       ---help---
   55.92 +         This enables tile blitting.  Tile blitting is a drawing technique
   55.93 +	 where the screen is divided into rectangular sections (tiles), whereas
   55.94 +	 the standard blitting divides the screen into pixels. Because the
   55.95 +	 default drawing element is a tile, drawing functions will be passed
   55.96 +	 parameters in terms of number of tiles instead of number of pixels.
   55.97 +	 For example, to draw a single character, instead of using bitmaps,
   55.98 +	 an index to an array of bitmaps will be used.  To clear or move a
   55.99 +	 rectangular section of a screen, the rectangle will be described in
  55.100 +	 terms of number of tiles in the x- and y-axis.
  55.101 +
  55.102 +	 This is particularly important to one driver, matroxfb.  If
  55.103 +	 unsure, say N.
  55.104 +
  55.105 +config FB_CIRRUS
  55.106 +	tristate "Cirrus Logic support"
  55.107 +	depends on FB && (ZORRO || PCI)
  55.108 +	select FB_CFB_FILLRECT
  55.109 +	select FB_CFB_COPYAREA
  55.110 +	select FB_CFB_IMAGEBLIT
  55.111 +	---help---
  55.112 +	  This enables support for Cirrus Logic GD542x/543x based boards on
  55.113 +	  Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum.
  55.114 +
  55.115 +	  If you have a PCI-based system, this enables support for these
  55.116 +	  chips: GD-543x, GD-544x, GD-5480.
  55.117 +
  55.118 +	  Please read the file <file:Documentation/fb/cirrusfb.txt>.
  55.119 +
  55.120 +	  Say N unless you have such a graphics board or plan to get one
  55.121 +	  before you next recompile the kernel.
  55.122 +
  55.123 +config FB_PM2
  55.124 +	tristate "Permedia2 support"
  55.125 +	depends on FB && ((AMIGA && BROKEN) || PCI)
  55.126 +	select FB_CFB_FILLRECT
  55.127 +	select FB_CFB_COPYAREA
  55.128 +	select FB_CFB_IMAGEBLIT
  55.129 +	help
  55.130 +	  This is the frame buffer device driver for the Permedia2 AGP frame
  55.131 +	  buffer card from ASK, aka `Graphic Blaster Exxtreme'.  There is a
  55.132 +	  product page at
  55.133 +	  <http://www.ask.com.hk/product/Permedia%202/permedia2.htm>.
  55.134 +
  55.135 +config FB_PM2_FIFO_DISCONNECT
  55.136 +	bool "enable FIFO disconnect feature"
  55.137 +	depends on FB_PM2 && PCI
  55.138 +	help
  55.139 +	  Support the Permedia2 FIFO disconnect feature (see CONFIG_FB_PM2).
  55.140 +
  55.141 +config FB_ARMCLCD
  55.142 +	tristate "ARM PrimeCell PL110 support"
  55.143 +	depends on FB && ARM && ARM_AMBA
  55.144 +	select FB_CFB_FILLRECT
  55.145 +	select FB_CFB_COPYAREA
  55.146 +	select FB_CFB_IMAGEBLIT
  55.147 +	help
  55.148 +	  This framebuffer device driver is for the ARM PrimeCell PL110
  55.149 +	  Colour LCD controller.  ARM PrimeCells provide the building
  55.150 +	  blocks for System on a Chip devices.
  55.151 +
  55.152 +	  If you want to compile this as a module (=code which can be
  55.153 +	  inserted into and removed from the running kernel), say M
  55.154 +	  here and read <file:Documentation/modules.txt>.  The module
  55.155 +	  will be called amba-clcd.
  55.156 +
  55.157 +config FB_ACORN
  55.158 +	bool "Acorn VIDC support"
  55.159 +	depends on (FB = y) && ARM && (ARCH_ACORN || ARCH_CLPS7500)
  55.160 +	select FB_CFB_FILLRECT
  55.161 +	select FB_CFB_COPYAREA
  55.162 +	select FB_CFB_IMAGEBLIT
  55.163 +	help
  55.164 +	  This is the frame buffer device driver for the Acorn VIDC graphics
  55.165 +	  hardware found in Acorn RISC PCs and other ARM-based machines.  If
  55.166 +	  unsure, say N.
  55.167 +
  55.168 +config FB_CLPS711X
  55.169 +	bool "CLPS711X LCD support"
  55.170 +	depends on (FB = y) && ARM && ARCH_CLPS711X
  55.171 +	select FB_CFB_FILLRECT
  55.172 +	select FB_CFB_COPYAREA
  55.173 +	select FB_CFB_IMAGEBLIT
  55.174 +	help
  55.175 +	  Say Y to enable the Framebuffer driver for the CLPS7111 and
  55.176 +	  EP7212 processors.
  55.177 +
  55.178 +config FB_SA1100
  55.179 +	bool "SA-1100 LCD support"
  55.180 +	depends on (FB = y) && ARM && ARCH_SA1100
  55.181 +	select FB_CFB_FILLRECT
  55.182 +	select FB_CFB_COPYAREA
  55.183 +	select FB_CFB_IMAGEBLIT
  55.184 +	help
  55.185 +	  This is a framebuffer device for the SA-1100 LCD Controller.
  55.186 +	  See <http://www.linux-fbdev.org/> for information on framebuffer
  55.187 +	  devices.
  55.188 +
  55.189 +	  If you plan to use the LCD display with your SA-1100 system, say
  55.190 +	  Y here.
  55.191 +
  55.192 +config FB_IMX
  55.193 +	tristate "Motorola i.MX LCD support"
  55.194 +	depends on FB && ARM && ARCH_IMX
  55.195 +	select FB_CFB_FILLRECT
  55.196 +	select FB_CFB_COPYAREA
  55.197 +	select FB_CFB_IMAGEBLIT
  55.198 +
  55.199 +config FB_CYBER2000
  55.200 +	tristate "CyberPro 2000/2010/5000 support"
  55.201 +	depends on FB && PCI && (BROKEN || !SPARC64)
  55.202 +	select FB_CFB_FILLRECT
  55.203 +	select FB_CFB_COPYAREA
  55.204 +	select FB_CFB_IMAGEBLIT
  55.205 +	help
  55.206 +	  This enables support for the Integraphics CyberPro 20x0 and 5000
  55.207 +	  VGA chips used in the Rebel.com Netwinder and other machines.
  55.208 +	  Say Y if you have a NetWinder or a graphics card containing this
  55.209 +	  device, otherwise say N.
  55.210 +
  55.211 +config FB_APOLLO
  55.212 +	bool
  55.213 +	depends on (FB = y) && APOLLO
  55.214 +	default y
  55.215 +	select FB_CFB_FILLRECT
  55.216 +	select FB_CFB_IMAGEBLIT
  55.217 +
  55.218 +config FB_Q40
  55.219 +	bool
  55.220 +	depends on (FB = y) && Q40
  55.221 +	default y
  55.222 +	select FB_CFB_FILLRECT
  55.223 +	select FB_CFB_COPYAREA
  55.224 +	select FB_CFB_IMAGEBLIT
  55.225 +
  55.226 +config FB_AMIGA
  55.227 +	tristate "Amiga native chipset support"
  55.228 +	depends on FB && AMIGA
  55.229 +	help
  55.230 +	  This is the frame buffer device driver for the builtin graphics
  55.231 +	  chipset found in Amigas.
  55.232 +
  55.233 +	  To compile this driver as a module, choose M here: the
  55.234 +	  module will be called amifb.
  55.235 +
  55.236 +config FB_AMIGA_OCS
  55.237 +	bool "Amiga OCS chipset support"
  55.238 +	depends on FB_AMIGA
  55.239 +	help
  55.240 +	  This enables support for the original Agnus and Denise video chips,
  55.241 +	  found in the Amiga 1000 and most A500's and A2000's. If you intend
  55.242 +	  to run Linux on any of these systems, say Y; otherwise say N.
  55.243 +
  55.244 +config FB_AMIGA_ECS
  55.245 +	bool "Amiga ECS chipset support"
  55.246 +	depends on FB_AMIGA
  55.247 +	help
  55.248 +	  This enables support for the Enhanced Chip Set, found in later
  55.249 +	  A500's, later A2000's, the A600, the A3000, the A3000T and CDTV. If
  55.250 +	  you intend to run Linux on any of these systems, say Y; otherwise
  55.251 +	  say N.
  55.252 +
  55.253 +config FB_AMIGA_AGA
  55.254 +	bool "Amiga AGA chipset support"
  55.255 +	depends on FB_AMIGA
  55.256 +	help
  55.257 +	  This enables support for the Advanced Graphics Architecture (also
  55.258 +	  known as the AGA or AA) Chip Set, found in the A1200, A4000, A4000T
  55.259 +	  and CD32. If you intend to run Linux on any of these systems, say Y;
  55.260 +	  otherwise say N.
  55.261 +
  55.262 +config FB_CYBER
  55.263 +	tristate "Amiga CyberVision 64 support"
  55.264 +	depends on FB && ZORRO && BROKEN
  55.265 +	select FB_CFB_FILLRECT
  55.266 +	select FB_CFB_COPYAREA
  55.267 +	select FB_CFB_IMAGEBLIT
  55.268 +	help
  55.269 +	  This enables support for the Cybervision 64 graphics card from
  55.270 +	  Phase5. Please note that its use is not all that intuitive (i.e. if
  55.271 +	  you have any questions, be sure to ask!). Say N unless you have a
  55.272 +	  Cybervision 64 or plan to get one before you next recompile the
  55.273 +	  kernel. Please note that this driver DOES NOT support the
  55.274 +	  Cybervision 64/3D card, as they use incompatible video chips.
  55.275 +
  55.276 +config FB_VIRGE
  55.277 +	bool "Amiga CyberVision 64/3D support "
  55.278 +	depends on (FB = y) && ZORRO && BROKEN
  55.279 +	select FB_CFB_FILLRECT
  55.280 +	select FB_CFB_COPYAREA
  55.281 +	select FB_CFB_IMAGEBLIT
  55.282 +	help
  55.283 +	  This enables support for the Cybervision 64/3D graphics card from
  55.284 +	  Phase5. Please note that its use is not all that intuitive (i.e. if
  55.285 +	  you have any questions, be sure to ask!). Say N unless you have a
  55.286 +	  Cybervision 64/3D or plan to get one before you next recompile the
  55.287 +	  kernel. Please note that this driver DOES NOT support the older
  55.288 +	  Cybervision 64 card, as they use incompatible video chips.
  55.289 +
  55.290 +config FB_RETINAZ3
  55.291 +	tristate "Amiga Retina Z3 support"
  55.292 +	depends on (FB = y) && ZORRO && BROKEN
  55.293 +	help
  55.294 +	  This enables support for the Retina Z3 graphics card. Say N unless
  55.295 +	  you have a Retina Z3 or plan to get one before you next recompile
  55.296 +	  the kernel.
  55.297 +
  55.298 +config FB_FM2
  55.299 +	bool "Amiga FrameMaster II/Rainbow II support"
  55.300 +	depends on (FB = y) && ZORRO
  55.301 +	select FB_CFB_FILLRECT
  55.302 +	select FB_CFB_COPYAREA
  55.303 +	select FB_CFB_IMAGEBLIT
  55.304 +	help
  55.305 +	  This is the frame buffer device driver for the Amiga FrameMaster
  55.306 +	  card from BSC (exhibited 1992 but not shipped as a CBM product).
  55.307 +
  55.308 +config FB_ARC
  55.309 +	tristate "Arc Monochrome LCD board support"
  55.310 +	depends on FB && X86
  55.311 +	select FB_CFB_FILLRECT
  55.312 +	select FB_CFB_COPYAREA
  55.313 +	select FB_CFB_IMAGEBLIT
  55.314 +	help
  55.315 +	  This enables support for the Arc Monochrome LCD board. The board
  55.316 +	  is based on the KS-108 lcd controller and is typically a matrix
  55.317 +	  of 2*n chips. This driver was tested with a 128x64 panel. This
  55.318 +	  driver supports it for use with x86 SBCs through a 16 bit GPIO
  55.319 +	  interface (8 bit data, 8 bit control). If you anticpate using
  55.320 +	  this driver, say Y or M; otherwise say N. You must specify the
  55.321 +	  GPIO IO address to be used for setting control and data.
  55.322 +
  55.323 +config FB_ATARI
  55.324 +	bool "Atari native chipset support"
  55.325 +	depends on (FB = y) && ATARI && BROKEN
  55.326 +	help
  55.327 +	  This is the frame buffer device driver for the builtin graphics
  55.328 +	  chipset found in Ataris.
  55.329 +
  55.330 +config FB_OF
  55.331 +	bool "Open Firmware frame buffer device support"
  55.332 +	depends on (FB = y) && (PPC64 || PPC_OF)
  55.333 +	select FB_CFB_FILLRECT
  55.334 +	select FB_CFB_COPYAREA
  55.335 +	select FB_CFB_IMAGEBLIT
  55.336 +	select FB_MACMODES
  55.337 +	help
  55.338 +	  Say Y if you want support with Open Firmware for your graphics
  55.339 +	  board.
  55.340 +
  55.341 +config FB_CONTROL
  55.342 +	bool "Apple \"control\" display support"
  55.343 +	depends on (FB = y) && PPC_PMAC
  55.344 +	select FB_CFB_FILLRECT
  55.345 +	select FB_CFB_COPYAREA
  55.346 +	select FB_CFB_IMAGEBLIT
  55.347 +	select FB_MACMODES
  55.348 +	help
  55.349 +	  This driver supports a frame buffer for the graphics adapter in the
  55.350 +	  Power Macintosh 7300 and others.
  55.351 +
  55.352 +config FB_PLATINUM
  55.353 +	bool "Apple \"platinum\" display support"
  55.354 +	depends on (FB = y) && PPC_PMAC
  55.355 +	select FB_CFB_FILLRECT
  55.356 +	select FB_CFB_COPYAREA
  55.357 +	select FB_CFB_IMAGEBLIT
  55.358 +	select FB_MACMODES
  55.359 +	help
  55.360 +	  This driver supports a frame buffer for the "platinum" graphics
  55.361 +	  adapter in some Power Macintoshes.
  55.362 +
  55.363 +config FB_VALKYRIE
  55.364 +	bool "Apple \"valkyrie\" display support"
  55.365 +	depends on (FB = y) && (MAC || PPC_PMAC)
  55.366 +	select FB_CFB_FILLRECT
  55.367 +	select FB_CFB_COPYAREA
  55.368 +	select FB_CFB_IMAGEBLIT
  55.369 +	select FB_MACMODES
  55.370 +	help
  55.371 +	  This driver supports a frame buffer for the "valkyrie" graphics
  55.372 +	  adapter in some Power Macintoshes.
  55.373 +
  55.374 +config FB_CT65550
  55.375 +	bool "Chips 65550 display support"
  55.376 +	depends on (FB = y) && PPC
  55.377 +	select FB_CFB_FILLRECT
  55.378 +	select FB_CFB_COPYAREA
  55.379 +	select FB_CFB_IMAGEBLIT
  55.380 +	help
  55.381 +	  This is the frame buffer device driver for the Chips & Technologies
  55.382 +	  65550 graphics chip in PowerBooks.
  55.383 +
  55.384 +config FB_ASILIANT
  55.385 +	bool "Asiliant (Chips) 69000 display support"
  55.386 +	depends on (FB = y) && PCI
  55.387 +	select FB_CFB_FILLRECT
  55.388 +	select FB_CFB_COPYAREA
  55.389 +	select FB_CFB_IMAGEBLIT
  55.390 +
  55.391 +config FB_IMSTT
  55.392 +	bool "IMS Twin Turbo display support"
  55.393 +	depends on (FB = y) && PCI
  55.394 +	select FB_CFB_IMAGEBLIT
  55.395 +	select FB_MACMODES if PPC
  55.396 +	help
  55.397 +	  The IMS Twin Turbo is a PCI-based frame buffer card bundled with
  55.398 +	  many Macintosh and compatible computers.
  55.399 +
  55.400 +config FB_VGA16
  55.401 +	tristate "VGA 16-color graphics support"
  55.402 +	depends on FB && (X86 || PPC)
  55.403 +	select FB_CFB_FILLRECT
  55.404 +	select FB_CFB_COPYAREA
  55.405 +	select FB_CFB_IMAGEBLIT
  55.406 +	help
  55.407 +	  This is the frame buffer device driver for VGA 16 color graphic
  55.408 +	  cards. Say Y if you have such a card.
  55.409 +
  55.410 +	  To compile this driver as a module, choose M here: the
  55.411 +	  module will be called vga16fb.
  55.412 +
  55.413 +config FB_STI
  55.414 +	tristate "HP STI frame buffer device support"
  55.415 +	depends on FB && PARISC
  55.416 +	select FB_CFB_FILLRECT
  55.417 +	select FB_CFB_COPYAREA
  55.418 +	select FB_CFB_IMAGEBLIT
  55.419 +	default y
  55.420 +	---help---
  55.421 +	  STI refers to the HP "Standard Text Interface" which is a set of
  55.422 +	  BIOS routines contained in a ROM chip in HP PA-RISC based machines.
  55.423 +	  Enabling this option will implement the linux framebuffer device
  55.424 +	  using calls to the STI BIOS routines for initialisation.
  55.425 +	
  55.426 +	  If you enable this option, you will get a planar framebuffer device
  55.427 +	  /dev/fb which will work on the most common HP graphic cards of the
  55.428 +	  NGLE family, including the artist chips (in the 7xx and Bxxx series),
  55.429 +	  HCRX, HCRX24, CRX, CRX24 and VisEG series.
  55.430 +
  55.431 +	  It is safe to enable this option, so you should probably say "Y".
  55.432 +
  55.433 +config FB_MAC
  55.434 +	bool "Generic Macintosh display support"
  55.435 +	depends on (FB = y) && MAC
  55.436 +	select FB_CFB_FILLRECT
  55.437 +	select FB_CFB_COPYAREA
  55.438 +	select FB_CFB_IMAGEBLIT
  55.439 +	select FB_MACMODES
  55.440 +
  55.441 +#      bool '  Apple DAFB display support' CONFIG_FB_DAFB
  55.442 +config FB_HP300
  55.443 +	bool
  55.444 +	depends on (FB = y) && HP300
  55.445 +	select FB_CFB_FILLRECT
  55.446 +	select FB_CFB_IMAGEBLIT
  55.447 +	default y
  55.448 +
  55.449 +config FB_TGA
  55.450 +	tristate "TGA framebuffer support"
  55.451 +	depends on FB && ALPHA
  55.452 +	select FB_CFB_FILLRECT
  55.453 +	select FB_CFB_COPYAREA
  55.454 +	select FB_CFB_IMAGEBLIT
  55.455 +	help
  55.456 +	  This is the frame buffer device driver for generic TGA graphic
  55.457 +	  cards. Say Y if you have one of those.
  55.458 +
  55.459 +config FB_VESA
  55.460 +	bool "VESA VGA graphics support"
  55.461 +	depends on (FB = y) && X86
  55.462 +	select FB_CFB_FILLRECT
  55.463 +	select FB_CFB_COPYAREA
  55.464 +	select FB_CFB_IMAGEBLIT
  55.465 +	help
  55.466 +	  This is the frame buffer device driver for generic VESA 2.0
  55.467 +	  compliant graphic cards. The older VESA 1.2 cards are not supported.
  55.468 +	  You will get a boot time penguin logo at no additional cost. Please
  55.469 +	  read <file:Documentation/fb/vesafb.txt>. If unsure, say Y.
  55.470 +
  55.471 +config VIDEO_SELECT
  55.472 +	bool
  55.473 +	depends on FB_VESA
  55.474 +	default y
  55.475 +
  55.476 +config FB_HGA
  55.477 +	tristate "Hercules mono graphics support"
  55.478 +	depends on FB && X86
  55.479 +	select FB_CFB_FILLRECT
  55.480 +	select FB_CFB_COPYAREA
  55.481 +	select FB_CFB_IMAGEBLIT
  55.482 +	help
  55.483 +	  Say Y here if you have a Hercules mono graphics card.
  55.484 +
  55.485 +	  To compile this driver as a module, choose M here: the
  55.486 +	  module will be called hgafb.
  55.487 +
  55.488 +	  As this card technology is 15 years old, most people will answer N
  55.489 +	  here.
  55.490 +
  55.491 +config FB_HGA_ACCEL
  55.492 +	bool "Hercules mono Acceleration functions (EXPERIMENTAL)"
  55.493 +	depends on FB_HGA && EXPERIMENTAL
  55.494 +	---help---
  55.495 +	This will compile the Hercules mono graphics with
  55.496 +	acceleration functions.
  55.497 +
  55.498 +
  55.499 +config VIDEO_SELECT
  55.500 +	bool
  55.501 +	depends on (FB = y) && X86 && !XEN
  55.502 +	default y
  55.503 +
  55.504 +config FB_SGIVW
  55.505 +	tristate "SGI Visual Workstation framebuffer support"
  55.506 +	depends on FB && X86_VISWS
  55.507 +	select FB_CFB_FILLRECT
  55.508 +	select FB_CFB_COPYAREA
  55.509 +	select FB_CFB_IMAGEBLIT
  55.510 +	help
  55.511 +	  SGI Visual Workstation support for framebuffer graphics.
  55.512 +
  55.513 +config FB_GBE
  55.514 +	bool "SGI Graphics Backend frame buffer support"
  55.515 +	depends on (FB = y) && (SGI_IP32 || X86_VISWS)
  55.516 +	select FB_CFB_FILLRECT
  55.517 +	select FB_CFB_COPYAREA
  55.518 +	select FB_CFB_IMAGEBLIT
  55.519 + 	help
  55.520 +	  This is the frame buffer device driver for SGI Graphics Backend.
  55.521 +	  This chip is used in SGI O2 and Visual Workstation 320/540.
  55.522 +
  55.523 +config FB_GBE_MEM
  55.524 +	int "Video memory size in MB"
  55.525 +	depends on FB_GBE
  55.526 +	default 8
  55.527 +	help
  55.528 +	  This is the amount of memory reserved for the framebuffer,
  55.529 +	  which can be any value between 1MB and 8MB.
  55.530 +
  55.531 +config FB_SUN3
  55.532 +	bool "Sun3 framebuffer support"
  55.533 +	depends on (FB = y) && (SUN3 || SUN3X) && BROKEN
  55.534 +
  55.535 +config FB_SBUS
  55.536 +	bool "SBUS and UPA framebuffers"
  55.537 +	depends on (FB = y) && SPARC
  55.538 +	help
  55.539 +	  Say Y if you want support for SBUS or UPA based frame buffer device.
  55.540 +
  55.541 +config FB_BW2
  55.542 +	bool "BWtwo support"
  55.543 +	depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
  55.544 +	select FB_CFB_FILLRECT
  55.545 +	select FB_CFB_COPYAREA
  55.546 +	select FB_CFB_IMAGEBLIT
  55.547 +	help
  55.548 +	  This is the frame buffer device driver for the BWtwo frame buffer.
  55.549 +
  55.550 +config FB_CG3
  55.551 +	bool "CGthree support"
  55.552 +	depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
  55.553 +	select FB_CFB_FILLRECT
  55.554 +	select FB_CFB_COPYAREA
  55.555 +	select FB_CFB_IMAGEBLIT
  55.556 +	help
  55.557 +	  This is the frame buffer device driver for the CGthree frame buffer.
  55.558 +
  55.559 +config FB_CG6
  55.560 +	bool "CGsix (GX,TurboGX) support"
  55.561 +	depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
  55.562 +	select FB_CFB_COPYAREA
  55.563 +	select FB_CFB_IMAGEBLIT
  55.564 +	help
  55.565 +	  This is the frame buffer device driver for the CGsix (GX, TurboGX)
  55.566 +	  frame buffer.
  55.567 +
  55.568 +config FB_PVR2
  55.569 +	tristate "NEC PowerVR 2 display support"
  55.570 +	depends on FB && SH_DREAMCAST
  55.571 +	select FB_CFB_FILLRECT
  55.572 +	select FB_CFB_COPYAREA
  55.573 +	select FB_CFB_IMAGEBLIT
  55.574 +	---help---
  55.575 +	  Say Y here if you have a PowerVR 2 card in your box.  If you plan to
  55.576 +	  run linux on your Dreamcast, you will have to say Y here.
  55.577 +	  This driver may or may not work on other PowerVR 2 cards, but is
  55.578 +	  totally untested.  Use at your own risk.  If unsure, say N.
  55.579 +
  55.580 +	  To compile this driver as a module, choose M here: the
  55.581 +	  module will be called pvr2fb.
  55.582 +
  55.583 +	  You can pass several parameters to the driver at boot time or at
  55.584 +	  module load time.  The parameters look like "video=pvr2:XXX", where
  55.585 +	  the meaning of XXX can be found at the end of the main source file
  55.586 +	  (<file:drivers/video/pvr2fb.c>). Please see the file
  55.587 +	  <file:Documentation/fb/pvr2fb.txt>.
  55.588 +
  55.589 +config FB_EPSON1355
  55.590 +	bool "Epson 1355 framebuffer support"
  55.591 +	depends on (FB = y) && (SUPERH || ARCH_CEIVA)
  55.592 +	select FB_CFB_FILLRECT
  55.593 +	select FB_CFB_COPYAREA
  55.594 +	select FB_CFB_IMAGEBLIT
  55.595 +	help
  55.596 +	  Build in support for the SED1355 Epson Research Embedded RAMDAC
  55.597 +	  LCD/CRT Controller (since redesignated as the S1D13505) as a
  55.598 +	  framebuffer.  Product specs at
  55.599 +	  <http://www.erd.epson.com/vdc/html/products.htm>.
  55.600 +
  55.601 +config FB_S1D13XXX
  55.602 +	tristate "Epson S1D13XXX framebuffer support"
  55.603 +	depends on FB
  55.604 +	select FB_CFB_FILLRECT
  55.605 +	select FB_CFB_COPYAREA
  55.606 +	select FB_CFB_IMAGEBLIT
  55.607 +	help
  55.608 +	  Support for S1D13XXX framebuffer device family (currently only
  55.609 +	  working with S1D13806). Product specs at
  55.610 +	  <http://www.erd.epson.com/vdc/html/legacy_13xxx.htm>
  55.611 +
  55.612 +config FB_NVIDIA
  55.613 +	tristate "nVidia Framebuffer Support"
  55.614 +	depends on FB && PCI
  55.615 +	select I2C_ALGOBIT if FB_NVIDIA_I2C
  55.616 +	select I2C if FB_NVIDIA_I2C
  55.617 +	select FB_MODE_HELPERS
  55.618 +	select FB_CFB_FILLRECT
  55.619 +	select FB_CFB_COPYAREA
  55.620 +	select FB_CFB_IMAGEBLIT
  55.621 +	help
  55.622 +	  This driver supports graphics boards with the nVidia chips, TNT
  55.623 +	  and newer. For very old chipsets, such as the RIVA128, then use
  55.624 +	  the rivafb.
  55.625 +	  Say Y if you have such a graphics board.
  55.626 +
  55.627 +	  To compile this driver as a module, choose M here: the
  55.628 +	  module will be called nvidiafb.
  55.629 +
  55.630 +config FB_NVIDIA_I2C
  55.631 +       bool "Enable DDC Support"
  55.632 +       depends on FB_NVIDIA
  55.633 +       help
  55.634 +	  This enables I2C support for nVidia Chipsets.  This is used
  55.635 +	  only for getting EDID information from the attached display
  55.636 +	  allowing for robust video mode handling and switching.
  55.637 +
  55.638 +	  Because fbdev-2.6 requires that drivers must be able to
  55.639 +	  independently validate video mode parameters, you should say Y
  55.640 +	  here.
  55.641 +
  55.642 +config FB_RIVA
  55.643 +	tristate "nVidia Riva support"
  55.644 +	depends on FB && PCI
  55.645 +	select I2C_ALGOBIT if FB_RIVA_I2C
  55.646 +	select I2C if FB_RIVA_I2C
  55.647 +	select FB_MODE_HELPERS
  55.648 +	select FB_CFB_FILLRECT
  55.649 +	select FB_CFB_COPYAREA
  55.650 +	select FB_CFB_IMAGEBLIT
  55.651 +	help
  55.652 +	  This driver supports graphics boards with the nVidia Riva/Geforce
  55.653 +	  chips.
  55.654 +	  Say Y if you have such a graphics board.
  55.655 +
  55.656 +	  To compile this driver as a module, choose M here: the
  55.657 +	  module will be called rivafb.
  55.658 +
  55.659 +config FB_RIVA_I2C
  55.660 +       bool "Enable DDC Support"
  55.661 +       depends on FB_RIVA
  55.662 +       help
  55.663 +	  This enables I2C support for nVidia Chipsets.  This is used
  55.664 +	  only for getting EDID information from the attached display
  55.665 +	  allowing for robust video mode handling and switching.
  55.666 +
  55.667 +	  Because fbdev-2.6 requires that drivers must be able to
  55.668 +	  independently validate video mode parameters, you should say Y
  55.669 +	  here.
  55.670 +
  55.671 +config FB_RIVA_DEBUG
  55.672 +	bool "Lots of debug output from Riva(nVidia) driver"
  55.673 +	depends on FB_RIVA
  55.674 +	default n
  55.675 +	help
  55.676 +	  Say Y here if you want the Riva driver to output all sorts
  55.677 +	  of debugging informations to provide to the maintainer when
  55.678 +	  something goes wrong.
  55.679 +
  55.680 +config FB_I810
  55.681 +	tristate "Intel 810/815 support (EXPERIMENTAL)"
  55.682 +	depends on FB && EXPERIMENTAL && PCI && X86_32
  55.683 +	select AGP
  55.684 +	select AGP_INTEL
  55.685 +	select FB_MODE_HELPERS
  55.686 +	select FB_CFB_FILLRECT
  55.687 +	select FB_CFB_COPYAREA
  55.688 +	select FB_CFB_IMAGEBLIT
  55.689 +	help
  55.690 +	  This driver supports the on-board graphics built in to the Intel 810 
  55.691 +          and 815 chipsets.  Say Y if you have and plan to use such a board.
  55.692 +
  55.693 +          To compile this driver as a module, choose M here: the
  55.694 +	  module will be called i810fb.
  55.695 +
  55.696 +          For more information, please read 
  55.697 +	  <file:Documentation/fb/intel810.txt>
  55.698 +
  55.699 +config FB_I810_GTF
  55.700 +	bool "use VESA Generalized Timing Formula"
  55.701 +	depends on FB_I810
  55.702 +	help
  55.703 +	  If you say Y, then the VESA standard, Generalized Timing Formula 
  55.704 +          or GTF, will be used to calculate the required video timing values
  55.705 +	  per video mode.  Since the GTF allows nondiscrete timings 
  55.706 +          (nondiscrete being a range of values as opposed to discrete being a
  55.707 +          set of values), you'll be able to use any combination of horizontal 
  55.708 +	  and vertical resolutions, and vertical refresh rates without having
  55.709 +	  to specify your own timing parameters.  This is especially useful
  55.710 +	  to maximize the performance of an aging display, or if you just 
  55.711 +          have a display with nonstandard dimensions. A VESA compliant 
  55.712 +	  monitor is recommended, but can still work with non-compliant ones.
  55.713 +	  If you need or want this, then select this option. The timings may 
  55.714 +	  not be compliant with Intel's recommended values. Use at your own 
  55.715 +	  risk.
  55.716 +
  55.717 +          If you say N, the driver will revert to discrete video timings 
  55.718 +	  using a set recommended by Intel in their documentation.
  55.719 +  
  55.720 +          If unsure, say N.
  55.721 +
  55.722 +config FB_I810_I2C
  55.723 +	bool "Enable DDC Support"
  55.724 +	depends on FB_I810 && FB_I810_GTF
  55.725 +	select I2C
  55.726 +	select I2C_ALGOBIT
  55.727 +	help
  55.728 +
  55.729 +config FB_INTEL
  55.730 +	tristate "Intel 830M/845G/852GM/855GM/865G support (EXPERIMENTAL)"
  55.731 +	depends on FB && EXPERIMENTAL && PCI && X86_32
  55.732 +	select AGP
  55.733 +	select AGP_INTEL
  55.734 +	select FB_MODE_HELPERS
  55.735 +	select FB_CFB_FILLRECT
  55.736 +	select FB_CFB_COPYAREA
  55.737 +	select FB_CFB_IMAGEBLIT
  55.738 +	help
  55.739 +	  This driver supports the on-board graphics built in to the Intel
  55.740 +          830M/845G/852GM/855GM/865G chipsets.
  55.741 +          Say Y if you have and plan to use such a board.
  55.742 +
  55.743 +          To compile this driver as a module, choose M here: the
  55.744 +	  module will be called intelfb.
  55.745 +
  55.746 +config FB_INTEL_DEBUG
  55.747 +        bool "Intel driver Debug Messages"
  55.748 +	depends on FB_INTEL
  55.749 +	---help---
  55.750 +	  Say Y here if you want the Intel driver to output all sorts
  55.751 +	  of debugging informations to provide to the maintainer when
  55.752 +	  something goes wrong.
  55.753 +
  55.754 +config FB_MATROX
  55.755 +	tristate "Matrox acceleration"
  55.756 +	depends on FB && PCI
  55.757 +	select FB_CFB_FILLRECT
  55.758 +	select FB_CFB_COPYAREA
  55.759 +	select FB_CFB_IMAGEBLIT
  55.760 +	select FB_TILEBLITTING
  55.761 +	select FB_MACMODES if PPC_PMAC
  55.762 +	---help---
  55.763 +	  Say Y here if you have a Matrox Millennium, Matrox Millennium II,
  55.764 +	  Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox
  55.765 +	  Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video,
  55.766 +	  Matrox G400, G450 or G550 card in your box.
  55.767 +
  55.768 +	  To compile this driver as a module, choose M here: the
  55.769 +	  module will be called matroxfb.
  55.770 +
  55.771 +	  You can pass several parameters to the driver at boot time or at
  55.772 +	  module load time. The parameters look like "video=matrox:XXX", and
  55.773 +	  are described in <file:Documentation/fb/matroxfb.txt>.
  55.774 +
  55.775 +config FB_MATROX_MILLENIUM
  55.776 +	bool "Millennium I/II support"
  55.777 +	depends on FB_MATROX
  55.778 +	help
  55.779 +	  Say Y here if you have a Matrox Millennium or Matrox Millennium II
  55.780 +	  video card. If you select "Advanced lowlevel driver options" below,
  55.781 +	  you should check 4 bpp packed pixel, 8 bpp packed pixel, 16 bpp
  55.782 +	  packed pixel, 24 bpp packed pixel and 32 bpp packed pixel. You can
  55.783 +	  also use font widths different from 8.
  55.784 +
  55.785 +config FB_MATROX_MYSTIQUE
  55.786 +	bool "Mystique support"
  55.787 +	depends on FB_MATROX
  55.788 +	help
  55.789 +	  Say Y here if you have a Matrox Mystique or Matrox Mystique 220
  55.790 +	  video card. If you select "Advanced lowlevel driver options" below,
  55.791 +	  you should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp
  55.792 +	  packed pixel and 32 bpp packed pixel. You can also use font widths
  55.793 +	  different from 8.
  55.794 +
  55.795 +config FB_MATROX_G
  55.796 +	bool "G100/G200/G400/G450/G550 support"
  55.797 +	depends on FB_MATROX
  55.798 +	---help---
  55.799 +	  Say Y here if you have a Matrox G100, G200, G400, G450 or G550 based
  55.800 +	  video card. If you select "Advanced lowlevel driver options", you
  55.801 +	  should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp packed
  55.802 +	  pixel and 32 bpp packed pixel. You can also use font widths
  55.803 +	  different from 8.
  55.804 +
  55.805 +	  If you need support for G400 secondary head, you must first say Y to
  55.806 +	  "I2C support" in the character devices section, and then to
  55.807 +	  "Matrox I2C support" and "G400 second head support" here in the
  55.808 +	  framebuffer section. G450/G550 secondary head and digital output
  55.809 +	  are supported without additional modules.
  55.810 +
  55.811 +	  The driver starts in monitor mode. You must use the matroxset tool 
  55.812 +	  (available at <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to 
  55.813 +	  swap primary and secondary head outputs, or to change output mode.  
  55.814 +	  Secondary head driver always start in 640x480 resolution and you 
  55.815 +	  must use fbset to change it.
  55.816 +
  55.817 +	  Do not forget that second head supports only 16 and 32 bpp
  55.818 +	  packed pixels, so it is a good idea to compile them into the kernel
  55.819 +	  too. You can use only some font widths, as the driver uses generic
  55.820 +	  painting procedures (the secondary head does not use acceleration
  55.821 +	  engine).
  55.822 +
  55.823 +	  G450/G550 hardware can display TV picture only from secondary CRTC,
  55.824 +	  and it performs no scaling, so picture must have 525 or 625 lines.
  55.825 +
  55.826 +config FB_MATROX_I2C
  55.827 +	tristate "Matrox I2C support"
  55.828 +	depends on FB_MATROX && I2C
  55.829 +	select I2C_ALGOBIT
  55.830 +	---help---
  55.831 +	  This drivers creates I2C buses which are needed for accessing the
  55.832 +	  DDC (I2C) bus present on all Matroxes, an I2C bus which
  55.833 +	  interconnects Matrox optional devices, like MGA-TVO on G200 and
  55.834 +	  G400, and the secondary head DDC bus, present on G400 only.
  55.835 +
  55.836 +	  You can say Y or M here if you want to experiment with monitor
  55.837 +	  detection code. You must say Y or M here if you want to use either
  55.838 +	  second head of G400 or MGA-TVO on G200 or G400.
  55.839 +
  55.840 +	  If you compile it as module, it will create a module named
  55.841 +	  i2c-matroxfb.
  55.842 +
  55.843 +config FB_MATROX_MAVEN
  55.844 +	tristate "G400 second head support"
  55.845 +	depends on FB_MATROX_G && FB_MATROX_I2C
  55.846 +	---help---
  55.847 +	  WARNING !!! This support does not work with G450 !!!
  55.848 +
  55.849 +	  Say Y or M here if you want to use a secondary head (meaning two
  55.850 +	  monitors in parallel) on G400 or MGA-TVO add-on on G200. Secondary
  55.851 +	  head is not compatible with accelerated XFree 3.3.x SVGA servers -
  55.852 +	  secondary head output is blanked while you are in X. With XFree
  55.853 +	  3.9.17 preview you can use both heads if you use SVGA over fbdev or
  55.854 +	  the fbdev driver on first head and the fbdev driver on second head.
  55.855 +
  55.856 +	  If you compile it as module, two modules are created,
  55.857 +	  matroxfb_crtc2 and matroxfb_maven. Matroxfb_maven is needed for
  55.858 +	  both G200 and G400, matroxfb_crtc2 is needed only by G400. You must
  55.859 +	  also load i2c-matroxfb to get it to run.
  55.860 +
  55.861 +	  The driver starts in monitor mode and you must use the matroxset
  55.862 +	  tool (available at
  55.863 +	  <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to switch it to
  55.864 +	  PAL or NTSC or to swap primary and secondary head outputs.
  55.865 +	  Secondary head driver also always start in 640x480 resolution, you
  55.866 +	  must use fbset to change it.
  55.867 +
  55.868 +	  Also do not forget that second head supports only 16 and 32 bpp
  55.869 +	  packed pixels, so it is a good idea to compile them into the kernel
  55.870 +	  too.  You can use only some font widths, as the driver uses generic
  55.871 +	  painting procedures (the secondary head does not use acceleration
  55.872 +	  engine).
  55.873 +
  55.874 +config FB_MATROX_MULTIHEAD
  55.875 +	bool "Multihead support"
  55.876 +	depends on FB_MATROX
  55.877 +	---help---
  55.878 +	  Say Y here if you have more than one (supported) Matrox device in
  55.879 +	  your computer and you want to use all of them for different monitors
  55.880 +	  ("multihead"). If you have only one device, you should say N because
  55.881 +	  the driver compiled with Y is larger and a bit slower, especially on
  55.882 +	  ia32 (ix86).
  55.883 +
  55.884 +	  If you said M to "Matrox unified accelerated driver" and N here, you
  55.885 +	  will still be able to use several Matrox devices simultaneously:
  55.886 +	  insert several instances of the module matroxfb into the kernel
  55.887 +	  with insmod, supplying the parameter "dev=N" where N is 0, 1, etc.
  55.888 +	  for the different Matrox devices. This method is slightly faster but
  55.889 +	  uses 40 KB of kernel memory per Matrox card.
  55.890 +
  55.891 +	  There is no need for enabling 'Matrox multihead support' if you have
  55.892 +	  only one Matrox card in the box.
  55.893 +
  55.894 +config FB_RADEON_OLD
  55.895 +	tristate "ATI Radeon display support (Old driver)"
  55.896 +	depends on FB && PCI
  55.897 +	select FB_CFB_FILLRECT
  55.898 +	select FB_CFB_COPYAREA
  55.899 +	select FB_CFB_IMAGEBLIT
  55.900 +	select FB_MACMODES if PPC
  55.901 +	help
  55.902 +	  Choose this option if you want to use an ATI Radeon graphics card as
  55.903 +	  a framebuffer device.  There are both PCI and AGP versions.  You
  55.904 +	  don't need to choose this to run the Radeon in plain VGA mode.
  55.905 +	  There is a product page at
  55.906 +	  <http://www.ati.com/na/pages/products/pc/radeon32/index.html>.
  55.907 +
  55.908 +config FB_RADEON
  55.909 +	tristate "ATI Radeon display support"
  55.910 +	depends on FB && PCI
  55.911 +	select I2C_ALGOBIT if FB_RADEON_I2C
  55.912 +	select I2C if FB_RADEON_I2C
  55.913 +	select FB_MODE_HELPERS
  55.914 +	select FB_CFB_FILLRECT
  55.915 +	select FB_CFB_COPYAREA
  55.916 +	select FB_CFB_IMAGEBLIT
  55.917 +	select FB_MACMODES if PPC_OF
  55.918 +	help
  55.919 +	  Choose this option if you want to use an ATI Radeon graphics card as
  55.920 +	  a framebuffer device.  There are both PCI and AGP versions.  You
  55.921 +	  don't need to choose this to run the Radeon in plain VGA mode.
  55.922 +
  55.923 +	  If you say Y here and want DDC/I2C support you must first say Y to
  55.924 +	  "I2C support" and "I2C bit-banging support" in the character devices
  55.925 +	  section.
  55.926 +
  55.927 +	  If you say M here then "I2C support" and "I2C bit-banging support" 
  55.928 +	  can be build either as modules or built-in.
  55.929 +
  55.930 +	  There is a product page at
  55.931 +	  http://apps.ati.com/ATIcompare/
  55.932 +config FB_RADEON_I2C
  55.933 +	bool "DDC/I2C for ATI Radeon support"
  55.934 +	depends on FB_RADEON
  55.935 +	default y
  55.936 +	help
  55.937 +	  Say Y here if you want DDC/I2C support for your Radeon board. 
  55.938 +
  55.939 +config FB_RADEON_DEBUG
  55.940 +	bool "Lots of debug output from Radeon driver"
  55.941 +	depends on FB_RADEON
  55.942 +	default n
  55.943 +	help
  55.944 +	  Say Y here if you want the Radeon driver to output all sorts
  55.945 +	  of debugging informations to provide to the maintainer when
  55.946 +	  something goes wrong.
  55.947 +
  55.948 +config FB_ATY128
  55.949 +	tristate "ATI Rage128 display support"
  55.950 +	depends on FB && PCI
  55.951 +	select FB_CFB_FILLRECT
  55.952 +	select FB_CFB_COPYAREA
  55.953 +	select FB_CFB_IMAGEBLIT
  55.954 +	select FB_MACMODES if PPC_PMAC
  55.955 +	help
  55.956 +	  This driver supports graphics boards with the ATI Rage128 chips.
  55.957 +	  Say Y if you have such a graphics board and read
  55.958 +	  <file:Documentation/fb/aty128fb.txt>.
  55.959 +
  55.960 +	  To compile this driver as a module, choose M here: the
  55.961 +	  module will be called aty128fb.
  55.962 +
  55.963 +config FB_ATY
  55.964 +	tristate "ATI Mach64 display support" if PCI || ATARI
  55.965 +	depends on FB
  55.966 +	select FB_CFB_FILLRECT
  55.967 +	select FB_CFB_COPYAREA
  55.968 +	select FB_CFB_IMAGEBLIT
  55.969 +	select FB_MACMODES if PPC
  55.970 +	help
  55.971 +	  This driver supports graphics boards with the ATI Mach64 chips.
  55.972 +	  Say Y if you have such a graphics board.
  55.973 +
  55.974 +	  To compile this driver as a module, choose M here: the
  55.975 +	  module will be called atyfb.
  55.976 +
  55.977 +config FB_ATY_CT
  55.978 +	bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
  55.979 +	depends on PCI && FB_ATY
  55.980 +	default y if SPARC64 && FB_PCI
  55.981 +	help
  55.982 +	  Say Y here to support use of ATI's 64-bit Rage boards (or other
  55.983 +	  boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
  55.984 +	  framebuffer device.  The ATI product support page for these boards
  55.985 +	  is at <http://support.ati.com/products/pc/mach64/>.
  55.986 +
  55.987 +config FB_ATY_GENERIC_LCD
  55.988 +	bool "Mach64 generic LCD support (EXPERIMENTAL)"
  55.989 +	depends on FB_ATY_CT
  55.990 +	help
  55.991 +	  Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility,
  55.992 +	  Rage XC, or Rage XL chipset.
  55.993 +
  55.994 +config FB_ATY_GX
  55.995 +	bool "Mach64 GX support" if PCI
  55.996 +	depends on FB_ATY
  55.997 +	default y if ATARI
  55.998 +	help
  55.999 +	  Say Y here to support use of the ATI Mach64 Graphics Expression
 55.1000 +	  board (or other boards based on the Mach64 GX chipset) as a
 55.1001 +	  framebuffer device.  The ATI product support page for these boards
 55.1002 +	  is at
 55.1003 +	  <http://support.ati.com/products/pc/mach64/graphics_xpression.html>.
 55.1004 +
 55.1005 +config FB_S3TRIO
 55.1006 +	bool "S3 Trio display support"
 55.1007 +	depends on (FB = y) && PPC && BROKEN
 55.1008 +	help
 55.1009 +	  If you have a S3 Trio say Y. Say N for S3 Virge.
 55.1010 +
 55.1011 +config FB_SAVAGE
 55.1012 +	tristate "S3 Savage support"
 55.1013 +	depends on FB && PCI && EXPERIMENTAL
 55.1014 +	select I2C_ALGOBIT if FB_SAVAGE_I2C
 55.1015 +	select I2C if FB_SAVAGE_I2C
 55.1016 +	select FB_MODE_HELPERS
 55.1017 +	select FB_CFB_FILLRECT
 55.1018 +	select FB_CFB_COPYAREA
 55.1019 +	select FB_CFB_IMAGEBLIT
 55.1020 +	help
 55.1021 +	  This driver supports notebooks and computers with S3 Savage PCI/AGP
 55.1022 +	  chips.
 55.1023 +
 55.1024 +	  Say Y if you have such a graphics card.
 55.1025 +
 55.1026 +	  To compile this driver as a module, choose M here; the module
 55.1027 +	  will be called savagefb.
 55.1028 +
 55.1029 +config FB_SAVAGE_I2C
 55.1030 +       bool "Enable DDC2 Support"
 55.1031 +       depends on FB_SAVAGE
 55.1032 +       help
 55.1033 +	  This enables I2C support for S3 Savage Chipsets.  This is used
 55.1034 +	  only for getting EDID information from the attached display
 55.1035 +	  allowing for robust video mode handling and switching.
 55.1036 +
 55.1037 +	  Because fbdev-2.6 requires that drivers must be able to
 55.1038 +	  independently validate video mode parameters, you should say Y
 55.1039 +	  here.
 55.1040 +
 55.1041 +config FB_SAVAGE_ACCEL
 55.1042 +       bool "Enable Console Acceleration"
 55.1043 +       depends on FB_SAVAGE
 55.1044 +       default n
 55.1045 +       help
 55.1046 +          This option will compile in console acceleration support. If
 55.1047 +          the resulting framebuffer console has bothersome glitches, then
 55.1048 +          choose N here.
 55.1049 +
 55.1050 +config FB_SIS
 55.1051 +	tristate "SiS/XGI display support"
 55.1052 +	depends on FB && PCI
 55.1053 +	select FB_CFB_FILLRECT
 55.1054 +	select FB_CFB_COPYAREA
 55.1055 +	select FB_CFB_IMAGEBLIT
 55.1056 +	help
 55.1057 +	  This is the frame buffer device driver for the SiS 300, 315, 330
 55.1058 +	  and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets.
 55.1059 +	  Specs available at <http://www.sis.com> and <http://www.xgitech.com>.
 55.1060 +
 55.1061 +	  To compile this driver as a module, choose M here; the module
 55.1062 +	  will be called sisfb.
 55.1063 +
 55.1064 +config FB_SIS_300
 55.1065 +	bool "SiS 300 series support"
 55.1066 +	depends on FB_SIS
 55.1067 +	help
 55.1068 +	  Say Y here to support use of the SiS 300/305, 540, 630 and 730.
 55.1069 +
 55.1070 +config FB_SIS_315
 55.1071 +	bool "SiS 315/330/340 series and XGI support"
 55.1072 +	depends on FB_SIS
 55.1073 +	help
 55.1074 +	  Say Y here to support use of the SiS 315, 330 and 340 series
 55.1075 +	  (315/H/PRO, 55x, 650, 651, 740, 330, 661, 741, 760, 761) as well
 55.1076 +	  as XGI V3XT, V5, V8 and Z7.
 55.1077 +
 55.1078 +config FB_NEOMAGIC
 55.1079 +	tristate "NeoMagic display support"
 55.1080 +	depends on FB && PCI
 55.1081 +	select FB_MODE_HELPERS
 55.1082 +	select FB_CFB_FILLRECT
 55.1083 +	select FB_CFB_COPYAREA
 55.1084 +	select FB_CFB_IMAGEBLIT
 55.1085 +	help
 55.1086 +	  This driver supports notebooks with NeoMagic PCI chips.
 55.1087 +	  Say Y if you have such a graphics card. 
 55.1088 +
 55.1089 +	  To compile this driver as a module, choose M here: the
 55.1090 +	  module will be called neofb.
 55.1091 +
 55.1092 +config FB_KYRO
 55.1093 +	tristate "IMG Kyro support"
 55.1094 +	depends on FB && PCI
 55.1095 +	select FB_CFB_FILLRECT
 55.1096 +	select FB_CFB_COPYAREA
 55.1097 +	select FB_CFB_IMAGEBLIT
 55.1098 +	help
 55.1099 +	  Say Y here if you have a STG4000 / Kyro / PowerVR 3 based
 55.1100 +	  graphics board.
 55.1101 +
 55.1102 +	  To compile this driver as a module, choose M here: the
 55.1103 +	  module will be called kyrofb.
 55.1104 +
 55.1105 +config FB_3DFX
 55.1106 +	tristate "3Dfx Banshee/Voodoo3 display support"
 55.1107 +	depends on FB && PCI
 55.1108 +	select FB_CFB_IMAGEBLIT
 55.1109 +	select FB_CFB_FILLRECT
 55.1110 +	select FB_CFB_COPYAREA
 55.1111 +	help
 55.1112 +	  This driver supports graphics boards with the 3Dfx Banshee/Voodoo3
 55.1113 +	  chips. Say Y if you have such a graphics board.
 55.1114 +
 55.1115 +	  To compile this driver as a module, choose M here: the
 55.1116 +	  module will be called tdfxfb.
 55.1117 +
 55.1118 +config FB_3DFX_ACCEL
 55.1119 +	bool "3Dfx Banshee/Voodoo3 Acceleration functions (EXPERIMENTAL)"
 55.1120 +	depends on FB_3DFX && EXPERIMENTAL
 55.1121 +	---help---
 55.1122 +	This will compile the 3Dfx Banshee/Voodoo3 frame buffer device
 55.1123 +	with acceleration functions.
 55.1124 +
 55.1125 +
 55.1126 +config FB_VOODOO1
 55.1127 +	tristate "3Dfx Voodoo Graphics (sst1) support"
 55.1128 +	depends on FB && PCI
 55.1129 +	select FB_CFB_FILLRECT
 55.1130 +	select FB_CFB_COPYAREA
 55.1131 +	select FB_CFB_IMAGEBLIT
 55.1132 +	---help---
 55.1133 +	  Say Y here if you have a 3Dfx Voodoo Graphics (Voodoo1/sst1) or 
 55.1134 +	  Voodoo2 (cvg) based graphics card.
 55.1135 +
 55.1136 +	  To compile this driver as a module, choose M here: the
 55.1137 +	  module will be called sstfb.
 55.1138 +
 55.1139 +	  WARNING: Do not use any application that uses the 3D engine
 55.1140 +	  (namely glide) while using this driver.
 55.1141 +	  Please read the <file:Documentation/fb/README-sstfb.txt> for supported
 55.1142 +	  options and other important info  support.
 55.1143 +
 55.1144 +config FB_CYBLA
 55.1145 +	tristate "Cyberblade/i1 support"
 55.1146 +	depends on FB && PCI && X86_32 && !64BIT
 55.1147 +	select FB_CFB_IMAGEBLIT
 55.1148 +	select VIDEO_SELECT
 55.1149 +	---help---
 55.1150 +	  This driver is supposed to support the Trident Cyberblade/i1
 55.1151 +	  graphics core integrated in the VIA VT8601A North Bridge,
 55.1152 +	  also known as VIA Apollo PLE133.
 55.1153 +
 55.1154 +	  Status:
 55.1155 +	   - Developed, tested and working on EPIA 5000 and EPIA 800.
 55.1156 +	   - Does work reliable on all systems with CRT/LCD connected to
 55.1157 +	     normal VGA ports.
 55.1158 +	   - Should work on systems that do use the internal LCD port, but
 55.1159 +	     this is absolutely not tested.
 55.1160 +
 55.1161 +	  Character imageblit, copyarea and rectangle fill are hw accelerated,
 55.1162 +	  ypan scrolling is used by default.
 55.1163 +
 55.1164 +	  Please do read <file:Documentation/fb/cyblafb/*>.
 55.1165 +
 55.1166 +	  To compile this driver as a module, choose M here: the
 55.1167 +	  module will be called cyblafb.
 55.1168 +
 55.1169 +config FB_TRIDENT
 55.1170 +	tristate "Trident support"
 55.1171 +	depends on FB && PCI
 55.1172 +	select FB_CFB_FILLRECT
 55.1173 +	select FB_CFB_COPYAREA
 55.1174 +	select FB_CFB_IMAGEBLIT
 55.1175 +	---help---
 55.1176 +	  This driver is supposed to support graphics boards with the
 55.1177 +	  Trident CyberXXXX/Image/CyberBlade chips mostly found in laptops
 55.1178 +	  but also on some motherboards. For more information, read
 55.1179 +	  <file:Documentation/fb/tridentfb.txt>
 55.1180 +
 55.1181 +	  Cyberblade/i1 support will be removed soon, use the cyblafb driver
 55.1182 +	  instead.
 55.1183 +
 55.1184 +	  Say Y if you have such a graphics board.
 55.1185 +
 55.1186 +
 55.1187 +	  To compile this driver as a module, choose M here: the
 55.1188 +	  module will be called tridentfb.
 55.1189 +
 55.1190 +config FB_TRIDENT_ACCEL
 55.1191 +	bool "Trident Acceleration functions (EXPERIMENTAL)"
 55.1192 +	depends on FB_TRIDENT && EXPERIMENTAL
 55.1193 +	---help---
 55.1194 +	This will compile the Trident frame buffer device with
 55.1195 +	acceleration functions.
 55.1196 +
 55.1197 +config FB_PM3
 55.1198 +	tristate "Permedia3 support"
 55.1199 +	depends on FB && PCI && BROKEN
 55.1200 +	help
 55.1201 +	  This is the frame buffer device driver for the 3DLabs Permedia3
 55.1202 +	  chipset, used in Formac ProFormance III, 3DLabs Oxygen VX1 &
 55.1203 +	  similar boards, 3DLabs Permedia3 Create!, Appian Jeronimo 2000
 55.1204 +	  and maybe other boards.
 55.1205 +
 55.1206 +config FB_AU1100
 55.1207 +	bool "Au1100 LCD Driver"
 55.1208 +	depends on (FB = y) && EXPERIMENTAL && PCI && MIPS && MIPS_PB1100=y
 55.1209 +
 55.1210 +source "drivers/video/geode/Kconfig"
 55.1211 +
 55.1212 +config FB_FFB
 55.1213 +	bool "Creator/Creator3D/Elite3D support"
 55.1214 +	depends on FB_SBUS && SPARC64
 55.1215 +	select FB_CFB_COPYAREA
 55.1216 +	select FB_CFB_IMAGEBLIT
 55.1217 +	help
 55.1218 +	  This is the frame buffer device driver for the Creator, Creator3D,
 55.1219 +	  and Elite3D graphics boards.
 55.1220 +
 55.1221 +config FB_TCX
 55.1222 +	bool "TCX (SS4/SS5 only) support"
 55.1223 +	depends on FB_SBUS
 55.1224 +	select FB_CFB_FILLRECT
 55.1225 +	select FB_CFB_COPYAREA
 55.1226 +	select FB_CFB_IMAGEBLIT
 55.1227 +	help
 55.1228 +	  This is the frame buffer device driver for the TCX 24/8bit frame
 55.1229 +	  buffer.
 55.1230 +
 55.1231 +config FB_CG14
 55.1232 +	bool "CGfourteen (SX) support"
 55.1233 +	depends on FB_SBUS
 55.1234 +	select FB_CFB_FILLRECT
 55.1235 +	select FB_CFB_COPYAREA
 55.1236 +	select FB_CFB_IMAGEBLIT
 55.1237 +	help
 55.1238 +	  This is the frame buffer device driver for the CGfourteen frame
 55.1239 +	  buffer on Desktop SPARCsystems with the SX graphics option.
 55.1240 +
 55.1241 +config FB_P9100
 55.1242 +	bool "P9100 (Sparcbook 3 only) support"
 55.1243 +	depends on FB_SBUS
 55.1244 +	select FB_CFB_FILLRECT
 55.1245 +	select FB_CFB_COPYAREA
 55.1246 +	select FB_CFB_IMAGEBLIT
 55.1247 +	help
 55.1248 +	  This is the frame buffer device driver for the P9100 card
 55.1249 +	  supported on Sparcbook 3 machines.
 55.1250 +
 55.1251 +config FB_LEO
 55.1252 +	bool "Leo (ZX) support"
 55.1253 +	depends on FB_SBUS
 55.1254 +	select FB_CFB_FILLRECT
 55.1255 +	select FB_CFB_COPYAREA
 55.1256 +	select FB_CFB_IMAGEBLIT
 55.1257 +	help
 55.1258 +	  This is the frame buffer device driver for the SBUS-based Sun ZX
 55.1259 +	  (leo) frame buffer cards.
 55.1260 +
 55.1261 +config FB_PCI
 55.1262 +	bool "PCI framebuffers"
 55.1263 +	depends on (FB = y) && PCI && SPARC
 55.1264 +
 55.1265 +config FB_IGA
 55.1266 +	bool "IGA 168x display support"
 55.1267 +	depends on SPARC32 && FB_PCI
 55.1268 +	select FB_CFB_FILLRECT
 55.1269 +	select FB_CFB_COPYAREA
 55.1270 +	select FB_CFB_IMAGEBLIT
 55.1271 +	help
 55.1272 +	  This is the framebuffer device for the INTERGRAPHICS 1680 and
 55.1273 +	  successor frame buffer cards.
 55.1274 +
 55.1275 +config FB_HIT
 55.1276 +	tristate "HD64461 Frame Buffer support"
 55.1277 +	depends on FB && HD64461
 55.1278 +	select FB_CFB_FILLRECT
 55.1279 +	select FB_CFB_COPYAREA
 55.1280 +	select FB_CFB_IMAGEBLIT
 55.1281 +	help
 55.1282 +	  This is the frame buffer device driver for the Hitachi HD64461 LCD
 55.1283 +	  frame buffer card.
 55.1284 +
 55.1285 +config FB_PMAG_AA
 55.1286 +	bool "PMAG-AA TURBOchannel framebuffer support"
 55.1287 +	depends on (FB = y) && TC
 55.1288 + 	select FB_CFB_FILLRECT
 55.1289 + 	select FB_CFB_COPYAREA
 55.1290 + 	select FB_CFB_IMAGEBLIT
 55.1291 +	help
 55.1292 +	  Support for the PMAG-AA TURBOchannel framebuffer card (1280x1024x1)
 55.1293 +	  used mainly in the MIPS-based DECstation series.
 55.1294 +
 55.1295 +config FB_PMAG_BA
 55.1296 +	bool "PMAG-BA TURBOchannel framebuffer support"
 55.1297 +	depends on (FB = y) && TC
 55.1298 + 	select FB_CFB_FILLRECT
 55.1299 + 	select FB_CFB_COPYAREA
 55.1300 + 	select FB_CFB_IMAGEBLIT
 55.1301 +	help
 55.1302 +	  Support for the PMAG-BA TURBOchannel framebuffer card (1024x864x8)
 55.1303 +	  used mainly in the MIPS-based DECstation series.
 55.1304 +
 55.1305 +config FB_PMAGB_B
 55.1306 +	bool "PMAGB-B TURBOchannel framebuffer support"
 55.1307 +	depends on (FB = y) && TC
 55.1308 + 	select FB_CFB_FILLRECT
 55.1309 + 	select FB_CFB_COPYAREA
 55.1310 + 	select FB_CFB_IMAGEBLIT
 55.1311 +	help
 55.1312 +	  Support for the PMAGB-B TURBOchannel framebuffer card used mainly
 55.1313 +	  in the MIPS-based DECstation series. The card is currently only
 55.1314 +	  supported in 1280x1024x8 mode.
 55.1315 +
 55.1316 +config FB_MAXINE
 55.1317 +	bool "Maxine (Personal DECstation) onboard framebuffer support"
 55.1318 +	depends on (FB = y) && MACH_DECSTATION
 55.1319 + 	select FB_CFB_FILLRECT
 55.1320 + 	select FB_CFB_COPYAREA
 55.1321 + 	select FB_CFB_IMAGEBLIT
 55.1322 +	help
 55.1323 +	  Support for the onboard framebuffer (1024x768x8) in the Personal
 55.1324 +	  DECstation series (Personal DECstation 5000/20, /25, /33, /50,
 55.1325 +	  Codename "Maxine").
 55.1326 +
 55.1327 +config FB_TX3912
 55.1328 +	bool "TMPTX3912/PR31700 frame buffer support"
 55.1329 +	depends on (FB = y) && NINO
 55.1330 +	select FB_CFB_FILLRECT
 55.1331 +	select FB_CFB_COPYAREA
 55.1332 +	select FB_CFB_IMAGEBLIT
 55.1333 +	help
 55.1334 +	  The TX3912 is a Toshiba RISC processor based on the MIPS 3900 core
 55.1335 +	  see <http://www.toshiba.com/taec/components/Generic/risc/tx3912.htm>.
 55.1336 +
 55.1337 +	  Say Y here to enable kernel support for the on-board framebuffer.
 55.1338 +
 55.1339 +config FB_G364
 55.1340 +	bool "G364 frame buffer support"
 55.1341 +	depends on (FB = y) && (MIPS_MAGNUM_4000 || OLIVETTI_M700)
 55.1342 + 	select FB_CFB_FILLRECT
 55.1343 + 	select FB_CFB_COPYAREA
 55.1344 + 	select FB_CFB_IMAGEBLIT
 55.1345 +	help
 55.1346 +	  The G364 driver is the framebuffer used in MIPS Magnum 4000 and
 55.1347 +	  Olivetti M700-10 systems.
 55.1348 +
 55.1349 +config FB_68328
 55.1350 +	bool "Motorola 68328 native frame buffer support"
 55.1351 +	depends on FB && (M68328 || M68EZ328 || M68VZ328)
 55.1352 + 	select FB_CFB_FILLRECT
 55.1353 + 	select FB_CFB_COPYAREA
 55.1354 + 	select FB_CFB_IMAGEBLIT
 55.1355 +	help
 55.1356 +	  Say Y here if you want to support the built-in frame buffer of
 55.1357 +	  the Motorola 68328 CPU family.
 55.1358 +
 55.1359 +config FB_PXA
 55.1360 +	tristate "PXA LCD framebuffer support"
 55.1361 +	depends on FB && ARCH_PXA
 55.1362 +	select FB_CFB_FILLRECT
 55.1363 +	select FB_CFB_COPYAREA
 55.1364 +	select FB_CFB_IMAGEBLIT
 55.1365 +	---help---
 55.1366 +	  Frame buffer driver for the built-in LCD controller in the Intel
 55.1367 +	  PXA2x0 processor.
 55.1368 +
 55.1369 +	  This driver is also available as a module ( = code which can be
 55.1370 +	  inserted and removed from the running kernel whenever you want). The
 55.1371 +	  module will be called pxafb. If you want to compile it as a module,
 55.1372 +	  say M here and read <file:Documentation/modules.txt>.
 55.1373 +
 55.1374 +	  If unsure, say N.
 55.1375 +
 55.1376 +config FB_PXA_PARAMETERS
 55.1377 +	bool "PXA LCD command line parameters"
 55.1378 +	default n
 55.1379 +	depends on FB_PXA
 55.1380 +	---help---
 55.1381 +	  Enable the use of kernel command line or module parameters
 55.1382 +	  to configure the physical properties of the LCD panel when
 55.1383 +	  using the PXA LCD driver.
 55.1384 +
 55.1385 +	  This option allows you to override the panel parameters
 55.1386 +	  supplied by the platform in order to support multiple
 55.1387 +	  different models of flatpanel. If you will only be using a
 55.1388 +	  single model of flatpanel then you can safely leave this
 55.1389 +	  option disabled.
 55.1390 +
 55.1391 +	  <file:Documentation/fb/pxafb.txt> describes the available parameters.
 55.1392 +
 55.1393 +config FB_W100
 55.1394 +	tristate "W100 frame buffer support"
 55.1395 +	depends on FB && PXA_SHARPSL
 55.1396 + 	select FB_CFB_FILLRECT
 55.1397 + 	select FB_CFB_COPYAREA
 55.1398 + 	select FB_CFB_IMAGEBLIT
 55.1399 +	---help---
 55.1400 +	  Frame buffer driver for the w100 as found on the Sharp SL-Cxx series.
 55.1401 +
 55.1402 +	  This driver is also available as a module ( = code which can be
 55.1403 +	  inserted and removed from the running kernel whenever you want). The
 55.1404 +	  module will be called w100fb. If you want to compile it as a module,
 55.1405 +	  say M here and read <file:Documentation/modules.txt>.
 55.1406 +
 55.1407 +	  If unsure, say N.
 55.1408 +
 55.1409 +config FB_S3C2410
 55.1410 +	tristate "S3C2410 LCD framebuffer support"
 55.1411 +	depends on FB && ARCH_S3C2410
 55.1412 +	select FB_CFB_FILLRECT
 55.1413 +	select FB_CFB_COPYAREA
 55.1414 +	select FB_CFB_IMAGEBLIT
 55.1415 +	---help---
 55.1416 +	  Frame buffer driver for the built-in LCD controller in the Samsung
 55.1417 +	  S3C2410 processor.
 55.1418 +
 55.1419 +	  This driver is also available as a module ( = code which can be
 55.1420 +	  inserted and removed from the running kernel whenever you want). The
 55.1421 +	  module will be called s3c2410fb. If you want to compile it as a module,
 55.1422 +	  say M here and read <file:Documentation/modules.txt>.
 55.1423 +
 55.1424 +	  If unsure, say N.
 55.1425 +config FB_S3C2410_DEBUG
 55.1426 +	bool "S3C2410 lcd debug messages"
 55.1427 +	depends on FB_S3C2410
 55.1428 +	help
 55.1429 +	  Turn on debugging messages. Note that you can set/unset at run time
 55.1430 +	  through sysfs
 55.1431 +
 55.1432 +config FB_VIRTUAL
 55.1433 +	tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
 55.1434 +	depends on FB
 55.1435 +	select FB_CFB_FILLRECT
 55.1436 +	select FB_CFB_COPYAREA
 55.1437 +	select FB_CFB_IMAGEBLIT
 55.1438 +	---help---
 55.1439 +	  This is a `virtual' frame buffer device. It operates on a chunk of
 55.1440 +	  unswappable kernel memory instead of on the memory of a graphics
 55.1441 +	  board. This means you cannot see any output sent to this frame
 55.1442 +	  buffer device, while it does consume precious memory. The main use
 55.1443 +	  of this frame buffer device is testing and debugging the frame
 55.1444 +	  buffer subsystem. Do NOT enable it for normal systems! To protect
 55.1445 +	  the innocent, it has to be enabled explicitly at boot time using the
 55.1446 +	  kernel option `video=vfb:'.
 55.1447 +
 55.1448 +	  To compile this driver as a module, choose M here: the
 55.1449 +	  module will be called vfb.
 55.1450 +
 55.1451 +	  If unsure, say N.
 55.1452 +if VT
 55.1453 +	source "drivers/video/console/Kconfig"
 55.1454 +endif
 55.1455 +
 55.1456 +if FB || SGI_NEWPORT_CONSOLE
 55.1457 +	source "drivers/video/logo/Kconfig"
 55.1458 +endif
 55.1459 +
 55.1460 +if FB && SYSFS
 55.1461 +	source "drivers/video/backlight/Kconfig"
 55.1462 +endif
 55.1463 +
 55.1464 +endmenu
 55.1465 +
    56.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Feb 24 14:03:07 2006 -0700
    56.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Feb 24 15:41:08 2006 -0700
    56.3 @@ -726,8 +726,7 @@ static void blkif_recover(struct blkfron
    56.4  	int j;
    56.5  
    56.6  	/* Stage 1: Make a safe copy of the shadow state. */
    56.7 -	copy = kmalloc(sizeof(info->shadow), GFP_KERNEL);
    56.8 -	BUG_ON(copy == NULL);
    56.9 +	copy = kmalloc(sizeof(info->shadow), GFP_KERNEL | __GFP_NOFAIL);
   56.10  	memcpy(copy, info->shadow, sizeof(info->shadow));
   56.11  
   56.12  	/* Stage 2: Set up free list. */
    57.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri Feb 24 14:03:07 2006 -0700
    57.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri Feb 24 15:41:08 2006 -0700
    57.3 @@ -222,25 +222,22 @@ gnttab_end_foreign_access(grant_ref_t re
    57.4  }
    57.5  
    57.6  int
    57.7 -gnttab_grant_foreign_transfer(domid_t domid)
    57.8 +gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn)
    57.9  {
   57.10  	int ref;
   57.11  
   57.12  	if (unlikely((ref = get_free_entry()) == -1))
   57.13  		return -ENOSPC;
   57.14 -
   57.15 -	shared[ref].frame = 0;
   57.16 -	shared[ref].domid = domid;
   57.17 -	wmb();
   57.18 -	shared[ref].flags = GTF_accept_transfer;
   57.19 +	gnttab_grant_foreign_transfer_ref(ref, domid, pfn);
   57.20  
   57.21  	return ref;
   57.22  }
   57.23  
   57.24  void
   57.25 -gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid)
   57.26 +gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid,
   57.27 +				  unsigned long pfn)
   57.28  {
   57.29 -	shared[ref].frame = 0;
   57.30 +	shared[ref].frame = pfn;
   57.31  	shared[ref].domid = domid;
   57.32  	wmb();
   57.33  	shared[ref].flags = GTF_accept_transfer;
    58.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c	Fri Feb 24 14:03:07 2006 -0700
    58.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c	Fri Feb 24 15:41:08 2006 -0700
    58.3 @@ -188,7 +188,7 @@ void vcpu_prepare(int vcpu)
    58.4  
    58.5  	ctxt.ctrlreg[3] = virt_to_mfn(swapper_pg_dir) << PAGE_SHIFT;
    58.6  #else /* __x86_64__ */
    58.7 -	ctxt.user_regs.cs = __KERNEL_CS | 3;
    58.8 +	ctxt.user_regs.cs = __KERNEL_CS;
    58.9  	ctxt.user_regs.esp = idle->thread.rsp0 - sizeof(struct pt_regs);
   58.10  
   58.11  	ctxt.kernel_ss = __KERNEL_DS;
   58.12 @@ -237,7 +237,6 @@ void __init smp_prepare_cpus(unsigned in
   58.13  #ifdef __x86_64__
   58.14  		cpu_pda(cpu)->pcurrent = idle;
   58.15  		cpu_pda(cpu)->cpunumber = cpu;
   58.16 -		per_cpu(init_tss,cpu).rsp0 = idle->thread.rsp;
   58.17  		clear_ti_thread_flag(idle->thread_info, TIF_FORK);
   58.18  #endif
   58.19  
    59.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c	Fri Feb 24 14:03:07 2006 -0700
    59.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c	Fri Feb 24 15:41:08 2006 -0700
    59.3 @@ -137,10 +137,13 @@ static int __init make_loopback(int i)
    59.4  
    59.5  	sprintf(dev_name, "vif0.%d", i);
    59.6  	dev1 = alloc_netdev(sizeof(struct net_private), dev_name, ether_setup);
    59.7 +	if (!dev1)
    59.8 +		return err;
    59.9 +
   59.10  	sprintf(dev_name, "veth%d", i);
   59.11  	dev2 = alloc_netdev(sizeof(struct net_private), dev_name, ether_setup);
   59.12 -	if ((dev1 == NULL) || (dev2 == NULL))
   59.13 -		goto fail;
   59.14 +	if (!dev2)
   59.15 +		goto fail_netdev2;
   59.16  
   59.17  	loopback_construct(dev1, dev2);
   59.18  	loopback_construct(dev2, dev1);
   59.19 @@ -169,8 +172,9 @@ static int __init make_loopback(int i)
   59.20  	return 0;
   59.21  
   59.22   fail:
   59.23 -	kfree(dev1);
   59.24 -	kfree(dev2);
   59.25 +	free_netdev(dev2);
   59.26 + fail_netdev2:
   59.27 +	free_netdev(dev1);
   59.28  	return err;
   59.29  }
   59.30  
    60.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Feb 24 14:03:07 2006 -0700
    60.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Feb 24 15:41:08 2006 -0700
    60.3 @@ -587,25 +587,23 @@ static void network_alloc_rx_buffers(str
    60.4  		BUG_ON((signed short)ref < 0);
    60.5  		np->grant_rx_ref[id] = ref;
    60.6  		gnttab_grant_foreign_transfer_ref(ref,
    60.7 -						  np->xbdev->otherend_id);
    60.8 +						  np->xbdev->otherend_id,
    60.9 +						  __pa(skb->head) >> PAGE_SHIFT);
   60.10  		RING_GET_REQUEST(&np->rx, req_prod + i)->gref = ref;
   60.11  		rx_pfn_array[i] = virt_to_mfn(skb->head);
   60.12  
   60.13 -		/* Remove this page from map before passing back to Xen. */
   60.14 -		set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT,
   60.15 -				    INVALID_P2M_ENTRY);
   60.16 -
   60.17 -		MULTI_update_va_mapping(rx_mcl+i, (unsigned long)skb->head,
   60.18 -					__pte(0), 0);
   60.19 +		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
   60.20 +			/* Remove this page before passing back to Xen. */
   60.21 +			set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT,
   60.22 +					    INVALID_P2M_ENTRY);
   60.23 +			MULTI_update_va_mapping(rx_mcl+i,
   60.24 +						(unsigned long)skb->head,
   60.25 +						__pte(0), 0);
   60.26 +		}
   60.27  	}
   60.28  
   60.29 -	/* After all PTEs have been zapped we blow away stale TLB entries. */
   60.30 -	rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
   60.31 -
   60.32 -	/* Give away a batch of pages. */
   60.33 -	rx_mcl[i].op = __HYPERVISOR_memory_op;
   60.34 -	rx_mcl[i].args[0] = XENMEM_decrease_reservation;
   60.35 -	rx_mcl[i].args[1] = (unsigned long)&reservation;
   60.36 +	/* Tell the ballon driver what is going on. */
   60.37 +	balloon_update_driver_allowance(i);
   60.38  
   60.39  	reservation.extent_start = rx_pfn_array;
   60.40  	reservation.nr_extents   = i;
   60.41 @@ -613,15 +611,27 @@ static void network_alloc_rx_buffers(str
   60.42  	reservation.address_bits = 0;
   60.43  	reservation.domid        = DOMID_SELF;
   60.44  
   60.45 -	/* Tell the ballon driver what is going on. */
   60.46 -	balloon_update_driver_allowance(i);
   60.47 +	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
   60.48 +		/* After all PTEs have been zapped, flush the TLB. */
   60.49 +		rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] =
   60.50 +			UVMF_TLB_FLUSH|UVMF_ALL;
   60.51  
   60.52 -	/* Zap PTEs and give away pages in one big multicall. */
   60.53 -	(void)HYPERVISOR_multicall(rx_mcl, i+1);
   60.54 +		/* Give away a batch of pages. */
   60.55 +		rx_mcl[i].op = __HYPERVISOR_memory_op;
   60.56 +		rx_mcl[i].args[0] = XENMEM_decrease_reservation;
   60.57 +		rx_mcl[i].args[1] = (unsigned long)&reservation;
   60.58  
   60.59 -	/* Check return status of HYPERVISOR_memory_op(). */
   60.60 -	if (unlikely(rx_mcl[i].result != i))
   60.61 -		panic("Unable to reduce memory reservation\n");
   60.62 +		/* Zap PTEs and give away pages in one big multicall. */
   60.63 +		(void)HYPERVISOR_multicall(rx_mcl, i+1);
   60.64 +
   60.65 +		/* Check return status of HYPERVISOR_memory_op(). */
   60.66 +		if (unlikely(rx_mcl[i].result != i))
   60.67 +			panic("Unable to reduce memory reservation\n");
   60.68 +	} else {
   60.69 +		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
   60.70 +					 &reservation) != i)
   60.71 +			panic("Unable to reduce memory reservation\n");
   60.72 +	}
   60.73  
   60.74  	/* Above is a suitable barrier to ensure backend will see requests. */
   60.75  	np->rx.req_prod_pvt = req_prod + i;
   60.76 @@ -802,17 +812,19 @@ static int netif_poll(struct net_device 
   60.77  		np->stats.rx_packets++;
   60.78  		np->stats.rx_bytes += rx->status;
   60.79  
   60.80 -		/* Remap the page. */
   60.81 -		MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
   60.82 -					pfn_pte_ma(mfn, PAGE_KERNEL), 0);
   60.83 -		mcl++;
   60.84  		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
   60.85 +			/* Remap the page. */
   60.86 +			MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
   60.87 +						pfn_pte_ma(mfn, PAGE_KERNEL),
   60.88 +						0);
   60.89 +			mcl++;
   60.90  			mmu->ptr = ((maddr_t)mfn << PAGE_SHIFT)
   60.91  				| MMU_MACHPHYS_UPDATE;
   60.92  			mmu->val = __pa(skb->head) >> PAGE_SHIFT;
   60.93  			mmu++;
   60.94  
   60.95 -			set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT, mfn);
   60.96 +			set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT,
   60.97 +					    mfn);
   60.98  		}
   60.99  
  60.100  		__skb_queue_tail(&rxq, skb);
  60.101 @@ -1003,7 +1015,8 @@ static void network_connect(struct net_d
  60.102  		if ((unsigned long)np->rx_skbs[i] < __PAGE_OFFSET)
  60.103  			continue;
  60.104  		gnttab_grant_foreign_transfer_ref(
  60.105 -			np->grant_rx_ref[i], np->xbdev->otherend_id);
  60.106 +			np->grant_rx_ref[i], np->xbdev->otherend_id,
  60.107 +			__pa(np->rx_skbs[i]->data) >> PAGE_SHIFT);
  60.108  		RING_GET_REQUEST(&np->rx, requeue_idx)->gref =
  60.109  			np->grant_rx_ref[i];
  60.110  		RING_GET_REQUEST(&np->rx, requeue_idx)->id = i;
    61.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Fri Feb 24 14:03:07 2006 -0700
    61.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Fri Feb 24 15:41:08 2006 -0700
    61.3 @@ -14,9 +14,6 @@
    61.4  #include "common.h"
    61.5  #include <xen/balloon.h>
    61.6  
    61.7 -#define TPMIF_HASHSZ (2 << 5)
    61.8 -#define TPMIF_HASH(_d,_h) (((int)(_d)^(int)(_h))&(TPMIF_HASHSZ-1))
    61.9 -
   61.10  static kmem_cache_t *tpmif_cachep;
   61.11  int num_frontends = 0;
   61.12  
    62.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Fri Feb 24 14:03:07 2006 -0700
    62.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Fri Feb 24 15:41:08 2006 -0700
    62.3 @@ -66,8 +66,6 @@ static int  packet_read_shmem(struct pac
    62.4                                u32 left);
    62.5  
    62.6  
    62.7 -#define MAX_PENDING_REQS TPMIF_TX_RING_SIZE
    62.8 -
    62.9  #define MIN(x,y)  (x) < (y) ? (x) : (y)
   62.10  
   62.11  
   62.12 @@ -973,8 +971,6 @@ static void processing_timeout(unsigned 
   62.13  static void tpm_tx_action(unsigned long unused);
   62.14  static DECLARE_TASKLET(tpm_tx_tasklet, tpm_tx_action, 0);
   62.15  
   62.16 -#define MAX_PENDING_REQS TPMIF_TX_RING_SIZE
   62.17 -
   62.18  static struct list_head tpm_schedule_list;
   62.19  static spinlock_t tpm_schedule_list_lock;
   62.20  
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/a.out.h	Fri Feb 24 15:41:08 2006 -0700
    63.3 @@ -0,0 +1,26 @@
    63.4 +#ifndef __I386_A_OUT_H__
    63.5 +#define __I386_A_OUT_H__
    63.6 +
    63.7 +struct exec
    63.8 +{
    63.9 +  unsigned long a_info;		/* Use macros N_MAGIC, etc for access */
   63.10 +  unsigned a_text;		/* length of text, in bytes */
   63.11 +  unsigned a_data;		/* length of data, in bytes */
   63.12 +  unsigned a_bss;		/* length of uninitialized data area for file, in bytes */
   63.13 +  unsigned a_syms;		/* length of symbol table data in file, in bytes */
   63.14 +  unsigned a_entry;		/* start address */
   63.15 +  unsigned a_trsize;		/* length of relocation info for text, in bytes */
   63.16 +  unsigned a_drsize;		/* length of relocation info for data, in bytes */
   63.17 +};
   63.18 +
   63.19 +#define N_TRSIZE(a)	((a).a_trsize)
   63.20 +#define N_DRSIZE(a)	((a).a_drsize)
   63.21 +#define N_SYMSIZE(a)	((a).a_syms)
   63.22 +
   63.23 +#ifdef __KERNEL__
   63.24 +
   63.25 +#define STACK_TOP	(TASK_SIZE - 3*PAGE_SIZE)
   63.26 +
   63.27 +#endif
   63.28 +
   63.29 +#endif /* __A_OUT_GNU_H__ */
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/apic.h	Fri Feb 24 15:41:08 2006 -0700
    64.3 @@ -0,0 +1,147 @@
    64.4 +#ifndef __ASM_APIC_H
    64.5 +#define __ASM_APIC_H
    64.6 +
    64.7 +#include <linux/config.h>
    64.8 +#include <linux/pm.h>
    64.9 +#include <asm/fixmap.h>
   64.10 +#include <asm/apicdef.h>
   64.11 +#include <asm/processor.h>
   64.12 +#include <asm/system.h>
   64.13 +
   64.14 +#define Dprintk(x...)
   64.15 +
   64.16 +/*
   64.17 + * Debugging macros
   64.18 + */
   64.19 +#define APIC_QUIET   0
   64.20 +#define APIC_VERBOSE 1
   64.21 +#define APIC_DEBUG   2
   64.22 +
   64.23 +extern int enable_local_apic;
   64.24 +extern int apic_verbosity;
   64.25 +
   64.26 +static inline void lapic_disable(void)
   64.27 +{
   64.28 +	enable_local_apic = -1;
   64.29 +	clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
   64.30 +}
   64.31 +
   64.32 +static inline void lapic_enable(void)
   64.33 +{
   64.34 +	enable_local_apic = 1;
   64.35 +}
   64.36 +
   64.37 +/*
   64.38 + * Define the default level of output to be very little
   64.39 + * This can be turned up by using apic=verbose for more
   64.40 + * information and apic=debug for _lots_ of information.
   64.41 + * apic_verbosity is defined in apic.c
   64.42 + */
   64.43 +#define apic_printk(v, s, a...) do {       \
   64.44 +		if ((v) <= apic_verbosity) \
   64.45 +			printk(s, ##a);    \
   64.46 +	} while (0)
   64.47 +
   64.48 +
   64.49 +#ifdef CONFIG_X86_LOCAL_APIC
   64.50 +
   64.51 +/*
   64.52 + * Basic functions accessing APICs.
   64.53 + */
   64.54 +
   64.55 +static __inline void apic_write(unsigned long reg, unsigned long v)
   64.56 +{
   64.57 +	*((volatile unsigned long *)(APIC_BASE+reg)) = v;
   64.58 +}
   64.59 +
   64.60 +static __inline void apic_write_atomic(unsigned long reg, unsigned long v)
   64.61 +{
   64.62 +	xchg((volatile unsigned long *)(APIC_BASE+reg), v);
   64.63 +}
   64.64 +
   64.65 +static __inline unsigned long apic_read(unsigned long reg)
   64.66 +{
   64.67 +	return *((volatile unsigned long *)(APIC_BASE+reg));
   64.68 +}
   64.69 +
   64.70 +static __inline__ void apic_wait_icr_idle(void)
   64.71 +{
   64.72 +	while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY )
   64.73 +		cpu_relax();
   64.74 +}
   64.75 +
   64.76 +int get_physical_broadcast(void);
   64.77 +
   64.78 +#ifdef CONFIG_X86_GOOD_APIC
   64.79 +# define FORCE_READ_AROUND_WRITE 0
   64.80 +# define apic_read_around(x)
   64.81 +# define apic_write_around(x,y) apic_write((x),(y))
   64.82 +#else
   64.83 +# define FORCE_READ_AROUND_WRITE 1
   64.84 +# define apic_read_around(x) apic_read(x)
   64.85 +# define apic_write_around(x,y) apic_write_atomic((x),(y))
   64.86 +#endif
   64.87 +
   64.88 +static inline void ack_APIC_irq(void)
   64.89 +{
   64.90 +	/*
   64.91 +	 * ack_APIC_irq() actually gets compiled as a single instruction:
   64.92 +	 * - a single rmw on Pentium/82489DX
   64.93 +	 * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
   64.94 +	 * ... yummie.
   64.95 +	 */
   64.96 +
   64.97 +	/* Docs say use 0 for future compatibility */
   64.98 +	apic_write_around(APIC_EOI, 0);
   64.99 +}
  64.100 +
  64.101 +extern void (*wait_timer_tick)(void);
  64.102 +
  64.103 +extern int get_maxlvt(void);
  64.104 +extern void clear_local_APIC(void);
  64.105 +extern void connect_bsp_APIC (void);
  64.106 +extern void disconnect_bsp_APIC (int virt_wire_setup);
  64.107 +extern void disable_local_APIC (void);
  64.108 +extern void lapic_shutdown (void);
  64.109 +extern int verify_local_APIC (void);
  64.110 +extern void cache_APIC_registers (void);
  64.111 +extern void sync_Arb_IDs (void);
  64.112 +extern void init_bsp_APIC (void);
  64.113 +extern void setup_local_APIC (void);
  64.114 +extern void init_apic_mappings (void);
  64.115 +extern void smp_local_timer_interrupt (struct pt_regs * regs);
  64.116 +extern void setup_boot_APIC_clock (void);
  64.117 +extern void setup_secondary_APIC_clock (void);
  64.118 +extern void setup_apic_nmi_watchdog (void);
  64.119 +extern int reserve_lapic_nmi(void);
  64.120 +extern void release_lapic_nmi(void);
  64.121 +extern void disable_timer_nmi_watchdog(void);
  64.122 +extern void enable_timer_nmi_watchdog(void);
  64.123 +extern void nmi_watchdog_tick (struct pt_regs * regs);
  64.124 +extern int APIC_init_uniprocessor (void);
  64.125 +extern void disable_APIC_timer(void);
  64.126 +extern void enable_APIC_timer(void);
  64.127 +
  64.128 +extern void enable_NMI_through_LVT0 (void * dummy);
  64.129 +
  64.130 +extern unsigned int nmi_watchdog;
  64.131 +#define NMI_NONE	0
  64.132 +#define NMI_IO_APIC	1
  64.133 +#define NMI_LOCAL_APIC	2
  64.134 +#define NMI_INVALID	3
  64.135 +
  64.136 +extern int disable_timer_pin_1;
  64.137 +
  64.138 +#ifndef CONFIG_XEN
  64.139 +void smp_send_timer_broadcast_ipi(struct pt_regs *regs);
  64.140 +void switch_APIC_timer_to_ipi(void *cpumask);
  64.141 +void switch_ipi_to_APIC_timer(void *cpumask);
  64.142 +#define ARCH_APICTIMER_STOPS_ON_C3	1
  64.143 +#endif
  64.144 +
  64.145 +#else /* !CONFIG_X86_LOCAL_APIC */
  64.146 +static inline void lapic_shutdown(void) { }
  64.147 +
  64.148 +#endif /* !CONFIG_X86_LOCAL_APIC */
  64.149 +
  64.150 +#endif /* __ASM_APIC_H */
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/elf.h	Fri Feb 24 15:41:08 2006 -0700
    65.3 @@ -0,0 +1,194 @@
    65.4 +#ifndef __ASMi386_ELF_H
    65.5 +#define __ASMi386_ELF_H
    65.6 +
    65.7 +/*
    65.8 + * ELF register definitions..
    65.9 + */
   65.10 +
   65.11 +#include <asm/ptrace.h>
   65.12 +#include <asm/user.h>
   65.13 +#include <asm/processor.h>
   65.14 +#include <asm/system.h>		/* for savesegment */
   65.15 +#include <asm/auxvec.h>
   65.16 +
   65.17 +#include <linux/utsname.h>
   65.18 +
   65.19 +#define R_386_NONE	0
   65.20 +#define R_386_32	1
   65.21 +#define R_386_PC32	2
   65.22 +#define R_386_GOT32	3
   65.23 +#define R_386_PLT32	4
   65.24 +#define R_386_COPY	5
   65.25 +#define R_386_GLOB_DAT	6
   65.26 +#define R_386_JMP_SLOT	7
   65.27 +#define R_386_RELATIVE	8
   65.28 +#define R_386_GOTOFF	9
   65.29 +#define R_386_GOTPC	10
   65.30 +#define R_386_NUM	11
   65.31 +
   65.32 +typedef unsigned long elf_greg_t;
   65.33 +
   65.34 +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
   65.35 +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
   65.36 +
   65.37 +typedef struct user_i387_struct elf_fpregset_t;
   65.38 +typedef struct user_fxsr_struct elf_fpxregset_t;
   65.39 +
   65.40 +/*
   65.41 + * This is used to ensure we don't load something for the wrong architecture.
   65.42 + */
   65.43 +#define elf_check_arch(x) \
   65.44 +	(((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
   65.45 +
   65.46 +/*
   65.47 + * These are used to set parameters in the core dumps.
   65.48 + */
   65.49 +#define ELF_CLASS	ELFCLASS32
   65.50 +#define ELF_DATA	ELFDATA2LSB
   65.51 +#define ELF_ARCH	EM_386
   65.52 +
   65.53 +/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
   65.54 +   contains a pointer to a function which might be registered using `atexit'.
   65.55 +   This provides a mean for the dynamic linker to call DT_FINI functions for
   65.56 +   shared libraries that have been loaded before the code runs.
   65.57 +
   65.58 +   A value of 0 tells we have no such handler. 
   65.59 +
   65.60 +   We might as well make sure everything else is cleared too (except for %esp),
   65.61 +   just to make things more deterministic.
   65.62 + */
   65.63 +#define ELF_PLAT_INIT(_r, load_addr)	do { \
   65.64 +	_r->ebx = 0; _r->ecx = 0; _r->edx = 0; \
   65.65 +	_r->esi = 0; _r->edi = 0; _r->ebp = 0; \
   65.66 +	_r->eax = 0; \
   65.67 +} while (0)
   65.68 +
   65.69 +#define USE_ELF_CORE_DUMP
   65.70 +#define ELF_EXEC_PAGESIZE	4096
   65.71 +
   65.72 +/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
   65.73 +   use of this is to invoke "./ld.so someprog" to test out a new version of
   65.74 +   the loader.  We need to make sure that it is out of the way of the program
   65.75 +   that it will "exec", and that there is sufficient room for the brk.  */
   65.76 +
   65.77 +#define ELF_ET_DYN_BASE         (TASK_SIZE / 3 * 2)
   65.78 +
   65.79 +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
   65.80 +   now struct_user_regs, they are different) */
   65.81 +
   65.82 +#define ELF_CORE_COPY_REGS(pr_reg, regs)		\
   65.83 +	pr_reg[0] = regs->ebx;				\
   65.84 +	pr_reg[1] = regs->ecx;				\
   65.85 +	pr_reg[2] = regs->edx;				\
   65.86 +	pr_reg[3] = regs->esi;				\
   65.87 +	pr_reg[4] = regs->edi;				\
   65.88 +	pr_reg[5] = regs->ebp;				\
   65.89 +	pr_reg[6] = regs->eax;				\
   65.90 +	pr_reg[7] = regs->xds;				\
   65.91 +	pr_reg[8] = regs->xes;				\
   65.92 +	savesegment(fs,pr_reg[9]);			\
   65.93 +	savesegment(gs,pr_reg[10]);			\
   65.94 +	pr_reg[11] = regs->orig_eax;			\
   65.95 +	pr_reg[12] = regs->eip;				\
   65.96 +	pr_reg[13] = regs->xcs;				\
   65.97 +	pr_reg[14] = regs->eflags;			\
   65.98 +	pr_reg[15] = regs->esp;				\
   65.99 +	pr_reg[16] = regs->xss;
  65.100 +
  65.101 +/* This yields a mask that user programs can use to figure out what
  65.102 +   instruction set this CPU supports.  This could be done in user space,
  65.103 +   but it's not easy, and we've already done it here.  */
  65.104 +
  65.105 +#define ELF_HWCAP	(boot_cpu_data.x86_capability[0])
  65.106 +
  65.107 +/* This yields a string that ld.so will use to load implementation
  65.108 +   specific libraries for optimization.  This is more specific in
  65.109 +   intent than poking at uname or /proc/cpuinfo.
  65.110 +
  65.111 +   For the moment, we have only optimizations for the Intel generations,
  65.112 +   but that could change... */
  65.113 +
  65.114 +#define ELF_PLATFORM  (system_utsname.machine)
  65.115 +
  65.116 +#ifdef __KERNEL__
  65.117 +#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
  65.118 +
  65.119 +/*
  65.120 + * An executable for which elf_read_implies_exec() returns TRUE will
  65.121 + * have the READ_IMPLIES_EXEC personality flag set automatically.
  65.122 + */
  65.123 +#define elf_read_implies_exec(ex, executable_stack)	(executable_stack != EXSTACK_DISABLE_X)
  65.124 +
  65.125 +struct task_struct;
  65.126 +
  65.127 +extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
  65.128 +extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
  65.129 +extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
  65.130 +
  65.131 +#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
  65.132 +#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
  65.133 +#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
  65.134 +
  65.135 +#define VSYSCALL_BASE	(PAGE_OFFSET - 2*PAGE_SIZE)
  65.136 +#define VSYSCALL_EHDR	((const struct elfhdr *) VSYSCALL_BASE)
  65.137 +#define VSYSCALL_ENTRY	((unsigned long) &__kernel_vsyscall)
  65.138 +extern void __kernel_vsyscall;
  65.139 +
  65.140 +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
  65.141 +struct linux_binprm;
  65.142 +extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  65.143 +                                       int executable_stack);
  65.144 +
  65.145 +#define ARCH_DLINFO						\
  65.146 +do {								\
  65.147 +		NEW_AUX_ENT(AT_SYSINFO,	VSYSCALL_ENTRY);	\
  65.148 +		NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE);	\
  65.149 +} while (0)
  65.150 +
  65.151 +/*
  65.152 + * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
  65.153 + * extra segments containing the vsyscall DSO contents.  Dumping its
  65.154 + * contents makes post-mortem fully interpretable later without matching up
  65.155 + * the same kernel and hardware config to see what PC values meant.
  65.156 + * Dumping its extra ELF program headers includes all the other information
  65.157 + * a debugger needs to easily find how the vsyscall DSO was being used.
  65.158 + */
  65.159 +#define ELF_CORE_EXTRA_PHDRS		(VSYSCALL_EHDR->e_phnum)
  65.160 +#define ELF_CORE_WRITE_EXTRA_PHDRS					      \
  65.161 +do {									      \
  65.162 +	const struct elf_phdr *const vsyscall_phdrs =			      \
  65.163 +		(const struct elf_phdr *) (VSYSCALL_BASE		      \
  65.164 +					   + VSYSCALL_EHDR->e_phoff);	      \
  65.165 +	int i;								      \
  65.166 +	Elf32_Off ofs = 0;						      \
  65.167 +	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
  65.168 +		struct elf_phdr phdr = vsyscall_phdrs[i];		      \
  65.169 +		if (phdr.p_type == PT_LOAD) {				      \
  65.170 +			BUG_ON(ofs != 0);				      \
  65.171 +			ofs = phdr.p_offset = offset;			      \
  65.172 +			phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);	      \
  65.173 +			phdr.p_filesz = phdr.p_memsz;			      \
  65.174 +			offset += phdr.p_filesz;			      \
  65.175 +		}							      \
  65.176 +		else							      \
  65.177 +			phdr.p_offset += ofs;				      \
  65.178 +		phdr.p_paddr = 0; /* match other core phdrs */		      \
  65.179 +		DUMP_WRITE(&phdr, sizeof(phdr));			      \
  65.180 +	}								      \
  65.181 +} while (0)
  65.182 +#define ELF_CORE_WRITE_EXTRA_DATA					      \
  65.183 +do {									      \
  65.184 +	const struct elf_phdr *const vsyscall_phdrs =			      \
  65.185 +		(const struct elf_phdr *) (VSYSCALL_BASE		      \
  65.186 +					   + VSYSCALL_EHDR->e_phoff);	      \
  65.187 +	int i;								      \
  65.188 +	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
  65.189 +		if (vsyscall_phdrs[i].p_type == PT_LOAD)		      \
  65.190 +			DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,	      \
  65.191 +				   PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));    \
  65.192 +	}								      \
  65.193 +} while (0)
  65.194 +
  65.195 +#endif
  65.196 +
  65.197 +#endif
    66.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/desc.h	Fri Feb 24 14:03:07 2006 -0700
    66.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/desc.h	Fri Feb 24 15:41:08 2006 -0700
    66.3 @@ -61,6 +61,7 @@ extern void set_intr_gate(unsigned int i
    66.4  	"rorl $16,%1" \
    66.5  	: "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type))
    66.6  
    66.7 +#ifndef CONFIG_X86_NO_TSS
    66.8  static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr)
    66.9  {
   66.10  	_set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr,
   66.11 @@ -68,6 +69,7 @@ static inline void __set_tss_desc(unsign
   66.12  }
   66.13  
   66.14  #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
   66.15 +#endif
   66.16  
   66.17  static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size)
   66.18  {
    67.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h	Fri Feb 24 14:03:07 2006 -0700
    67.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h	Fri Feb 24 15:41:08 2006 -0700
    67.3 @@ -20,7 +20,7 @@
    67.4   * Leave one empty page between vmalloc'ed areas and
    67.5   * the start of the fixmap.
    67.6   */
    67.7 -#define __FIXADDR_TOP	(HYPERVISOR_VIRT_START - 2 * PAGE_SIZE)
    67.8 +extern unsigned long __FIXADDR_TOP;
    67.9  
   67.10  #ifndef __ASSEMBLY__
   67.11  #include <linux/kernel.h>
   67.12 @@ -53,7 +53,6 @@
   67.13   */
   67.14  enum fixed_addresses {
   67.15  	FIX_HOLE,
   67.16 -	FIX_VSYSCALL,
   67.17  #ifdef CONFIG_X86_LOCAL_APIC
   67.18  	FIX_APIC_BASE,	/* local (CPU) APIC) -- required for SMP or not */
   67.19  #endif
   67.20 @@ -99,8 +98,10 @@ enum fixed_addresses {
   67.21  	__end_of_fixed_addresses
   67.22  };
   67.23  
   67.24 -extern void __set_fixmap(
   67.25 -	enum fixed_addresses idx, maddr_t phys, pgprot_t flags);
   67.26 +extern void __set_fixmap(enum fixed_addresses idx,
   67.27 +					maddr_t phys, pgprot_t flags);
   67.28 +
   67.29 +extern void set_fixaddr_top(unsigned long top);
   67.30  
   67.31  #define set_fixmap(idx, phys) \
   67.32  		__set_fixmap(idx, phys, PAGE_KERNEL)
   67.33 @@ -123,14 +124,6 @@ extern void __set_fixmap(
   67.34  #define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
   67.35  #define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
   67.36  
   67.37 -/*
   67.38 - * This is the range that is readable by user mode, and things
   67.39 - * acting like user mode such as get_user_pages.
   67.40 - */
   67.41 -#define FIXADDR_USER_START	(__fix_to_virt(FIX_VSYSCALL))
   67.42 -#define FIXADDR_USER_END	(FIXADDR_USER_START + PAGE_SIZE)
   67.43 -
   67.44 -
   67.45  extern void __this_fixmap_does_not_exist(void);
   67.46  
   67.47  /*
    68.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri Feb 24 14:03:07 2006 -0700
    68.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri Feb 24 15:41:08 2006 -0700
    68.3 @@ -61,9 +61,6 @@ void xen_cpu_idle (void);
    68.4  /* arch/xen/i386/kernel/hypervisor.c */
    68.5  void do_hypervisor_callback(struct pt_regs *regs);
    68.6  
    68.7 -/* arch/xen/i386/kernel/head.S */
    68.8 -void lgdt_finish(void);
    68.9 -
   68.10  /* arch/xen/i386/mm/hypervisor.c */
   68.11  /*
   68.12   * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already
    69.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h	Fri Feb 24 14:03:07 2006 -0700
    69.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h	Fri Feb 24 15:41:08 2006 -0700
    69.3 @@ -294,7 +294,7 @@ extern int page_is_ram(unsigned long pag
    69.4  
    69.5  #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
    69.6  #define VMALLOC_RESERVE		((unsigned long)__VMALLOC_RESERVE)
    69.7 -#define MAXMEM			(HYPERVISOR_VIRT_START-__PAGE_OFFSET-__VMALLOC_RESERVE)
    69.8 +#define MAXMEM			(__FIXADDR_TOP-__PAGE_OFFSET-__VMALLOC_RESERVE)
    69.9  #define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
   69.10  #define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
   69.11  #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
   69.12 @@ -317,6 +317,8 @@ extern int page_is_ram(unsigned long pag
   69.13  #define virt_to_mfn(v)		(pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
   69.14  #define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
   69.15  
   69.16 +#define __HAVE_ARCH_GATE_AREA 1
   69.17 +
   69.18  #endif /* __KERNEL__ */
   69.19  
   69.20  #include <asm-generic/page.h>
    70.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h	Fri Feb 24 14:03:07 2006 -0700
    70.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h	Fri Feb 24 15:41:08 2006 -0700
    70.3 @@ -91,8 +91,10 @@ struct cpuinfo_x86 {
    70.4  
    70.5  extern struct cpuinfo_x86 boot_cpu_data;
    70.6  extern struct cpuinfo_x86 new_cpu_data;
    70.7 +#ifndef CONFIG_X86_NO_TSS
    70.8  extern struct tss_struct doublefault_tss;
    70.9  DECLARE_PER_CPU(struct tss_struct, init_tss);
   70.10 +#endif
   70.11  
   70.12  #ifdef CONFIG_SMP
   70.13  extern struct cpuinfo_x86 cpu_data[];
   70.14 @@ -343,7 +345,9 @@ extern int bootloader_type;
   70.15  #define IO_BITMAP_BITS  65536
   70.16  #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
   70.17  #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
   70.18 +#ifndef CONFIG_X86_NO_TSS
   70.19  #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
   70.20 +#endif
   70.21  #define INVALID_IO_BITMAP_OFFSET 0x8000
   70.22  #define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000
   70.23  
   70.24 @@ -401,6 +405,7 @@ typedef struct {
   70.25  
   70.26  struct thread_struct;
   70.27  
   70.28 +#ifndef CONFIG_X86_NO_TSS
   70.29  struct tss_struct {
   70.30  	unsigned short	back_link,__blh;
   70.31  	unsigned long	esp0;
   70.32 @@ -446,6 +451,7 @@ struct tss_struct {
   70.33  	 */
   70.34  	unsigned long stack[64];
   70.35  } __attribute__((packed));
   70.36 +#endif
   70.37  
   70.38  #define ARCH_MIN_TASKALIGN	16
   70.39  
   70.40 @@ -482,6 +488,7 @@ struct thread_struct {
   70.41  	.io_bitmap_ptr = NULL,						\
   70.42  }
   70.43  
   70.44 +#ifndef CONFIG_X86_NO_TSS
   70.45  /*
   70.46   * Note that the .io_bitmap member must be extra-big. This is because
   70.47   * the CPU will access an additional byte beyond the end of the IO
   70.48 @@ -496,16 +503,23 @@ struct thread_struct {
   70.49  	.io_bitmap	= { [ 0 ... IO_BITMAP_LONGS] = ~0 },		\
   70.50  }
   70.51  
   70.52 -static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
   70.53 +static inline void __load_esp0(struct tss_struct *tss, struct thread_struct *thread)
   70.54  {
   70.55  	tss->esp0 = thread->esp0;
   70.56 +#ifdef CONFIG_X86_SYSENTER
   70.57  	/* This can only happen when SEP is enabled, no need to test "SEP"arately */
   70.58  	if (unlikely(tss->ss1 != thread->sysenter_cs)) {
   70.59  		tss->ss1 = thread->sysenter_cs;
   70.60  		wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
   70.61  	}
   70.62 -	HYPERVISOR_stack_switch(tss->ss0, tss->esp0);
   70.63 +#endif
   70.64  }
   70.65 +#define load_esp0(tss, thread) \
   70.66 +	__load_esp0(tss, thread)
   70.67 +#else
   70.68 +#define load_esp0(tss, thread) \
   70.69 +	HYPERVISOR_stack_switch(__KERNEL_DS, (thread)->esp0)
   70.70 +#endif
   70.71  
   70.72  #define start_thread(regs, new_eip, new_esp) do {		\
   70.73  	__asm__("movl %0,%%fs ; movl %0,%%gs": :"r" (0));	\
    71.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/segment.h	Fri Feb 24 14:03:07 2006 -0700
    71.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/segment.h	Fri Feb 24 15:41:08 2006 -0700
    71.3 @@ -60,10 +60,12 @@
    71.4  #define GDT_ENTRY_KERNEL_BASE	12
    71.5  
    71.6  #define GDT_ENTRY_KERNEL_CS		(GDT_ENTRY_KERNEL_BASE + 0)
    71.7 -#define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8 + 1)
    71.8 +#define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8)
    71.9 +#define GET_KERNEL_CS() (__KERNEL_CS | (xen_feature(XENFEAT_supervisor_mode_kernel)?0:1) )
   71.10  
   71.11  #define GDT_ENTRY_KERNEL_DS		(GDT_ENTRY_KERNEL_BASE + 1)
   71.12 -#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8 + 1)
   71.13 +#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8)
   71.14 +#define GET_KERNEL_DS() (__KERNEL_DS | (xen_feature(XENFEAT_supervisor_mode_kernel)?0:1) )
   71.15  
   71.16  #define GDT_ENTRY_TSS			(GDT_ENTRY_KERNEL_BASE + 4)
   71.17  #define GDT_ENTRY_LDT			(GDT_ENTRY_KERNEL_BASE + 5)
   71.18 @@ -85,9 +87,11 @@
   71.19  
   71.20  /* Simple and small GDT entries for booting only */
   71.21  
   71.22 -#define __BOOT_CS	FLAT_KERNEL_CS
   71.23 +#define GDT_ENTRY_BOOT_CS		2
   71.24 +#define __BOOT_CS	(GDT_ENTRY_BOOT_CS * 8)
   71.25  
   71.26 -#define __BOOT_DS	FLAT_KERNEL_DS
   71.27 +#define GDT_ENTRY_BOOT_DS		(GDT_ENTRY_BOOT_CS + 1)
   71.28 +#define __BOOT_DS	(GDT_ENTRY_BOOT_DS * 8)
   71.29  
   71.30  /* The PnP BIOS entries in the GDT */
   71.31  #define GDT_ENTRY_PNPBIOS_CS32		(GDT_ENTRY_PNPBIOS_BASE + 0)
    72.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Fri Feb 24 14:03:07 2006 -0700
    72.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Fri Feb 24 15:41:08 2006 -0700
    72.3 @@ -25,6 +25,7 @@ void __init machine_specific_modify_cpu_
    72.4  	clear_bit(X86_FEATURE_SEP, c->x86_capability);
    72.5  	if (!(xen_start_info->flags & SIF_PRIVILEGED))
    72.6  		clear_bit(X86_FEATURE_MTRR, c->x86_capability);
    72.7 +	c->hlt_works_ok = 0;
    72.8  }
    72.9  
   72.10  extern void hypervisor_callback(void);
   72.11 @@ -33,6 +34,8 @@ extern void nmi(void);
   72.12  
   72.13  static void __init machine_specific_arch_setup(void)
   72.14  {
   72.15 +	struct xen_platform_parameters pp;
   72.16 +
   72.17  	HYPERVISOR_set_callbacks(
   72.18  	    __KERNEL_CS, (unsigned long)hypervisor_callback,
   72.19  	    __KERNEL_CS, (unsigned long)failsafe_callback);
   72.20 @@ -40,4 +43,8 @@ static void __init machine_specific_arch
   72.21  	HYPERVISOR_nmi_op(XENNMI_register_callback, (unsigned long)&nmi);
   72.22  
   72.23  	machine_specific_modify_cpu_capabilities(&boot_cpu_data);
   72.24 +
   72.25 +	if (HYPERVISOR_xen_version(XENVER_platform_parameters,
   72.26 +				   &pp) == 0)
   72.27 +		set_fixaddr_top(pp.virt_start - PAGE_SIZE);
   72.28  }
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/apic.h	Fri Feb 24 15:41:08 2006 -0700
    73.3 @@ -0,0 +1,120 @@
    73.4 +#ifndef __ASM_APIC_H
    73.5 +#define __ASM_APIC_H
    73.6 +
    73.7 +#include <linux/config.h>
    73.8 +#include <linux/pm.h>
    73.9 +#include <asm/fixmap.h>
   73.10 +#include <asm/apicdef.h>
   73.11 +#include <asm/system.h>
   73.12 +
   73.13 +#define Dprintk(x...)
   73.14 +
   73.15 +/*
   73.16 + * Debugging macros
   73.17 + */
   73.18 +#define APIC_QUIET   0
   73.19 +#define APIC_VERBOSE 1
   73.20 +#define APIC_DEBUG   2
   73.21 +
   73.22 +extern int apic_verbosity;
   73.23 +extern int apic_runs_main_timer;
   73.24 +
   73.25 +/*
   73.26 + * Define the default level of output to be very little
   73.27 + * This can be turned up by using apic=verbose for more
   73.28 + * information and apic=debug for _lots_ of information.
   73.29 + * apic_verbosity is defined in apic.c
   73.30 + */
   73.31 +#define apic_printk(v, s, a...) do {       \
   73.32 +		if ((v) <= apic_verbosity) \
   73.33 +			printk(s, ##a);    \
   73.34 +	} while (0)
   73.35 +
   73.36 +#ifdef CONFIG_X86_LOCAL_APIC
   73.37 +
   73.38 +struct pt_regs;
   73.39 +
   73.40 +/*
   73.41 + * Basic functions accessing APICs.
   73.42 + */
   73.43 +
   73.44 +static __inline void apic_write(unsigned long reg, unsigned int v)
   73.45 +{
   73.46 +	*((volatile unsigned int *)(APIC_BASE+reg)) = v;
   73.47 +}
   73.48 +
   73.49 +static __inline unsigned int apic_read(unsigned long reg)
   73.50 +{
   73.51 +	return *((volatile unsigned int *)(APIC_BASE+reg));
   73.52 +}
   73.53 +
   73.54 +static __inline__ void apic_wait_icr_idle(void)
   73.55 +{
   73.56 +	while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
   73.57 +}
   73.58 +
   73.59 +static inline void ack_APIC_irq(void)
   73.60 +{
   73.61 +	/*
   73.62 +	 * ack_APIC_irq() actually gets compiled as a single instruction:
   73.63 +	 * - a single rmw on Pentium/82489DX
   73.64 +	 * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
   73.65 +	 * ... yummie.
   73.66 +	 */
   73.67 +
   73.68 +	/* Docs say use 0 for future compatibility */
   73.69 +	apic_write(APIC_EOI, 0);
   73.70 +}
   73.71 +
   73.72 +extern int get_maxlvt (void);
   73.73 +extern void clear_local_APIC (void);
   73.74 +extern void connect_bsp_APIC (void);
   73.75 +extern void disconnect_bsp_APIC (int virt_wire_setup);
   73.76 +extern void disable_local_APIC (void);
   73.77 +extern int verify_local_APIC (void);
   73.78 +extern void cache_APIC_registers (void);
   73.79 +extern void sync_Arb_IDs (void);
   73.80 +extern void init_bsp_APIC (void);
   73.81 +extern void setup_local_APIC (void);
   73.82 +extern void init_apic_mappings (void);
   73.83 +extern void smp_local_timer_interrupt (struct pt_regs * regs);
   73.84 +extern void setup_boot_APIC_clock (void);
   73.85 +extern void setup_secondary_APIC_clock (void);
   73.86 +extern void setup_apic_nmi_watchdog (void);
   73.87 +extern int reserve_lapic_nmi(void);
   73.88 +extern void release_lapic_nmi(void);
   73.89 +extern void disable_timer_nmi_watchdog(void);
   73.90 +extern void enable_timer_nmi_watchdog(void);
   73.91 +extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
   73.92 +extern int APIC_init_uniprocessor (void);
   73.93 +extern void disable_APIC_timer(void);
   73.94 +extern void enable_APIC_timer(void);
   73.95 +extern void clustered_apic_check(void);
   73.96 +
   73.97 +extern void nmi_watchdog_default(void);
   73.98 +extern int setup_nmi_watchdog(char *);
   73.99 +
  73.100 +extern unsigned int nmi_watchdog;
  73.101 +#define NMI_DEFAULT	-1
  73.102 +#define NMI_NONE	0
  73.103 +#define NMI_IO_APIC	1
  73.104 +#define NMI_LOCAL_APIC	2
  73.105 +#define NMI_INVALID	3
  73.106 +
  73.107 +extern int disable_timer_pin_1;
  73.108 +
  73.109 +extern void setup_threshold_lvt(unsigned long lvt_off);
  73.110 +
  73.111 +#ifndef CONFIG_XEN
  73.112 +void smp_send_timer_broadcast_ipi(void);
  73.113 +void switch_APIC_timer_to_ipi(void *cpumask);
  73.114 +void switch_ipi_to_APIC_timer(void *cpumask);
  73.115 +
  73.116 +#define ARCH_APICTIMER_STOPS_ON_C3	1
  73.117 +#endif
  73.118 +
  73.119 +#endif /* CONFIG_X86_LOCAL_APIC */
  73.120 +
  73.121 +extern unsigned boot_cpu_id;
  73.122 +
  73.123 +#endif /* __ASM_APIC_H */
    74.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/desc.h	Fri Feb 24 14:03:07 2006 -0700
    74.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/desc.h	Fri Feb 24 15:41:08 2006 -0700
    74.3 @@ -90,7 +90,9 @@ static inline void clear_LDT(void)
    74.4   * something other than this.
    74.5   */
    74.6  extern struct desc_struct default_ldt[];
    74.7 +#ifndef CONFIG_X86_NO_IDT
    74.8  extern struct gate_struct idt_table[]; 
    74.9 +#endif
   74.10  extern struct desc_ptr cpu_gdt_descr[];
   74.11  
   74.12  /* the cpu gdt accessor */
   74.13 @@ -113,6 +115,7 @@ static inline void _set_gate(void *adr, 
   74.14  	memcpy(adr, &s, 16); 
   74.15  } 
   74.16  
   74.17 +#ifndef CONFIG_X86_NO_IDT
   74.18  static inline void set_intr_gate(int nr, void *func) 
   74.19  { 
   74.20  	BUG_ON((unsigned)nr > 0xFF);
   74.21 @@ -135,6 +138,7 @@ static inline void set_system_gate_ist(i
   74.22  {
   74.23  	_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist);
   74.24  }
   74.25 +#endif
   74.26  
   74.27  static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 
   74.28  					 unsigned size) 
   74.29 @@ -152,6 +156,7 @@ static inline void set_tssldt_descriptor
   74.30  	memcpy(ptr, &d, 16); 
   74.31  }
   74.32  
   74.33 +#ifndef CONFIG_X86_NO_TSS
   74.34  static inline void set_tss_desc(unsigned cpu, void *addr)
   74.35  { 
   74.36  	/*
   74.37 @@ -165,6 +170,7 @@ static inline void set_tss_desc(unsigned
   74.38  		(unsigned long)addr, DESC_TSS,
   74.39  		IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1);
   74.40  } 
   74.41 +#endif
   74.42  
   74.43  static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
   74.44  { 
    75.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/floppy.h	Fri Feb 24 14:03:07 2006 -0700
    75.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/floppy.h	Fri Feb 24 15:41:08 2006 -0700
    75.3 @@ -14,7 +14,6 @@
    75.4  
    75.5  #include <linux/vmalloc.h>
    75.6  
    75.7 -
    75.8  /*
    75.9   * The DMA channel used by the floppy controller cannot access data at
   75.10   * addresses >= 16MB
   75.11 @@ -26,8 +25,6 @@
   75.12  #define _CROSS_64KB(a,s,vdma) \
   75.13  (!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
   75.14  
   75.15 -#include <linux/vmalloc.h>
   75.16 -
   75.17  /* XEN: Hit DMA paths on the head. This trick from asm-m68k/floppy.h. */
   75.18  #include <asm/dma.h>
   75.19  #undef MAX_DMA_ADDRESS
   75.20 @@ -43,8 +40,12 @@
   75.21  #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
   75.22  #define fd_free_irq()		free_irq(FLOPPY_IRQ, NULL)
   75.23  #define fd_get_dma_residue()    vdma_get_dma_residue(FLOPPY_DMA)
   75.24 -#define fd_dma_mem_alloc(size)	vdma_mem_alloc(size)
   75.25 -#define fd_dma_mem_free(addr, size) vdma_mem_free(addr, size) 
   75.26 +/*
   75.27 + * Do not use vmalloc/vfree: floppy_release_irq_and_dma() gets called from
   75.28 + * softirq context via motor_off_callback. A generic bug we happen to trigger.
   75.29 + */
   75.30 +#define fd_dma_mem_alloc(size)	__get_free_pages(GFP_KERNEL, get_order(size))
   75.31 +#define fd_dma_mem_free(addr, size) free_pages(addr, get_order(size))
   75.32  #define fd_dma_setup(addr, size, mode, io) vdma_dma_setup(addr, size, mode, io)
   75.33  
   75.34  static int virtual_dma_count;
   75.35 @@ -137,7 +138,7 @@ static int fd_request_irq(void)
   75.36  					   "floppy", NULL);
   75.37  }
   75.38  
   75.39 -
   75.40 +#if 0
   75.41  static unsigned long vdma_mem_alloc(unsigned long size)
   75.42  {
   75.43  	return (unsigned long) vmalloc(size);
   75.44 @@ -148,6 +149,7 @@ static void vdma_mem_free(unsigned long 
   75.45  {
   75.46  	vfree((void *)addr);
   75.47  }
   75.48 +#endif
   75.49  
   75.50  static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
   75.51  {
   75.52 @@ -168,7 +170,7 @@ static int xen_floppy_init(void)
   75.53  {
   75.54  	use_virtual_dma = 1;
   75.55  	can_use_virtual_dma = 1;
   75.56 -	return 0x340;
   75.57 +	return 0x3f0;
   75.58  }
   75.59  
   75.60  /*
    76.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/processor.h	Fri Feb 24 14:03:07 2006 -0700
    76.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/processor.h	Fri Feb 24 15:41:08 2006 -0700
    76.3 @@ -196,7 +196,9 @@ static inline void clear_in_cr4 (unsigne
    76.4  #define IO_BITMAP_BITS  65536
    76.5  #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
    76.6  #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
    76.7 +#ifndef CONFIG_X86_NO_TSS
    76.8  #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
    76.9 +#endif
   76.10  #define INVALID_IO_BITMAP_OFFSET 0x8000
   76.11  
   76.12  struct i387_fxsave_struct {
   76.13 @@ -217,6 +219,7 @@ union i387_union {
   76.14  	struct i387_fxsave_struct	fxsave;
   76.15  };
   76.16  
   76.17 +#ifndef CONFIG_X86_NO_TSS
   76.18  struct tss_struct {
   76.19  	u32 reserved1;
   76.20  	u64 rsp0;	
   76.21 @@ -240,8 +243,10 @@ struct tss_struct {
   76.22  	unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
   76.23  } __attribute__((packed)) ____cacheline_aligned;
   76.24  
   76.25 +DECLARE_PER_CPU(struct tss_struct,init_tss);
   76.26 +#endif
   76.27 +
   76.28  extern struct cpuinfo_x86 boot_cpu_data;
   76.29 -DECLARE_PER_CPU(struct tss_struct,init_tss);
   76.30  
   76.31  #ifdef CONFIG_X86_VSMP
   76.32  #define ARCH_MIN_TASKALIGN	(1 << INTERNODE_CACHE_SHIFT)
   76.33 @@ -283,9 +288,11 @@ struct thread_struct {
   76.34  	.rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
   76.35  }
   76.36  
   76.37 +#ifndef CONFIG_X86_NO_TSS
   76.38  #define INIT_TSS  { \
   76.39  	.rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
   76.40  }
   76.41 +#endif
   76.42  
   76.43  #define INIT_MMAP \
   76.44  { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
    77.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/segment.h	Fri Feb 24 14:03:07 2006 -0700
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,44 +0,0 @@
    77.4 -#ifndef _ASM_SEGMENT_H
    77.5 -#define _ASM_SEGMENT_H
    77.6 -
    77.7 -#include <asm/cache.h>
    77.8 -
    77.9 -#define __KERNEL_CS	0x10
   77.10 -#define __KERNEL_DS	0x1b
   77.11 -
   77.12 -#define __KERNEL32_CS   0x3b
   77.13 -
   77.14 -/* 
   77.15 - * we cannot use the same code segment descriptor for user and kernel
   77.16 - * -- not even in the long flat mode, because of different DPL /kkeil 
   77.17 - * The segment offset needs to contain a RPL. Grr. -AK
   77.18 - * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets) 
   77.19 - */
   77.20 -
   77.21 -#define __USER32_CS   0x23   /* 4*8+3 */ 
   77.22 -#define __USER_DS     0x2b   /* 5*8+3 */ 
   77.23 -#define __USER_CS     0x33   /* 6*8+3 */ 
   77.24 -#define __USER32_DS	__USER_DS 
   77.25 -
   77.26 -#define GDT_ENTRY_TLS 1
   77.27 -#define GDT_ENTRY_TSS 8	/* needs two entries */
   77.28 -#define GDT_ENTRY_LDT 10 /* needs two entries */
   77.29 -#define GDT_ENTRY_TLS_MIN 12
   77.30 -#define GDT_ENTRY_TLS_MAX 14
   77.31 -/* 15 free */
   77.32 -
   77.33 -#define GDT_ENTRY_TLS_ENTRIES 3
   77.34 -
   77.35 -/* TLS indexes for 64bit - hardcoded in arch_prctl */
   77.36 -#define FS_TLS 0	
   77.37 -#define GS_TLS 1	
   77.38 -
   77.39 -#define GS_TLS_SEL ((GDT_ENTRY_TLS_MIN+GS_TLS)*8 + 3)
   77.40 -#define FS_TLS_SEL ((GDT_ENTRY_TLS_MIN+FS_TLS)*8 + 3)
   77.41 -
   77.42 -#define IDT_ENTRIES 256
   77.43 -#define GDT_ENTRIES 16
   77.44 -#define GDT_SIZE (GDT_ENTRIES * 8)
   77.45 -#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) 
   77.46 -
   77.47 -#endif
    78.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h	Fri Feb 24 14:03:07 2006 -0700
    78.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h	Fri Feb 24 15:41:08 2006 -0700
    78.3 @@ -182,7 +182,7 @@ static inline void write_cr0(unsigned lo
    78.4  #define read_cr3() ({ \
    78.5  	unsigned long __dummy; \
    78.6  	asm("movq %%cr3,%0" : "=r" (__dummy)); \
    78.7 -	return machine_to_phys(__dummy); \
    78.8 +	machine_to_phys(__dummy); \
    78.9  })
   78.10  
   78.11  static inline unsigned long read_cr4(void)
    79.1 --- a/linux-2.6-xen-sparse/include/linux/mm.h	Fri Feb 24 14:03:07 2006 -0700
    79.2 +++ b/linux-2.6-xen-sparse/include/linux/mm.h	Fri Feb 24 15:41:08 2006 -0700
    79.3 @@ -1064,5 +1064,7 @@ int shrink_slab(unsigned long scanned, g
    79.4  void drop_pagecache(void);
    79.5  void drop_slab(void);
    79.6  
    79.7 +extern int randomize_va_space;
    79.8 +
    79.9  #endif /* __KERNEL__ */
   79.10  #endif /* _LINUX_MM_H */
    80.1 --- a/linux-2.6-xen-sparse/include/xen/gnttab.h	Fri Feb 24 14:03:07 2006 -0700
    80.2 +++ b/linux-2.6-xen-sparse/include/xen/gnttab.h	Fri Feb 24 15:41:08 2006 -0700
    80.3 @@ -71,7 +71,7 @@ int gnttab_end_foreign_access_ref(grant_
    80.4  void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
    80.5  			       unsigned long page);
    80.6  
    80.7 -int gnttab_grant_foreign_transfer(domid_t domid);
    80.8 +int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
    80.9  
   80.10  unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
   80.11  unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
   80.12 @@ -98,7 +98,8 @@ void gnttab_request_free_callback(struct
   80.13  void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
   80.14  				     unsigned long frame, int readonly);
   80.15  
   80.16 -void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid);
   80.17 +void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
   80.18 +				       unsigned long pfn);
   80.19  
   80.20  #ifdef __ia64__
   80.21  #define gnttab_map_vaddr(map) __va(map.dev_bus_addr)
    81.1 --- a/linux-2.6-xen-sparse/mm/memory.c	Fri Feb 24 14:03:07 2006 -0700
    81.2 +++ b/linux-2.6-xen-sparse/mm/memory.c	Fri Feb 24 15:41:08 2006 -0700
    81.3 @@ -82,6 +82,16 @@ EXPORT_SYMBOL(num_physpages);
    81.4  EXPORT_SYMBOL(high_memory);
    81.5  EXPORT_SYMBOL(vmalloc_earlyreserve);
    81.6  
    81.7 +int randomize_va_space __read_mostly = 1;
    81.8 +
    81.9 +static int __init disable_randmaps(char *s)
   81.10 +{
   81.11 +	randomize_va_space = 0;
   81.12 +	return 0;
   81.13 +}
   81.14 +__setup("norandmaps", disable_randmaps);
   81.15 +
   81.16 +
   81.17  /*
   81.18   * If a p?d_bad entry is found while walking page tables, report
   81.19   * the error, before resetting entry to p?d_none.  Usually (but
    82.1 --- a/linux-2.6-xen-sparse/mm/page_alloc.c	Fri Feb 24 14:03:07 2006 -0700
    82.2 +++ b/linux-2.6-xen-sparse/mm/page_alloc.c	Fri Feb 24 15:41:08 2006 -0700
    82.3 @@ -56,6 +56,7 @@ long nr_swap_pages;
    82.4  int percpu_pagelist_fraction;
    82.5  
    82.6  static void fastcall free_hot_cold_page(struct page *page, int cold);
    82.7 +static void __free_pages_ok(struct page *page, unsigned int order);
    82.8  
    82.9  /*
   82.10   * results with 256, 32 in the lowmem_reserve sysctl:
   82.11 @@ -169,20 +170,23 @@ static void bad_page(struct page *page)
   82.12   * All pages have PG_compound set.  All pages have their ->private pointing at
   82.13   * the head page (even the head page has this).
   82.14   *
   82.15 - * The first tail page's ->mapping, if non-zero, holds the address of the
   82.16 - * compound page's put_page() function.
   82.17 - *
   82.18 - * The order of the allocation is stored in the first tail page's ->index
   82.19 - * This is only for debug at present.  This usage means that zero-order pages
   82.20 - * may not be compound.
   82.21 + * The first tail page's ->lru.next holds the address of the compound page's
   82.22 + * put_page() function.  Its ->lru.prev holds the order of allocation.
   82.23 + * This usage means that zero-order pages may not be compound.
   82.24   */
   82.25 +
   82.26 +static void free_compound_page(struct page *page)
   82.27 +{
   82.28 +	__free_pages_ok(page, (unsigned long)page[1].lru.prev);
   82.29 +}
   82.30 +
   82.31  static void prep_compound_page(struct page *page, unsigned long order)
   82.32  {
   82.33  	int i;
   82.34  	int nr_pages = 1 << order;
   82.35  
   82.36 -	page[1].mapping = NULL;
   82.37 -	page[1].index = order;
   82.38 +	page[1].lru.next = (void *)free_compound_page;	/* set dtor */
   82.39 +	page[1].lru.prev = (void *)order;
   82.40  	for (i = 0; i < nr_pages; i++) {
   82.41  		struct page *p = page + i;
   82.42  
   82.43 @@ -196,7 +200,7 @@ static void destroy_compound_page(struct
   82.44  	int i;
   82.45  	int nr_pages = 1 << order;
   82.46  
   82.47 -	if (unlikely(page[1].index != order))
   82.48 +	if (unlikely((unsigned long)page[1].lru.prev != order))
   82.49  		bad_page(page);
   82.50  
   82.51  	for (i = 0; i < nr_pages; i++) {
   82.52 @@ -1539,29 +1543,29 @@ static int __initdata node_load[MAX_NUMN
   82.53   */
   82.54  static int __init find_next_best_node(int node, nodemask_t *used_node_mask)
   82.55  {
   82.56 -	int i, n, val;
   82.57 +	int n, val;
   82.58  	int min_val = INT_MAX;
   82.59  	int best_node = -1;
   82.60  
   82.61 -	for_each_online_node(i) {
   82.62 +	/* Use the local node if we haven't already */
   82.63 +	if (!node_isset(node, *used_node_mask)) {
   82.64 +		node_set(node, *used_node_mask);
   82.65 +		return node;
   82.66 +	}
   82.67 +
   82.68 +	for_each_online_node(n) {
   82.69  		cpumask_t tmp;
   82.70  
   82.71 -		/* Start from local node */
   82.72 -		n = (node+i) % num_online_nodes();
   82.73 -
   82.74  		/* Don't want a node to appear more than once */
   82.75  		if (node_isset(n, *used_node_mask))
   82.76  			continue;
   82.77  
   82.78 -		/* Use the local node if we haven't already */
   82.79 -		if (!node_isset(node, *used_node_mask)) {
   82.80 -			best_node = node;
   82.81 -			break;
   82.82 -		}
   82.83 -
   82.84  		/* Use the distance array to find the distance */
   82.85  		val = node_distance(node, n);
   82.86  
   82.87 +		/* Penalize nodes under us ("prefer the next node") */
   82.88 +		val += (n < node);
   82.89 +
   82.90  		/* Give preference to headless and unused nodes */
   82.91  		tmp = node_to_cpumask(n);
   82.92  		if (!cpus_empty(tmp))
    83.1 --- a/patches/linux-2.6.16-rc3/i386-mach-io-check-nmi.patch	Fri Feb 24 14:03:07 2006 -0700
    83.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.3 @@ -1,45 +0,0 @@
    83.4 -diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/traps.c ./arch/i386/kernel/traps.c
    83.5 ---- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/traps.c	2006-02-15 20:38:51.000000000 +0000
    83.6 -+++ ./arch/i386/kernel/traps.c	2006-02-15 20:40:43.000000000 +0000
    83.7 -@@ -567,18 +567,11 @@ static void mem_parity_error(unsigned ch
    83.8 - 
    83.9 - static void io_check_error(unsigned char reason, struct pt_regs * regs)
   83.10 - {
   83.11 --	unsigned long i;
   83.12 --
   83.13 - 	printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
   83.14 - 	show_registers(regs);
   83.15 - 
   83.16 - 	/* Re-enable the IOCK line, wait for a few seconds */
   83.17 --	reason = (reason & 0xf) | 8;
   83.18 --	outb(reason, 0x61);
   83.19 --	i = 2000;
   83.20 --	while (--i) udelay(1000);
   83.21 --	reason &= ~8;
   83.22 --	outb(reason, 0x61);
   83.23 -+	clear_io_check_error(reason);
   83.24 - }
   83.25 - 
   83.26 - static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
   83.27 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/mach-default/mach_traps.h ./include/asm-i386/mach-default/mach_traps.h
   83.28 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/mach-default/mach_traps.h	2006-01-03 03:21:10.000000000 +0000
   83.29 -+++ ./include/asm-i386/mach-default/mach_traps.h	2006-02-15 20:40:43.000000000 +0000
   83.30 -@@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig
   83.31 - 	outb(reason, 0x61);
   83.32 - }
   83.33 - 
   83.34 -+static inline void clear_io_check_error(unsigned char reason)
   83.35 -+{
   83.36 -+	unsigned long i;
   83.37 -+
   83.38 -+	reason = (reason & 0xf) | 8;
   83.39 -+	outb(reason, 0x61);
   83.40 -+	i = 2000;
   83.41 -+	while (--i) udelay(1000);
   83.42 -+	reason &= ~8;
   83.43 -+	outb(reason, 0x61);
   83.44 -+}
   83.45 -+
   83.46 - static inline unsigned char get_nmi_reason(void)
   83.47 - {
   83.48 - 	return inb(0x61);
    84.1 --- a/patches/linux-2.6.16-rc3/net-csum.patch	Fri Feb 24 14:03:07 2006 -0700
    84.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.3 @@ -1,41 +0,0 @@
    84.4 -diff -pruN ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_tcp.c ./net/ipv4/netfilter/ip_nat_proto_tcp.c
    84.5 ---- ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-02-02 17:39:51.000000000 +0000
    84.6 -+++ ./net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-02-02 17:44:18.000000000 +0000
    84.7 -@@ -129,10 +129,14 @@ tcp_manip_pkt(struct sk_buff **pskb,
    84.8 - 	if (hdrsize < sizeof(*hdr))
    84.9 - 		return 1;
   84.10 - 
   84.11 --	hdr->check = ip_nat_cheat_check(~oldip, newip,
   84.12 -+	if ((*pskb)->proto_csum_blank) {
   84.13 -+		hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   84.14 -+	} else {
   84.15 -+		hdr->check = ip_nat_cheat_check(~oldip, newip,
   84.16 - 					ip_nat_cheat_check(oldport ^ 0xFFFF,
   84.17 - 							   newport,
   84.18 - 							   hdr->check));
   84.19 -+	}
   84.20 - 	return 1;
   84.21 - }
   84.22 -
   84.23 -diff -pruN ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_udp.c ./net/ipv4/netfilter/ip_nat_proto_udp.c
   84.24 ---- ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-02-02 17:39:51.000000000 +0000
   84.25 -+++ ./net/ipv4/netfilter/ip_nat_proto_udp.c	2006-02-02 17:44:18.000000000 +0000
   84.26 -@@ -113,11 +113,16 @@ udp_manip_pkt(struct sk_buff **pskb,
   84.27 - 		newport = tuple->dst.u.udp.port;
   84.28 - 		portptr = &hdr->dest;
   84.29 - 	}
   84.30 --	if (hdr->check) /* 0 is a special case meaning no checksum */
   84.31 --		hdr->check = ip_nat_cheat_check(~oldip, newip,
   84.32 -+	if (hdr->check) { /* 0 is a special case meaning no checksum */
   84.33 -+		if ((*pskb)->proto_csum_blank) {
   84.34 -+			hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   84.35 -+		} else {
   84.36 -+			hdr->check = ip_nat_cheat_check(~oldip, newip,
   84.37 - 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
   84.38 - 							   newport,
   84.39 - 							   hdr->check));
   84.40 -+		}
   84.41 -+	}
   84.42 - 	*portptr = newport;
   84.43 - 	return 1;
   84.44 - }
    85.1 --- a/patches/linux-2.6.16-rc3/pmd-shared.patch	Fri Feb 24 14:03:07 2006 -0700
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,111 +0,0 @@
    85.4 -diff -pruN ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pageattr.c ./arch/i386/mm/pageattr.c
    85.5 ---- ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pageattr.c	2006-02-02 17:39:29.000000000 +0000
    85.6 -+++ ./arch/i386/mm/pageattr.c	2006-02-02 17:45:14.000000000 +0000
    85.7 -@@ -78,7 +78,7 @@ static void set_pmd_pte(pte_t *kpte, uns
    85.8 - 	unsigned long flags;
    85.9 - 
   85.10 - 	set_pte_atomic(kpte, pte); 	/* change init_mm */
   85.11 --	if (PTRS_PER_PMD > 1)
   85.12 -+	if (HAVE_SHARED_KERNEL_PMD)
   85.13 - 		return;
   85.14 - 
   85.15 - 	spin_lock_irqsave(&pgd_lock, flags);
   85.16 -diff -pruN ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pgtable.c ./arch/i386/mm/pgtable.c
   85.17 ---- ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pgtable.c	2006-01-03 03:21:10.000000000 +0000
   85.18 -+++ ./arch/i386/mm/pgtable.c	2006-02-02 17:45:14.000000000 +0000
   85.19 -@@ -215,9 +215,10 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
   85.20 - 		spin_lock_irqsave(&pgd_lock, flags);
   85.21 - 	}
   85.22 - 
   85.23 --	clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
   85.24 --			swapper_pg_dir + USER_PTRS_PER_PGD,
   85.25 --			KERNEL_PGD_PTRS);
   85.26 -+	if (PTRS_PER_PMD == 1 || HAVE_SHARED_KERNEL_PMD)
   85.27 -+		clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
   85.28 -+				swapper_pg_dir + USER_PTRS_PER_PGD,
   85.29 -+				KERNEL_PGD_PTRS);
   85.30 - 	if (PTRS_PER_PMD > 1)
   85.31 - 		return;
   85.32 - 
   85.33 -@@ -249,6 +250,30 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
   85.34 - 			goto out_oom;
   85.35 - 		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
   85.36 - 	}
   85.37 -+
   85.38 -+	if (!HAVE_SHARED_KERNEL_PMD) {
   85.39 -+		unsigned long flags;
   85.40 -+
   85.41 -+		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   85.42 -+			pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
   85.43 -+			if (!pmd)
   85.44 -+				goto out_oom;
   85.45 -+			set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(1 + __pa(pmd)));
   85.46 -+		}
   85.47 -+
   85.48 -+		spin_lock_irqsave(&pgd_lock, flags);
   85.49 -+		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   85.50 -+			unsigned long v = (unsigned long)i << PGDIR_SHIFT;
   85.51 -+			pgd_t *kpgd = pgd_offset_k(v);
   85.52 -+			pud_t *kpud = pud_offset(kpgd, v);
   85.53 -+			pmd_t *kpmd = pmd_offset(kpud, v);
   85.54 -+			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   85.55 -+			memcpy(pmd, kpmd, PAGE_SIZE);
   85.56 -+		}
   85.57 -+		pgd_list_add(pgd);
   85.58 -+		spin_unlock_irqrestore(&pgd_lock, flags);
   85.59 -+	}
   85.60 -+
   85.61 - 	return pgd;
   85.62 - 
   85.63 - out_oom:
   85.64 -@@ -263,9 +288,23 @@ void pgd_free(pgd_t *pgd)
   85.65 - 	int i;
   85.66 - 
   85.67 - 	/* in the PAE case user pgd entries are overwritten before usage */
   85.68 --	if (PTRS_PER_PMD > 1)
   85.69 --		for (i = 0; i < USER_PTRS_PER_PGD; ++i)
   85.70 --			kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
   85.71 -+	if (PTRS_PER_PMD > 1) {
   85.72 -+		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
   85.73 -+			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   85.74 -+			kmem_cache_free(pmd_cache, pmd);
   85.75 -+		}
   85.76 -+		if (!HAVE_SHARED_KERNEL_PMD) {
   85.77 -+			unsigned long flags;
   85.78 -+			spin_lock_irqsave(&pgd_lock, flags);
   85.79 -+			pgd_list_del(pgd);
   85.80 -+			spin_unlock_irqrestore(&pgd_lock, flags);
   85.81 -+			for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   85.82 -+				pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   85.83 -+				memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
   85.84 -+				kmem_cache_free(pmd_cache, pmd);
   85.85 -+			}
   85.86 -+		}
   85.87 -+	}
   85.88 - 	/* in the non-PAE case, free_pgtables() clears user pgd entries */
   85.89 - 	kmem_cache_free(pgd_cache, pgd);
   85.90 - }
   85.91 -diff -pruN ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-2level-defs.h ./include/asm-i386/pgtable-2level-defs.h
   85.92 ---- ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-2level-defs.h	2006-01-03 03:21:10.000000000 +0000
   85.93 -+++ ./include/asm-i386/pgtable-2level-defs.h	2006-02-02 17:45:14.000000000 +0000
   85.94 -@@ -1,6 +1,8 @@
   85.95 - #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
   85.96 - #define _I386_PGTABLE_2LEVEL_DEFS_H
   85.97 - 
   85.98 -+#define HAVE_SHARED_KERNEL_PMD 0
   85.99 -+
  85.100 - /*
  85.101 -  * traditional i386 two-level paging structure:
  85.102 -  */
  85.103 -diff -pruN ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-3level-defs.h ./include/asm-i386/pgtable-3level-defs.h
  85.104 ---- ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-3level-defs.h	2006-01-03 03:21:10.000000000 +0000
  85.105 -+++ ./include/asm-i386/pgtable-3level-defs.h	2006-02-02 17:45:14.000000000 +0000
  85.106 -@@ -1,6 +1,8 @@
  85.107 - #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
  85.108 - #define _I386_PGTABLE_3LEVEL_DEFS_H
  85.109 - 
  85.110 -+#define HAVE_SHARED_KERNEL_PMD 1
  85.111 -+
  85.112 - /*
  85.113 -  * PGDIR_SHIFT determines what a top-level page table entry can map
  85.114 -  */
    86.1 --- a/patches/linux-2.6.16-rc3/smp-alts.patch	Fri Feb 24 14:03:07 2006 -0700
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,591 +0,0 @@
    86.4 -diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/Kconfig ./arch/i386/Kconfig
    86.5 ---- ../pristine-linux-2.6.16-rc3/arch/i386/Kconfig	2006-02-15 20:38:51.000000000 +0000
    86.6 -+++ ./arch/i386/Kconfig	2006-02-15 20:45:57.000000000 +0000
    86.7 -@@ -202,6 +202,19 @@ config SMP
    86.8 - 
    86.9 - 	  If you don't know what to do here, say N.
   86.10 - 
   86.11 -+config SMP_ALTERNATIVES
   86.12 -+	bool "SMP alternatives support (EXPERIMENTAL)"
   86.13 -+	depends on SMP && EXPERIMENTAL
   86.14 -+	help
   86.15 -+	  Try to reduce the overhead of running an SMP kernel on a uniprocessor
   86.16 -+	  host slightly by replacing certain key instruction sequences
   86.17 -+	  according to whether we currently have more than one CPU available.
   86.18 -+	  This should provide a noticeable boost to performance when
   86.19 -+	  running SMP kernels on UP machines, and have negligible impact
   86.20 -+	  when running on an true SMP host.
   86.21 -+
   86.22 -+          If unsure, say N.
   86.23 -+	  
   86.24 - config NR_CPUS
   86.25 - 	int "Maximum number of CPUs (2-255)"
   86.26 - 	range 2 255
   86.27 -diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/Makefile ./arch/i386/kernel/Makefile
   86.28 ---- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/Makefile	2006-02-15 20:38:51.000000000 +0000
   86.29 -+++ ./arch/i386/kernel/Makefile	2006-02-15 20:45:57.000000000 +0000
   86.30 -@@ -37,6 +37,7 @@ obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
   86.31 - obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
   86.32 - obj-$(CONFIG_VM86)		+= vm86.o
   86.33 - obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
   86.34 -+obj-$(CONFIG_SMP_ALTERNATIVES)  += smpalts.o
   86.35 - 
   86.36 - EXTRA_AFLAGS   := -traditional
   86.37 - 
   86.38 -diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpalts.c ./arch/i386/kernel/smpalts.c
   86.39 ---- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpalts.c	1970-01-01 01:00:00.000000000 +0100
   86.40 -+++ ./arch/i386/kernel/smpalts.c	2006-02-15 20:45:57.000000000 +0000
   86.41 -@@ -0,0 +1,85 @@
   86.42 -+#include <linux/kernel.h>
   86.43 -+#include <asm/system.h>
   86.44 -+#include <asm/smp_alt.h>
   86.45 -+#include <asm/processor.h>
   86.46 -+#include <asm/string.h>
   86.47 -+
   86.48 -+struct smp_replacement_record {
   86.49 -+	unsigned char targ_size;
   86.50 -+	unsigned char smp1_size;
   86.51 -+	unsigned char smp2_size;
   86.52 -+	unsigned char up_size;
   86.53 -+	unsigned char feature;
   86.54 -+	unsigned char data[0];
   86.55 -+};
   86.56 -+
   86.57 -+struct smp_alternative_record {
   86.58 -+	void *targ_start;
   86.59 -+	struct smp_replacement_record *repl;
   86.60 -+};
   86.61 -+
   86.62 -+extern struct smp_alternative_record __start_smp_alternatives_table,
   86.63 -+  __stop_smp_alternatives_table;
   86.64 -+extern unsigned long __init_begin, __init_end;
   86.65 -+
   86.66 -+void prepare_for_smp(void)
   86.67 -+{
   86.68 -+	struct smp_alternative_record *r;
   86.69 -+	printk(KERN_INFO "Enabling SMP...\n");
   86.70 -+	for (r = &__start_smp_alternatives_table;
   86.71 -+	     r != &__stop_smp_alternatives_table;
   86.72 -+	     r++) {
   86.73 -+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
   86.74 -+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
   86.75 -+		BUG_ON(r->repl->targ_size < r->repl->up_size);
   86.76 -+               if (system_state == SYSTEM_RUNNING &&
   86.77 -+                   r->targ_start >= (void *)&__init_begin &&
   86.78 -+                   r->targ_start < (void *)&__init_end)
   86.79 -+                       continue;
   86.80 -+		if (r->repl->feature != (unsigned char)-1 &&
   86.81 -+		    boot_cpu_has(r->repl->feature)) {
   86.82 -+			memcpy(r->targ_start,
   86.83 -+			       r->repl->data + r->repl->smp1_size,
   86.84 -+			       r->repl->smp2_size);
   86.85 -+			memset(r->targ_start + r->repl->smp2_size,
   86.86 -+			       0x90,
   86.87 -+			       r->repl->targ_size - r->repl->smp2_size);
   86.88 -+		} else {
   86.89 -+			memcpy(r->targ_start,
   86.90 -+			       r->repl->data,
   86.91 -+			       r->repl->smp1_size);
   86.92 -+			memset(r->targ_start + r->repl->smp1_size,
   86.93 -+			       0x90,
   86.94 -+			       r->repl->targ_size - r->repl->smp1_size);
   86.95 -+		}
   86.96 -+	}
   86.97 -+	/* Paranoia */
   86.98 -+	asm volatile ("jmp 1f\n1:");
   86.99 -+	mb();
  86.100 -+}
  86.101 -+
  86.102 -+void unprepare_for_smp(void)
  86.103 -+{
  86.104 -+	struct smp_alternative_record *r;
  86.105 -+	printk(KERN_INFO "Disabling SMP...\n");
  86.106 -+	for (r = &__start_smp_alternatives_table;
  86.107 -+	     r != &__stop_smp_alternatives_table;
  86.108 -+	     r++) {
  86.109 -+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
  86.110 -+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
  86.111 -+		BUG_ON(r->repl->targ_size < r->repl->up_size);
  86.112 -+               if (system_state == SYSTEM_RUNNING &&
  86.113 -+                   r->targ_start >= (void *)&__init_begin &&
  86.114 -+                   r->targ_start < (void *)&__init_end)
  86.115 -+                       continue;
  86.116 -+		memcpy(r->targ_start,
  86.117 -+		       r->repl->data + r->repl->smp1_size + r->repl->smp2_size,
  86.118 -+		       r->repl->up_size);
  86.119 -+		memset(r->targ_start + r->repl->up_size,
  86.120 -+		       0x90,
  86.121 -+		       r->repl->targ_size - r->repl->up_size);
  86.122 -+	}
  86.123 -+	/* Paranoia */
  86.124 -+	asm volatile ("jmp 1f\n1:");
  86.125 -+	mb();
  86.126 -+}
  86.127 -diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpboot.c ./arch/i386/kernel/smpboot.c
  86.128 ---- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpboot.c	2006-02-15 20:38:51.000000000 +0000
  86.129 -+++ ./arch/i386/kernel/smpboot.c	2006-02-15 20:45:57.000000000 +0000
  86.130 -@@ -1214,6 +1214,11 @@ static void __init smp_boot_cpus(unsigne
  86.131 - 		if (max_cpus <= cpucount+1)
  86.132 - 			continue;
  86.133 - 
  86.134 -+#ifdef CONFIG_SMP_ALTERNATIVES
  86.135 -+		if (kicked == 1)
  86.136 -+			prepare_for_smp();
  86.137 -+#endif
  86.138 -+
  86.139 - 		if (((cpu = alloc_cpu_id()) <= 0) || do_boot_cpu(apicid, cpu))
  86.140 - 			printk("CPU #%d not responding - cannot use it.\n",
  86.141 - 								apicid);
  86.142 -@@ -1392,6 +1397,11 @@ int __devinit __cpu_up(unsigned int cpu)
  86.143 - 		return -EIO;
  86.144 - 	}
  86.145 - 
  86.146 -+#ifdef CONFIG_SMP_ALTERNATIVES
  86.147 -+	if (num_online_cpus() == 1)
  86.148 -+		prepare_for_smp();
  86.149 -+#endif
  86.150 -+
  86.151 - 	local_irq_enable();
  86.152 - 	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
  86.153 - 	/* Unleash the CPU! */
  86.154 -diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/vmlinux.lds.S ./arch/i386/kernel/vmlinux.lds.S
  86.155 ---- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/vmlinux.lds.S	2006-01-03 03:21:10.000000000 +0000
  86.156 -+++ ./arch/i386/kernel/vmlinux.lds.S	2006-02-15 20:45:57.000000000 +0000
  86.157 -@@ -34,6 +34,13 @@ SECTIONS
  86.158 -   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
  86.159 -   __stop___ex_table = .;
  86.160 - 
  86.161 -+  . = ALIGN(16);
  86.162 -+  __start_smp_alternatives_table = .;
  86.163 -+  __smp_alternatives : { *(__smp_alternatives) }
  86.164 -+  __stop_smp_alternatives_table = .;
  86.165 -+
  86.166 -+  __smp_replacements : { *(__smp_replacements) }
  86.167 -+
  86.168 -   RODATA
  86.169 - 
  86.170 -   /* writeable */
  86.171 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/atomic.h ./include/asm-i386/atomic.h
  86.172 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/atomic.h	2006-02-15 20:38:57.000000000 +0000
  86.173 -+++ ./include/asm-i386/atomic.h	2006-02-15 20:45:57.000000000 +0000
  86.174 -@@ -4,18 +4,13 @@
  86.175 - #include <linux/config.h>
  86.176 - #include <linux/compiler.h>
  86.177 - #include <asm/processor.h>
  86.178 -+#include <asm/smp_alt.h>
  86.179 - 
  86.180 - /*
  86.181 -  * Atomic operations that C can't guarantee us.  Useful for
  86.182 -  * resource counting etc..
  86.183 -  */
  86.184 - 
  86.185 --#ifdef CONFIG_SMP
  86.186 --#define LOCK "lock ; "
  86.187 --#else
  86.188 --#define LOCK ""
  86.189 --#endif
  86.190 --
  86.191 - /*
  86.192 -  * Make sure gcc doesn't try to be clever and move things around
  86.193 -  * on us. We need to use _exactly_ the address the user gave us,
  86.194 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/bitops.h ./include/asm-i386/bitops.h
  86.195 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/bitops.h	2006-02-15 20:38:57.000000000 +0000
  86.196 -+++ ./include/asm-i386/bitops.h	2006-02-15 20:45:57.000000000 +0000
  86.197 -@@ -7,6 +7,7 @@
  86.198 - 
  86.199 - #include <linux/config.h>
  86.200 - #include <linux/compiler.h>
  86.201 -+#include <asm/smp_alt.h>
  86.202 - 
  86.203 - /*
  86.204 -  * These have to be done with inline assembly: that way the bit-setting
  86.205 -@@ -16,12 +17,6 @@
  86.206 -  * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
  86.207 -  */
  86.208 - 
  86.209 --#ifdef CONFIG_SMP
  86.210 --#define LOCK_PREFIX "lock ; "
  86.211 --#else
  86.212 --#define LOCK_PREFIX ""
  86.213 --#endif
  86.214 --
  86.215 - #define ADDR (*(volatile long *) addr)
  86.216 - 
  86.217 - /**
  86.218 -@@ -41,7 +36,7 @@
  86.219 -  */
  86.220 - static inline void set_bit(int nr, volatile unsigned long * addr)
  86.221 - {
  86.222 --	__asm__ __volatile__( LOCK_PREFIX
  86.223 -+	__asm__ __volatile__( LOCK
  86.224 - 		"btsl %1,%0"
  86.225 - 		:"+m" (ADDR)
  86.226 - 		:"Ir" (nr));
  86.227 -@@ -76,7 +71,7 @@ static inline void __set_bit(int nr, vol
  86.228 -  */
  86.229 - static inline void clear_bit(int nr, volatile unsigned long * addr)
  86.230 - {
  86.231 --	__asm__ __volatile__( LOCK_PREFIX
  86.232 -+	__asm__ __volatile__( LOCK
  86.233 - 		"btrl %1,%0"
  86.234 - 		:"+m" (ADDR)
  86.235 - 		:"Ir" (nr));
  86.236 -@@ -121,7 +116,7 @@ static inline void __change_bit(int nr, 
  86.237 -  */
  86.238 - static inline void change_bit(int nr, volatile unsigned long * addr)
  86.239 - {
  86.240 --	__asm__ __volatile__( LOCK_PREFIX
  86.241 -+	__asm__ __volatile__( LOCK
  86.242 - 		"btcl %1,%0"
  86.243 - 		:"+m" (ADDR)
  86.244 - 		:"Ir" (nr));
  86.245 -@@ -140,7 +135,7 @@ static inline int test_and_set_bit(int n
  86.246 - {
  86.247 - 	int oldbit;
  86.248 - 
  86.249 --	__asm__ __volatile__( LOCK_PREFIX
  86.250 -+	__asm__ __volatile__( LOCK
  86.251 - 		"btsl %2,%1\n\tsbbl %0,%0"
  86.252 - 		:"=r" (oldbit),"+m" (ADDR)
  86.253 - 		:"Ir" (nr) : "memory");
  86.254 -@@ -180,7 +175,7 @@ static inline int test_and_clear_bit(int
  86.255 - {
  86.256 - 	int oldbit;
  86.257 - 
  86.258 --	__asm__ __volatile__( LOCK_PREFIX
  86.259 -+	__asm__ __volatile__( LOCK
  86.260 - 		"btrl %2,%1\n\tsbbl %0,%0"
  86.261 - 		:"=r" (oldbit),"+m" (ADDR)
  86.262 - 		:"Ir" (nr) : "memory");
  86.263 -@@ -231,7 +226,7 @@ static inline int test_and_change_bit(in
  86.264 - {
  86.265 - 	int oldbit;
  86.266 - 
  86.267 --	__asm__ __volatile__( LOCK_PREFIX
  86.268 -+	__asm__ __volatile__( LOCK
  86.269 - 		"btcl %2,%1\n\tsbbl %0,%0"
  86.270 - 		:"=r" (oldbit),"+m" (ADDR)
  86.271 - 		:"Ir" (nr) : "memory");
  86.272 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/futex.h ./include/asm-i386/futex.h
  86.273 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/futex.h	2006-02-15 20:38:57.000000000 +0000
  86.274 -+++ ./include/asm-i386/futex.h	2006-02-15 20:45:57.000000000 +0000
  86.275 -@@ -28,7 +28,7 @@
  86.276 - "1:	movl	%2, %0\n\
  86.277 - 	movl	%0, %3\n"					\
  86.278 - 	insn "\n"						\
  86.279 --"2:	" LOCK_PREFIX "cmpxchgl %3, %2\n\
  86.280 -+"2:	" LOCK "cmpxchgl %3, %2\n\
  86.281 - 	jnz	1b\n\
  86.282 - 3:	.section .fixup,\"ax\"\n\
  86.283 - 4:	mov	%5, %1\n\
  86.284 -@@ -68,7 +68,7 @@ futex_atomic_op_inuser (int encoded_op, 
  86.285 - #endif
  86.286 - 		switch (op) {
  86.287 - 		case FUTEX_OP_ADD:
  86.288 --			__futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret,
  86.289 -+			__futex_atomic_op1(LOCK "xaddl %0, %2", ret,
  86.290 - 					   oldval, uaddr, oparg);
  86.291 - 			break;
  86.292 - 		case FUTEX_OP_OR:
  86.293 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/rwsem.h ./include/asm-i386/rwsem.h
  86.294 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/rwsem.h	2006-01-03 03:21:10.000000000 +0000
  86.295 -+++ ./include/asm-i386/rwsem.h	2006-02-15 20:45:57.000000000 +0000
  86.296 -@@ -40,6 +40,7 @@
  86.297 - 
  86.298 - #include <linux/list.h>
  86.299 - #include <linux/spinlock.h>
  86.300 -+#include <asm/smp_alt.h>
  86.301 - 
  86.302 - struct rwsem_waiter;
  86.303 - 
  86.304 -@@ -99,7 +100,7 @@ static inline void __down_read(struct rw
  86.305 - {
  86.306 - 	__asm__ __volatile__(
  86.307 - 		"# beginning down_read\n\t"
  86.308 --LOCK_PREFIX	"  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
  86.309 -+LOCK	        "  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
  86.310 - 		"  js        2f\n\t" /* jump if we weren't granted the lock */
  86.311 - 		"1:\n\t"
  86.312 - 		LOCK_SECTION_START("")
  86.313 -@@ -130,7 +131,7 @@ static inline int __down_read_trylock(st
  86.314 - 		"  movl	     %1,%2\n\t"
  86.315 - 		"  addl      %3,%2\n\t"
  86.316 - 		"  jle	     2f\n\t"
  86.317 --LOCK_PREFIX	"  cmpxchgl  %2,%0\n\t"
  86.318 -+LOCK	        "  cmpxchgl  %2,%0\n\t"
  86.319 - 		"  jnz	     1b\n\t"
  86.320 - 		"2:\n\t"
  86.321 - 		"# ending __down_read_trylock\n\t"
  86.322 -@@ -150,7 +151,7 @@ static inline void __down_write(struct r
  86.323 - 	tmp = RWSEM_ACTIVE_WRITE_BIAS;
  86.324 - 	__asm__ __volatile__(
  86.325 - 		"# beginning down_write\n\t"
  86.326 --LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
  86.327 -+LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
  86.328 - 		"  testl     %%edx,%%edx\n\t" /* was the count 0 before? */
  86.329 - 		"  jnz       2f\n\t" /* jump if we weren't granted the lock */
  86.330 - 		"1:\n\t"
  86.331 -@@ -188,7 +189,7 @@ static inline void __up_read(struct rw_s
  86.332 - 	__s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
  86.333 - 	__asm__ __volatile__(
  86.334 - 		"# beginning __up_read\n\t"
  86.335 --LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
  86.336 -+LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
  86.337 - 		"  js        2f\n\t" /* jump if the lock is being waited upon */
  86.338 - 		"1:\n\t"
  86.339 - 		LOCK_SECTION_START("")
  86.340 -@@ -214,7 +215,7 @@ static inline void __up_write(struct rw_
  86.341 - 	__asm__ __volatile__(
  86.342 - 		"# beginning __up_write\n\t"
  86.343 - 		"  movl      %2,%%edx\n\t"
  86.344 --LOCK_PREFIX	"  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
  86.345 -+LOCK	        "  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
  86.346 - 		"  jnz       2f\n\t" /* jump if the lock is being waited upon */
  86.347 - 		"1:\n\t"
  86.348 - 		LOCK_SECTION_START("")
  86.349 -@@ -239,7 +240,7 @@ static inline void __downgrade_write(str
  86.350 - {
  86.351 - 	__asm__ __volatile__(
  86.352 - 		"# beginning __downgrade_write\n\t"
  86.353 --LOCK_PREFIX	"  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
  86.354 -+LOCK	        "  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
  86.355 - 		"  js        2f\n\t" /* jump if the lock is being waited upon */
  86.356 - 		"1:\n\t"
  86.357 - 		LOCK_SECTION_START("")
  86.358 -@@ -263,7 +264,7 @@ LOCK_PREFIX	"  addl      %2,(%%eax)\n\t"
  86.359 - static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
  86.360 - {
  86.361 - 	__asm__ __volatile__(
  86.362 --LOCK_PREFIX	"addl %1,%0"
  86.363 -+LOCK	          "addl %1,%0"
  86.364 - 		: "=m"(sem->count)
  86.365 - 		: "ir"(delta), "m"(sem->count));
  86.366 - }
  86.367 -@@ -276,7 +277,7 @@ static inline int rwsem_atomic_update(in
  86.368 - 	int tmp = delta;
  86.369 - 
  86.370 - 	__asm__ __volatile__(
  86.371 --LOCK_PREFIX	"xadd %0,(%2)"
  86.372 -+LOCK  	          "xadd %0,(%2)"
  86.373 - 		: "+r"(tmp), "=m"(sem->count)
  86.374 - 		: "r"(sem), "m"(sem->count)
  86.375 - 		: "memory");
  86.376 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/smp_alt.h ./include/asm-i386/smp_alt.h
  86.377 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/smp_alt.h	1970-01-01 01:00:00.000000000 +0100
  86.378 -+++ ./include/asm-i386/smp_alt.h	2006-02-15 20:45:57.000000000 +0000
  86.379 -@@ -0,0 +1,32 @@
  86.380 -+#ifndef __ASM_SMP_ALT_H__
  86.381 -+#define __ASM_SMP_ALT_H__
  86.382 -+
  86.383 -+#include <linux/config.h>
  86.384 -+
  86.385 -+#ifdef CONFIG_SMP
  86.386 -+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
  86.387 -+#define LOCK \
  86.388 -+        "6677: nop\n" \
  86.389 -+	".section __smp_alternatives,\"a\"\n" \
  86.390 -+	".long 6677b\n" \
  86.391 -+	".long 6678f\n" \
  86.392 -+	".previous\n" \
  86.393 -+	".section __smp_replacements,\"a\"\n" \
  86.394 -+	"6678: .byte 1\n" \
  86.395 -+	".byte 1\n" \
  86.396 -+	".byte 0\n" \
  86.397 -+        ".byte 1\n" \
  86.398 -+	".byte -1\n" \
  86.399 -+	"lock\n" \
  86.400 -+	"nop\n" \
  86.401 -+	".previous\n"
  86.402 -+void prepare_for_smp(void);
  86.403 -+void unprepare_for_smp(void);
  86.404 -+#else
  86.405 -+#define LOCK "lock ; "
  86.406 -+#endif
  86.407 -+#else
  86.408 -+#define LOCK ""
  86.409 -+#endif
  86.410 -+
  86.411 -+#endif /* __ASM_SMP_ALT_H__ */
  86.412 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/spinlock.h ./include/asm-i386/spinlock.h
  86.413 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/spinlock.h	2006-01-03 03:21:10.000000000 +0000
  86.414 -+++ ./include/asm-i386/spinlock.h	2006-02-15 20:45:57.000000000 +0000
  86.415 -@@ -6,6 +6,7 @@
  86.416 - #include <asm/page.h>
  86.417 - #include <linux/config.h>
  86.418 - #include <linux/compiler.h>
  86.419 -+#include <asm/smp_alt.h>
  86.420 - 
  86.421 - /*
  86.422 -  * Your basic SMP spinlocks, allowing only a single CPU anywhere
  86.423 -@@ -23,7 +24,8 @@
  86.424 - 
  86.425 - #define __raw_spin_lock_string \
  86.426 - 	"\n1:\t" \
  86.427 --	"lock ; decb %0\n\t" \
  86.428 -+	LOCK \
  86.429 -+	"decb %0\n\t" \
  86.430 - 	"jns 3f\n" \
  86.431 - 	"2:\t" \
  86.432 - 	"rep;nop\n\t" \
  86.433 -@@ -34,7 +36,8 @@
  86.434 - 
  86.435 - #define __raw_spin_lock_string_flags \
  86.436 - 	"\n1:\t" \
  86.437 --	"lock ; decb %0\n\t" \
  86.438 -+	LOCK \
  86.439 -+	"decb %0\n\t" \
  86.440 - 	"jns 4f\n\t" \
  86.441 - 	"2:\t" \
  86.442 - 	"testl $0x200, %1\n\t" \
  86.443 -@@ -65,10 +68,34 @@ static inline void __raw_spin_lock_flags
  86.444 - static inline int __raw_spin_trylock(raw_spinlock_t *lock)
  86.445 - {
  86.446 - 	char oldval;
  86.447 -+#ifdef CONFIG_SMP_ALTERNATIVES
  86.448 - 	__asm__ __volatile__(
  86.449 --		"xchgb %b0,%1"
  86.450 -+		"1:movb %1,%b0\n"
  86.451 -+		"movb $0,%1\n"
  86.452 -+		"2:"
  86.453 -+		".section __smp_alternatives,\"a\"\n"
  86.454 -+		".long 1b\n"
  86.455 -+		".long 3f\n"
  86.456 -+		".previous\n"
  86.457 -+		".section __smp_replacements,\"a\"\n"
  86.458 -+		"3: .byte 2b - 1b\n"
  86.459 -+		".byte 5f-4f\n"
  86.460 -+		".byte 0\n"
  86.461 -+		".byte 6f-5f\n"
  86.462 -+		".byte -1\n"
  86.463 -+		"4: xchgb %b0,%1\n"
  86.464 -+		"5: movb %1,%b0\n"
  86.465 -+		"movb $0,%1\n"
  86.466 -+		"6:\n"
  86.467 -+		".previous\n"
  86.468 - 		:"=q" (oldval), "=m" (lock->slock)
  86.469 - 		:"0" (0) : "memory");
  86.470 -+#else
  86.471 -+	__asm__ __volatile__(
  86.472 -+		"xchgb %b0,%1\n"
  86.473 -+		:"=q" (oldval), "=m" (lock->slock)
  86.474 -+		:"0" (0) : "memory");
  86.475 -+#endif
  86.476 - 	return oldval > 0;
  86.477 - }
  86.478 - 
  86.479 -@@ -178,12 +205,12 @@ static inline int __raw_write_trylock(ra
  86.480 - 
  86.481 - static inline void __raw_read_unlock(raw_rwlock_t *rw)
  86.482 - {
  86.483 --	asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory");
  86.484 -+	asm volatile(LOCK "incl %0" :"=m" (rw->lock) : : "memory");
  86.485 - }
  86.486 - 
  86.487 - static inline void __raw_write_unlock(raw_rwlock_t *rw)
  86.488 - {
  86.489 --	asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0"
  86.490 -+	asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ", %0"
  86.491 - 				 : "=m" (rw->lock) : : "memory");
  86.492 - }
  86.493 - 
  86.494 -diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/system.h ./include/asm-i386/system.h
  86.495 ---- ../pristine-linux-2.6.16-rc3/include/asm-i386/system.h	2006-02-15 20:38:57.000000000 +0000
  86.496 -+++ ./include/asm-i386/system.h	2006-02-15 20:45:57.000000000 +0000
  86.497 -@@ -5,7 +5,7 @@
  86.498 - #include <linux/kernel.h>
  86.499 - #include <asm/segment.h>
  86.500 - #include <asm/cpufeature.h>
  86.501 --#include <linux/bitops.h> /* for LOCK_PREFIX */
  86.502 -+#include <asm/smp_alt.h>
  86.503 - 
  86.504 - #ifdef __KERNEL__
  86.505 - 
  86.506 -@@ -271,19 +271,19 @@ static inline unsigned long __cmpxchg(vo
  86.507 - 	unsigned long prev;
  86.508 - 	switch (size) {
  86.509 - 	case 1:
  86.510 --		__asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
  86.511 -+		__asm__ __volatile__(LOCK "cmpxchgb %b1,%2"
  86.512 - 				     : "=a"(prev)
  86.513 - 				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
  86.514 - 				     : "memory");
  86.515 - 		return prev;
  86.516 - 	case 2:
  86.517 --		__asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
  86.518 -+		__asm__ __volatile__(LOCK "cmpxchgw %w1,%2"
  86.519 - 				     : "=a"(prev)
  86.520 - 				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  86.521 - 				     : "memory");
  86.522 - 		return prev;
  86.523 - 	case 4:
  86.524 --		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
  86.525 -+		__asm__ __volatile__(LOCK "cmpxchgl %1,%2"
  86.526 - 				     : "=a"(prev)
  86.527 - 				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  86.528 - 				     : "memory");
  86.529 -@@ -336,7 +336,7 @@ static inline unsigned long long __cmpxc
  86.530 - 				      unsigned long long new)
  86.531 - {
  86.532 - 	unsigned long long prev;
  86.533 --	__asm__ __volatile__(LOCK_PREFIX "cmpxchg8b %3"
  86.534 -+	__asm__ __volatile__(LOCK "cmpxchg8b %3"
  86.535 - 			     : "=A"(prev)
  86.536 - 			     : "b"((unsigned long)new),
  86.537 - 			       "c"((unsigned long)(new >> 32)),
  86.538 -@@ -503,11 +503,55 @@ struct alt_instr { 
  86.539 - #endif
  86.540 - 
  86.541 - #ifdef CONFIG_SMP
  86.542 -+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
  86.543 -+#define smp_alt_mb(instr)                                           \
  86.544 -+__asm__ __volatile__("6667:\nnop\nnop\nnop\nnop\nnop\nnop\n6668:\n" \
  86.545 -+		     ".section __smp_alternatives,\"a\"\n"          \
  86.546 -+		     ".long 6667b\n"                                \
  86.547 -+                     ".long 6673f\n"                                \
  86.548 -+		     ".previous\n"                                  \
  86.549 -+		     ".section __smp_replacements,\"a\"\n"          \
  86.550 -+		     "6673:.byte 6668b-6667b\n"                     \
  86.551 -+		     ".byte 6670f-6669f\n"                          \
  86.552 -+		     ".byte 6671f-6670f\n"                          \
  86.553 -+                     ".byte 0\n"                                    \
  86.554 -+		     ".byte %c0\n"                                  \
  86.555 -+		     "6669:lock;addl $0,0(%%esp)\n"                 \
  86.556 -+		     "6670:" instr "\n"                             \
  86.557 -+		     "6671:\n"                                      \
  86.558 -+		     ".previous\n"                                  \
  86.559 -+		     :                                              \
  86.560 -+		     : "i" (X86_FEATURE_XMM2)                       \
  86.561 -+		     : "memory")
  86.562 -+#define smp_rmb() smp_alt_mb("lfence")
  86.563 -+#define smp_mb()  smp_alt_mb("mfence")
  86.564 -+#define set_mb(var, value) do {                                     \
  86.565 -+unsigned long __set_mb_temp;                                        \
  86.566 -+__asm__ __volatile__("6667:movl %1, %0\n6668:\n"                    \
  86.567 -+		     ".section __smp_alternatives,\"a\"\n"          \
  86.568 -+		     ".long 6667b\n"                                \
  86.569 -+		     ".long 6673f\n"                                \
  86.570 -+		     ".previous\n"                                  \
  86.571 -+		     ".section __smp_replacements,\"a\"\n"          \
  86.572 -+		     "6673: .byte 6668b-6667b\n"                    \
  86.573 -+		     ".byte 6670f-6669f\n"                          \
  86.574 -+		     ".byte 0\n"                                    \
  86.575 -+		     ".byte 6671f-6670f\n"                          \
  86.576 -+		     ".byte -1\n"                                   \
  86.577 -+		     "6669: xchg %1, %0\n"                          \
  86.578 -+		     "6670:movl %1, %0\n"                           \
  86.579 -+		     "6671:\n"                                      \
  86.580 -+		     ".previous\n"                                  \
  86.581 -+		     : "=m" (var), "=r" (__set_mb_temp)             \
  86.582 -+		     : "1" (value)                                  \
  86.583 -+		     : "memory"); } while (0)
  86.584 -+#else
  86.585 - #define smp_mb()	mb()
  86.586 - #define smp_rmb()	rmb()
  86.587 -+#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
  86.588 -+#endif
  86.589 - #define smp_wmb()	wmb()
  86.590 - #define smp_read_barrier_depends()	read_barrier_depends()
  86.591 --#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
  86.592 - #else
  86.593 - #define smp_mb()	barrier()
  86.594 - #define smp_rmb()	barrier()
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/patches/linux-2.6.16-rc4/i386-mach-io-check-nmi.patch	Fri Feb 24 15:41:08 2006 -0700
    87.3 @@ -0,0 +1,45 @@
    87.4 +diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/traps.c ./arch/i386/kernel/traps.c
    87.5 +--- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/traps.c	2006-02-15 20:38:51.000000000 +0000
    87.6 ++++ ./arch/i386/kernel/traps.c	2006-02-15 20:40:43.000000000 +0000
    87.7 +@@ -567,18 +567,11 @@ static void mem_parity_error(unsigned ch
    87.8 + 
    87.9 + static void io_check_error(unsigned char reason, struct pt_regs * regs)
   87.10 + {
   87.11 +-	unsigned long i;
   87.12 +-
   87.13 + 	printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
   87.14 + 	show_registers(regs);
   87.15 + 
   87.16 + 	/* Re-enable the IOCK line, wait for a few seconds */
   87.17 +-	reason = (reason & 0xf) | 8;
   87.18 +-	outb(reason, 0x61);
   87.19 +-	i = 2000;
   87.20 +-	while (--i) udelay(1000);
   87.21 +-	reason &= ~8;
   87.22 +-	outb(reason, 0x61);
   87.23 ++	clear_io_check_error(reason);
   87.24 + }
   87.25 + 
   87.26 + static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
   87.27 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/mach-default/mach_traps.h ./include/asm-i386/mach-default/mach_traps.h
   87.28 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/mach-default/mach_traps.h	2006-01-03 03:21:10.000000000 +0000
   87.29 ++++ ./include/asm-i386/mach-default/mach_traps.h	2006-02-15 20:40:43.000000000 +0000
   87.30 +@@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig
   87.31 + 	outb(reason, 0x61);
   87.32 + }
   87.33 + 
   87.34 ++static inline void clear_io_check_error(unsigned char reason)
   87.35 ++{
   87.36 ++	unsigned long i;
   87.37 ++
   87.38 ++	reason = (reason & 0xf) | 8;
   87.39 ++	outb(reason, 0x61);
   87.40 ++	i = 2000;
   87.41 ++	while (--i) udelay(1000);
   87.42 ++	reason &= ~8;
   87.43 ++	outb(reason, 0x61);
   87.44 ++}
   87.45 ++
   87.46 + static inline unsigned char get_nmi_reason(void)
   87.47 + {
   87.48 + 	return inb(0x61);
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/patches/linux-2.6.16-rc4/net-csum.patch	Fri Feb 24 15:41:08 2006 -0700
    88.3 @@ -0,0 +1,41 @@
    88.4 +diff -pruN ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_tcp.c ./net/ipv4/netfilter/ip_nat_proto_tcp.c
    88.5 +--- ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-02-02 17:39:51.000000000 +0000
    88.6 ++++ ./net/ipv4/netfilter/ip_nat_proto_tcp.c	2006-02-02 17:44:18.000000000 +0000
    88.7 +@@ -129,10 +129,14 @@ tcp_manip_pkt(struct sk_buff **pskb,
    88.8 + 	if (hdrsize < sizeof(*hdr))
    88.9 + 		return 1;
   88.10 + 
   88.11 +-	hdr->check = ip_nat_cheat_check(~oldip, newip,
   88.12 ++	if ((*pskb)->proto_csum_blank) {
   88.13 ++		hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   88.14 ++	} else {
   88.15 ++		hdr->check = ip_nat_cheat_check(~oldip, newip,
   88.16 + 					ip_nat_cheat_check(oldport ^ 0xFFFF,
   88.17 + 							   newport,
   88.18 + 							   hdr->check));
   88.19 ++	}
   88.20 + 	return 1;
   88.21 + }
   88.22 +
   88.23 +diff -pruN ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_udp.c ./net/ipv4/netfilter/ip_nat_proto_udp.c
   88.24 +--- ../pristine-linux-2.6.16-rc1-git4/net/ipv4/netfilter/ip_nat_proto_udp.c	2006-02-02 17:39:51.000000000 +0000
   88.25 ++++ ./net/ipv4/netfilter/ip_nat_proto_udp.c	2006-02-02 17:44:18.000000000 +0000
   88.26 +@@ -113,11 +113,16 @@ udp_manip_pkt(struct sk_buff **pskb,
   88.27 + 		newport = tuple->dst.u.udp.port;
   88.28 + 		portptr = &hdr->dest;
   88.29 + 	}
   88.30 +-	if (hdr->check) /* 0 is a special case meaning no checksum */
   88.31 +-		hdr->check = ip_nat_cheat_check(~oldip, newip,
   88.32 ++	if (hdr->check) { /* 0 is a special case meaning no checksum */
   88.33 ++		if ((*pskb)->proto_csum_blank) {
   88.34 ++			hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
   88.35 ++		} else {
   88.36 ++			hdr->check = ip_nat_cheat_check(~oldip, newip,
   88.37 + 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
   88.38 + 							   newport,
   88.39 + 							   hdr->check));
   88.40 ++		}
   88.41 ++	}
   88.42 + 	*portptr = newport;
   88.43 + 	return 1;
   88.44 + }
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/patches/linux-2.6.16-rc4/pmd-shared.patch	Fri Feb 24 15:41:08 2006 -0700
    89.3 @@ -0,0 +1,111 @@
    89.4 +diff -pruN ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pageattr.c ./arch/i386/mm/pageattr.c
    89.5 +--- ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pageattr.c	2006-02-02 17:39:29.000000000 +0000
    89.6 ++++ ./arch/i386/mm/pageattr.c	2006-02-02 17:45:14.000000000 +0000
    89.7 +@@ -78,7 +78,7 @@ static void set_pmd_pte(pte_t *kpte, uns
    89.8 + 	unsigned long flags;
    89.9 + 
   89.10 + 	set_pte_atomic(kpte, pte); 	/* change init_mm */
   89.11 +-	if (PTRS_PER_PMD > 1)
   89.12 ++	if (HAVE_SHARED_KERNEL_PMD)
   89.13 + 		return;
   89.14 + 
   89.15 + 	spin_lock_irqsave(&pgd_lock, flags);
   89.16 +diff -pruN ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pgtable.c ./arch/i386/mm/pgtable.c
   89.17 +--- ../pristine-linux-2.6.16-rc1-git4/arch/i386/mm/pgtable.c	2006-01-03 03:21:10.000000000 +0000
   89.18 ++++ ./arch/i386/mm/pgtable.c	2006-02-02 17:45:14.000000000 +0000
   89.19 +@@ -215,9 +215,10 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
   89.20 + 		spin_lock_irqsave(&pgd_lock, flags);
   89.21 + 	}
   89.22 + 
   89.23 +-	clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
   89.24 +-			swapper_pg_dir + USER_PTRS_PER_PGD,
   89.25 +-			KERNEL_PGD_PTRS);
   89.26 ++	if (PTRS_PER_PMD == 1 || HAVE_SHARED_KERNEL_PMD)
   89.27 ++		clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
   89.28 ++				swapper_pg_dir + USER_PTRS_PER_PGD,
   89.29 ++				KERNEL_PGD_PTRS);
   89.30 + 	if (PTRS_PER_PMD > 1)
   89.31 + 		return;
   89.32 + 
   89.33 +@@ -249,6 +250,30 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
   89.34 + 			goto out_oom;
   89.35 + 		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
   89.36 + 	}
   89.37 ++
   89.38 ++	if (!HAVE_SHARED_KERNEL_PMD) {
   89.39 ++		unsigned long flags;
   89.40 ++
   89.41 ++		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   89.42 ++			pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
   89.43 ++			if (!pmd)
   89.44 ++				goto out_oom;
   89.45 ++			set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(1 + __pa(pmd)));
   89.46 ++		}
   89.47 ++
   89.48 ++		spin_lock_irqsave(&pgd_lock, flags);
   89.49 ++		for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   89.50 ++			unsigned long v = (unsigned long)i << PGDIR_SHIFT;
   89.51 ++			pgd_t *kpgd = pgd_offset_k(v);
   89.52 ++			pud_t *kpud = pud_offset(kpgd, v);
   89.53 ++			pmd_t *kpmd = pmd_offset(kpud, v);
   89.54 ++			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   89.55 ++			memcpy(pmd, kpmd, PAGE_SIZE);
   89.56 ++		}
   89.57 ++		pgd_list_add(pgd);
   89.58 ++		spin_unlock_irqrestore(&pgd_lock, flags);
   89.59 ++	}
   89.60 ++
   89.61 + 	return pgd;
   89.62 + 
   89.63 + out_oom:
   89.64 +@@ -263,9 +288,23 @@ void pgd_free(pgd_t *pgd)
   89.65 + 	int i;
   89.66 + 
   89.67 + 	/* in the PAE case user pgd entries are overwritten before usage */
   89.68 +-	if (PTRS_PER_PMD > 1)
   89.69 +-		for (i = 0; i < USER_PTRS_PER_PGD; ++i)
   89.70 +-			kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
   89.71 ++	if (PTRS_PER_PMD > 1) {
   89.72 ++		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
   89.73 ++			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   89.74 ++			kmem_cache_free(pmd_cache, pmd);
   89.75 ++		}
   89.76 ++		if (!HAVE_SHARED_KERNEL_PMD) {
   89.77 ++			unsigned long flags;
   89.78 ++			spin_lock_irqsave(&pgd_lock, flags);
   89.79 ++			pgd_list_del(pgd);
   89.80 ++			spin_unlock_irqrestore(&pgd_lock, flags);
   89.81 ++			for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
   89.82 ++				pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
   89.83 ++				memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
   89.84 ++				kmem_cache_free(pmd_cache, pmd);
   89.85 ++			}
   89.86 ++		}
   89.87 ++	}
   89.88 + 	/* in the non-PAE case, free_pgtables() clears user pgd entries */
   89.89 + 	kmem_cache_free(pgd_cache, pgd);
   89.90 + }
   89.91 +diff -pruN ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-2level-defs.h ./include/asm-i386/pgtable-2level-defs.h
   89.92 +--- ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-2level-defs.h	2006-01-03 03:21:10.000000000 +0000
   89.93 ++++ ./include/asm-i386/pgtable-2level-defs.h	2006-02-02 17:45:14.000000000 +0000
   89.94 +@@ -1,6 +1,8 @@
   89.95 + #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
   89.96 + #define _I386_PGTABLE_2LEVEL_DEFS_H
   89.97 + 
   89.98 ++#define HAVE_SHARED_KERNEL_PMD 0
   89.99 ++
  89.100 + /*
  89.101 +  * traditional i386 two-level paging structure:
  89.102 +  */
  89.103 +diff -pruN ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-3level-defs.h ./include/asm-i386/pgtable-3level-defs.h
  89.104 +--- ../pristine-linux-2.6.16-rc1-git4/include/asm-i386/pgtable-3level-defs.h	2006-01-03 03:21:10.000000000 +0000
  89.105 ++++ ./include/asm-i386/pgtable-3level-defs.h	2006-02-02 17:45:14.000000000 +0000
  89.106 +@@ -1,6 +1,8 @@
  89.107 + #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
  89.108 + #define _I386_PGTABLE_3LEVEL_DEFS_H
  89.109 + 
  89.110 ++#define HAVE_SHARED_KERNEL_PMD 1
  89.111 ++
  89.112 + /*
  89.113 +  * PGDIR_SHIFT determines what a top-level page table entry can map
  89.114 +  */
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/patches/linux-2.6.16-rc4/smp-alts.patch	Fri Feb 24 15:41:08 2006 -0700
    90.3 @@ -0,0 +1,591 @@
    90.4 +diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/Kconfig ./arch/i386/Kconfig
    90.5 +--- ../pristine-linux-2.6.16-rc3/arch/i386/Kconfig	2006-02-15 20:38:51.000000000 +0000
    90.6 ++++ ./arch/i386/Kconfig	2006-02-15 20:45:57.000000000 +0000
    90.7 +@@ -202,6 +202,19 @@ config SMP
    90.8 + 
    90.9 + 	  If you don't know what to do here, say N.
   90.10 + 
   90.11 ++config SMP_ALTERNATIVES
   90.12 ++	bool "SMP alternatives support (EXPERIMENTAL)"
   90.13 ++	depends on SMP && EXPERIMENTAL
   90.14 ++	help
   90.15 ++	  Try to reduce the overhead of running an SMP kernel on a uniprocessor
   90.16 ++	  host slightly by replacing certain key instruction sequences
   90.17 ++	  according to whether we currently have more than one CPU available.
   90.18 ++	  This should provide a noticeable boost to performance when
   90.19 ++	  running SMP kernels on UP machines, and have negligible impact
   90.20 ++	  when running on an true SMP host.
   90.21 ++
   90.22 ++          If unsure, say N.
   90.23 ++	  
   90.24 + config NR_CPUS
   90.25 + 	int "Maximum number of CPUs (2-255)"
   90.26 + 	range 2 255
   90.27 +diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/Makefile ./arch/i386/kernel/Makefile
   90.28 +--- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/Makefile	2006-02-15 20:38:51.000000000 +0000
   90.29 ++++ ./arch/i386/kernel/Makefile	2006-02-15 20:45:57.000000000 +0000
   90.30 +@@ -37,6 +37,7 @@ obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
   90.31 + obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
   90.32 + obj-$(CONFIG_VM86)		+= vm86.o
   90.33 + obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
   90.34 ++obj-$(CONFIG_SMP_ALTERNATIVES)  += smpalts.o
   90.35 + 
   90.36 + EXTRA_AFLAGS   := -traditional
   90.37 + 
   90.38 +diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpalts.c ./arch/i386/kernel/smpalts.c
   90.39 +--- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpalts.c	1970-01-01 01:00:00.000000000 +0100
   90.40 ++++ ./arch/i386/kernel/smpalts.c	2006-02-15 20:45:57.000000000 +0000
   90.41 +@@ -0,0 +1,85 @@
   90.42 ++#include <linux/kernel.h>
   90.43 ++#include <asm/system.h>
   90.44 ++#include <asm/smp_alt.h>
   90.45 ++#include <asm/processor.h>
   90.46 ++#include <asm/string.h>
   90.47 ++
   90.48 ++struct smp_replacement_record {
   90.49 ++	unsigned char targ_size;
   90.50 ++	unsigned char smp1_size;
   90.51 ++	unsigned char smp2_size;
   90.52 ++	unsigned char up_size;
   90.53 ++	unsigned char feature;
   90.54 ++	unsigned char data[0];
   90.55 ++};
   90.56 ++
   90.57 ++struct smp_alternative_record {
   90.58 ++	void *targ_start;
   90.59 ++	struct smp_replacement_record *repl;
   90.60 ++};
   90.61 ++
   90.62 ++extern struct smp_alternative_record __start_smp_alternatives_table,
   90.63 ++  __stop_smp_alternatives_table;
   90.64 ++extern unsigned long __init_begin, __init_end;
   90.65 ++
   90.66 ++void prepare_for_smp(void)
   90.67 ++{
   90.68 ++	struct smp_alternative_record *r;
   90.69 ++	printk(KERN_INFO "Enabling SMP...\n");
   90.70 ++	for (r = &__start_smp_alternatives_table;
   90.71 ++	     r != &__stop_smp_alternatives_table;
   90.72 ++	     r++) {
   90.73 ++		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
   90.74 ++		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
   90.75 ++		BUG_ON(r->repl->targ_size < r->repl->up_size);
   90.76 ++               if (system_state == SYSTEM_RUNNING &&
   90.77 ++                   r->targ_start >= (void *)&__init_begin &&
   90.78 ++                   r->targ_start < (void *)&__init_end)
   90.79 ++                       continue;
   90.80 ++		if (r->repl->feature != (unsigned char)-1 &&
   90.81 ++		    boot_cpu_has(r->repl->feature)) {
   90.82 ++			memcpy(r->targ_start,
   90.83 ++			       r->repl->data + r->repl->smp1_size,
   90.84 ++			       r->repl->smp2_size);
   90.85 ++			memset(r->targ_start + r->repl->smp2_size,
   90.86 ++			       0x90,
   90.87 ++			       r->repl->targ_size - r->repl->smp2_size);
   90.88 ++		} else {
   90.89 ++			memcpy(r->targ_start,
   90.90 ++			       r->repl->data,
   90.91 ++			       r->repl->smp1_size);
   90.92 ++			memset(r->targ_start + r->repl->smp1_size,
   90.93 ++			       0x90,
   90.94 ++			       r->repl->targ_size - r->repl->smp1_size);
   90.95 ++		}
   90.96 ++	}
   90.97 ++	/* Paranoia */
   90.98 ++	asm volatile ("jmp 1f\n1:");
   90.99 ++	mb();
  90.100 ++}
  90.101 ++
  90.102 ++void unprepare_for_smp(void)
  90.103 ++{
  90.104 ++	struct smp_alternative_record *r;
  90.105 ++	printk(KERN_INFO "Disabling SMP...\n");
  90.106 ++	for (r = &__start_smp_alternatives_table;
  90.107 ++	     r != &__stop_smp_alternatives_table;
  90.108 ++	     r++) {
  90.109 ++		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
  90.110 ++		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
  90.111 ++		BUG_ON(r->repl->targ_size < r->repl->up_size);
  90.112 ++               if (system_state == SYSTEM_RUNNING &&
  90.113 ++                   r->targ_start >= (void *)&__init_begin &&
  90.114 ++                   r->targ_start < (void *)&__init_end)
  90.115 ++                       continue;
  90.116 ++		memcpy(r->targ_start,
  90.117 ++		       r->repl->data + r->repl->smp1_size + r->repl->smp2_size,
  90.118 ++		       r->repl->up_size);
  90.119 ++		memset(r->targ_start + r->repl->up_size,
  90.120 ++		       0x90,
  90.121 ++		       r->repl->targ_size - r->repl->up_size);
  90.122 ++	}
  90.123 ++	/* Paranoia */
  90.124 ++	asm volatile ("jmp 1f\n1:");
  90.125 ++	mb();
  90.126 ++}
  90.127 +diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpboot.c ./arch/i386/kernel/smpboot.c
  90.128 +--- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/smpboot.c	2006-02-15 20:38:51.000000000 +0000
  90.129 ++++ ./arch/i386/kernel/smpboot.c	2006-02-15 20:45:57.000000000 +0000
  90.130 +@@ -1214,6 +1214,11 @@ static void __init smp_boot_cpus(unsigne
  90.131 + 		if (max_cpus <= cpucount+1)
  90.132 + 			continue;
  90.133 + 
  90.134 ++#ifdef CONFIG_SMP_ALTERNATIVES
  90.135 ++		if (kicked == 1)
  90.136 ++			prepare_for_smp();
  90.137 ++#endif
  90.138 ++
  90.139 + 		if (((cpu = alloc_cpu_id()) <= 0) || do_boot_cpu(apicid, cpu))
  90.140 + 			printk("CPU #%d not responding - cannot use it.\n",
  90.141 + 								apicid);
  90.142 +@@ -1392,6 +1397,11 @@ int __devinit __cpu_up(unsigned int cpu)
  90.143 + 		return -EIO;
  90.144 + 	}
  90.145 + 
  90.146 ++#ifdef CONFIG_SMP_ALTERNATIVES
  90.147 ++	if (num_online_cpus() == 1)
  90.148 ++		prepare_for_smp();
  90.149 ++#endif
  90.150 ++
  90.151 + 	local_irq_enable();
  90.152 + 	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
  90.153 + 	/* Unleash the CPU! */
  90.154 +diff -pruN ../pristine-linux-2.6.16-rc3/arch/i386/kernel/vmlinux.lds.S ./arch/i386/kernel/vmlinux.lds.S
  90.155 +--- ../pristine-linux-2.6.16-rc3/arch/i386/kernel/vmlinux.lds.S	2006-01-03 03:21:10.000000000 +0000
  90.156 ++++ ./arch/i386/kernel/vmlinux.lds.S	2006-02-15 20:45:57.000000000 +0000
  90.157 +@@ -34,6 +34,13 @@ SECTIONS
  90.158 +   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
  90.159 +   __stop___ex_table = .;
  90.160 + 
  90.161 ++  . = ALIGN(16);
  90.162 ++  __start_smp_alternatives_table = .;
  90.163 ++  __smp_alternatives : { *(__smp_alternatives) }
  90.164 ++  __stop_smp_alternatives_table = .;
  90.165 ++
  90.166 ++  __smp_replacements : { *(__smp_replacements) }
  90.167 ++
  90.168 +   RODATA
  90.169 + 
  90.170 +   /* writeable */
  90.171 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/atomic.h ./include/asm-i386/atomic.h
  90.172 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/atomic.h	2006-02-15 20:38:57.000000000 +0000
  90.173 ++++ ./include/asm-i386/atomic.h	2006-02-15 20:45:57.000000000 +0000
  90.174 +@@ -4,18 +4,13 @@
  90.175 + #include <linux/config.h>
  90.176 + #include <linux/compiler.h>
  90.177 + #include <asm/processor.h>
  90.178 ++#include <asm/smp_alt.h>
  90.179 + 
  90.180 + /*
  90.181 +  * Atomic operations that C can't guarantee us.  Useful for
  90.182 +  * resource counting etc..
  90.183 +  */
  90.184 + 
  90.185 +-#ifdef CONFIG_SMP
  90.186 +-#define LOCK "lock ; "
  90.187 +-#else
  90.188 +-#define LOCK ""
  90.189 +-#endif
  90.190 +-
  90.191 + /*
  90.192 +  * Make sure gcc doesn't try to be clever and move things around
  90.193 +  * on us. We need to use _exactly_ the address the user gave us,
  90.194 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/bitops.h ./include/asm-i386/bitops.h
  90.195 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/bitops.h	2006-02-15 20:38:57.000000000 +0000
  90.196 ++++ ./include/asm-i386/bitops.h	2006-02-15 20:45:57.000000000 +0000
  90.197 +@@ -7,6 +7,7 @@
  90.198 + 
  90.199 + #include <linux/config.h>
  90.200 + #include <linux/compiler.h>
  90.201 ++#include <asm/smp_alt.h>
  90.202 + 
  90.203 + /*
  90.204 +  * These have to be done with inline assembly: that way the bit-setting
  90.205 +@@ -16,12 +17,6 @@
  90.206 +  * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
  90.207 +  */
  90.208 + 
  90.209 +-#ifdef CONFIG_SMP
  90.210 +-#define LOCK_PREFIX "lock ; "
  90.211 +-#else
  90.212 +-#define LOCK_PREFIX ""
  90.213 +-#endif
  90.214 +-
  90.215 + #define ADDR (*(volatile long *) addr)
  90.216 + 
  90.217 + /**
  90.218 +@@ -41,7 +36,7 @@
  90.219 +  */
  90.220 + static inline void set_bit(int nr, volatile unsigned long * addr)
  90.221 + {
  90.222 +-	__asm__ __volatile__( LOCK_PREFIX
  90.223 ++	__asm__ __volatile__( LOCK
  90.224 + 		"btsl %1,%0"
  90.225 + 		:"+m" (ADDR)
  90.226 + 		:"Ir" (nr));
  90.227 +@@ -76,7 +71,7 @@ static inline void __set_bit(int nr, vol
  90.228 +  */
  90.229 + static inline void clear_bit(int nr, volatile unsigned long * addr)
  90.230 + {
  90.231 +-	__asm__ __volatile__( LOCK_PREFIX
  90.232 ++	__asm__ __volatile__( LOCK
  90.233 + 		"btrl %1,%0"
  90.234 + 		:"+m" (ADDR)
  90.235 + 		:"Ir" (nr));
  90.236 +@@ -121,7 +116,7 @@ static inline void __change_bit(int nr, 
  90.237 +  */
  90.238 + static inline void change_bit(int nr, volatile unsigned long * addr)
  90.239 + {
  90.240 +-	__asm__ __volatile__( LOCK_PREFIX
  90.241 ++	__asm__ __volatile__( LOCK
  90.242 + 		"btcl %1,%0"
  90.243 + 		:"+m" (ADDR)
  90.244 + 		:"Ir" (nr));
  90.245 +@@ -140,7 +135,7 @@ static inline int test_and_set_bit(int n
  90.246 + {
  90.247 + 	int oldbit;
  90.248 + 
  90.249 +-	__asm__ __volatile__( LOCK_PREFIX
  90.250 ++	__asm__ __volatile__( LOCK
  90.251 + 		"btsl %2,%1\n\tsbbl %0,%0"
  90.252 + 		:"=r" (oldbit),"+m" (ADDR)
  90.253 + 		:"Ir" (nr) : "memory");
  90.254 +@@ -180,7 +175,7 @@ static inline int test_and_clear_bit(int
  90.255 + {
  90.256 + 	int oldbit;
  90.257 + 
  90.258 +-	__asm__ __volatile__( LOCK_PREFIX
  90.259 ++	__asm__ __volatile__( LOCK
  90.260 + 		"btrl %2,%1\n\tsbbl %0,%0"
  90.261 + 		:"=r" (oldbit),"+m" (ADDR)
  90.262 + 		:"Ir" (nr) : "memory");
  90.263 +@@ -231,7 +226,7 @@ static inline int test_and_change_bit(in
  90.264 + {
  90.265 + 	int oldbit;
  90.266 + 
  90.267 +-	__asm__ __volatile__( LOCK_PREFIX
  90.268 ++	__asm__ __volatile__( LOCK
  90.269 + 		"btcl %2,%1\n\tsbbl %0,%0"
  90.270 + 		:"=r" (oldbit),"+m" (ADDR)
  90.271 + 		:"Ir" (nr) : "memory");
  90.272 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/futex.h ./include/asm-i386/futex.h
  90.273 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/futex.h	2006-02-15 20:38:57.000000000 +0000
  90.274 ++++ ./include/asm-i386/futex.h	2006-02-15 20:45:57.000000000 +0000
  90.275 +@@ -28,7 +28,7 @@
  90.276 + "1:	movl	%2, %0\n\
  90.277 + 	movl	%0, %3\n"					\
  90.278 + 	insn "\n"						\
  90.279 +-"2:	" LOCK_PREFIX "cmpxchgl %3, %2\n\
  90.280 ++"2:	" LOCK "cmpxchgl %3, %2\n\
  90.281 + 	jnz	1b\n\
  90.282 + 3:	.section .fixup,\"ax\"\n\
  90.283 + 4:	mov	%5, %1\n\
  90.284 +@@ -68,7 +68,7 @@ futex_atomic_op_inuser (int encoded_op, 
  90.285 + #endif
  90.286 + 		switch (op) {
  90.287 + 		case FUTEX_OP_ADD:
  90.288 +-			__futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret,
  90.289 ++			__futex_atomic_op1(LOCK "xaddl %0, %2", ret,
  90.290 + 					   oldval, uaddr, oparg);
  90.291 + 			break;
  90.292 + 		case FUTEX_OP_OR:
  90.293 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/rwsem.h ./include/asm-i386/rwsem.h
  90.294 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/rwsem.h	2006-01-03 03:21:10.000000000 +0000
  90.295 ++++ ./include/asm-i386/rwsem.h	2006-02-15 20:45:57.000000000 +0000
  90.296 +@@ -40,6 +40,7 @@
  90.297 + 
  90.298 + #include <linux/list.h>
  90.299 + #include <linux/spinlock.h>
  90.300 ++#include <asm/smp_alt.h>
  90.301 + 
  90.302 + struct rwsem_waiter;
  90.303 + 
  90.304 +@@ -99,7 +100,7 @@ static inline void __down_read(struct rw
  90.305 + {
  90.306 + 	__asm__ __volatile__(
  90.307 + 		"# beginning down_read\n\t"
  90.308 +-LOCK_PREFIX	"  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
  90.309 ++LOCK	        "  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
  90.310 + 		"  js        2f\n\t" /* jump if we weren't granted the lock */
  90.311 + 		"1:\n\t"
  90.312 + 		LOCK_SECTION_START("")
  90.313 +@@ -130,7 +131,7 @@ static inline int __down_read_trylock(st
  90.314 + 		"  movl	     %1,%2\n\t"
  90.315 + 		"  addl      %3,%2\n\t"
  90.316 + 		"  jle	     2f\n\t"
  90.317 +-LOCK_PREFIX	"  cmpxchgl  %2,%0\n\t"
  90.318 ++LOCK	        "  cmpxchgl  %2,%0\n\t"
  90.319 + 		"  jnz	     1b\n\t"
  90.320 + 		"2:\n\t"
  90.321 + 		"# ending __down_read_trylock\n\t"
  90.322 +@@ -150,7 +151,7 @@ static inline void __down_write(struct r
  90.323 + 	tmp = RWSEM_ACTIVE_WRITE_BIAS;
  90.324 + 	__asm__ __volatile__(
  90.325 + 		"# beginning down_write\n\t"
  90.326 +-LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
  90.327 ++LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
  90.328 + 		"  testl     %%edx,%%edx\n\t" /* was the count 0 before? */
  90.329 + 		"  jnz       2f\n\t" /* jump if we weren't granted the lock */
  90.330 + 		"1:\n\t"
  90.331 +@@ -188,7 +189,7 @@ static inline void __up_read(struct rw_s
  90.332 + 	__s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
  90.333 + 	__asm__ __volatile__(
  90.334 + 		"# beginning __up_read\n\t"
  90.335 +-LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
  90.336 ++LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
  90.337 + 		"  js        2f\n\t" /* jump if the lock is being waited upon */
  90.338 + 		"1:\n\t"
  90.339 + 		LOCK_SECTION_START("")
  90.340 +@@ -214,7 +215,7 @@ static inline void __up_write(struct rw_
  90.341 + 	__asm__ __volatile__(
  90.342 + 		"# beginning __up_write\n\t"
  90.343 + 		"  movl      %2,%%edx\n\t"
  90.344 +-LOCK_PREFIX	"  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
  90.345 ++LOCK	        "  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
  90.346 + 		"  jnz       2f\n\t" /* jump if the lock is being waited upon */
  90.347 + 		"1:\n\t"
  90.348 + 		LOCK_SECTION_START("")
  90.349 +@@ -239,7 +240,7 @@ static inline void __downgrade_write(str
  90.350 + {
  90.351 + 	__asm__ __volatile__(
  90.352 + 		"# beginning __downgrade_write\n\t"
  90.353 +-LOCK_PREFIX	"  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
  90.354 ++LOCK	        "  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
  90.355 + 		"  js        2f\n\t" /* jump if the lock is being waited upon */
  90.356 + 		"1:\n\t"
  90.357 + 		LOCK_SECTION_START("")
  90.358 +@@ -263,7 +264,7 @@ LOCK_PREFIX	"  addl      %2,(%%eax)\n\t"
  90.359 + static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
  90.360 + {
  90.361 + 	__asm__ __volatile__(
  90.362 +-LOCK_PREFIX	"addl %1,%0"
  90.363 ++LOCK	          "addl %1,%0"
  90.364 + 		: "=m"(sem->count)
  90.365 + 		: "ir"(delta), "m"(sem->count));
  90.366 + }
  90.367 +@@ -276,7 +277,7 @@ static inline int rwsem_atomic_update(in
  90.368 + 	int tmp = delta;
  90.369 + 
  90.370 + 	__asm__ __volatile__(
  90.371 +-LOCK_PREFIX	"xadd %0,(%2)"
  90.372 ++LOCK  	          "xadd %0,(%2)"
  90.373 + 		: "+r"(tmp), "=m"(sem->count)
  90.374 + 		: "r"(sem), "m"(sem->count)
  90.375 + 		: "memory");
  90.376 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/smp_alt.h ./include/asm-i386/smp_alt.h
  90.377 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/smp_alt.h	1970-01-01 01:00:00.000000000 +0100
  90.378 ++++ ./include/asm-i386/smp_alt.h	2006-02-15 20:45:57.000000000 +0000
  90.379 +@@ -0,0 +1,32 @@
  90.380 ++#ifndef __ASM_SMP_ALT_H__
  90.381 ++#define __ASM_SMP_ALT_H__
  90.382 ++
  90.383 ++#include <linux/config.h>
  90.384 ++
  90.385 ++#ifdef CONFIG_SMP
  90.386 ++#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
  90.387 ++#define LOCK \
  90.388 ++        "6677: nop\n" \
  90.389 ++	".section __smp_alternatives,\"a\"\n" \
  90.390 ++	".long 6677b\n" \
  90.391 ++	".long 6678f\n" \
  90.392 ++	".previous\n" \
  90.393 ++	".section __smp_replacements,\"a\"\n" \
  90.394 ++	"6678: .byte 1\n" \
  90.395 ++	".byte 1\n" \
  90.396 ++	".byte 0\n" \
  90.397 ++        ".byte 1\n" \
  90.398 ++	".byte -1\n" \
  90.399 ++	"lock\n" \
  90.400 ++	"nop\n" \
  90.401 ++	".previous\n"
  90.402 ++void prepare_for_smp(void);
  90.403 ++void unprepare_for_smp(void);
  90.404 ++#else
  90.405 ++#define LOCK "lock ; "
  90.406 ++#endif
  90.407 ++#else
  90.408 ++#define LOCK ""
  90.409 ++#endif
  90.410 ++
  90.411 ++#endif /* __ASM_SMP_ALT_H__ */
  90.412 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/spinlock.h ./include/asm-i386/spinlock.h
  90.413 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/spinlock.h	2006-01-03 03:21:10.000000000 +0000
  90.414 ++++ ./include/asm-i386/spinlock.h	2006-02-15 20:45:57.000000000 +0000
  90.415 +@@ -6,6 +6,7 @@
  90.416 + #include <asm/page.h>
  90.417 + #include <linux/config.h>
  90.418 + #include <linux/compiler.h>
  90.419 ++#include <asm/smp_alt.h>
  90.420 + 
  90.421 + /*
  90.422 +  * Your basic SMP spinlocks, allowing only a single CPU anywhere
  90.423 +@@ -23,7 +24,8 @@
  90.424 + 
  90.425 + #define __raw_spin_lock_string \
  90.426 + 	"\n1:\t" \
  90.427 +-	"lock ; decb %0\n\t" \
  90.428 ++	LOCK \
  90.429 ++	"decb %0\n\t" \
  90.430 + 	"jns 3f\n" \
  90.431 + 	"2:\t" \
  90.432 + 	"rep;nop\n\t" \
  90.433 +@@ -34,7 +36,8 @@
  90.434 + 
  90.435 + #define __raw_spin_lock_string_flags \
  90.436 + 	"\n1:\t" \
  90.437 +-	"lock ; decb %0\n\t" \
  90.438 ++	LOCK \
  90.439 ++	"decb %0\n\t" \
  90.440 + 	"jns 4f\n\t" \
  90.441 + 	"2:\t" \
  90.442 + 	"testl $0x200, %1\n\t" \
  90.443 +@@ -65,10 +68,34 @@ static inline void __raw_spin_lock_flags
  90.444 + static inline int __raw_spin_trylock(raw_spinlock_t *lock)
  90.445 + {
  90.446 + 	char oldval;
  90.447 ++#ifdef CONFIG_SMP_ALTERNATIVES
  90.448 + 	__asm__ __volatile__(
  90.449 +-		"xchgb %b0,%1"
  90.450 ++		"1:movb %1,%b0\n"
  90.451 ++		"movb $0,%1\n"
  90.452 ++		"2:"
  90.453 ++		".section __smp_alternatives,\"a\"\n"
  90.454 ++		".long 1b\n"
  90.455 ++		".long 3f\n"
  90.456 ++		".previous\n"
  90.457 ++		".section __smp_replacements,\"a\"\n"
  90.458 ++		"3: .byte 2b - 1b\n"
  90.459 ++		".byte 5f-4f\n"
  90.460 ++		".byte 0\n"
  90.461 ++		".byte 6f-5f\n"
  90.462 ++		".byte -1\n"
  90.463 ++		"4: xchgb %b0,%1\n"
  90.464 ++		"5: movb %1,%b0\n"
  90.465 ++		"movb $0,%1\n"
  90.466 ++		"6:\n"
  90.467 ++		".previous\n"
  90.468 + 		:"=q" (oldval), "=m" (lock->slock)
  90.469 + 		:"0" (0) : "memory");
  90.470 ++#else
  90.471 ++	__asm__ __volatile__(
  90.472 ++		"xchgb %b0,%1\n"
  90.473 ++		:"=q" (oldval), "=m" (lock->slock)
  90.474 ++		:"0" (0) : "memory");
  90.475 ++#endif
  90.476 + 	return oldval > 0;
  90.477 + }
  90.478 + 
  90.479 +@@ -178,12 +205,12 @@ static inline int __raw_write_trylock(ra
  90.480 + 
  90.481 + static inline void __raw_read_unlock(raw_rwlock_t *rw)
  90.482 + {
  90.483 +-	asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory");
  90.484 ++	asm volatile(LOCK "incl %0" :"=m" (rw->lock) : : "memory");
  90.485 + }
  90.486 + 
  90.487 + static inline void __raw_write_unlock(raw_rwlock_t *rw)
  90.488 + {
  90.489 +-	asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0"
  90.490 ++	asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ", %0"
  90.491 + 				 : "=m" (rw->lock) : : "memory");
  90.492 + }
  90.493 + 
  90.494 +diff -pruN ../pristine-linux-2.6.16-rc3/include/asm-i386/system.h ./include/asm-i386/system.h
  90.495 +--- ../pristine-linux-2.6.16-rc3/include/asm-i386/system.h	2006-02-15 20:38:57.000000000 +0000
  90.496 ++++ ./include/asm-i386/system.h	2006-02-15 20:45:57.000000000 +0000
  90.497 +@@ -5,7 +5,7 @@
  90.498 + #include <linux/kernel.h>
  90.499 + #include <asm/segment.h>
  90.500 + #include <asm/cpufeature.h>
  90.501 +-#include <linux/bitops.h> /* for LOCK_PREFIX */
  90.502 ++#include <asm/smp_alt.h>
  90.503 + 
  90.504 + #ifdef __KERNEL__
  90.505 + 
  90.506 +@@ -271,19 +271,19 @@ static inline unsigned long __cmpxchg(vo
  90.507 + 	unsigned long prev;
  90.508 + 	switch (size) {
  90.509 + 	case 1:
  90.510 +-		__asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
  90.511 ++		__asm__ __volatile__(LOCK "cmpxchgb %b1,%2"
  90.512 + 				     : "=a"(prev)
  90.513 + 				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
  90.514 + 				     : "memory");
  90.515 + 		return prev;
  90.516 + 	case 2:
  90.517 +-		__asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
  90.518 ++		__asm__ __volatile__(LOCK "cmpxchgw %w1,%2"
  90.519 + 				     : "=a"(prev)
  90.520 + 				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  90.521 + 				     : "memory");
  90.522 + 		return prev;
  90.523 + 	case 4:
  90.524 +-		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
  90.525 ++		__asm__ __volatile__(LOCK "cmpxchgl %1,%2"
  90.526 + 				     : "=a"(prev)
  90.527 + 				     : "r"(new), "m"(*__xg(ptr)), "0"(old)
  90.528 + 				     : "memory");
  90.529 +@@ -336,7 +336,7 @@ static inline unsigned long long __cmpxc
  90.530 + 				      unsigned long long new)
  90.531 + {
  90.532 + 	unsigned long long prev;
  90.533 +-	__asm__ __volatile__(LOCK_PREFIX "cmpxchg8b %3"
  90.534 ++	__asm__ __volatile__(LOCK "cmpxchg8b %3"
  90.535 + 			     : "=A"(prev)
  90.536 + 			     : "b"((unsigned long)new),
  90.537 + 			       "c"((unsigned long)(new >> 32)),
  90.538 +@@ -503,11 +503,55 @@ struct alt_instr { 
  90.539 + #endif
  90.540 + 
  90.541 + #ifdef CONFIG_SMP
  90.542 ++#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
  90.543 ++#define smp_alt_mb(instr)                                           \
  90.544 ++__asm__ __volatile__("6667:\nnop\nnop\nnop\nnop\nnop\nnop\n6668:\n" \
  90.545 ++		     ".section __smp_alternatives,\"a\"\n"          \
  90.546 ++		     ".long 6667b\n"                                \
  90.547 ++                     ".long 6673f\n"                                \
  90.548 ++		     ".previous\n"                                  \
  90.549 ++		     ".section __smp_replacements,\"a\"\n"          \
  90.550 ++		     "6673:.byte 6668b-6667b\n"                     \
  90.551 ++		     ".byte 6670f-6669f\n"                          \
  90.552 ++		     ".byte 6671f-6670f\n"                          \
  90.553 ++                     ".byte 0\n"                                    \
  90.554 ++		     ".byte %c0\n"                                  \
  90.555 ++		     "6669:lock;addl $0,0(%%esp)\n"                 \
  90.556 ++		     "6670:" instr "\n"                             \
  90.557 ++		     "6671:\n"                                      \
  90.558 ++		     ".previous\n"                                  \
  90.559 ++		     :                                              \
  90.560 ++		     : "i" (X86_FEATURE_XMM2)                       \
  90.561 ++		     : "memory")
  90.562 ++#define smp_rmb() smp_alt_mb("lfence")
  90.563 ++#define smp_mb()  smp_alt_mb("mfence")
  90.564 ++#define set_mb(var, value) do {                                     \
  90.565 ++unsigned long __set_mb_temp;                                        \
  90.566 ++__asm__ __volatile__("6667:movl %1, %0\n6668:\n"                    \
  90.567 ++		     ".section __smp_alternatives,\"a\"\n"          \
  90.568 ++		     ".long 6667b\n"                                \
  90.569 ++		     ".long 6673f\n"                                \
  90.570 ++		     ".previous\n"                                  \
  90.571 ++		     ".section __smp_replacements,\"a\"\n"          \
  90.572 ++		     "6673: .byte 6668b-6667b\n"                    \
  90.573 ++		     ".byte 6670f-6669f\n"                          \
  90.574 ++		     ".byte 0\n"                                    \
  90.575 ++		     ".byte 6671f-6670f\n"                          \
  90.576 ++		     ".byte -1\n"                                   \
  90.577 ++		     "6669: xchg %1, %0\n"                          \
  90.578 ++		     "6670:movl %1, %0\n"                           \
  90.579 ++		     "6671:\n"                                      \
  90.580 ++		     ".previous\n"                                  \
  90.581 ++		     : "=m" (var), "=r" (__set_mb_temp)             \
  90.582 ++		     : "1" (value)                                  \
  90.583 ++		     : "memory"); } while (0)
  90.584 ++#else
  90.585 + #define smp_mb()	mb()
  90.586 + #define smp_rmb()	rmb()
  90.587 ++#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
  90.588 ++#endif
  90.589 + #define smp_wmb()	wmb()
  90.590 + #define smp_read_barrier_depends()	read_barrier_depends()
  90.591 +-#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
  90.592 + #else
  90.593 + #define smp_mb()	barrier()
  90.594 + #define smp_rmb()	barrier()
    91.1 --- a/tools/examples/vif-common.sh	Fri Feb 24 14:03:07 2006 -0700
    91.2 +++ b/tools/examples/vif-common.sh	Fri Feb 24 15:41:08 2006 -0700
    91.3 @@ -125,7 +125,7 @@ function handle_iptable()
    91.4  #
    91.5  function ip_of()
    91.6  {
    91.7 -  ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed 's,/.*,,'
    91.8 +  ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed 's,/.*,,' | head -1
    91.9  }
   91.10  
   91.11  
    92.1 --- a/tools/examples/vtpm	Fri Feb 24 14:03:07 2006 -0700
    92.2 +++ b/tools/examples/vtpm	Fri Feb 24 15:41:08 2006 -0700
    92.3 @@ -3,6 +3,7 @@
    92.4  dir=$(dirname "$0")
    92.5  . "$dir/vtpm-common.sh"
    92.6  
    92.7 +vtpm_fatal_error=0
    92.8  
    92.9  case "$command" in
   92.10    add)
   92.11 @@ -19,5 +20,8 @@ case "$command" in
   92.12    ;;
   92.13  esac
   92.14  
   92.15 -log debug "Successful vTPM operation '$command'."
   92.16 -success
   92.17 +if [ $vtpm_fatal_error -eq 0 ]; then
   92.18 +	log debug "Successful vTPM operation '$command'."
   92.19 +	success
   92.20 +fi
   92.21 +
    93.1 --- a/tools/examples/vtpm-common.sh	Fri Feb 24 14:03:07 2006 -0700
    93.2 +++ b/tools/examples/vtpm-common.sh	Fri Feb 24 15:41:08 2006 -0700
    93.3 @@ -173,6 +173,7 @@ function validate_entry () {
    93.4  	local vmname=$1
    93.5  	local inst=$2
    93.6  	local res
    93.7 +
    93.8  	res=`cat $VTPMDB |             \
    93.9  	     gawk -vvmname=$vmname     \
   93.10  	          -vinst=$inst         \
   93.11 @@ -238,6 +239,9 @@ function vtpm_create_instance () {
   93.12  	local res
   93.13  	set +e
   93.14  	get_create_reason
   93.15 +
   93.16 +	claim_lock vtpmdb
   93.17 +
   93.18  	find_instance $domname
   93.19  	res=$?
   93.20  	if [ $res -eq 0 ]; then
   93.21 @@ -262,6 +266,9 @@ function vtpm_create_instance () {
   93.22  			vtpm_create $instance
   93.23  		fi
   93.24  	fi
   93.25 +
   93.26 +	release_lock vtpmdb
   93.27 +
   93.28  	if [ "$REASON" == "create" ]; then
   93.29  		vtpm_reset $instance
   93.30  	elif [ "$REASON" == "resume" ]; then
   93.31 @@ -292,3 +299,5 @@ function vtpm_remove_instance () {
   93.32  	fi
   93.33  	set -e
   93.34  }
   93.35 +
   93.36 +
    94.1 --- a/tools/examples/xmexample.hvm	Fri Feb 24 14:03:07 2006 -0700
    94.2 +++ b/tools/examples/xmexample.hvm	Fri Feb 24 15:41:08 2006 -0700
    94.3 @@ -30,6 +30,9 @@ name = "ExampleHVMDomain"
    94.4  # the number of cpus guest platform has, default=1
    94.5  #vcpus=1
    94.6  
    94.7 +# enable/disable HVM guest PAE, default=0 (disabled)
    94.8 +#pae=0
    94.9 +
   94.10  # enable/disable HVM guest ACPI, default=0 (disabled)
   94.11  #acpi=0
   94.12  
    95.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Fri Feb 24 14:03:07 2006 -0700
    95.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Fri Feb 24 15:41:08 2006 -0700
    95.3 @@ -125,9 +125,8 @@ target_ulong cpu_get_phys_page_debug(CPU
    95.4  //the evtchn fd for polling
    95.5  int evtchn_fd = -1;
    95.6  
    95.7 -//the evtchn port for polling the notification,
    95.8 -//should be inputed as bochs's parameter
    95.9 -evtchn_port_t ioreq_remote_port, ioreq_local_port;
   95.10 +//which vcpu we are serving
   95.11 +int send_vcpu = 0;
   95.12  
   95.13  //some functions to handle the io req packet
   95.14  void sp_info()
   95.15 @@ -135,52 +134,62 @@ void sp_info()
   95.16      ioreq_t *req;
   95.17      int i;
   95.18  
   95.19 -    term_printf("event port: %d\n", shared_page->sp_global.eport);
   95.20      for ( i = 0; i < vcpus; i++ ) {
   95.21          req = &(shared_page->vcpu_iodata[i].vp_ioreq);
   95.22 -        term_printf("vcpu %d:\n", i);
   95.23 +        term_printf("vcpu %d: event port %d\n",
   95.24 +                    i, shared_page->vcpu_iodata[i].vp_eport);
   95.25          term_printf("  req state: %x, pvalid: %x, addr: %llx, "
   95.26                      "data: %llx, count: %llx, size: %llx\n",
   95.27                      req->state, req->pdata_valid, req->addr,
   95.28                      req->u.data, req->count, req->size);
   95.29 +        term_printf("  IO totally occurred on this vcpu: %llx\n",
   95.30 +                    req->io_count);
   95.31      }
   95.32  }
   95.33  
   95.34  //get the ioreq packets from share mem
   95.35 -ioreq_t* __cpu_get_ioreq(void)
   95.36 +static ioreq_t* __cpu_get_ioreq(int vcpu)
   95.37  {
   95.38      ioreq_t *req;
   95.39  
   95.40 -    req = &(shared_page->vcpu_iodata[0].vp_ioreq);
   95.41 -    if (req->state == STATE_IOREQ_READY) {
   95.42 -        req->state = STATE_IOREQ_INPROCESS;
   95.43 -    } else {
   95.44 -        fprintf(logfile, "False I/O request ... in-service already: "
   95.45 -                         "%x, pvalid: %x, port: %llx, "
   95.46 -                         "data: %llx, count: %llx, size: %llx\n",
   95.47 -                         req->state, req->pdata_valid, req->addr,
   95.48 -                         req->u.data, req->count, req->size);
   95.49 -        req = NULL;
   95.50 -    }
   95.51 +    req = &(shared_page->vcpu_iodata[vcpu].vp_ioreq);
   95.52  
   95.53 -    return req;
   95.54 +    if ( req->state == STATE_IOREQ_READY )
   95.55 +        return req;
   95.56 +
   95.57 +    fprintf(logfile, "False I/O request ... in-service already: "
   95.58 +                     "%x, pvalid: %x, port: %llx, "
   95.59 +                     "data: %llx, count: %llx, size: %llx\n",
   95.60 +                     req->state, req->pdata_valid, req->addr,
   95.61 +                     req->u.data, req->count, req->size);
   95.62 +    return NULL;
   95.63  }
   95.64  
   95.65  //use poll to get the port notification
   95.66  //ioreq_vec--out,the
   95.67  //retval--the number of ioreq packet
   95.68 -ioreq_t* cpu_get_ioreq(void)
   95.69 +static ioreq_t* cpu_get_ioreq(void)
   95.70  {
   95.71 -    int rc;
   95.72 +    int i, rc;
   95.73      evtchn_port_t port;
   95.74  
   95.75      rc = read(evtchn_fd, &port, sizeof(port));
   95.76 -    if ((rc == sizeof(port)) && (port == ioreq_local_port)) {
   95.77 +    if ( rc == sizeof(port) ) {
   95.78 +        for ( i = 0; i < vcpus; i++ )
   95.79 +            if ( shared_page->vcpu_iodata[i].dm_eport == port )
   95.80 +                break;
   95.81 +
   95.82 +        if ( i == vcpus ) {
   95.83 +            fprintf(logfile, "Fatal error while trying to get io event!\n");
   95.84 +            exit(1);
   95.85 +        }
   95.86 +
   95.87          // unmask the wanted port again
   95.88 -        write(evtchn_fd, &ioreq_local_port, sizeof(port));
   95.89 +        write(evtchn_fd, &port, sizeof(port));
   95.90  
   95.91          //get the io packet from shared memory
   95.92 -        return __cpu_get_ioreq();
   95.93 +        send_vcpu = i;
   95.94 +        return __cpu_get_ioreq(i);
   95.95      }
   95.96  
   95.97      //read error or read nothing
   95.98 @@ -361,6 +370,8 @@ void cpu_handle_ioreq(CPUState *env)
   95.99      ioreq_t *req = cpu_get_ioreq();
  95.100  
  95.101      if (req) {
  95.102 +        req->state = STATE_IOREQ_INPROCESS;
  95.103 +
  95.104          if ((!req->pdata_valid) && (req->dir == IOREQ_WRITE)) {
  95.105              if (req->size != 4)
  95.106                  req->u.data &= (1UL << (8 * req->size))-1;
  95.107 @@ -465,7 +476,7 @@ int main_loop(void)
  95.108              struct ioctl_evtchn_notify notify;
  95.109  
  95.110              env->send_event = 0;
  95.111 -            notify.port = ioreq_local_port;
  95.112 +            notify.port = shared_page->vcpu_iodata[send_vcpu].dm_eport;
  95.113              (void)ioctl(evtchn_fd, IOCTL_EVTCHN_NOTIFY, &notify);
  95.114          }
  95.115      }
  95.116 @@ -488,7 +499,7 @@ CPUState * cpu_init()
  95.117  {
  95.118      CPUX86State *env;
  95.119      struct ioctl_evtchn_bind_interdomain bind;
  95.120 -    int rc;
  95.121 +    int i, rc;
  95.122  
  95.123      cpu_exec_init();
  95.124      qemu_register_reset(qemu_hvm_reset, NULL);
  95.125 @@ -509,14 +520,17 @@ CPUState * cpu_init()
  95.126          return NULL;
  95.127      }
  95.128  
  95.129 +    /* FIXME: how about if we overflow the page here? */
  95.130      bind.remote_domain = domid;
  95.131 -    bind.remote_port   = ioreq_remote_port;
  95.132 -    rc = ioctl(evtchn_fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
  95.133 -    if (rc == -1) {
  95.134 -        fprintf(logfile, "bind interdomain ioctl error %d\n", errno);
  95.135 -        return NULL;
  95.136 +    for ( i = 0; i < vcpus; i++ ) {
  95.137 +        bind.remote_port = shared_page->vcpu_iodata[i].vp_eport;
  95.138 +        rc = ioctl(evtchn_fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
  95.139 +        if ( rc == -1 ) {
  95.140 +            fprintf(logfile, "bind interdomain ioctl error %d\n", errno);
  95.141 +            return NULL;
  95.142 +        }
  95.143 +        shared_page->vcpu_iodata[i].dm_eport = rc;
  95.144      }
  95.145 -    ioreq_local_port = rc;
  95.146  
  95.147      return env;
  95.148  }
    96.1 --- a/tools/ioemu/vl.c	Fri Feb 24 14:03:07 2006 -0700
    96.2 +++ b/tools/ioemu/vl.c	Fri Feb 24 15:41:08 2006 -0700
    96.3 @@ -2337,7 +2337,6 @@ enum {
    96.4  
    96.5      QEMU_OPTION_S,
    96.6      QEMU_OPTION_s,
    96.7 -    QEMU_OPTION_p,
    96.8      QEMU_OPTION_d,
    96.9      QEMU_OPTION_l,
   96.10      QEMU_OPTION_hdachs,
   96.11 @@ -2414,7 +2413,6 @@ const QEMUOption qemu_options[] = {
   96.12  
   96.13      { "S", 0, QEMU_OPTION_S },
   96.14      { "s", 0, QEMU_OPTION_s },
   96.15 -    { "p", HAS_ARG, QEMU_OPTION_p },
   96.16      { "d", HAS_ARG, QEMU_OPTION_d },
   96.17      { "l", HAS_ARG, QEMU_OPTION_l },
   96.18      { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
   96.19 @@ -2938,13 +2936,6 @@ int main(int argc, char **argv)
   96.20                      fprintf(logfile, "domid: %d\n", domid);
   96.21                  }
   96.22                  break;
   96.23 -            case QEMU_OPTION_p:
   96.24 -                {
   96.25 -                    extern evtchn_port_t ioreq_remote_port;
   96.26 -                    ioreq_remote_port = atoi(optarg);
   96.27 -                    fprintf(logfile, "eport: %d\n", ioreq_remote_port);
   96.28 -                }
   96.29 -                break;
   96.30              case QEMU_OPTION_l:
   96.31                  {
   96.32                      int mask;
    97.1 --- a/tools/libxc/xc_hvm_build.c	Fri Feb 24 14:03:07 2006 -0700
    97.2 +++ b/tools/libxc/xc_hvm_build.c	Fri Feb 24 15:41:08 2006 -0700
    97.3 @@ -20,7 +20,7 @@
    97.4  #define L3_PROT (_PAGE_PRESENT)
    97.5  #endif
    97.6  
    97.7 -#define E820MAX	128
    97.8 +#define E820MAX     128
    97.9  
   97.10  #define E820_RAM          1
   97.11  #define E820_RESERVED     2
   97.12 @@ -137,7 +137,7 @@ set_hvm_info_checksum(struct hvm_info_ta
   97.13   */
   97.14  static int set_hvm_info(int xc_handle, uint32_t dom,
   97.15                          unsigned long *pfn_list, unsigned int vcpus,
   97.16 -                        unsigned int acpi, unsigned int apic)
   97.17 +                        unsigned int pae, unsigned int acpi, unsigned int apic)
   97.18  {
   97.19      char *va_map;
   97.20      struct hvm_info_table *va_hvm;
   97.21 @@ -149,7 +149,7 @@ static int set_hvm_info(int xc_handle, u
   97.22          PAGE_SIZE,
   97.23          PROT_READ|PROT_WRITE,
   97.24          pfn_list[HVM_INFO_PFN]);
   97.25 -    
   97.26 +
   97.27      if ( va_map == NULL )
   97.28          return -1;
   97.29  
   97.30 @@ -159,6 +159,7 @@ static int set_hvm_info(int xc_handle, u
   97.31      va_hvm->length       = sizeof(struct hvm_info_table);
   97.32      va_hvm->acpi_enabled = acpi;
   97.33      va_hvm->apic_enabled = apic;
   97.34 +    va_hvm->pae_enabled  = pae;
   97.35      va_hvm->nr_vcpus     = vcpus;
   97.36  
   97.37      set_hvm_info_checksum(va_hvm);
   97.38 @@ -174,9 +175,9 @@ static int setup_guest(int xc_handle,
   97.39                         unsigned long nr_pages,
   97.40                         vcpu_guest_context_t *ctxt,
   97.41                         unsigned long shared_info_frame,
   97.42 -                       unsigned int control_evtchn,
   97.43                         unsigned int vcpus,
   97.44 -		       unsigned int acpi,
   97.45 +                       unsigned int pae,
   97.46 +                       unsigned int acpi,
   97.47                         unsigned int apic,
   97.48                         unsigned int store_evtchn,
   97.49                         unsigned long *store_mfn)
   97.50 @@ -190,11 +191,7 @@ static int setup_guest(int xc_handle,
   97.51      xc_mmu_t *mmu = NULL;
   97.52      int rc;
   97.53  
   97.54 -    unsigned long nr_pt_pages;
   97.55 -
   97.56      struct domain_setup_info dsi;
   97.57 -    unsigned long vpt_start;
   97.58 -    unsigned long vpt_end;
   97.59      unsigned long v_end;
   97.60  
   97.61      unsigned long shared_page_frame = 0;
   97.62 @@ -214,20 +211,10 @@ static int setup_guest(int xc_handle,
   97.63      /* memsize is in megabytes */
   97.64      v_end              = (unsigned long)memsize << 20;
   97.65  
   97.66 -#ifdef __i386__
   97.67 -    nr_pt_pages = 1 + ((memsize + 3) >> 2);
   97.68 -#else
   97.69 -    nr_pt_pages = 5 + ((memsize + 1) >> 1);
   97.70 -#endif
   97.71 -    vpt_start   = v_end;
   97.72 -    vpt_end     = vpt_start + (nr_pt_pages * PAGE_SIZE);
   97.73 -
   97.74      printf("VIRTUAL MEMORY ARRANGEMENT:\n"
   97.75             " Loaded HVM loader: %08lx->%08lx\n"
   97.76 -           " Page tables:   %08lx->%08lx\n"
   97.77             " TOTAL:         %08lx->%08lx\n",
   97.78             dsi.v_kernstart, dsi.v_kernend,
   97.79 -           vpt_start, vpt_end,
   97.80             dsi.v_start, v_end);
   97.81      printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
   97.82  
   97.83 @@ -265,7 +252,7 @@ static int setup_guest(int xc_handle,
   97.84              goto error_out;
   97.85      }
   97.86  
   97.87 -    if ( set_hvm_info(xc_handle, dom, page_array, vcpus, acpi, apic) ) {
   97.88 +    if ( set_hvm_info(xc_handle, dom, page_array, vcpus, pae, acpi, apic) ) {
   97.89          fprintf(stderr, "Couldn't set hvm info for HVM guest.\n");
   97.90          goto error_out;
   97.91      }
   97.92 @@ -296,7 +283,19 @@ static int setup_guest(int xc_handle,
   97.93           shared_page_frame)) == 0 )
   97.94          goto error_out;
   97.95      memset(sp, 0, PAGE_SIZE);
   97.96 -    sp->sp_global.eport = control_evtchn;
   97.97 +
   97.98 +    /* FIXME: how about if we overflow the page here? */
   97.99 +    for ( i = 0; i < vcpus; i++ ) {
  97.100 +        unsigned int vp_eport;
  97.101 +
  97.102 +        vp_eport = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
  97.103 +        if ( vp_eport < 0 ) {
  97.104 +            fprintf(stderr, "Couldn't get unbound port from VMX guest.\n");
  97.105 +            goto error_out;
  97.106 +        }
  97.107 +        sp->vcpu_iodata[i].vp_eport = vp_eport;
  97.108 +    }
  97.109 +
  97.110      munmap(sp, PAGE_SIZE);
  97.111  
  97.112      *store_mfn = page_array[(v_end >> PAGE_SHIFT) - 2];
  97.113 @@ -343,9 +342,9 @@ int xc_hvm_build(int xc_handle,
  97.114                   uint32_t domid,
  97.115                   int memsize,
  97.116                   const char *image_name,
  97.117 -                 unsigned int control_evtchn,
  97.118                   unsigned int vcpus,
  97.119 -		 unsigned int acpi,
  97.120 +                 unsigned int pae,
  97.121 +                 unsigned int acpi,
  97.122                   unsigned int apic,
  97.123                   unsigned int store_evtchn,
  97.124                   unsigned long *store_mfn)
  97.125 @@ -366,8 +365,8 @@ int xc_hvm_build(int xc_handle,
  97.126  
  97.127      if ( !strstr(xen_caps, "hvm") )
  97.128      {
  97.129 -	PERROR("CPU doesn't support HVM extensions or "
  97.130 -	       "the extensions are not enabled");
  97.131 +        PERROR("CPU doesn't support HVM extensions or "
  97.132 +               "the extensions are not enabled");
  97.133          goto error_out;
  97.134      }
  97.135  
  97.136 @@ -399,8 +398,8 @@ int xc_hvm_build(int xc_handle,
  97.137  
  97.138      ctxt->flags = VGCF_HVM_GUEST;
  97.139      if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages,
  97.140 -                     ctxt, op.u.getdomaininfo.shared_info_frame, control_evtchn,
  97.141 -                     vcpus, acpi, apic, store_evtchn, store_mfn) < 0)
  97.142 +                     ctxt, op.u.getdomaininfo.shared_info_frame,
  97.143 +                     vcpus, pae, acpi, apic, store_evtchn, store_mfn) < 0)
  97.144      {
  97.145          ERROR("Error constructing guest OS");
  97.146          goto error_out;
    98.1 --- a/tools/libxc/xc_ia64_stubs.c	Fri Feb 24 14:03:07 2006 -0700
    98.2 +++ b/tools/libxc/xc_ia64_stubs.c	Fri Feb 24 15:41:08 2006 -0700
    98.3 @@ -16,7 +16,7 @@
    98.4  #undef __IA64_UL
    98.5  #define __IA64_UL(x)           ((unsigned long)(x))
    98.6  #undef __ASSEMBLY__
    98.7 -                                                                                
    98.8 +
    98.9  unsigned long xc_ia64_fpsr_default(void)
   98.10  {
   98.11          return FPSR_DEFAULT;
   98.12 @@ -569,12 +569,14 @@ static int add_pal_hob(void* hob_buf){
   98.13  static int setup_guest(  int xc_handle,
   98.14                           uint32_t dom, unsigned long memsize,
   98.15                           char *image, unsigned long image_size,
   98.16 -                         unsigned int control_evtchn,
   98.17 +                         uint32_t vcpus,
   98.18                           unsigned int store_evtchn,
   98.19                           unsigned long *store_mfn)
   98.20  {
   98.21      unsigned long page_array[2];
   98.22      shared_iopage_t *sp;
   98.23 +    int i;
   98.24 +
   98.25      // FIXME: initialize pfn list for a temp hack
   98.26      if (xc_ia64_get_pfn_list(xc_handle, dom, NULL, -1, -1) == -1) {
   98.27  	PERROR("Could not allocate continuous memory");
   98.28 @@ -612,7 +614,18 @@ static int setup_guest(  int xc_handle,
   98.29  		page_array[0])) == 0)
   98.30  	goto error_out;
   98.31      memset(sp, 0, PAGE_SIZE);
   98.32 -    sp->sp_global.eport = control_evtchn;
   98.33 +
   98.34 +    for (i = 0; i < vcpus; i++) {
   98.35 +        uint32_t vp_eport;
   98.36 +
   98.37 +        vp_eport = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
   98.38 +        if (vp_eport < 0) {
   98.39 +            fprintf(stderr, "Couldn't get unbound port from VMX guest.\n");
   98.40 +            goto error_out;
   98.41 +        }
   98.42 +        sp->vcpu_iodata[i].vp_eport = vp_eport;
   98.43 +    }
   98.44 +
   98.45      munmap(sp, PAGE_SIZE);
   98.46  
   98.47      return 0;
   98.48 @@ -625,10 +638,10 @@ int xc_hvm_build(int xc_handle,
   98.49                   uint32_t domid,
   98.50                   int memsize,
   98.51                   const char *image_name,
   98.52 -                 unsigned int control_evtchn,
   98.53 -                 unsigned int lapic,
   98.54                   unsigned int vcpus,
   98.55 +                 unsigned int pae,
   98.56                   unsigned int acpi,
   98.57 +                 unsigned int apic,
   98.58                   unsigned int store_evtchn,
   98.59                   unsigned long *store_mfn)
   98.60  {
   98.61 @@ -667,8 +680,8 @@ int xc_hvm_build(int xc_handle,
   98.62  
   98.63      memset(ctxt, 0, sizeof(*ctxt));
   98.64  
   98.65 -    if ( setup_guest(xc_handle, domid, (unsigned long)memsize, image, image_size, 
   98.66 -                       control_evtchn, store_evtchn, store_mfn ) < 0 ){
   98.67 +    if ( setup_guest(xc_handle, domid, (unsigned long)memsize, image,
   98.68 +                     image_size, vcpus, store_evtchn, store_mfn ) < 0 ){
   98.69          ERROR("Error constructing guest OS");
   98.70          goto error_out;
   98.71      }
    99.1 --- a/tools/libxc/xc_load_bin.c	Fri Feb 24 14:03:07 2006 -0700
    99.2 +++ b/tools/libxc/xc_load_bin.c	Fri Feb 24 15:41:08 2006 -0700
    99.3 @@ -231,6 +231,7 @@ static int parsebinimage(char *image,
    99.4      dsi->v_kernstart = dsi->v_start;
    99.5      dsi->v_kernend = dsi->v_end;
    99.6      dsi->v_kernentry = image_info->entry_addr;
    99.7 +    dsi->xen_guest_string = "";
    99.8  
    99.9      return 0;
   99.10  }
   100.1 --- a/tools/libxc/xenguest.h	Fri Feb 24 14:03:07 2006 -0700
   100.2 +++ b/tools/libxc/xenguest.h	Fri Feb 24 15:41:08 2006 -0700
   100.3 @@ -40,7 +40,7 @@ int xc_linux_save(int xc_handle, int io_
   100.4  int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, 
   100.5                       unsigned long nr_pfns, unsigned int store_evtchn, 
   100.6                       unsigned long *store_mfn, unsigned int console_evtchn,
   100.7 -		     unsigned long *console_mfn);
   100.8 +                     unsigned long *console_mfn);
   100.9  
  100.10  int xc_linux_build(int xc_handle,
  100.11                     uint32_t domid,
  100.12 @@ -57,8 +57,8 @@ int xc_hvm_build(int xc_handle,
  100.13                   uint32_t domid,
  100.14                   int memsize,
  100.15                   const char *image_name,
  100.16 -                 unsigned int control_evtchn,
  100.17                   unsigned int vcpus,
  100.18 +                 unsigned int pae,
  100.19                   unsigned int acpi,
  100.20                   unsigned int apic,
  100.21                   unsigned int store_evtchn,
   101.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Feb 24 14:03:07 2006 -0700
   101.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Feb 24 15:41:08 2006 -0700
   101.3 @@ -363,23 +363,24 @@ static PyObject *pyxc_hvm_build(XcObject
   101.4  {
   101.5      uint32_t dom;
   101.6      char *image;
   101.7 -    int control_evtchn, store_evtchn;
   101.8 +    int store_evtchn;
   101.9      int memsize;
  101.10      int vcpus = 1;
  101.11 +    int pae  = 0;
  101.12      int acpi = 0;
  101.13      int apic = 0;
  101.14      unsigned long store_mfn = 0;
  101.15  
  101.16 -    static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn",
  101.17 -				"memsize", "image", "vcpus", "acpi", "apic",
  101.18 +    static char *kwd_list[] = { "dom", "store_evtchn",
  101.19 +				"memsize", "image", "vcpus", "pae", "acpi", "apic",
  101.20  				NULL };
  101.21 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiisiii", kwd_list,
  101.22 -                                      &dom, &control_evtchn, &store_evtchn,
  101.23 -				      &memsize, &image, &vcpus, &acpi, &apic) )
  101.24 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiii", kwd_list,
  101.25 +                                      &dom, &store_evtchn, &memsize,
  101.26 +                                      &image, &vcpus, &pae, &acpi, &apic) )
  101.27          return NULL;
  101.28  
  101.29 -    if ( xc_hvm_build(self->xc_handle, dom, memsize, image, control_evtchn,
  101.30 -		      vcpus, acpi, apic, store_evtchn, &store_mfn) != 0 )
  101.31 +    if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
  101.32 +		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
  101.33          return PyErr_SetFromErrno(xc_error);
  101.34  
  101.35      return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
   102.1 --- a/tools/python/xen/xend/image.py	Fri Feb 24 14:03:07 2006 -0700
   102.2 +++ b/tools/python/xen/xend/image.py	Fri Feb 24 15:41:08 2006 -0700
   102.3 @@ -191,8 +191,8 @@ class HVMImageHandler(ImageHandler):
   102.4          ImageHandler.configure(self, imageConfig, deviceConfig)
   102.5  
   102.6          info = xc.xeninfo()
   102.7 -	if not 'hvm' in info['xen_caps']:
   102.8 -	    raise VmError("Not an HVM capable platform, we stop creating!")
   102.9 +        if not 'hvm' in info['xen_caps']:
  102.10 +            raise VmError("Not an HVM capable platform, we stop creating!")
  102.11  
  102.12          self.dmargs = self.parseDeviceModelArgs(imageConfig, deviceConfig)
  102.13          self.device_model = sxp.child_value(imageConfig, 'device_model')
  102.14 @@ -205,28 +205,24 @@ class HVMImageHandler(ImageHandler):
  102.15                          ("image/device-model", self.device_model),
  102.16                          ("image/display", self.display))
  102.17  
  102.18 -        self.device_channel = None
  102.19          self.pid = 0
  102.20  
  102.21          self.dmargs += self.configVNC(imageConfig)
  102.22  
  102.23 +        self.pae  = int(sxp.child_value(imageConfig, 'pae', 0))
  102.24 +
  102.25          self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0))
  102.26          self.apic = int(sxp.child_value(imageConfig, 'apic', 0))
  102.27  
  102.28      def buildDomain(self):
  102.29 -        # Create an event channel
  102.30 -        self.device_channel = xc.evtchn_alloc_unbound(dom=self.vm.getDomid(),
  102.31 -                                                      remote_dom=0)
  102.32 -        log.info("HVM device model port: %d", self.device_channel)
  102.33 -
  102.34          store_evtchn = self.vm.getStorePort()
  102.35  
  102.36          log.debug("dom            = %d", self.vm.getDomid())
  102.37          log.debug("image          = %s", self.kernel)
  102.38 -        log.debug("control_evtchn = %d", self.device_channel)
  102.39          log.debug("store_evtchn   = %d", store_evtchn)
  102.40          log.debug("memsize        = %d", self.vm.getMemoryTarget() / 1024)
  102.41          log.debug("vcpus          = %d", self.vm.getVCpuCount())
  102.42 +        log.debug("pae            = %d", self.pae)
  102.43          log.debug("acpi           = %d", self.acpi)
  102.44          log.debug("apic           = %d", self.apic)
  102.45  
  102.46 @@ -234,10 +230,10 @@ class HVMImageHandler(ImageHandler):
  102.47  
  102.48          return xc.hvm_build(dom            = self.vm.getDomid(),
  102.49                              image          = self.kernel,
  102.50 -                            control_evtchn = self.device_channel,
  102.51                              store_evtchn   = store_evtchn,
  102.52                              memsize        = self.vm.getMemoryTarget() / 1024,
  102.53                              vcpus          = self.vm.getVCpuCount(),
  102.54 +                            pae            = self.pae,
  102.55                              acpi           = self.acpi,
  102.56                              apic           = self.apic)
  102.57  
  102.58 @@ -341,7 +337,6 @@ class HVMImageHandler(ImageHandler):
  102.59          if len(vnc):
  102.60              args = args + vnc
  102.61          args = args + ([ "-d",  "%d" % self.vm.getDomid(),
  102.62 -                  "-p", "%d" % self.device_channel,
  102.63                    "-m", "%s" % (self.vm.getMemoryTarget() / 1024)])
  102.64          args = args + self.dmargs
  102.65          env = dict(os.environ)
  102.66 @@ -379,28 +374,12 @@ class HVMImageHandler(ImageHandler):
  102.67      def getDomainMemory(self, mem):
  102.68          """@see ImageHandler.getDomainMemory"""
  102.69          page_kb = 4
  102.70 +        extra_pages = 0
  102.71          if os.uname()[4] == 'ia64':
  102.72              page_kb = 16
  102.73 -        # for ioreq_t and xenstore
  102.74 -        static_pages = 2
  102.75 -        return mem + (self.getPageTableSize(mem / 1024) + static_pages) * page_kb
  102.76 -
  102.77 -    def getPageTableSize(self, mem_mb):
  102.78 -        """Return the pages of memory needed for 1:1 page tables for physical
  102.79 -           mode.
  102.80 -
  102.81 -        @param mem_mb: size in MB
  102.82 -        @return size in KB
  102.83 -        """
  102.84 -        # 1 page for the PGD + 1 pte page for 4MB of memory (rounded)
  102.85 -        if os.uname()[4] == 'x86_64':
  102.86 -            return 5 + ((mem_mb + 1) >> 1)
  102.87 -        elif os.uname()[4] == 'ia64':
  102.88 -            # 1:1 pgtable is allocated on demand ia64, so just return rom size
  102.89 -	    # for guest firmware
  102.90 -            return 1024
  102.91 -        else:
  102.92 -            return 1 + ((mem_mb + 3) >> 2)
  102.93 +            # ROM size for guest firmware, ioreq page and xenstore page
  102.94 +            extra_pages = 1024 + 2
  102.95 +        return mem + extra_pages * page_kb
  102.96  
  102.97      def register_shutdown_watch(self):
  102.98          """ add xen store watch on control/shutdown """
   103.1 --- a/tools/python/xen/xm/create.py	Fri Feb 24 14:03:07 2006 -0700
   103.2 +++ b/tools/python/xen/xm/create.py	Fri Feb 24 15:41:08 2006 -0700
   103.3 @@ -161,6 +161,10 @@ gopts.var('cpus', val='CPUS',
   103.4            fn=set_int, default=None,
   103.5            use="CPUS to run the domain on.")
   103.6  
   103.7 +gopts.var('pae', val='PAE',
   103.8 +          fn=set_int, default=0,
   103.9 +          use="Disable or enable PAE of HVM domain.")
  103.10 +
  103.11  gopts.var('acpi', val='ACPI',
  103.12            fn=set_int, default=0,
  103.13            use="Disable or enable ACPI of HVM domain.")
  103.14 @@ -545,7 +549,7 @@ def configure_vifs(config_devs, vals):
  103.15  def configure_hvm(config_image, vals):
  103.16      """Create the config for HVM devices.
  103.17      """
  103.18 -    args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
  103.19 +    args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
  103.20               'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
  103.21               'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'acpi', 'apic',
  103.22               'xauthority' ]
   104.1 --- a/tools/xenstore/xenstored_core.c	Fri Feb 24 14:03:07 2006 -0700
   104.2 +++ b/tools/xenstore/xenstored_core.c	Fri Feb 24 15:41:08 2006 -0700
   104.3 @@ -573,14 +573,11 @@ static struct buffered_data *new_buffer(
   104.4  {
   104.5  	struct buffered_data *data;
   104.6  
   104.7 -	data = talloc(ctx, struct buffered_data);
   104.8 +	data = talloc_zero(ctx, struct buffered_data);
   104.9  	if (data == NULL)
  104.10  		return NULL;
  104.11  	
  104.12  	data->inhdr = true;
  104.13 -	data->used = 0;
  104.14 -	data->buffer = NULL;
  104.15 -
  104.16  	return data;
  104.17  }
  104.18  
  104.19 @@ -1394,17 +1391,13 @@ static void manual_node(const char *name
  104.20  	struct node *node;
  104.21  	struct xs_permissions perms = { .id = 0, .perms = XS_PERM_NONE };
  104.22  
  104.23 -	node = talloc(NULL, struct node);
  104.24 +	node = talloc_zero(NULL, struct node);
  104.25  	node->name = name;
  104.26  	node->perms = &perms;
  104.27  	node->num_perms = 1;
  104.28 -	node->data = NULL;
  104.29 -	node->datalen = 0;
  104.30  	node->children = (char *)child;
  104.31  	if (child)
  104.32  		node->childlen = strlen(child) + 1;
  104.33 -	else
  104.34 -		node->childlen = 0;
  104.35  
  104.36  	if (!write_node(NULL, node))
  104.37  		barf_perror("Could not create initial node %s", name);
   105.1 --- a/tools/xm-test/README	Fri Feb 24 14:03:07 2006 -0700
   105.2 +++ b/tools/xm-test/README	Fri Feb 24 15:41:08 2006 -0700
   105.3 @@ -49,6 +49,15 @@ Simply copy the initrd-X.Y.img file into
   105.4  
   105.5     # make existing
   105.6  
   105.7 +Or, you can run:
   105.8 +   # INITRD="http://url.of.initrd.repo/" make existing
   105.9 +
  105.10 +You do not need to include the name of the image itself in the url, 
  105.11 +however, an initrd with the right name (initrd.X.Y.img) and version 
  105.12 +number must exist at that location.  The script will determine which 
  105.13 +version of the initrd it needs and try to download the right file from 
  105.14 +that location.
  105.15 +
  105.16  This will set up the link so that xm-test will use the existing
  105.17  ramdisk.  Next, just run "runtest.sh" normally.  Note that in general,
  105.18  you should not attempt to use a ramdisk from a previous minor version
   106.1 --- a/tools/xm-test/ramdisk/Makefile.am	Fri Feb 24 14:03:07 2006 -0700
   106.2 +++ b/tools/xm-test/ramdisk/Makefile.am	Fri Feb 24 15:41:08 2006 -0700
   106.3 @@ -57,6 +57,9 @@ disk.img: existing
   106.4  	fi
   106.5  
   106.6  existing:
   106.7 +	@if test -n "$(INITRD)"; then \
   106.8 +		wget $(INITRD)/$(XMTEST_VER_IMG); \
   106.9 +	fi
  106.10  	@if [ -f $(XMTEST_VER_IMG) ] ; then \
  106.11  		ln -sf $(XMTEST_VER_IMG) initrd.img; \
  106.12  	else \
   107.1 --- a/xen/arch/ia64/vmx/mmio.c	Fri Feb 24 14:03:07 2006 -0700
   107.2 +++ b/xen/arch/ia64/vmx/mmio.c	Fri Feb 24 15:41:08 2006 -0700
   107.3 @@ -154,7 +154,7 @@ static void low_mmio_access(VCPU *vcpu, 
   107.4  
   107.5      set_bit(ARCH_VMX_IO_WAIT, &v->arch.arch_vmx.flags);
   107.6      p->state = STATE_IOREQ_READY;
   107.7 -    evtchn_send(iopacket_port(v->domain));
   107.8 +    evtchn_send(iopacket_port(v));
   107.9      vmx_wait_io();
  107.10      if(dir==IOREQ_READ){ //read
  107.11          *val=p->u.data;
  107.12 @@ -186,7 +186,7 @@ static void legacy_io_access(VCPU *vcpu,
  107.13  
  107.14      set_bit(ARCH_VMX_IO_WAIT, &v->arch.arch_vmx.flags);
  107.15      p->state = STATE_IOREQ_READY;
  107.16 -    evtchn_send(iopacket_port(v->domain));
  107.17 +    evtchn_send(iopacket_port(v));
  107.18  
  107.19      vmx_wait_io();
  107.20      if(dir==IOREQ_READ){ //read
   108.1 --- a/xen/arch/ia64/vmx/vmx_init.c	Fri Feb 24 14:03:07 2006 -0700
   108.2 +++ b/xen/arch/ia64/vmx/vmx_init.c	Fri Feb 24 15:41:08 2006 -0700
   108.3 @@ -49,6 +49,7 @@
   108.4  #include <xen/mm.h>
   108.5  #include <public/arch-ia64.h>
   108.6  #include <asm/hvm/vioapic.h>
   108.7 +#include <public/event_channel.h>
   108.8  
   108.9  /* Global flag to identify whether Intel vmx feature is on */
  108.10  u32 vmx_enabled = 0;
  108.11 @@ -250,9 +251,6 @@ vmx_final_setup_guest(struct vcpu *v)
  108.12  {
  108.13  	vpd_t *vpd;
  108.14  
  108.15 -	/* Allocate resources for vcpu 0 */
  108.16 -	//memset(&v->arch.arch_vmx, 0, sizeof(struct arch_vmx_struct));
  108.17 -
  108.18  	vpd = alloc_vpd();
  108.19  	ASSERT(vpd);
  108.20  
  108.21 @@ -371,20 +369,15 @@ int vmx_alloc_contig_pages(struct domain
  108.22  
  108.23  void vmx_setup_platform(struct domain *d, struct vcpu_guest_context *c)
  108.24  {
  108.25 -	shared_iopage_t *sp;
  108.26 -
  108.27  	ASSERT(d != dom0); /* only for non-privileged vti domain */
  108.28  	d->arch.vmx_platform.shared_page_va =
  108.29  		(unsigned long)__va(__gpa_to_mpa(d, IO_PAGE_START));
  108.30 -	sp = get_sp(d);
  108.31 -	//memset((char *)sp,0,PAGE_SIZE);
  108.32  	/* TEMP */
  108.33  	d->arch.vmx_platform.pib_base = 0xfee00000UL;
  108.34  
  108.35  	/* Only open one port for I/O and interrupt emulation */
  108.36  	memset(&d->shared_info->evtchn_mask[0], 0xff,
  108.37  	    sizeof(d->shared_info->evtchn_mask));
  108.38 -	clear_bit(iopacket_port(d), &d->shared_info->evtchn_mask[0]);
  108.39  
  108.40  	/* Initialize the virtual interrupt lines */
  108.41  	vmx_virq_line_init(d);
  108.42 @@ -393,4 +386,16 @@ void vmx_setup_platform(struct domain *d
  108.43  	hvm_vioapic_init(d);
  108.44  }
  108.45  
  108.46 +void vmx_do_launch(struct vcpu *v)
  108.47 +{
  108.48 +	if (evtchn_bind_vcpu(iopacket_port(v), v->vcpu_id) < 0) {
  108.49 +	    printk("VMX domain bind port %d to vcpu %d failed!\n",
  108.50 +		iopacket_port(v), v->vcpu_id);
  108.51 +	    domain_crash_synchronous();
  108.52 +	}
  108.53  
  108.54 +	clear_bit(iopacket_port(v),
  108.55 +		&v->domain->shared_info->evtchn_mask[0]);
  108.56 +
  108.57 +	vmx_load_all_rr(v);
  108.58 +}
   109.1 --- a/xen/arch/ia64/vmx/vmx_support.c	Fri Feb 24 14:03:07 2006 -0700
   109.2 +++ b/xen/arch/ia64/vmx/vmx_support.c	Fri Feb 24 15:41:08 2006 -0700
   109.3 @@ -38,7 +38,7 @@ void vmx_wait_io(void)
   109.4  {
   109.5      struct vcpu *v = current;
   109.6      struct domain *d = v->domain;
   109.7 -    int port = iopacket_port(d);
   109.8 +    int port = iopacket_port(v);
   109.9  
  109.10      do {
  109.11  	if (!test_bit(port,
  109.12 @@ -129,7 +129,7 @@ void vmx_intr_assist(struct vcpu *v)
  109.13      struct domain *d = v->domain;
  109.14      extern void vmx_vcpu_pend_batch_interrupt(VCPU *vcpu,
  109.15  					unsigned long *pend_irr);
  109.16 -    int port = iopacket_port(d);
  109.17 +    int port = iopacket_port(v);
  109.18  
  109.19      /* I/O emulation is atomic, so it's impossible to see execution flow
  109.20       * out of vmx_wait_io, when guest is still waiting for response.
   110.1 --- a/xen/arch/ia64/xen/process.c	Fri Feb 24 14:03:07 2006 -0700
   110.2 +++ b/xen/arch/ia64/xen/process.c	Fri Feb 24 15:41:08 2006 -0700
   110.3 @@ -71,7 +71,7 @@ void schedule_tail(struct vcpu *prev)
   110.4  	context_saved(prev);
   110.5  
   110.6  	if (VMX_DOMAIN(current)) {
   110.7 -		vmx_load_all_rr(current);
   110.8 +		vmx_do_launch(current);
   110.9  	} else {
  110.10  		load_region_regs(current);
  110.11  		vcpu_load_kernel_regs(current);
   111.1 --- a/xen/arch/ia64/xen/xenmisc.c	Fri Feb 24 14:03:07 2006 -0700
   111.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Fri Feb 24 15:41:08 2006 -0700
   111.3 @@ -349,6 +349,10 @@ void continue_running(struct vcpu *same)
   111.4  	/* nothing to do */
   111.5  }
   111.6  
   111.7 +void arch_dump_domain_info(struct domain *d)
   111.8 +{
   111.9 +}
  111.10 +
  111.11  void panic_domain(struct pt_regs *regs, const char *fmt, ...)
  111.12  {
  111.13  	va_list args;
   112.1 --- a/xen/arch/x86/domain.c	Fri Feb 24 14:03:07 2006 -0700
   112.2 +++ b/xen/arch/x86/domain.c	Fri Feb 24 15:41:08 2006 -0700
   112.3 @@ -346,19 +346,22 @@ int arch_set_info_guest(
   112.4      struct vcpu *v, struct vcpu_guest_context *c)
   112.5  {
   112.6      struct domain *d = v->domain;
   112.7 -    unsigned long phys_basetab;
   112.8 +    unsigned long phys_basetab = INVALID_MFN;
   112.9      int i, rc;
  112.10  
  112.11 -    /*
  112.12 -     * This is sufficient! If the descriptor DPL differs from CS RPL then we'll
  112.13 -     * #GP. If DS, ES, FS, GS are DPL 0 then they'll be cleared automatically.
  112.14 -     * If SS RPL or DPL differs from CS RPL then we'll #GP.
  112.15 -     */
  112.16      if ( !(c->flags & VGCF_HVM_GUEST) )
  112.17      {
  112.18 -        if ( ((c->user_regs.cs & 3) == 0) ||
  112.19 -             ((c->user_regs.ss & 3) == 0) )
  112.20 -            return -EINVAL;
  112.21 +        fixup_guest_selector(c->user_regs.ss);
  112.22 +        fixup_guest_selector(c->kernel_ss);
  112.23 +        fixup_guest_selector(c->user_regs.cs);
  112.24 +
  112.25 +#ifdef __i386__
  112.26 +        fixup_guest_selector(c->event_callback_cs);
  112.27 +        fixup_guest_selector(c->failsafe_callback_cs);
  112.28 +#endif
  112.29 +
  112.30 +        for ( i = 0; i < 256; i++ )
  112.31 +            fixup_guest_selector(c->trap_ctxt[i].cs);
  112.32      }
  112.33      else if ( !hvm_enabled )
  112.34        return -EINVAL;
  112.35 @@ -372,6 +375,7 @@ int arch_set_info_guest(
  112.36          v->arch.flags |= TF_kernel_mode;
  112.37  
  112.38      memcpy(&v->arch.guest_context, c, sizeof(*c));
  112.39 +    init_int80_direct_trap(v);
  112.40  
  112.41      if ( !(c->flags & VGCF_HVM_GUEST) )
  112.42      {
  112.43 @@ -398,17 +402,27 @@ int arch_set_info_guest(
  112.44      if ( v->vcpu_id == 0 )
  112.45          d->vm_assist = c->vm_assist;
  112.46  
  112.47 -    phys_basetab = c->ctrlreg[3];
  112.48 -    phys_basetab =
  112.49 -        (gmfn_to_mfn(d, phys_basetab >> PAGE_SHIFT) << PAGE_SHIFT) |
  112.50 -        (phys_basetab & ~PAGE_MASK);
  112.51 +    if ( !(c->flags & VGCF_HVM_GUEST) )
  112.52 +    {
  112.53 +        phys_basetab = c->ctrlreg[3];
  112.54 +        phys_basetab =
  112.55 +            (gmfn_to_mfn(d, phys_basetab >> PAGE_SHIFT) << PAGE_SHIFT) |
  112.56 +            (phys_basetab & ~PAGE_MASK);
  112.57  
  112.58 -    v->arch.guest_table = mk_pagetable(phys_basetab);
  112.59 +        v->arch.guest_table = mk_pagetable(phys_basetab);
  112.60 +    }
  112.61  
  112.62      if ( (rc = (int)set_gdt(v, c->gdt_frames, c->gdt_ents)) != 0 )
  112.63          return rc;
  112.64  
  112.65 -    if ( shadow_mode_refcounts(d) )
  112.66 +    if ( c->flags & VGCF_HVM_GUEST )
  112.67 +    {
  112.68 +        v->arch.guest_table = mk_pagetable(0);
  112.69 +
  112.70 +        if ( !hvm_initialize_guest_resources(v) )
  112.71 +            return -EINVAL;
  112.72 +    }
  112.73 +    else if ( shadow_mode_refcounts(d) )
  112.74      {
  112.75          if ( !get_page(mfn_to_page(phys_basetab>>PAGE_SHIFT), d) )
  112.76          {
  112.77 @@ -416,7 +430,7 @@ int arch_set_info_guest(
  112.78              return -EINVAL;
  112.79          }
  112.80      }
  112.81 -    else if ( !(c->flags & VGCF_HVM_GUEST) )
  112.82 +    else
  112.83      {
  112.84          if ( !get_page_and_type(mfn_to_page(phys_basetab>>PAGE_SHIFT), d,
  112.85                                  PGT_base_page_table) )
  112.86 @@ -426,17 +440,6 @@ int arch_set_info_guest(
  112.87          }
  112.88      }
  112.89  
  112.90 -    if ( c->flags & VGCF_HVM_GUEST )
  112.91 -    {
  112.92 -        /* HVM uses the initially provided page tables as the P2M map. */
  112.93 -        if ( !pagetable_get_paddr(d->arch.phys_table) )
  112.94 -            d->arch.phys_table = v->arch.guest_table;
  112.95 -        v->arch.guest_table = mk_pagetable(0);
  112.96 -
  112.97 -        if ( !hvm_initialize_guest_resources(v) )
  112.98 -            return -EINVAL;
  112.99 -    }
 112.100 -
 112.101      update_pagetables(v);
 112.102  
 112.103      if ( v->vcpu_id == 0 )
 112.104 @@ -610,9 +613,6 @@ static void save_segments(struct vcpu *v
 112.105      struct cpu_user_regs      *regs = &ctxt->user_regs;
 112.106      unsigned int dirty_segment_mask = 0;
 112.107  
 112.108 -    if ( HVM_DOMAIN(v) )
 112.109 -        hvm_save_segments(v);
 112.110 -
 112.111      regs->ds = read_segment_register(ds);
 112.112      regs->es = read_segment_register(es);
 112.113      regs->fs = read_segment_register(fs);
 112.114 @@ -682,9 +682,15 @@ static void __context_switch(void)
 112.115                 stack_regs,
 112.116                 CTXT_SWITCH_STACK_BYTES);
 112.117          unlazy_fpu(p);
 112.118 -        save_segments(p);
 112.119 -        if ( HVM_DOMAIN(p) )
 112.120 +        if ( !HVM_DOMAIN(p) )
 112.121 +        {
 112.122 +            save_segments(p);
 112.123 +        }
 112.124 +        else
 112.125 +        {
 112.126 +            hvm_save_segments(p);
 112.127              hvm_load_msrs();
 112.128 +        }
 112.129      }
 112.130  
 112.131      if ( !is_idle_vcpu(n) )
 112.132 @@ -980,6 +986,26 @@ void domain_relinquish_resources(struct 
 112.133      relinquish_memory(d, &d->page_list);
 112.134  }
 112.135  
 112.136 +void arch_dump_domain_info(struct domain *d)
 112.137 +{
 112.138 +    if ( shadow_mode_enabled(d) )
 112.139 +    {
 112.140 +        printk("    shadow mode: ");
 112.141 +        if ( shadow_mode_refcounts(d) )
 112.142 +            printk("refcounts ");
 112.143 +        if ( shadow_mode_write_all(d) )
 112.144 +            printk("write_all ");
 112.145 +        if ( shadow_mode_log_dirty(d) )
 112.146 +            printk("log_dirty ");
 112.147 +        if ( shadow_mode_translate(d) )
 112.148 +            printk("translate ");
 112.149 +        if ( shadow_mode_external(d) )
 112.150 +            printk("external ");
 112.151 +        if ( shadow_mode_wr_pt_pte(d) )
 112.152 +            printk("wr_pt_pte ");
 112.153 +        printk("\n");
 112.154 +    }
 112.155 +}
 112.156  
 112.157  /*
 112.158   * Local variables:
   113.1 --- a/xen/arch/x86/domain_build.c	Fri Feb 24 14:03:07 2006 -0700
   113.2 +++ b/xen/arch/x86/domain_build.c	Fri Feb 24 15:41:08 2006 -0700
   113.3 @@ -17,6 +17,7 @@
   113.4  #include <xen/domain.h>
   113.5  #include <xen/compile.h>
   113.6  #include <xen/iocap.h>
   113.7 +#include <xen/bitops.h>
   113.8  #include <asm/regs.h>
   113.9  #include <asm/system.h>
  113.10  #include <asm/io.h>
  113.11 @@ -25,6 +26,8 @@
  113.12  #include <asm/i387.h>
  113.13  #include <asm/shadow.h>
  113.14  
  113.15 +#include <public/version.h>
  113.16 +
  113.17  static long dom0_nrpages;
  113.18  
  113.19  /*
  113.20 @@ -56,9 +59,6 @@ integer_param("dom0_max_vcpus", opt_dom0
  113.21  static unsigned int opt_dom0_shadow;
  113.22  boolean_param("dom0_shadow", opt_dom0_shadow);
  113.23  
  113.24 -static unsigned int opt_dom0_translate;
  113.25 -boolean_param("dom0_translate", opt_dom0_translate);
  113.26 -
  113.27  static char opt_dom0_ioports_disable[200] = "";
  113.28  string_param("dom0_ioports_disable", opt_dom0_ioports_disable);
  113.29  
  113.30 @@ -134,6 +134,62 @@ static void process_dom0_ioports_disable
  113.31      }
  113.32  }
  113.33  
  113.34 +static const char *feature_names[XENFEAT_NR_SUBMAPS*32] = {
  113.35 +    [XENFEAT_writable_page_tables]       = "writable_page_tables",
  113.36 +    [XENFEAT_writable_descriptor_tables] = "writable_descriptor_tables",
  113.37 +    [XENFEAT_auto_translated_physmap]    = "auto_translated_physmap",
  113.38 +    [XENFEAT_supervisor_mode_kernel]     = "supervisor_mode_kernel",
  113.39 +    [XENFEAT_pae_pgdir_above_4gb]        = "pae_pgdir_above_4gb"
  113.40 +};
  113.41 +
  113.42 +static void parse_features(
  113.43 +    const char *feats,
  113.44 +    uint32_t supported[XENFEAT_NR_SUBMAPS],
  113.45 +    uint32_t required[XENFEAT_NR_SUBMAPS])
  113.46 +{
  113.47 +    const char *end, *p;
  113.48 +    int i, req;
  113.49 +
  113.50 +    if ( (end = strchr(feats, ',')) == NULL )
  113.51 +        end = feats + strlen(feats);
  113.52 +
  113.53 +    while ( feats < end )
  113.54 +    {
  113.55 +        p = strchr(feats, '|');
  113.56 +        if ( (p == NULL) || (p > end) )
  113.57 +            p = end;
  113.58 +
  113.59 +        req = (*feats == '!');
  113.60 +        if ( req )
  113.61 +            feats++;
  113.62 +
  113.63 +        for ( i = 0; i < XENFEAT_NR_SUBMAPS*32; i++ )
  113.64 +        {
  113.65 +            if ( feature_names[i] == NULL )
  113.66 +                continue;
  113.67 +
  113.68 +            if ( strncmp(feature_names[i], feats, p-feats) == 0 )
  113.69 +            {
  113.70 +                set_bit(i, supported);
  113.71 +                if ( req )
  113.72 +                    set_bit(i, required);
  113.73 +                break;
  113.74 +            }
  113.75 +        }
  113.76 +
  113.77 +        if ( i == XENFEAT_NR_SUBMAPS*32 )
  113.78 +        {
  113.79 +            printk("Unknown kernel feature \"%.*s\".\n",
  113.80 +                   (int)(p-feats), feats);
  113.81 +            panic("Domain 0 requires an unknown hypervisor feature.\n");
  113.82 +        }
  113.83 +
  113.84 +        feats = p;
  113.85 +        if ( *feats == '|' )
  113.86 +            feats++;
  113.87 +    }
  113.88 +}
  113.89 +
  113.90  int construct_dom0(struct domain *d,
  113.91                     unsigned long _image_start, unsigned long image_len, 
  113.92                     unsigned long _initrd_start, unsigned long initrd_len,
  113.93 @@ -188,6 +244,10 @@ int construct_dom0(struct domain *d,
  113.94      /* Machine address of next candidate page-table page. */
  113.95      unsigned long mpt_alloc;
  113.96  
  113.97 +    /* Features supported. */
  113.98 +    uint32_t dom0_features_supported[XENFEAT_NR_SUBMAPS] = { 0 };
  113.99 +    uint32_t dom0_features_required[XENFEAT_NR_SUBMAPS] = { 0 };
 113.100 +
 113.101      extern void translate_l2pgtable(
 113.102          struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
 113.103  
 113.104 @@ -245,8 +305,19 @@ int construct_dom0(struct domain *d,
 113.105          return -EINVAL;
 113.106      }
 113.107  
 113.108 -    if ( strstr(dsi.xen_section_string, "SHADOW=translate") )
 113.109 -        opt_dom0_translate = 1;
 113.110 +    if ( (p = strstr(dsi.xen_section_string, "FEATURES=")) != NULL )
 113.111 +    {
 113.112 +        parse_features(
 113.113 +            p + strlen("FEATURES="),
 113.114 +            dom0_features_supported,
 113.115 +            dom0_features_required);
 113.116 +        printk("Domain 0 kernel supports features = { %08x }.\n",
 113.117 +               dom0_features_supported[0]);
 113.118 +        printk("Domain 0 kernel requires features = { %08x }.\n",
 113.119 +               dom0_features_required[0]);
 113.120 +        if ( dom0_features_required[0] )
 113.121 +            panic("Domain 0 requires an unsupported hypervisor feature.\n");
 113.122 +    }
 113.123  
 113.124      /* Align load address to 4MB boundary. */
 113.125      dsi.v_start &= ~((1UL<<22)-1);
 113.126 @@ -650,11 +721,6 @@ int construct_dom0(struct domain *d,
 113.127      si->nr_pages = nr_pages;
 113.128  
 113.129      si->shared_info = virt_to_maddr(d->shared_info);
 113.130 -    if ( opt_dom0_translate )
 113.131 -    {
 113.132 -        si->shared_info  = max_page << PAGE_SHIFT;
 113.133 -        set_gpfn_from_mfn(virt_to_maddr(d->shared_info) >> PAGE_SHIFT, max_page);
 113.134 -    }
 113.135  
 113.136      si->flags        = SIF_PRIVILEGED | SIF_INITDOMAIN;
 113.137      si->pt_base      = vpt_start;
 113.138 @@ -669,7 +735,7 @@ int construct_dom0(struct domain *d,
 113.139          mfn = pfn + alloc_spfn;
 113.140  #ifndef NDEBUG
 113.141  #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT)
 113.142 -        if ( !opt_dom0_translate && (pfn > REVERSE_START) )
 113.143 +        if ( pfn > REVERSE_START )
 113.144              mfn = alloc_epfn - (pfn - REVERSE_START);
 113.145  #endif
 113.146          ((unsigned long *)vphysmap_start)[pfn] = mfn;
 113.147 @@ -720,48 +786,10 @@ int construct_dom0(struct domain *d,
 113.148  
 113.149      new_thread(v, dsi.v_kernentry, vstack_end, vstartinfo_start);
 113.150  
 113.151 -    if ( opt_dom0_shadow || opt_dom0_translate )
 113.152 +    if ( opt_dom0_shadow )
 113.153      {
 113.154 -        printk("dom0: shadow enable\n");
 113.155 -        shadow_mode_enable(d, (opt_dom0_translate
 113.156 -                               ? SHM_enable | SHM_refcounts | SHM_translate
 113.157 -                               : SHM_enable));
 113.158 -        if ( opt_dom0_translate )
 113.159 -        {
 113.160 -            printk("dom0: shadow translate\n");
 113.161 -#if defined(__i386__) && defined(CONFIG_X86_PAE)
 113.162 -            printk("FIXME: PAE code needed here: %s:%d (%s)\n",
 113.163 -                   __FILE__, __LINE__, __FUNCTION__);
 113.164 -            for ( ; ; )
 113.165 -                __asm__ __volatile__ ( "hlt" );
 113.166 -#else
 113.167 -            /* Hmm, what does this?
 113.168 -               Looks like isn't portable across 32/64 bit and pae/non-pae ...
 113.169 -               -- kraxel */
 113.170 -
 113.171 -            /* mafetter: This code is mostly a hack in order to be able to
 113.172 -             * test with dom0's which are running with shadow translate.
 113.173 -             * I expect we'll rip this out once we have a stable set of
 113.174 -             * domU clients which use the various shadow modes, but it's
 113.175 -             * useful to leave this here for now...
 113.176 -             */
 113.177 -
 113.178 -            // map this domain's p2m table into current page table,
 113.179 -            // so that we can easily access it.
 113.180 -            //
 113.181 -            ASSERT( root_get_intpte(idle_pg_table[1]) == 0 );
 113.182 -            ASSERT( pagetable_get_paddr(d->arch.phys_table) );
 113.183 -            idle_pg_table[1] = root_from_paddr(
 113.184 -                pagetable_get_paddr(d->arch.phys_table), __PAGE_HYPERVISOR);
 113.185 -            translate_l2pgtable(d, (l1_pgentry_t *)(1u << L2_PAGETABLE_SHIFT),
 113.186 -                                pagetable_get_pfn(v->arch.guest_table));
 113.187 -            idle_pg_table[1] = root_empty();
 113.188 -            local_flush_tlb();
 113.189 -#endif
 113.190 -        }
 113.191 -
 113.192 -        update_pagetables(v); /* XXX SMP */
 113.193 -        printk("dom0: shadow setup done\n");
 113.194 +        shadow_mode_enable(d, SHM_enable);
 113.195 +        update_pagetables(v);
 113.196      }
 113.197  
 113.198      rc = 0;
   114.1 --- a/xen/arch/x86/hvm/hvm.c	Fri Feb 24 14:03:07 2006 -0700
   114.2 +++ b/xen/arch/x86/hvm/hvm.c	Fri Feb 24 15:41:08 2006 -0700
   114.3 @@ -124,11 +124,6 @@ static void hvm_map_io_shared_page(struc
   114.4          domain_crash_synchronous();
   114.5      }
   114.6      d->arch.hvm_domain.shared_page_va = (unsigned long)p;
   114.7 -
   114.8 -    HVM_DBG_LOG(DBG_LEVEL_1, "eport: %x\n", iopacket_port(d));
   114.9 -
  114.10 -    clear_bit(iopacket_port(d),
  114.11 -              &d->shared_info->evtchn_mask[0]);
<