ia64/xen-unstable

view linux-2.6-xen-sparse/arch/i386/kernel/fixup.c @ 11923:1633f9a3a120

Omit seg fixup warning if it's just from statically linked init.

Signed-off-by: Steven Hand <steven@xensource.com>
author Steven Hand <steven@xensource.com>
date Fri Oct 20 11:49:00 2006 +0100 (2006-10-20)
parents 48c0f5489d44
children 35c724302bdd
line source
1 /******************************************************************************
2 * fixup.c
3 *
4 * Binary-rewriting of certain IA32 instructions, on notification by Xen.
5 * Used to avoid repeated slow emulation of common instructions used by the
6 * user-space TLS (Thread-Local Storage) libraries.
7 *
8 * **** NOTE ****
9 * Issues with the binary rewriting have caused it to be removed. Instead
10 * we rely on Xen's emulator to boot the kernel, and then print a banner
11 * message recommending that the user disables /lib/tls.
12 *
13 * Copyright (c) 2004, K A Fraser
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
30 #include <linux/config.h>
31 #include <linux/init.h>
32 #include <linux/sched.h>
33 #include <linux/slab.h>
34 #include <linux/kernel.h>
35 #include <linux/delay.h>
36 #include <linux/version.h>
38 #define DP(_f, _args...) printk(KERN_ALERT " " _f "\n" , ## _args )
40 fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
41 {
42 static unsigned long printed = 0;
43 char info[100];
44 int i;
46 if (test_and_set_bit(0, &printed))
47 return;
49 if (current->tgid == 1) /* Ignore statically linked init */
50 return;
52 HYPERVISOR_vm_assist(
53 VMASST_CMD_disable, VMASST_TYPE_4gb_segments_notify);
55 sprintf(info, "%s (pid=%d)", current->comm, current->tgid);
58 DP("");
59 DP("***************************************************************");
60 DP("***************************************************************");
61 DP("** WARNING: Currently emulating unsupported memory accesses **");
62 DP("** in /lib/tls glibc libraries. The emulation is **");
63 DP("** slow. To ensure full performance you should **");
64 DP("** install a 'xen-friendly' (nosegneg) version of **");
65 DP("** the library, or disable tls support by executing **");
66 DP("** the following as root: **");
67 DP("** mv /lib/tls /lib/tls.disabled **");
68 DP("** Offending process: %-38.38s **", info);
69 DP("***************************************************************");
70 DP("***************************************************************");
71 DP("");
73 for (i = 5; i > 0; i--) {
74 touch_softlockup_watchdog();
75 printk("Pausing... %d", i);
76 mdelay(1000);
77 printk("\b\b\b\b\b\b\b\b\b\b\b\b");
78 }
80 printk("Continuing...\n\n");
81 }
83 static int __init fixup_init(void)
84 {
85 HYPERVISOR_vm_assist(
86 VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify);
87 return 0;
88 }
89 __initcall(fixup_init);