MIPS: do_mcheck: Fix kernel code dump with EVA
[linux-2.6-block.git] / arch / mips / kernel / traps.c
index e207a43b5f8f0bcbf0544e5289cfc08126cbc7f5..02484d17fb6f343d733364ede94f0bcc3387e8e6 100644 (file)
@@ -1519,6 +1519,7 @@ asmlinkage void do_mcheck(struct pt_regs *regs)
        const int field = 2 * sizeof(unsigned long);
        int multi_match = regs->cp0_status & ST0_TS;
        enum ctx_state prev_state;
+       mm_segment_t old_fs = get_fs();
 
        prev_state = exception_enter();
        show_regs(regs);
@@ -1540,8 +1541,13 @@ asmlinkage void do_mcheck(struct pt_regs *regs)
                dump_tlb_all();
        }
 
+       if (!user_mode(regs))
+               set_fs(KERNEL_DS);
+
        show_code((unsigned int __user *) regs->cp0_epc);
 
+       set_fs(old_fs);
+
        /*
         * Some chips may have other causes of machine check (e.g. SB1
         * graduation timer)