~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/mips/kernel/traps.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <linux/kdb.h>
31
31
#include <linux/irq.h>
32
32
#include <linux/perf_event.h>
33
 
#include <trace/trap.h>
34
33
 
35
34
#include <asm/bootinfo.h>
36
35
#include <asm/branch.h>
56
55
#include <asm/stacktrace.h>
57
56
#include <asm/uasm.h>
58
57
 
59
 
/*
60
 
 * Also used in unaligned.c and fault.c.
61
 
 */
62
 
DEFINE_TRACE(trap_entry);
63
 
DEFINE_TRACE(trap_exit);
64
 
 
65
58
extern void check_wait(void);
66
59
extern asmlinkage void r4k_wait(void);
67
60
extern asmlinkage void rollback_handle_int(void);
328
321
 
329
322
        printk("Cause : %08x\n", cause);
330
323
 
331
 
        cause = CAUSE_EXCCODE(cause);
 
324
        cause = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE;
332
325
        if (1 <= cause && cause <= 5)
333
326
                printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr);
334
327
 
381
374
        unsigned long dvpret = dvpe();
382
375
#endif /* CONFIG_MIPS_MT_SMTC */
383
376
 
384
 
        notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV);
 
377
        if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP)
 
378
                sig = 0;
385
379
 
386
380
        console_verbose();
387
381
        spin_lock_irq(&die_lock);
390
384
        mips_mt_regdump(dvpret);
391
385
#endif /* CONFIG_MIPS_MT_SMTC */
392
386
 
393
 
        if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP)
394
 
                sig = 0;
395
 
 
396
387
        printk("%s[#%d]:\n", str, ++die_counter);
397
388
        show_registers(regs);
398
389
        add_taint(TAINT_DIE);
705
696
                return;
706
697
        die_if_kernel("FP exception in kernel code", regs);
707
698
 
708
 
        trace_trap_entry(regs, CAUSE_EXCCODE(regs->cp0_cause));
709
699
        if (fcr31 & FPU_CSR_UNI_X) {
710
700
                int sig;
711
701
                void __user *fault_addr = NULL;
738
728
 
739
729
                /* If something went wrong, signal */
740
730
                process_fpemu_return(sig, fault_addr);
741
 
                trace_trap_exit();
 
731
 
742
732
                return;
743
733
        } else if (fcr31 & FPU_CSR_INV_X)
744
734
                info.si_code = FPE_FLTINV;
756
746
        info.si_errno = 0;
757
747
        info.si_addr = (void __user *) regs->cp0_epc;
758
748
        force_sig_info(SIGFPE, &info, current);
759
 
        trace_trap_exit();
760
749
}
761
750
 
762
751
static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
988
977
        int status;
989
978
        unsigned long __maybe_unused flags;
990
979
 
991
 
        trace_trap_entry(regs, CAUSE_EXCCODE(regs->cp0_cause));
992
 
 
993
980
        die_if_kernel("do_cpu invoked from kernel context!", regs);
994
981
 
995
982
        cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
1001
988
                opcode = 0;
1002
989
                status = -1;
1003
990
 
1004
 
                if (unlikely(compute_return_epc(regs) < 0)) {
1005
 
                        trace_trap_exit();
 
991
                if (unlikely(compute_return_epc(regs) < 0))
1006
992
                        return;
1007
 
                }
1008
993
 
1009
994
                if (unlikely(get_user(opcode, epc) < 0))
1010
995
                        status = SIGSEGV;
1022
1007
                        regs->cp0_epc = old_epc;        /* Undo skip-over.  */
1023
1008
                        force_sig(status, current);
1024
1009
                }
1025
 
                trace_trap_exit();
 
1010
 
1026
1011
                return;
1027
1012
 
1028
1013
        case 1:
1042
1027
                        if (!process_fpemu_return(sig, fault_addr))
1043
1028
                                mt_ase_fp_affinity();
1044
1029
                }
1045
 
                trace_trap_exit();
 
1030
 
1046
1031
                return;
1047
1032
 
1048
1033
        case 2:
1049
1034
                raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs);
1050
 
                trace_trap_exit();
1051
1035
                return;
1052
1036
 
1053
1037
        case 3:
1055
1039
        }
1056
1040
 
1057
1041
        force_sig(SIGILL, current);
1058
 
        trace_trap_exit();
1059
1042
}
1060
1043
 
1061
1044
asmlinkage void do_mdmx(struct pt_regs *regs)