ia64/xen-unstable

changeset 8106:243265ade404

Merged.
author emellor@leeni.uk.xensource.com
date Mon Nov 28 17:22:02 2005 +0000 (2005-11-28)
parents 7638cf95b63c 82e48750542c
children 85eef527ba74
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile	Mon Nov 28 16:48:25 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile	Mon Nov 28 17:22:02 2005 +0000
     1.3 @@ -11,7 +11,7 @@ extra-y := head.o init_task.o
     1.4  
     1.5  obj-y	:= process.o signal.o entry.o traps.o \
     1.6  		time.o ioport.o ldt.o setup.o \
     1.7 -		pci-dma.o i386_ksyms.o irq.o quirks.o
     1.8 +		pci-dma.o i386_ksyms.o irq.o quirks.o fixup.o
     1.9  
    1.10  c-obj-y	:= semaphore.o vm86.o \
    1.11  		ptrace.o sys_i386.o \
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/fixup.c	Mon Nov 28 17:22:02 2005 +0000
     2.3 @@ -0,0 +1,93 @@
     2.4 +/******************************************************************************
     2.5 + * fixup.c
     2.6 + * 
     2.7 + * Binary-rewriting of certain IA32 instructions, on notification by Xen.
     2.8 + * Used to avoid repeated slow emulation of common instructions used by the
     2.9 + * user-space TLS (Thread-Local Storage) libraries.
    2.10 + * 
    2.11 + * **** NOTE ****
    2.12 + *  Issues with the binary rewriting have caused it to be removed. Instead
    2.13 + *  we rely on Xen's emulator to boot the kernel, and then print a banner
    2.14 + *  message recommending that the user disables /lib/tls.
    2.15 + * 
    2.16 + * Copyright (c) 2004, K A Fraser
    2.17 + * 
    2.18 + * This program is free software; you can redistribute it and/or modify
    2.19 + * it under the terms of the GNU General Public License as published by
    2.20 + * the Free Software Foundation; either version 2 of the License, or
    2.21 + * (at your option) any later version.
    2.22 + * 
    2.23 + * This program is distributed in the hope that it will be useful,
    2.24 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.25 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.26 + * GNU General Public License for more details.
    2.27 + * 
    2.28 + * You should have received a copy of the GNU General Public License
    2.29 + * along with this program; if not, write to the Free Software
    2.30 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.31 + */
    2.32 +
    2.33 +#include <linux/config.h>
    2.34 +#include <linux/init.h>
    2.35 +#include <linux/sched.h>
    2.36 +#include <linux/slab.h>
    2.37 +#include <linux/kernel.h>
    2.38 +#include <linux/delay.h>
    2.39 +#include <linux/version.h>
    2.40 +
    2.41 +#define DP(_f, _args...) printk(KERN_ALERT "  " _f "\n" , ## _args )
    2.42 +
    2.43 +fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
    2.44 +{
    2.45 +	static unsigned long printed = 0;
    2.46 +	char info[100];
    2.47 +	int i;
    2.48 +
    2.49 +	if (test_and_set_bit(0, &printed))
    2.50 +		return;
    2.51 +
    2.52 +	HYPERVISOR_vm_assist(
    2.53 +		VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify);
    2.54 +
    2.55 +	sprintf(info, "%s (pid=%d)", current->comm, current->tgid);
    2.56 +
    2.57 +
    2.58 +	DP("");
    2.59 +	DP("***************************************************************");
    2.60 +	DP("***************************************************************");
    2.61 +	DP("** WARNING: Currently emulating unsupported memory accesses  **");
    2.62 +	DP("**          in /lib/tls libraries. The emulation is very     **");
    2.63 +	DP("**          slow. To ensure full performance you should      **");
    2.64 +	DP("**          execute the following as root:                   **");
    2.65 +	DP("**          mv /lib/tls /lib/tls.disabled                    **");
    2.66 +	DP("** Offending process: %-38.38s **", info);
    2.67 +	DP("***************************************************************");
    2.68 +	DP("***************************************************************");
    2.69 +	DP("");
    2.70 +
    2.71 +	for (i = 5; i > 0; i--) {
    2.72 +		printk("Pausing... %d", i);
    2.73 +		mdelay(1000);
    2.74 +		printk("\b\b\b\b\b\b\b\b\b\b\b\b");
    2.75 +	}
    2.76 +
    2.77 +	printk("Continuing...\n\n");
    2.78 +}
    2.79 +
    2.80 +static int __init fixup_init(void)
    2.81 +{
    2.82 +	HYPERVISOR_vm_assist(
    2.83 +		VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify);
    2.84 +	return 0;
    2.85 +}
    2.86 +__initcall(fixup_init);
    2.87 +
    2.88 +/*
    2.89 + * Local variables:
    2.90 + *  c-file-style: "linux"
    2.91 + *  indent-tabs-mode: t
    2.92 + *  c-indent-level: 8
    2.93 + *  c-basic-offset: 8
    2.94 + *  tab-width: 8
    2.95 + * End:
    2.96 + */
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/Makefile	Mon Nov 28 16:48:25 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/Makefile	Mon Nov 28 17:22:02 2005 +0000
     3.3 @@ -11,8 +11,8 @@ CPPFLAGS_vmlinux.lds += -U$(XENARCH)
     3.4  
     3.5  extra-y += vmlinux.lds
     3.6  
     3.7 -obj-y   := evtchn.o fixup.o reboot.o gnttab.o devmem.o
     3.8 +obj-y   := evtchn.o reboot.o gnttab.o
     3.9  
    3.10  obj-$(CONFIG_PROC_FS) += xen_proc.o
    3.11  obj-$(CONFIG_NET)     += skbuff.o
    3.12 -obj-$(CONFIG_SMP)     += smp.o smpboot.o
    3.13 +obj-$(CONFIG_SMP)     += smpboot.o
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c	Mon Nov 28 16:48:25 2005 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,157 +0,0 @@
     4.4 -/*
     4.5 - *  Originally from linux/drivers/char/mem.c
     4.6 - *
     4.7 - *  Copyright (C) 1991, 1992  Linus Torvalds
     4.8 - *
     4.9 - *  Added devfs support. 
    4.10 - *    Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
    4.11 - *  Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>
    4.12 - */
    4.13 -
    4.14 -#include <linux/config.h>
    4.15 -#include <linux/mm.h>
    4.16 -#include <linux/miscdevice.h>
    4.17 -#include <linux/slab.h>
    4.18 -#include <linux/vmalloc.h>
    4.19 -#include <linux/mman.h>
    4.20 -#include <linux/random.h>
    4.21 -#include <linux/init.h>
    4.22 -#include <linux/raw.h>
    4.23 -#include <linux/tty.h>
    4.24 -#include <linux/capability.h>
    4.25 -#include <linux/smp_lock.h>
    4.26 -#include <linux/devfs_fs_kernel.h>
    4.27 -#include <linux/ptrace.h>
    4.28 -#include <linux/device.h>
    4.29 -#include <asm/pgalloc.h>
    4.30 -#include <asm/uaccess.h>
    4.31 -#include <asm/io.h>
    4.32 -#include <asm/hypervisor.h>
    4.33 -
    4.34 -static inline int uncached_access(struct file *file)
    4.35 -{
    4.36 -        if (file->f_flags & O_SYNC)
    4.37 -                return 1;
    4.38 -        /* Xen sets correct MTRR type on non-RAM for us. */
    4.39 -        return 0;
    4.40 -}
    4.41 -
    4.42 -/*
    4.43 - * This funcion reads the *physical* memory. The f_pos points directly to the 
    4.44 - * memory location. 
    4.45 - */
    4.46 -static ssize_t read_mem(struct file * file, char __user * buf,
    4.47 -			size_t count, loff_t *ppos)
    4.48 -{
    4.49 -	unsigned long i, p = *ppos;
    4.50 -	ssize_t read = -EFAULT;
    4.51 -	void __iomem *v;
    4.52 -
    4.53 -	if ((v = ioremap(p, count)) == NULL) {
    4.54 -		/*
    4.55 -		 * Some programs (e.g., dmidecode) groove off into weird RAM
    4.56 -		 * areas where no table scan possibly exist (because Xen will
    4.57 -		 * have stomped on them!). These programs get rather upset if
    4.58 -                 * we let them know that Xen failed their access, so we fake
    4.59 -                 * out a read of all zeroes. :-)
    4.60 -		 */
    4.61 -		for (i = 0; i < count; i++)
    4.62 -			if (put_user(0, buf+i))
    4.63 -				return -EFAULT;
    4.64 -		return count;
    4.65 -	}
    4.66 -	if (copy_to_user(buf, v, count))
    4.67 -		goto out;
    4.68 -
    4.69 -	read = count;
    4.70 -	*ppos += read;
    4.71 -out:
    4.72 -	iounmap(v);
    4.73 -	return read;
    4.74 -}
    4.75 -
    4.76 -static ssize_t write_mem(struct file * file, const char __user * buf, 
    4.77 -			 size_t count, loff_t *ppos)
    4.78 -{
    4.79 -	unsigned long p = *ppos;
    4.80 -	ssize_t written = -EFAULT;
    4.81 -	void __iomem *v;
    4.82 -
    4.83 -	if ((v = ioremap(p, count)) == NULL)
    4.84 -		return -EFAULT;
    4.85 -	if (copy_from_user(v, buf, count))
    4.86 -		goto out;
    4.87 -
    4.88 -	written = count;
    4.89 -	*ppos += written;
    4.90 -out:
    4.91 -	iounmap(v);
    4.92 -	return written;
    4.93 -}
    4.94 -
    4.95 -static int mmap_mem(struct file * file, struct vm_area_struct * vma)
    4.96 -{
    4.97 -	if (uncached_access(file))
    4.98 -		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
    4.99 -
   4.100 -	if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
   4.101 -				   vma->vm_end - vma->vm_start,
   4.102 -				   vma->vm_page_prot, DOMID_IO))
   4.103 -		return -EAGAIN;
   4.104 -
   4.105 -	return 0;
   4.106 -}
   4.107 -
   4.108 -/*
   4.109 - * The memory devices use the full 32/64 bits of the offset, and so we cannot
   4.110 - * check against negative addresses: they are ok. The return value is weird,
   4.111 - * though, in that case (0).
   4.112 - *
   4.113 - * also note that seeking relative to the "end of file" isn't supported:
   4.114 - * it has no meaning, so it returns -EINVAL.
   4.115 - */
   4.116 -static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
   4.117 -{
   4.118 -	loff_t ret;
   4.119 -
   4.120 -	down(&file->f_dentry->d_inode->i_sem);
   4.121 -	switch (orig) {
   4.122 -		case 0:
   4.123 -			file->f_pos = offset;
   4.124 -			ret = file->f_pos;
   4.125 -			force_successful_syscall_return();
   4.126 -			break;
   4.127 -		case 1:
   4.128 -			file->f_pos += offset;
   4.129 -			ret = file->f_pos;
   4.130 -			force_successful_syscall_return();
   4.131 -			break;
   4.132 -		default:
   4.133 -			ret = -EINVAL;
   4.134 -	}
   4.135 -	up(&file->f_dentry->d_inode->i_sem);
   4.136 -	return ret;
   4.137 -}
   4.138 -
   4.139 -static int open_mem(struct inode * inode, struct file * filp)
   4.140 -{
   4.141 -	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
   4.142 -}
   4.143 -
   4.144 -struct file_operations mem_fops = {
   4.145 -	.llseek		= memory_lseek,
   4.146 -	.read		= read_mem,
   4.147 -	.write		= write_mem,
   4.148 -	.mmap		= mmap_mem,
   4.149 -	.open		= open_mem,
   4.150 -};
   4.151 -
   4.152 -/*
   4.153 - * Local variables:
   4.154 - *  c-file-style: "linux"
   4.155 - *  indent-tabs-mode: t
   4.156 - *  c-indent-level: 8
   4.157 - *  c-basic-offset: 8
   4.158 - *  tab-width: 8
   4.159 - * End:
   4.160 - */
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/fixup.c	Mon Nov 28 16:48:25 2005 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,93 +0,0 @@
     5.4 -/******************************************************************************
     5.5 - * fixup.c
     5.6 - * 
     5.7 - * Binary-rewriting of certain IA32 instructions, on notification by Xen.
     5.8 - * Used to avoid repeated slow emulation of common instructions used by the
     5.9 - * user-space TLS (Thread-Local Storage) libraries.
    5.10 - * 
    5.11 - * **** NOTE ****
    5.12 - *  Issues with the binary rewriting have caused it to be removed. Instead
    5.13 - *  we rely on Xen's emulator to boot the kernel, and then print a banner
    5.14 - *  message recommending that the user disables /lib/tls.
    5.15 - * 
    5.16 - * Copyright (c) 2004, K A Fraser
    5.17 - * 
    5.18 - * This program is free software; you can redistribute it and/or modify
    5.19 - * it under the terms of the GNU General Public License as published by
    5.20 - * the Free Software Foundation; either version 2 of the License, or
    5.21 - * (at your option) any later version.
    5.22 - * 
    5.23 - * This program is distributed in the hope that it will be useful,
    5.24 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.25 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.26 - * GNU General Public License for more details.
    5.27 - * 
    5.28 - * You should have received a copy of the GNU General Public License
    5.29 - * along with this program; if not, write to the Free Software
    5.30 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    5.31 - */
    5.32 -
    5.33 -#include <linux/config.h>
    5.34 -#include <linux/init.h>
    5.35 -#include <linux/sched.h>
    5.36 -#include <linux/slab.h>
    5.37 -#include <linux/kernel.h>
    5.38 -#include <linux/delay.h>
    5.39 -#include <linux/version.h>
    5.40 -
    5.41 -#define DP(_f, _args...) printk(KERN_ALERT "  " _f "\n" , ## _args )
    5.42 -
    5.43 -fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
    5.44 -{
    5.45 -	static unsigned long printed = 0;
    5.46 -	char info[100];
    5.47 -	int i;
    5.48 -
    5.49 -	if (test_and_set_bit(0, &printed))
    5.50 -		return;
    5.51 -
    5.52 -	HYPERVISOR_vm_assist(
    5.53 -		VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify);
    5.54 -
    5.55 -	sprintf(info, "%s (pid=%d)", current->comm, current->tgid);
    5.56 -
    5.57 -
    5.58 -	DP("");
    5.59 -	DP("***************************************************************");
    5.60 -	DP("***************************************************************");
    5.61 -	DP("** WARNING: Currently emulating unsupported memory accesses  **");
    5.62 -	DP("**          in /lib/tls libraries. The emulation is very     **");
    5.63 -	DP("**          slow. To ensure full performance you should      **");
    5.64 -	DP("**          execute the following as root:                   **");
    5.65 -	DP("**          mv /lib/tls /lib/tls.disabled                    **");
    5.66 -	DP("** Offending process: %-38.38s **", info);
    5.67 -	DP("***************************************************************");
    5.68 -	DP("***************************************************************");
    5.69 -	DP("");
    5.70 -
    5.71 -	for (i = 5; i > 0; i--) {
    5.72 -		printk("Pausing... %d", i);
    5.73 -		mdelay(1000);
    5.74 -		printk("\b\b\b\b\b\b\b\b\b\b\b\b");
    5.75 -	}
    5.76 -
    5.77 -	printk("Continuing...\n\n");
    5.78 -}
    5.79 -
    5.80 -static int __init fixup_init(void)
    5.81 -{
    5.82 -	HYPERVISOR_vm_assist(
    5.83 -		VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify);
    5.84 -	return 0;
    5.85 -}
    5.86 -__initcall(fixup_init);
    5.87 -
    5.88 -/*
    5.89 - * Local variables:
    5.90 - *  c-file-style: "linux"
    5.91 - *  indent-tabs-mode: t
    5.92 - *  c-indent-level: 8
    5.93 - *  c-basic-offset: 8
    5.94 - *  tab-width: 8
    5.95 - * End:
    5.96 - */
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/smp.c	Mon Nov 28 16:48:25 2005 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,25 +0,0 @@
     6.4 -/* Copyright (C) 2004, Christian Limpach */
     6.5 -
     6.6 -#include <linux/init.h>
     6.7 -#include <linux/kernel.h>
     6.8 -#include <linux/threads.h>
     6.9 -
    6.10 -/*
    6.11 - * the frequency of the profiling timer can be changed
    6.12 - * by writing a multiplier value into /proc/profile.
    6.13 - */
    6.14 -int setup_profiling_timer(unsigned int multiplier)
    6.15 -{
    6.16 -	printk("setup_profiling_timer\n");
    6.17 -	return 0;
    6.18 -}
    6.19 -
    6.20 -/*
    6.21 - * Local variables:
    6.22 - *  c-file-style: "linux"
    6.23 - *  indent-tabs-mode: t
    6.24 - *  c-indent-level: 8
    6.25 - *  c-basic-offset: 8
    6.26 - *  tab-width: 8
    6.27 - * End:
    6.28 - */
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c	Mon Nov 28 16:48:25 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c	Mon Nov 28 17:22:02 2005 +0000
     7.3 @@ -420,6 +420,12 @@ void __init smp_cpus_done(unsigned int m
     7.4  {
     7.5  }
     7.6  
     7.7 +int setup_profiling_timer(unsigned int multiplier)
     7.8 +{
     7.9 +	/* Dummy function. */
    7.10 +	return 0;
    7.11 +}
    7.12 +
    7.13  /*
    7.14   * Local variables:
    7.15   *  c-file-style: "linux"
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile	Mon Nov 28 16:48:25 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile	Mon Nov 28 17:22:02 2005 +0000
     8.3 @@ -21,6 +21,12 @@ c-obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
     8.4  $(obj)/syscall32.o: $(src)/syscall32.c \
     8.5  	$(foreach F,int80 sysenter syscall,$(obj)/vsyscall-$F.so)
     8.6  
     8.7 +# syscall32.c currently contains inline asm which has .incbin directives.
     8.8 +# This defeats ccache's signature checks, and also breaks distcc.
     8.9 +# Make sure neither ccache nor distcc compiles this file.
    8.10 +#
    8.11 +$(obj)/syscall32.o: override CC := env CCACHE_DISABLE=1 DISTCC_HOSTS=localhost $(CC)
    8.12 +
    8.13  # Teach kbuild about targets
    8.14  targets := $(foreach F,int80 sysenter syscall,vsyscall-$F.o vsyscall-$F.so)
    8.15  
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/Makefile	Mon Nov 28 16:48:25 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/Makefile	Mon Nov 28 17:22:02 2005 +0000
     9.3 @@ -2,6 +2,7 @@
     9.4  obj-y	+= net_driver_util.o
     9.5  obj-y	+= util.o
     9.6  
     9.7 +obj-y	+= char/
     9.8  obj-y	+= console/
     9.9  obj-y	+= evtchn/
    9.10  obj-y	+= balloon/
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/char/Makefile	Mon Nov 28 17:22:02 2005 +0000
    10.3 @@ -0,0 +1,2 @@
    10.4 +
    10.5 +obj-y	:= mem.o
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/char/mem.c	Mon Nov 28 17:22:02 2005 +0000
    11.3 @@ -0,0 +1,157 @@
    11.4 +/*
    11.5 + *  Originally from linux/drivers/char/mem.c
    11.6 + *
    11.7 + *  Copyright (C) 1991, 1992  Linus Torvalds
    11.8 + *
    11.9 + *  Added devfs support. 
   11.10 + *    Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
   11.11 + *  Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>
   11.12 + */
   11.13 +
   11.14 +#include <linux/config.h>
   11.15 +#include <linux/mm.h>
   11.16 +#include <linux/miscdevice.h>
   11.17 +#include <linux/slab.h>
   11.18 +#include <linux/vmalloc.h>
   11.19 +#include <linux/mman.h>
   11.20 +#include <linux/random.h>
   11.21 +#include <linux/init.h>
   11.22 +#include <linux/raw.h>
   11.23 +#include <linux/tty.h>
   11.24 +#include <linux/capability.h>
   11.25 +#include <linux/smp_lock.h>
   11.26 +#include <linux/devfs_fs_kernel.h>
   11.27 +#include <linux/ptrace.h>
   11.28 +#include <linux/device.h>
   11.29 +#include <asm/pgalloc.h>
   11.30 +#include <asm/uaccess.h>
   11.31 +#include <asm/io.h>
   11.32 +#include <asm/hypervisor.h>
   11.33 +
   11.34 +static inline int uncached_access(struct file *file)
   11.35 +{
   11.36 +        if (file->f_flags & O_SYNC)
   11.37 +                return 1;
   11.38 +        /* Xen sets correct MTRR type on non-RAM for us. */
   11.39 +        return 0;
   11.40 +}
   11.41 +
   11.42 +/*
   11.43 + * This funcion reads the *physical* memory. The f_pos points directly to the 
   11.44 + * memory location. 
   11.45 + */
   11.46 +static ssize_t read_mem(struct file * file, char __user * buf,
   11.47 +			size_t count, loff_t *ppos)
   11.48 +{
   11.49 +	unsigned long i, p = *ppos;
   11.50 +	ssize_t read = -EFAULT;
   11.51 +	void __iomem *v;
   11.52 +
   11.53 +	if ((v = ioremap(p, count)) == NULL) {
   11.54 +		/*
   11.55 +		 * Some programs (e.g., dmidecode) groove off into weird RAM
   11.56 +		 * areas where no table scan possibly exist (because Xen will
   11.57 +		 * have stomped on them!). These programs get rather upset if
   11.58 +                 * we let them know that Xen failed their access, so we fake
   11.59 +                 * out a read of all zeroes. :-)
   11.60 +		 */
   11.61 +		for (i = 0; i < count; i++)
   11.62 +			if (put_user(0, buf+i))
   11.63 +				return -EFAULT;
   11.64 +		return count;
   11.65 +	}
   11.66 +	if (copy_to_user(buf, v, count))
   11.67 +		goto out;
   11.68 +
   11.69 +	read = count;
   11.70 +	*ppos += read;
   11.71 +out:
   11.72 +	iounmap(v);
   11.73 +	return read;
   11.74 +}
   11.75 +
   11.76 +static ssize_t write_mem(struct file * file, const char __user * buf, 
   11.77 +			 size_t count, loff_t *ppos)
   11.78 +{
   11.79 +	unsigned long p = *ppos;
   11.80 +	ssize_t written = -EFAULT;
   11.81 +	void __iomem *v;
   11.82 +
   11.83 +	if ((v = ioremap(p, count)) == NULL)
   11.84 +		return -EFAULT;
   11.85 +	if (copy_from_user(v, buf, count))
   11.86 +		goto out;
   11.87 +
   11.88 +	written = count;
   11.89 +	*ppos += written;
   11.90 +out:
   11.91 +	iounmap(v);
   11.92 +	return written;
   11.93 +}
   11.94 +
   11.95 +static int mmap_mem(struct file * file, struct vm_area_struct * vma)
   11.96 +{
   11.97 +	if (uncached_access(file))
   11.98 +		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
   11.99 +
  11.100 +	if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
  11.101 +				   vma->vm_end - vma->vm_start,
  11.102 +				   vma->vm_page_prot, DOMID_IO))
  11.103 +		return -EAGAIN;
  11.104 +
  11.105 +	return 0;
  11.106 +}
  11.107 +
  11.108 +/*
  11.109 + * The memory devices use the full 32/64 bits of the offset, and so we cannot
  11.110 + * check against negative addresses: they are ok. The return value is weird,
  11.111 + * though, in that case (0).
  11.112 + *
  11.113 + * also note that seeking relative to the "end of file" isn't supported:
  11.114 + * it has no meaning, so it returns -EINVAL.
  11.115 + */
  11.116 +static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
  11.117 +{
  11.118 +	loff_t ret;
  11.119 +
  11.120 +	down(&file->f_dentry->d_inode->i_sem);
  11.121 +	switch (orig) {
  11.122 +		case 0:
  11.123 +			file->f_pos = offset;
  11.124 +			ret = file->f_pos;
  11.125 +			force_successful_syscall_return();
  11.126 +			break;
  11.127 +		case 1:
  11.128 +			file->f_pos += offset;
  11.129 +			ret = file->f_pos;
  11.130 +			force_successful_syscall_return();
  11.131 +			break;
  11.132 +		default:
  11.133 +			ret = -EINVAL;
  11.134 +	}
  11.135 +	up(&file->f_dentry->d_inode->i_sem);
  11.136 +	return ret;
  11.137 +}
  11.138 +
  11.139 +static int open_mem(struct inode * inode, struct file * filp)
  11.140 +{
  11.141 +	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
  11.142 +}
  11.143 +
  11.144 +struct file_operations mem_fops = {
  11.145 +	.llseek		= memory_lseek,
  11.146 +	.read		= read_mem,
  11.147 +	.write		= write_mem,
  11.148 +	.mmap		= mmap_mem,
  11.149 +	.open		= open_mem,
  11.150 +};
  11.151 +
  11.152 +/*
  11.153 + * Local variables:
  11.154 + *  c-file-style: "linux"
  11.155 + *  indent-tabs-mode: t
  11.156 + *  c-indent-level: 8
  11.157 + *  c-basic-offset: 8
  11.158 + *  tab-width: 8
  11.159 + * End:
  11.160 + */
    12.1 --- a/tools/Rules.mk	Mon Nov 28 16:48:25 2005 +0000
    12.2 +++ b/tools/Rules.mk	Mon Nov 28 17:22:02 2005 +0000
    12.3 @@ -1,5 +1,8 @@
    12.4  #  -*- mode: Makefile; -*-
    12.5  
    12.6 +# `all' is the default target
    12.7 +all:
    12.8 +
    12.9  include $(XEN_ROOT)/Config.mk
   12.10  
   12.11  XEN_XC             = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
   12.12 @@ -27,3 +30,13 @@ X11_LDPATH = -L/usr/X11R6/$(LIBDIR)
   12.13  
   12.14  %.o: %.cc
   12.15  	$(CC) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
   12.16 +
   12.17 +mk-symlinks: LINUX_ROOT=$(XEN_ROOT)/linux-2.6-xen-sparse
   12.18 +mk-symlinks:
   12.19 +	mkdir -p xen
   12.20 +	( cd xen && ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
   12.21 +	mkdir -p xen/io
   12.22 +	( cd xen/io && ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
   12.23 +	mkdir -p xen/linux
   12.24 +	( cd xen/linux && \
   12.25 +	  ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
    13.1 --- a/tools/blktap/Makefile	Mon Nov 28 16:48:25 2005 +0000
    13.2 +++ b/tools/blktap/Makefile	Mon Nov 28 17:22:02 2005 +0000
    13.3 @@ -47,17 +47,6 @@ all: mk-symlinks libblktap.so #blkdump
    13.4  		$(MAKE) -C $$subdir $@;       \
    13.5  	done
    13.6  
    13.7 -LINUX_ROOT := $(wildcard $(XEN_ROOT)/linux-2.6.*-xen-sparse)
    13.8 -mk-symlinks:
    13.9 -	[ -e xen/linux ] || mkdir -p xen/linux
   13.10 -	[ -e xen/io ]    || mkdir -p xen/io
   13.11 -	( cd xen >/dev/null ; \
   13.12 -	  ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
   13.13 -	( cd xen/io >/dev/null ; \
   13.14 -	   ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
   13.15 -	( cd xen/linux >/dev/null ; \
   13.16 -	  ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
   13.17 -
   13.18  install: all
   13.19  	$(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
   13.20  	$(INSTALL_DIR) -p $(DESTDIR)/usr/include
    14.1 --- a/tools/libxc/Makefile	Mon Nov 28 16:48:25 2005 +0000
    14.2 +++ b/tools/libxc/Makefile	Mon Nov 28 17:22:02 2005 +0000
    14.3 @@ -83,17 +83,6 @@ check-for-zlib:
    14.4  	false; \
    14.5  	fi
    14.6  
    14.7 -LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
    14.8 -mk-symlinks:
    14.9 -	[ -e xen/linux ] || mkdir -p xen/linux
   14.10 -	[ -e xen/io ]    || mkdir -p xen/io
   14.11 -	( cd xen >/dev/null ; \
   14.12 -	  ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
   14.13 -	( cd xen/io >/dev/null ; \
   14.14 -	   ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
   14.15 -	( cd xen/linux >/dev/null ; \
   14.16 -	  ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
   14.17 -
   14.18  install: build
   14.19  	[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
   14.20  	[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
    15.1 --- a/tools/security/Makefile	Mon Nov 28 16:48:25 2005 +0000
    15.2 +++ b/tools/security/Makefile	Mon Nov 28 17:22:02 2005 +0000
    15.3 @@ -69,14 +69,3 @@ mrproper: clean policy_clean
    15.4  boot_install: $(POLICYFILE)
    15.5  	@cp $(POLICYFILE) /boot
    15.6  	@./updategrub.sh $(POLICY) $(PWD)/$(XEN_ROOT)
    15.7 -
    15.8 -LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
    15.9 -mk-symlinks:
   15.10 -	[ -e xen/linux ] || mkdir -p xen/linux
   15.11 -	[ -e xen/io ]    || mkdir -p xen/io
   15.12 -	( cd xen >/dev/null ; \
   15.13 -	  ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
   15.14 -	( cd xen/io >/dev/null ; \
   15.15 -	  ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
   15.16 -	( cd xen/linux >/dev/null ; \
   15.17 -	  ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
    16.1 --- a/xen/arch/x86/domain.c	Mon Nov 28 16:48:25 2005 +0000
    16.2 +++ b/xen/arch/x86/domain.c	Mon Nov 28 17:22:02 2005 +0000
    16.3 @@ -414,9 +414,6 @@ int arch_set_info_guest(
    16.4              d->arch.phys_table = v->arch.guest_table;
    16.5          v->arch.guest_table = mk_pagetable(0);
    16.6  
    16.7 -        /* Initialize monitor page table */
    16.8 -        v->arch.monitor_table = mk_pagetable(0);
    16.9 -
   16.10          vmx_final_setup_guest(v);
   16.11      }
   16.12  
    17.1 --- a/xen/arch/x86/shadow.c	Mon Nov 28 16:48:25 2005 +0000
    17.2 +++ b/xen/arch/x86/shadow.c	Mon Nov 28 17:22:02 2005 +0000
    17.3 @@ -1075,8 +1075,8 @@ static void shadow_mark_va_out_of_sync(
    17.4      entry->next = d->arch.out_of_sync;
    17.5      d->arch.out_of_sync = entry;
    17.6  
    17.7 -    FSH_LOG("mark_out_of_sync(va=%lx -> writable_pl1e=%lx)",
    17.8 -            va, entry->writable_pl1e);
    17.9 +    FSH_LOG("%s(va=%lx -> writable_pl1e=%lx)",
   17.10 +            __func__, va, entry->writable_pl1e);
   17.11  }
   17.12  
   17.13  /*
    18.1 --- a/xen/arch/x86/shadow32.c	Mon Nov 28 16:48:25 2005 +0000
    18.2 +++ b/xen/arch/x86/shadow32.c	Mon Nov 28 17:22:02 2005 +0000
    18.3 @@ -796,8 +796,6 @@ void free_monitor_pagetable(struct vcpu 
    18.4          put_shadow_ref(mfn);
    18.5      }
    18.6  
    18.7 -    unmap_domain_page(mpl2e);
    18.8 -
    18.9      /*
   18.10       * Then free monitor_table.
   18.11       */
   18.12 @@ -1411,7 +1409,7 @@ int shadow_mode_control(struct domain *d
   18.13  }
   18.14  
   18.15  unsigned long
   18.16 -gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
   18.17 +get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
   18.18  {
   18.19      unsigned long va, tabpfn;
   18.20      l1_pgentry_t *l1, l1e;
   18.21 @@ -1419,7 +1417,7 @@ gpfn_to_mfn_foreign(struct domain *d, un
   18.22  
   18.23      ASSERT(shadow_mode_translate(d));
   18.24  
   18.25 -    perfc_incrc(gpfn_to_mfn_foreign);
   18.26 +    perfc_incrc(get_mfn_from_pfn_foreign);
   18.27  
   18.28      va = gpfn << PAGE_SHIFT;
   18.29      tabpfn = pagetable_get_pfn(d->arch.phys_table);
   18.30 @@ -1428,8 +1426,8 @@ gpfn_to_mfn_foreign(struct domain *d, un
   18.31      unmap_domain_page(l2);
   18.32      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
   18.33      {
   18.34 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
   18.35 -               d->domain_id, gpfn, l2e_get_intpte(l2e));
   18.36 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
   18.37 +               __func__, d->domain_id, gpfn, l2e_get_intpte(l2e));
   18.38          return INVALID_MFN;
   18.39      }
   18.40      l1 = map_domain_page(l2e_get_pfn(l2e));
   18.41 @@ -1437,14 +1435,14 @@ gpfn_to_mfn_foreign(struct domain *d, un
   18.42      unmap_domain_page(l1);
   18.43  
   18.44  #if 0
   18.45 -    printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
   18.46 -           d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
   18.47 +    printk("%s(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
   18.48 +           __func__, d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
   18.49  #endif
   18.50  
   18.51      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
   18.52      {
   18.53 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
   18.54 -               d->domain_id, gpfn, l1e_get_intpte(l1e));
   18.55 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
   18.56 +               __func__, d->domain_id, gpfn, l1e_get_intpte(l1e));
   18.57          return INVALID_MFN;
   18.58      }
   18.59  
   18.60 @@ -1933,8 +1931,8 @@ void shadow_mark_va_out_of_sync(
   18.61      entry->next = d->arch.out_of_sync;
   18.62      d->arch.out_of_sync = entry;
   18.63  
   18.64 -    FSH_LOG("mark_out_of_sync(va=%lx -> writable_pl1e=%lx)",
   18.65 -            va, entry->writable_pl1e);
   18.66 +    FSH_LOG("%s(va=%lx -> writable_pl1e=%lx)",
   18.67 +            __func__, va, entry->writable_pl1e);
   18.68  }
   18.69  
   18.70  /*
    19.1 --- a/xen/arch/x86/shadow_public.c	Mon Nov 28 16:48:25 2005 +0000
    19.2 +++ b/xen/arch/x86/shadow_public.c	Mon Nov 28 17:22:02 2005 +0000
    19.3 @@ -390,8 +390,6 @@ void free_monitor_pagetable(struct vcpu 
    19.4          put_shadow_ref(mfn);
    19.5      }
    19.6  
    19.7 -    unmap_domain_page(mpl2e);
    19.8 -
    19.9      /*
   19.10       * Then free monitor_table.
   19.11       */
   19.12 @@ -1593,7 +1591,7 @@ remove_shadow(struct domain *d, unsigned
   19.13  }
   19.14  
   19.15  unsigned long
   19.16 -gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
   19.17 +get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
   19.18  {
   19.19      unsigned long va, tabpfn;
   19.20      l1_pgentry_t *l1, l1e;
   19.21 @@ -1601,7 +1599,7 @@ gpfn_to_mfn_foreign(struct domain *d, un
   19.22  
   19.23      ASSERT(shadow_mode_translate(d));
   19.24  
   19.25 -    perfc_incrc(gpfn_to_mfn_foreign);
   19.26 +    perfc_incrc(get_mfn_from_pfn_foreign);
   19.27  
   19.28      va = gpfn << PAGE_SHIFT;
   19.29      tabpfn = pagetable_get_pfn(d->arch.phys_table);
   19.30 @@ -1610,8 +1608,8 @@ gpfn_to_mfn_foreign(struct domain *d, un
   19.31      unmap_domain_page(l2);
   19.32      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
   19.33      {
   19.34 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
   19.35 -               d->domain_id, gpfn, l2e_get_intpte(l2e));
   19.36 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
   19.37 +               __func__, d->domain_id, gpfn, l2e_get_intpte(l2e));
   19.38          return INVALID_MFN;
   19.39      }
   19.40      l1 = map_domain_page(l2e_get_pfn(l2e));
   19.41 @@ -1619,14 +1617,14 @@ gpfn_to_mfn_foreign(struct domain *d, un
   19.42      unmap_domain_page(l1);
   19.43  
   19.44  #if 0
   19.45 -    printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
   19.46 -           d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
   19.47 +    printk("%s(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
   19.48 +           __func__, d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
   19.49  #endif
   19.50  
   19.51      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
   19.52      {
   19.53 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
   19.54 -               d->domain_id, gpfn, l1e_get_intpte(l1e));
   19.55 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
   19.56 +               __func__, d->domain_id, gpfn, l1e_get_intpte(l1e));
   19.57          return INVALID_MFN;
   19.58      }
   19.59  
    20.1 --- a/xen/arch/x86/vmx.c	Mon Nov 28 16:48:25 2005 +0000
    20.2 +++ b/xen/arch/x86/vmx.c	Mon Nov 28 17:22:02 2005 +0000
    20.3 @@ -61,23 +61,30 @@ void vmx_final_setup_guest(struct vcpu *
    20.4  {
    20.5      v->arch.schedule_tail = arch_vmx_do_launch;
    20.6  
    20.7 -    if ( v == v->domain->vcpu[0] )
    20.8 +    if ( v->vcpu_id == 0 )
    20.9      {
   20.10 -        v->domain->arch.vmx_platform.lapic_enable =
   20.11 -            v->arch.guest_context.user_regs.ecx;
   20.12 +        struct domain *d = v->domain;
   20.13 +        struct vcpu *vc;
   20.14 +
   20.15 +        d->arch.vmx_platform.lapic_enable = v->arch.guest_context.user_regs.ecx;
   20.16          v->arch.guest_context.user_regs.ecx = 0;
   20.17          VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "lapic enable is %d.\n",
   20.18 -                    v->domain->arch.vmx_platform.lapic_enable);
   20.19 +                    d->arch.vmx_platform.lapic_enable);
   20.20 +
   20.21 +        /* Initialize monitor page table */
   20.22 +        for_each_vcpu(d, vc)
   20.23 +            vc->arch.monitor_table = mk_pagetable(0);
   20.24 +
   20.25          /*
   20.26           * Required to do this once per domain
   20.27           * XXX todo: add a seperate function to do these.
   20.28           */
   20.29 -        memset(&v->domain->shared_info->evtchn_mask[0], 0xff,
   20.30 -               sizeof(v->domain->shared_info->evtchn_mask));
   20.31 +        memset(&d->shared_info->evtchn_mask[0], 0xff,
   20.32 +               sizeof(d->shared_info->evtchn_mask));
   20.33  
   20.34          /* Put the domain in shadow mode even though we're going to be using
   20.35           * the shared 1:1 page table initially. It shouldn't hurt */
   20.36 -        shadow_mode_enable(v->domain,
   20.37 +        shadow_mode_enable(d,
   20.38                             SHM_enable|SHM_refcounts|
   20.39                             SHM_translate|SHM_external|SHM_wr_pt_pte);
   20.40      }
    21.1 --- a/xen/common/domain.c	Mon Nov 28 16:48:25 2005 +0000
    21.2 +++ b/xen/common/domain.c	Mon Nov 28 17:22:02 2005 +0000
    21.3 @@ -376,14 +376,10 @@ int set_info_guest(struct domain *d, dom
    21.4  int boot_vcpu(struct domain *d, int vcpuid, struct vcpu_guest_context *ctxt) 
    21.5  {
    21.6      struct vcpu *v = d->vcpu[vcpuid];
    21.7 -    int rc;
    21.8  
    21.9      BUG_ON(test_bit(_VCPUF_initialised, &v->vcpu_flags));
   21.10  
   21.11 -    if ( (rc = arch_set_info_guest(v, ctxt)) != 0 )
   21.12 -        return rc;
   21.13 -
   21.14 -    return rc;
   21.15 +    return arch_set_info_guest(v, ctxt);
   21.16  }
   21.17  
   21.18  long do_vcpu_op(int cmd, int vcpuid, void *arg)
    22.1 --- a/xen/common/grant_table.c	Mon Nov 28 16:48:25 2005 +0000
    22.2 +++ b/xen/common/grant_table.c	Mon Nov 28 17:22:02 2005 +0000
    22.3 @@ -234,7 +234,7 @@ static int
    22.4  
    22.5          /* rmb(); */ /* not on x86 */
    22.6  
    22.7 -        frame = __gpfn_to_mfn_foreign(rd, sha->frame);
    22.8 +        frame = __gpfn_to_mfn(rd, sha->frame);
    22.9  
   22.10          if ( unlikely(!pfn_valid(frame)) ||
   22.11               unlikely(!((dev_hst_ro_flags & GNTMAP_readonly) ?
    23.1 --- a/xen/include/asm-x86/cpufeature.h	Mon Nov 28 16:48:25 2005 +0000
    23.2 +++ b/xen/include/asm-x86/cpufeature.h	Mon Nov 28 17:22:02 2005 +0000
    23.3 @@ -94,7 +94,7 @@
    23.4  #define cpu_has(c, bit)		test_bit(bit, (c)->x86_capability)
    23.5  #define boot_cpu_has(bit)	test_bit(bit, boot_cpu_data.x86_capability)
    23.6  
    23.7 -#define cpu_has_fpu		boot_cpu_has(X86_FEATURE_FPU)
    23.8 +#ifdef __i386__
    23.9  #define cpu_has_vme		boot_cpu_has(X86_FEATURE_VME)
   23.10  #define cpu_has_de		boot_cpu_has(X86_FEATURE_DE)
   23.11  #define cpu_has_pse		boot_cpu_has(X86_FEATURE_PSE)
   23.12 @@ -102,7 +102,6 @@
   23.13  #define cpu_has_pae		boot_cpu_has(X86_FEATURE_PAE)
   23.14  #define cpu_has_pge		boot_cpu_has(X86_FEATURE_PGE)
   23.15  #define cpu_has_apic		boot_cpu_has(X86_FEATURE_APIC)
   23.16 -#define cpu_has_sep		boot_cpu_has(X86_FEATURE_SEP)
   23.17  #define cpu_has_mtrr		boot_cpu_has(X86_FEATURE_MTRR)
   23.18  #define cpu_has_mmx		boot_cpu_has(X86_FEATURE_MMX)
   23.19  #define cpu_has_fxsr		boot_cpu_has(X86_FEATURE_FXSR)
   23.20 @@ -115,10 +114,29 @@
   23.21  #define cpu_has_k6_mtrr		boot_cpu_has(X86_FEATURE_K6_MTRR)
   23.22  #define cpu_has_cyrix_arr	boot_cpu_has(X86_FEATURE_CYRIX_ARR)
   23.23  #define cpu_has_centaur_mcr	boot_cpu_has(X86_FEATURE_CENTAUR_MCR)
   23.24 -#define cpu_has_xstore		boot_cpu_has(X86_FEATURE_XSTORE)
   23.25 -#define cpu_has_xstore_enabled	boot_cpu_has(X86_FEATURE_XSTORE_EN)
   23.26 -#define cpu_has_xcrypt		boot_cpu_has(X86_FEATURE_XCRYPT)
   23.27 -#define cpu_has_xcrypt_enabled	boot_cpu_has(X86_FEATURE_XCRYPT_EN)
   23.28 +#define cpu_has_clflush		boot_cpu_has(X86_FEATURE_CLFLSH)
   23.29 +#else /* __x86_64__ */
   23.30 +#define cpu_has_vme		0
   23.31 +#define cpu_has_de		1
   23.32 +#define cpu_has_pse		1
   23.33 +#define cpu_has_tsc		1
   23.34 +#define cpu_has_pae		1
   23.35 +#define cpu_has_pge		1
   23.36 +#define cpu_has_apic		boot_cpu_has(X86_FEATURE_APIC)
   23.37 +#define cpu_has_mtrr		1
   23.38 +#define cpu_has_mmx		1
   23.39 +#define cpu_has_fxsr		1
   23.40 +#define cpu_has_xmm		1
   23.41 +#define cpu_has_xmm2		1
   23.42 +#define cpu_has_xmm3		boot_cpu_has(X86_FEATURE_XMM3)
   23.43 +#define cpu_has_ht		boot_cpu_has(X86_FEATURE_HT)
   23.44 +#define cpu_has_mp		1
   23.45 +#define cpu_has_nx		boot_cpu_has(X86_FEATURE_NX)
   23.46 +#define cpu_has_k6_mtrr		0
   23.47 +#define cpu_has_cyrix_arr	0
   23.48 +#define cpu_has_centaur_mcr	0
   23.49 +#define cpu_has_clflush		boot_cpu_has(X86_FEATURE_CLFLSH)
   23.50 +#endif
   23.51  
   23.52  #endif /* __ASM_I386_CPUFEATURE_H */
   23.53  
    24.1 --- a/xen/include/asm-x86/shadow.h	Mon Nov 28 16:48:25 2005 +0000
    24.2 +++ b/xen/include/asm-x86/shadow.h	Mon Nov 28 17:22:02 2005 +0000
    24.3 @@ -283,26 +283,21 @@ static inline void shadow_mode_disable(s
    24.4  
    24.5  /************************************************************************/
    24.6  
    24.7 -#define __mfn_to_gpfn(_d, mfn)                  \
    24.8 -    ( (shadow_mode_translate(_d))               \
    24.9 -      ? get_pfn_from_mfn(mfn)                   \
   24.10 +#define __mfn_to_gpfn(_d, mfn)                         \
   24.11 +    ( (shadow_mode_translate(_d))                      \
   24.12 +      ? get_pfn_from_mfn(mfn)                          \
   24.13        : (mfn) )
   24.14  
   24.15 -#define __gpfn_to_mfn(_d, gpfn)                 \
   24.16 -    ({                                          \
   24.17 -        (shadow_mode_translate(_d))             \
   24.18 -        ? (((_d) == current->domain) ?          \
   24.19 -           get_mfn_from_pfn(gpfn) :             \
   24.20 -           gpfn_to_mfn_foreign((_d), (gpfn)))   \
   24.21 -        : (gpfn);                               \
   24.22 +#define __gpfn_to_mfn(_d, gpfn)                        \
   24.23 +    ({                                                 \
   24.24 +        unlikely(shadow_mode_translate(_d))            \
   24.25 +        ? (likely(current->domain == (_d))             \
   24.26 +           ? get_mfn_from_pfn(gpfn)                    \
   24.27 +           : get_mfn_from_pfn_foreign(_d, gpfn))       \
   24.28 +        : (gpfn);                                      \
   24.29      })
   24.30  
   24.31 -#define __gpfn_to_mfn_foreign(_d, gpfn)         \
   24.32 -    ( (shadow_mode_translate(_d))               \
   24.33 -      ? gpfn_to_mfn_foreign(_d, gpfn)           \
   24.34 -      : (gpfn) )
   24.35 -
   24.36 -extern unsigned long gpfn_to_mfn_foreign(
   24.37 +extern unsigned long get_mfn_from_pfn_foreign(
   24.38      struct domain *d, unsigned long gpfn);
   24.39  
   24.40  /************************************************************************/
   24.41 @@ -860,18 +855,7 @@ static inline void hl2e_propagate_from_g
   24.42  
   24.43      if ( l2e_get_flags(gpde) & _PAGE_PRESENT )
   24.44      {
   24.45 -        if ( unlikely((current->domain != d) && !shadow_mode_external(d)) )
   24.46 -        {
   24.47 -            // Can't use __gpfn_to_mfn() if we don't have one of this domain's
   24.48 -            // page tables currently installed.
   24.49 -            // This isn't common -- it only happens during shadow mode setup
   24.50 -            // and mode changes.
   24.51 -            //
   24.52 -            mfn = gpfn_to_mfn_foreign(d, pfn);
   24.53 -        }
   24.54 -        else
   24.55 -            mfn = __gpfn_to_mfn(d, pfn);
   24.56 -
   24.57 +        mfn = __gpfn_to_mfn(d, pfn);
   24.58          if ( VALID_MFN(mfn) && (mfn < max_page) )
   24.59              hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
   24.60      }
    25.1 --- a/xen/include/xen/perfc_defn.h	Mon Nov 28 16:48:25 2005 +0000
    25.2 +++ b/xen/include/xen/perfc_defn.h	Mon Nov 28 17:22:02 2005 +0000
    25.3 @@ -114,7 +114,7 @@ PERFCOUNTER_CPU(shadow_get_page_fail,   
    25.4  PERFCOUNTER_CPU(validate_hl2e_calls,    "calls to validate_hl2e_change")
    25.5  PERFCOUNTER_CPU(validate_hl2e_changes,  "validate_hl2e makes changes")
    25.6  PERFCOUNTER_CPU(exception_fixed,        "pre-exception fixed")
    25.7 -PERFCOUNTER_CPU(gpfn_to_mfn_foreign,    "calls to gpfn_to_mfn_foreign")
    25.8 +PERFCOUNTER_CPU(get_mfn_from_pfn_foreign, "calls to get_mfn_from_pfn_foreign")
    25.9  PERFCOUNTER_CPU(remove_all_access,      "calls to remove_all_access")
   25.10  PERFCOUNTER_CPU(remove_write_access,    "calls to remove_write_access")
   25.11  PERFCOUNTER_CPU(remove_write_access_easy, "easy outs of remove_write_access")