[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] arch/xen/kernel/fixup.c -> arch/xen/i386/kernel/fixup.c
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 367b9ca30e8864f0402b83002d9d50ad8e1da650 # Parent 2eb868d02f0f8ee0964d6322c6585be6ce0de123 arch/xen/kernel/fixup.c -> arch/xen/i386/kernel/fixup.c arch/xen/kernel/devmem.c -> drivers/xen/char/mem.c arch/xen/kernel/smp.c deleted Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile Mon Nov 28 13:08:53 2005 @@ -11,7 +11,7 @@ obj-y := process.o signal.o entry.o traps.o \ time.o ioport.o ldt.o setup.o \ - pci-dma.o i386_ksyms.o irq.o quirks.o + pci-dma.o i386_ksyms.o irq.o quirks.o fixup.o c-obj-y := semaphore.o vm86.o \ ptrace.o sys_i386.o \ diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/kernel/Makefile --- a/linux-2.6-xen-sparse/arch/xen/kernel/Makefile Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/Makefile Mon Nov 28 13:08:53 2005 @@ -11,8 +11,8 @@ extra-y += vmlinux.lds -obj-y := evtchn.o fixup.o reboot.o gnttab.o devmem.o +obj-y := evtchn.o reboot.o gnttab.o obj-$(CONFIG_PROC_FS) += xen_proc.o obj-$(CONFIG_NET) += skbuff.o -obj-$(CONFIG_SMP) += smp.o smpboot.o +obj-$(CONFIG_SMP) += smpboot.o diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c Mon Nov 28 13:08:53 2005 @@ -420,6 +420,12 @@ { } +int setup_profiling_timer(unsigned int multiplier) +{ + /* Dummy function. */ + return 0; +} + /* * Local variables: * c-file-style: "linux" diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/drivers/xen/Makefile --- a/linux-2.6-xen-sparse/drivers/xen/Makefile Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/Makefile Mon Nov 28 13:08:53 2005 @@ -2,6 +2,7 @@ obj-y += net_driver_util.o obj-y += util.o +obj-y += char/ obj-y += console/ obj-y += evtchn/ obj-y += balloon/ diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/i386/kernel/fixup.c --- /dev/null Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/fixup.c Mon Nov 28 13:08:53 2005 @@ -0,0 +1,93 @@ +/****************************************************************************** + * fixup.c + * + * Binary-rewriting of certain IA32 instructions, on notification by Xen. + * Used to avoid repeated slow emulation of common instructions used by the + * user-space TLS (Thread-Local Storage) libraries. + * + * **** NOTE **** + * Issues with the binary rewriting have caused it to be removed. Instead + * we rely on Xen's emulator to boot the kernel, and then print a banner + * message recommending that the user disables /lib/tls. + * + * Copyright (c) 2004, K A Fraser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <linux/config.h> +#include <linux/init.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/kernel.h> +#include <linux/delay.h> +#include <linux/version.h> + +#define DP(_f, _args...) printk(KERN_ALERT " " _f "\n" , ## _args ) + +fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code) +{ + static unsigned long printed = 0; + char info[100]; + int i; + + if (test_and_set_bit(0, &printed)) + return; + + HYPERVISOR_vm_assist( + VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify); + + sprintf(info, "%s (pid=%d)", current->comm, current->tgid); + + + DP(""); + DP("***************************************************************"); + DP("***************************************************************"); + DP("** WARNING: Currently emulating unsupported memory accesses **"); + DP("** in /lib/tls libraries. The emulation is very **"); + DP("** slow. To ensure full performance you should **"); + DP("** execute the following as root: **"); + DP("** mv /lib/tls /lib/tls.disabled **"); + DP("** Offending process: %-38.38s **", info); + DP("***************************************************************"); + DP("***************************************************************"); + DP(""); + + for (i = 5; i > 0; i--) { + printk("Pausing... %d", i); + mdelay(1000); + printk("\b\b\b\b\b\b\b\b\b\b\b\b"); + } + + printk("Continuing...\n\n"); +} + +static int __init fixup_init(void) +{ + HYPERVISOR_vm_assist( + VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify); + return 0; +} +__initcall(fixup_init); + +/* + * Local variables: + * c-file-style: "linux" + * indent-tabs-mode: t + * c-indent-level: 8 + * c-basic-offset: 8 + * tab-width: 8 + * End: + */ diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/drivers/xen/char/Makefile --- /dev/null Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/char/Makefile Mon Nov 28 13:08:53 2005 @@ -0,0 +1,2 @@ + +obj-y := mem.o diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/drivers/xen/char/mem.c --- /dev/null Mon Nov 28 12:39:22 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/char/mem.c Mon Nov 28 13:08:53 2005 @@ -0,0 +1,157 @@ +/* + * Originally from linux/drivers/char/mem.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + * + * Added devfs support. + * Jan-11-1998, C. Scott Ananian <cananian@xxxxxxxxxxxxxxxxxxxx> + * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@xxxxxxx> + */ + +#include <linux/config.h> +#include <linux/mm.h> +#include <linux/miscdevice.h> +#include <linux/slab.h> +#include <linux/vmalloc.h> +#include <linux/mman.h> +#include <linux/random.h> +#include <linux/init.h> +#include <linux/raw.h> +#include <linux/tty.h> +#include <linux/capability.h> +#include <linux/smp_lock.h> +#include <linux/devfs_fs_kernel.h> +#include <linux/ptrace.h> +#include <linux/device.h> +#include <asm/pgalloc.h> +#include <asm/uaccess.h> +#include <asm/io.h> +#include <asm/hypervisor.h> + +static inline int uncached_access(struct file *file) +{ + if (file->f_flags & O_SYNC) + return 1; + /* Xen sets correct MTRR type on non-RAM for us. */ + return 0; +} + +/* + * This funcion reads the *physical* memory. The f_pos points directly to the + * memory location. + */ +static ssize_t read_mem(struct file * file, char __user * buf, + size_t count, loff_t *ppos) +{ + unsigned long i, p = *ppos; + ssize_t read = -EFAULT; + void __iomem *v; + + if ((v = ioremap(p, count)) == NULL) { + /* + * Some programs (e.g., dmidecode) groove off into weird RAM + * areas where no table scan possibly exist (because Xen will + * have stomped on them!). These programs get rather upset if + * we let them know that Xen failed their access, so we fake + * out a read of all zeroes. :-) + */ + for (i = 0; i < count; i++) + if (put_user(0, buf+i)) + return -EFAULT; + return count; + } + if (copy_to_user(buf, v, count)) + goto out; + + read = count; + *ppos += read; +out: + iounmap(v); + return read; +} + +static ssize_t write_mem(struct file * file, const char __user * buf, + size_t count, loff_t *ppos) +{ + unsigned long p = *ppos; + ssize_t written = -EFAULT; + void __iomem *v; + + if ((v = ioremap(p, count)) == NULL) + return -EFAULT; + if (copy_from_user(v, buf, count)) + goto out; + + written = count; + *ppos += written; +out: + iounmap(v); + return written; +} + +static int mmap_mem(struct file * file, struct vm_area_struct * vma) +{ + if (uncached_access(file)) + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, + vma->vm_end - vma->vm_start, + vma->vm_page_prot, DOMID_IO)) + return -EAGAIN; + + return 0; +} + +/* + * The memory devices use the full 32/64 bits of the offset, and so we cannot + * check against negative addresses: they are ok. The return value is weird, + * though, in that case (0). + * + * also note that seeking relative to the "end of file" isn't supported: + * it has no meaning, so it returns -EINVAL. + */ +static loff_t memory_lseek(struct file * file, loff_t offset, int orig) +{ + loff_t ret; + + down(&file->f_dentry->d_inode->i_sem); + switch (orig) { + case 0: + file->f_pos = offset; + ret = file->f_pos; + force_successful_syscall_return(); + break; + case 1: + file->f_pos += offset; + ret = file->f_pos; + force_successful_syscall_return(); + break; + default: + ret = -EINVAL; + } + up(&file->f_dentry->d_inode->i_sem); + return ret; +} + +static int open_mem(struct inode * inode, struct file * filp) +{ + return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; +} + +struct file_operations mem_fops = { + .llseek = memory_lseek, + .read = read_mem, + .write = write_mem, + .mmap = mmap_mem, + .open = open_mem, +}; + +/* + * Local variables: + * c-file-style: "linux" + * indent-tabs-mode: t + * c-indent-level: 8 + * c-basic-offset: 8 + * tab-width: 8 + * End: + */ diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/kernel/devmem.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Mon Nov 28 12:39:22 2005 +++ /dev/null Mon Nov 28 13:08:53 2005 @@ -1,157 +0,0 @@ -/* - * Originally from linux/drivers/char/mem.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - * - * Added devfs support. - * Jan-11-1998, C. Scott Ananian <cananian@xxxxxxxxxxxxxxxxxxxx> - * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@xxxxxxx> - */ - -#include <linux/config.h> -#include <linux/mm.h> -#include <linux/miscdevice.h> -#include <linux/slab.h> -#include <linux/vmalloc.h> -#include <linux/mman.h> -#include <linux/random.h> -#include <linux/init.h> -#include <linux/raw.h> -#include <linux/tty.h> -#include <linux/capability.h> -#include <linux/smp_lock.h> -#include <linux/devfs_fs_kernel.h> -#include <linux/ptrace.h> -#include <linux/device.h> -#include <asm/pgalloc.h> -#include <asm/uaccess.h> -#include <asm/io.h> -#include <asm/hypervisor.h> - -static inline int uncached_access(struct file *file) -{ - if (file->f_flags & O_SYNC) - return 1; - /* Xen sets correct MTRR type on non-RAM for us. */ - return 0; -} - -/* - * This funcion reads the *physical* memory. The f_pos points directly to the - * memory location. - */ -static ssize_t read_mem(struct file * file, char __user * buf, - size_t count, loff_t *ppos) -{ - unsigned long i, p = *ppos; - ssize_t read = -EFAULT; - void __iomem *v; - - if ((v = ioremap(p, count)) == NULL) { - /* - * Some programs (e.g., dmidecode) groove off into weird RAM - * areas where no table scan possibly exist (because Xen will - * have stomped on them!). These programs get rather upset if - * we let them know that Xen failed their access, so we fake - * out a read of all zeroes. :-) - */ - for (i = 0; i < count; i++) - if (put_user(0, buf+i)) - return -EFAULT; - return count; - } - if (copy_to_user(buf, v, count)) - goto out; - - read = count; - *ppos += read; -out: - iounmap(v); - return read; -} - -static ssize_t write_mem(struct file * file, const char __user * buf, - size_t count, loff_t *ppos) -{ - unsigned long p = *ppos; - ssize_t written = -EFAULT; - void __iomem *v; - - if ((v = ioremap(p, count)) == NULL) - return -EFAULT; - if (copy_from_user(v, buf, count)) - goto out; - - written = count; - *ppos += written; -out: - iounmap(v); - return written; -} - -static int mmap_mem(struct file * file, struct vm_area_struct * vma) -{ - if (uncached_access(file)) - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - - if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, - vma->vm_end - vma->vm_start, - vma->vm_page_prot, DOMID_IO)) - return -EAGAIN; - - return 0; -} - -/* - * The memory devices use the full 32/64 bits of the offset, and so we cannot - * check against negative addresses: they are ok. The return value is weird, - * though, in that case (0). - * - * also note that seeking relative to the "end of file" isn't supported: - * it has no meaning, so it returns -EINVAL. - */ -static loff_t memory_lseek(struct file * file, loff_t offset, int orig) -{ - loff_t ret; - - down(&file->f_dentry->d_inode->i_sem); - switch (orig) { - case 0: - file->f_pos = offset; - ret = file->f_pos; - force_successful_syscall_return(); - break; - case 1: - file->f_pos += offset; - ret = file->f_pos; - force_successful_syscall_return(); - break; - default: - ret = -EINVAL; - } - up(&file->f_dentry->d_inode->i_sem); - return ret; -} - -static int open_mem(struct inode * inode, struct file * filp) -{ - return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; -} - -struct file_operations mem_fops = { - .llseek = memory_lseek, - .read = read_mem, - .write = write_mem, - .mmap = mmap_mem, - .open = open_mem, -}; - -/* - * Local variables: - * c-file-style: "linux" - * indent-tabs-mode: t - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/kernel/fixup.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/fixup.c Mon Nov 28 12:39:22 2005 +++ /dev/null Mon Nov 28 13:08:53 2005 @@ -1,93 +0,0 @@ -/****************************************************************************** - * fixup.c - * - * Binary-rewriting of certain IA32 instructions, on notification by Xen. - * Used to avoid repeated slow emulation of common instructions used by the - * user-space TLS (Thread-Local Storage) libraries. - * - * **** NOTE **** - * Issues with the binary rewriting have caused it to be removed. Instead - * we rely on Xen's emulator to boot the kernel, and then print a banner - * message recommending that the user disables /lib/tls. - * - * Copyright (c) 2004, K A Fraser - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <linux/config.h> -#include <linux/init.h> -#include <linux/sched.h> -#include <linux/slab.h> -#include <linux/kernel.h> -#include <linux/delay.h> -#include <linux/version.h> - -#define DP(_f, _args...) printk(KERN_ALERT " " _f "\n" , ## _args ) - -fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code) -{ - static unsigned long printed = 0; - char info[100]; - int i; - - if (test_and_set_bit(0, &printed)) - return; - - HYPERVISOR_vm_assist( - VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify); - - sprintf(info, "%s (pid=%d)", current->comm, current->tgid); - - - DP(""); - DP("***************************************************************"); - DP("***************************************************************"); - DP("** WARNING: Currently emulating unsupported memory accesses **"); - DP("** in /lib/tls libraries. The emulation is very **"); - DP("** slow. To ensure full performance you should **"); - DP("** execute the following as root: **"); - DP("** mv /lib/tls /lib/tls.disabled **"); - DP("** Offending process: %-38.38s **", info); - DP("***************************************************************"); - DP("***************************************************************"); - DP(""); - - for (i = 5; i > 0; i--) { - printk("Pausing... %d", i); - mdelay(1000); - printk("\b\b\b\b\b\b\b\b\b\b\b\b"); - } - - printk("Continuing...\n\n"); -} - -static int __init fixup_init(void) -{ - HYPERVISOR_vm_assist( - VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify); - return 0; -} -__initcall(fixup_init); - -/* - * Local variables: - * c-file-style: "linux" - * indent-tabs-mode: t - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ diff -r 2eb868d02f0f -r 367b9ca30e88 linux-2.6-xen-sparse/arch/xen/kernel/smp.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/smp.c Mon Nov 28 12:39:22 2005 +++ /dev/null Mon Nov 28 13:08:53 2005 @@ -1,25 +0,0 @@ -/* Copyright (C) 2004, Christian Limpach */ - -#include <linux/init.h> -#include <linux/kernel.h> -#include <linux/threads.h> - -/* - * the frequency of the profiling timer can be changed - * by writing a multiplier value into /proc/profile. - */ -int setup_profiling_timer(unsigned int multiplier) -{ - printk("setup_profiling_timer\n"); - return 0; -} - -/* - * Local variables: - * c-file-style: "linux" - * indent-tabs-mode: t - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |