diff options
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r-- | arch/mips/kernel/traps.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 80b9e070c207..353056110f2b 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/cpu.h> | 32 | #include <asm/cpu.h> |
33 | #include <asm/dsp.h> | 33 | #include <asm/dsp.h> |
34 | #include <asm/fpu.h> | 34 | #include <asm/fpu.h> |
35 | #include <asm/fpu_emulator.h> | ||
35 | #include <asm/mipsregs.h> | 36 | #include <asm/mipsregs.h> |
36 | #include <asm/mipsmtregs.h> | 37 | #include <asm/mipsmtregs.h> |
37 | #include <asm/module.h> | 38 | #include <asm/module.h> |
@@ -722,6 +723,21 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code, | |||
722 | die_if_kernel("Kernel bug detected", regs); | 723 | die_if_kernel("Kernel bug detected", regs); |
723 | force_sig(SIGTRAP, current); | 724 | force_sig(SIGTRAP, current); |
724 | break; | 725 | break; |
726 | case BRK_MEMU: | ||
727 | /* | ||
728 | * Address errors may be deliberately induced by the FPU | ||
729 | * emulator to retake control of the CPU after executing the | ||
730 | * instruction in the delay slot of an emulated branch. | ||
731 | * | ||
732 | * Terminate if exception was recognized as a delay slot return | ||
733 | * otherwise handle as normal. | ||
734 | */ | ||
735 | if (do_dsemulret(regs)) | ||
736 | return; | ||
737 | |||
738 | die_if_kernel("Math emu break/trap", regs); | ||
739 | force_sig(SIGTRAP, current); | ||
740 | break; | ||
725 | default: | 741 | default: |
726 | scnprintf(b, sizeof(b), "%s instruction in kernel code", str); | 742 | scnprintf(b, sizeof(b), "%s instruction in kernel code", str); |
727 | die_if_kernel(b, regs); | 743 | die_if_kernel(b, regs); |
@@ -1555,6 +1571,8 @@ void __cpuinit set_uncached_handler(unsigned long offset, void *addr, | |||
1555 | #ifdef CONFIG_64BIT | 1571 | #ifdef CONFIG_64BIT |
1556 | unsigned long uncached_ebase = TO_UNCAC(ebase); | 1572 | unsigned long uncached_ebase = TO_UNCAC(ebase); |
1557 | #endif | 1573 | #endif |
1574 | if (cpu_has_mips_r2) | ||
1575 | ebase += (read_c0_ebase() & 0x3ffff000); | ||
1558 | 1576 | ||
1559 | if (!addr) | 1577 | if (!addr) |
1560 | panic(panic_null_cerr); | 1578 | panic(panic_null_cerr); |
@@ -1588,8 +1606,11 @@ void __init trap_init(void) | |||
1588 | 1606 | ||
1589 | if (cpu_has_veic || cpu_has_vint) | 1607 | if (cpu_has_veic || cpu_has_vint) |
1590 | ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64); | 1608 | ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64); |
1591 | else | 1609 | else { |
1592 | ebase = CAC_BASE; | 1610 | ebase = CAC_BASE; |
1611 | if (cpu_has_mips_r2) | ||
1612 | ebase += (read_c0_ebase() & 0x3ffff000); | ||
1613 | } | ||
1593 | 1614 | ||
1594 | per_cpu_trap_init(); | 1615 | per_cpu_trap_init(); |
1595 | 1616 | ||
@@ -1697,11 +1718,11 @@ void __init trap_init(void) | |||
1697 | 1718 | ||
1698 | if (cpu_has_vce) | 1719 | if (cpu_has_vce) |
1699 | /* Special exception: R4[04]00 uses also the divec space. */ | 1720 | /* Special exception: R4[04]00 uses also the divec space. */ |
1700 | memcpy((void *)(CAC_BASE + 0x180), &except_vec3_r4000, 0x100); | 1721 | memcpy((void *)(ebase + 0x180), &except_vec3_r4000, 0x100); |
1701 | else if (cpu_has_4kex) | 1722 | else if (cpu_has_4kex) |
1702 | memcpy((void *)(CAC_BASE + 0x180), &except_vec3_generic, 0x80); | 1723 | memcpy((void *)(ebase + 0x180), &except_vec3_generic, 0x80); |
1703 | else | 1724 | else |
1704 | memcpy((void *)(CAC_BASE + 0x080), &except_vec3_generic, 0x80); | 1725 | memcpy((void *)(ebase + 0x080), &except_vec3_generic, 0x80); |
1705 | 1726 | ||
1706 | signal_init(); | 1727 | signal_init(); |
1707 | #ifdef CONFIG_MIPS32_COMPAT | 1728 | #ifdef CONFIG_MIPS32_COMPAT |