This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / arch / i386 / kernel / traps.c
index adeaef6..4c16d9f 100644 (file)
@@ -25,7 +25,8 @@
 #include <linux/highmem.h>
 #include <linux/kallsyms.h>
 #include <linux/ptrace.h>
-#include <linux/utsname.h>
+#include <linux/version.h>
+#include <linux/dump.h>
 #include <linux/kprobes.h>
 
 #ifdef CONFIG_EISA
 
 #include <linux/irq.h>
 #include <linux/module.h>
-#include <linux/vserver/debug.h>
 
 #include "mach_traps.h"
 
 asmlinkage int system_call(void);
+asmlinkage void lcall7(void);
+asmlinkage void lcall27(void);
 
 struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
                { 0, 0 }, { 0, 0 } };
@@ -219,7 +221,7 @@ void show_registers(struct pt_regs *regs)
        printk("CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\nEFLAGS: %08lx"
                        "   (%s) \n",
                smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-               print_tainted(), regs->eflags, system_utsname.release);
+               print_tainted(), regs->eflags, UTS_RELEASE);
        print_symbol("EIP is at %s\n", regs->eip);
        printk("eax: %08lx   ebx: %08lx   ecx: %08lx   edx: %08lx\n",
                regs->eax, regs->ebx, regs->ecx, regs->edx);
@@ -307,7 +309,6 @@ void die(const char * str, struct pt_regs * regs, long err)
        };
        static int die_counter;
 
-       vxh_throw_oops();
        if (die.lock_owner != smp_processor_id()) {
                console_verbose();
                spin_lock_irq(&die.lock);
@@ -336,20 +337,22 @@ void die(const char * str, struct pt_regs * regs, long err)
                        printk("\n");
                notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
                show_registers(regs);
-               try_crashdump(regs);
+#warning MEF netdump_func not part of 2.6.9-1.11-FC2; taking out call for now
+#if 0
+               if (netdump_func)
+                       netdump_func(regs);
+#endif
+               dump((char *)str, regs);
        } else
                printk(KERN_ERR "Recursive die() failure, output suppressed\n");
 
        bust_spinlocks(0);
        die.lock_owner = -1;
        spin_unlock_irq(&die.lock);
-       vxh_dump_history();
        if (in_interrupt())
                panic("Fatal exception in interrupt");
 
        if (panic_on_oops) {
-               if (netdump_func)
-                       netdump_func = NULL;
                printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(5 * HZ);
@@ -364,7 +367,16 @@ static inline void die_if_kernel(const char * str, struct pt_regs * regs, long e
                die(str, regs, err);
 }
 
-static void do_trap(int trapnr, int signr, char *str, int vm86,
+static inline unsigned long get_cr2(void)
+{
+       unsigned long address;
+
+       /* get the address */
+       __asm__("movl %%cr2,%0":"=r" (address));
+       return address;
+}
+
+static inline void do_trap(int trapnr, int signr, char *str, int vm86,
                           struct pt_regs * regs, long error_code, siginfo_t *info)
 {
        if (regs->eflags & VM_MASK) {
@@ -401,7 +413,7 @@ static void do_trap(int trapnr, int signr, char *str, int vm86,
 }
 
 #define DO_ERROR(trapnr, signr, str, name) \
-fastcall void do_##name(struct pt_regs * regs, long error_code) \
+asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
                                                == NOTIFY_STOP) \
@@ -410,7 +422,7 @@ fastcall void do_##name(struct pt_regs * regs, long error_code) \
 }
 
 #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
-fastcall void do_##name(struct pt_regs * regs, long error_code) \
+asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
        siginfo_t info; \
        info.si_signo = signr; \
@@ -424,7 +436,7 @@ fastcall void do_##name(struct pt_regs * regs, long error_code) \
 }
 
 #define DO_VM86_ERROR(trapnr, signr, str, name) \
-fastcall void do_##name(struct pt_regs * regs, long error_code) \
+asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
                                                == NOTIFY_STOP) \
@@ -433,7 +445,7 @@ fastcall void do_##name(struct pt_regs * regs, long error_code) \
 }
 
 #define DO_VM86_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
-fastcall void do_##name(struct pt_regs * regs, long error_code) \
+asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
        siginfo_t info; \
        info.si_signo = signr; \
@@ -463,7 +475,7 @@ DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
  * the original non-exec stack patch was written by
  * Solar Designer <solar at openwall.com>. Thanks!
  */
-fastcall void do_general_protection(struct pt_regs * regs, long error_code)
+asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
 {
        int cpu = get_cpu();
        struct tss_struct *tss = &per_cpu(init_tss, cpu);
@@ -554,7 +566,7 @@ gp_in_vm86:
 gp_in_kernel:
        if (!fixup_exception(regs)) {
                if (notify_die(DIE_GPF, "general protection fault", regs,
-                               error_code, 13, SIGSEGV) == NOTIFY_STOP)
+                               error_code, 13, SIGSEGV) == NOTIFY_STOP);
                        return;
                die("general protection fault", regs, error_code);
        }
@@ -624,11 +636,7 @@ void die_nmi (struct pt_regs *regs, const char *msg)
 
 static void default_do_nmi(struct pt_regs * regs)
 {
-       unsigned char reason = 0;
-
-       /* Only the BSP gets external NMIs from the system.  */
-       if (!smp_processor_id())
-               reason = get_nmi_reason();
+       unsigned char reason = get_nmi_reason();
  
        if (!(reason & 0xc0)) {
                if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT)
@@ -667,7 +675,7 @@ static int dummy_nmi_callback(struct pt_regs * regs, int cpu)
  
 static nmi_callback_t nmi_callback = dummy_nmi_callback;
  
-fastcall void do_nmi(struct pt_regs * regs, long error_code)
+asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
 {
        int cpu;
 
@@ -693,7 +701,7 @@ void unset_nmi_callback(void)
 }
 
 #ifdef CONFIG_KPROBES
-fastcall int do_int3(struct pt_regs *regs, long error_code)
+asmlinkage int do_int3(struct pt_regs *regs, long error_code)
 {
        if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
                        == NOTIFY_STOP)
@@ -728,7 +736,7 @@ fastcall int do_int3(struct pt_regs *regs, long error_code)
  * find every occurrence of the TF bit that could be saved away even
  * by user code)
  */
-fastcall void do_debug(struct pt_regs * regs, long error_code)
+asmlinkage void do_debug(struct pt_regs * regs, long error_code)
 {
        unsigned int condition;
        struct task_struct *tsk = current;
@@ -867,7 +875,7 @@ void math_error(void __user *eip)
        force_sig_info(SIGFPE, &info, task);
 }
 
-fastcall void do_coprocessor_error(struct pt_regs * regs, long error_code)
+asmlinkage void do_coprocessor_error(struct pt_regs * regs, long error_code)
 {
        ignore_fpu_irq = 1;
        math_error((void __user *)regs->eip);
@@ -921,7 +929,7 @@ void simd_math_error(void __user *eip)
        force_sig_info(SIGFPE, &info, task);
 }
 
-fastcall void do_simd_coprocessor_error(struct pt_regs * regs,
+asmlinkage void do_simd_coprocessor_error(struct pt_regs * regs,
                                          long error_code)
 {
        if (cpu_has_xmm) {
@@ -945,7 +953,7 @@ fastcall void do_simd_coprocessor_error(struct pt_regs * regs,
        }
 }
 
-fastcall void do_spurious_interrupt_bug(struct pt_regs * regs,
+asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs,
                                          long error_code)
 {
 #if 0
@@ -1045,6 +1053,11 @@ static void __init set_system_gate(unsigned int n, void *addr)
        _set_gate(idt_table+n,15,3,addr,__KERNEL_CS);
 }
 
+static void __init set_call_gate(void *a, void *addr)
+{
+       _set_gate(a,12,3,addr,__KERNEL_CS);
+}
+
 static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
 {
        _set_gate(idt_table+n,5,0,0,(gdt_entry<<3));
@@ -1088,6 +1101,14 @@ void __init trap_init(void)
 
        set_system_gate(SYSCALL_VECTOR,&system_call);
 
+       /*
+        * default LDT is a single-entry callgate to lcall7 for iBCS
+        * and a callgate to lcall27 for Solaris/x86 binaries
+        */
+#if 0   
+       set_call_gate(&default_ldt[0],lcall7);
+       set_call_gate(&default_ldt[4],lcall27);
+#endif
        /*
         * Should be a barrier for any external CPU state.
         */