linux-uconsole/arch/mips
Shane McDonald a6507d3cb8 MIPS FPU emulator: allow Cause bits of FCSR to be writeable by ctc1
commit 95e8f634d7 upstream.

    In the FPU emulator code of the MIPS, the Cause bits of the FCSR register
    are not currently writeable by the ctc1 instruction.  In odd corner cases,
    this can cause problems.  For example, a case existed where a divide-by-zero
    exception was generated by the FPU, and the signal handler attempted to
    restore the FPU registers to their state before the exception occurred.  In
    this particular setup, writing the old value to the FCSR register would
    cause another divide-by-zero exception to occur immediately.  The solution
    is to change the ctc1 instruction emulator code to allow the Cause bits of
    the FCSR register to be writeable.  This is the behaviour of the hardware
    that the code is emulating.

    This problem was found by Shane McDonald, but the credit for the fix goes
    to Kevin Kissell.  In Kevin's words:

    I submit that the bug is indeed in that ctc_op:  case of the emulator.  The
    Cause bits (17:12) are supposed to be writable by that instruction, but the
    CTC1 emulation won't let them be updated by the instruction.  I think that
    actually if you just completely removed lines 387-388 [...] things would
    work a good deal better.  At least, it would be a more accurate emulation of
    the architecturally defined FPU.  If I wanted to be really, really pedantic
    (which I sometimes do), I'd also protect the reserved bits that aren't
    necessarily writable.

Signed-off-by: Shane McDonald <mcdonald.shane@gmail.com>
To: anemo@mba.ocn.ne.jp
To: kevink@paralogos.com
To: sshtylyov@mvista.com
Patchwork: http://patchwork.linux-mips.org/patch/1205/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-08-02 10:21:27 -07:00
..
alchemy MIPS: Alchemy: Fix hang with high-frequency edge interrupts 2009-11-02 12:00:08 +01:00
ar7 MIPS: AR7: register watchdog device only if enabled in hw configuration 2009-11-02 12:00:03 +01:00
basler/excite MIPS: Excite: Get rid of BKL. 2009-09-30 21:47:01 +02:00
bcm47xx MIPS: Make local arrays with CL_SIZE static __initdata 2009-11-13 18:10:37 +01:00
bcm63xx MIPS: bcm63xx: Set the correct BCM3302 CPU name 2009-11-02 12:00:07 +01:00
boot MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
cavium-octeon MIPS: Octeon: Use lockless interrupt controller operations when possible. 2009-11-02 12:00:07 +01:00
cobalt Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
configs MIPS: TXx9: Update rbtx49xx_defconfig 2009-11-13 18:10:37 +01:00
dec Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-09-18 09:15:24 -07:00
emma MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
fw MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
gt64120/wrppmc Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
include/asm MIPS FPU emulator: allow Cause bits of FCSR to be writeable by ctc1 2010-08-02 10:21:27 -07:00
jazz MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
kernel untangle the do_mremap() mess 2010-01-18 10:19:11 -08:00
lasat sysctl: remove "struct file *" argument of ->proc_handler 2009-09-24 07:21:04 -07:00
lib MIPS: Fix __ndelay build error and add 'ull' suffix for 32-bit kernel 2009-06-17 11:06:24 +01:00
loongson MIPS: Loongson: Remove redundant local_irq_disable() 2009-11-02 12:00:02 +01:00
math-emu MIPS FPU emulator: allow Cause bits of FCSR to be writeable by ctc1 2010-08-02 10:21:27 -07:00
mipssim cpumask: arch_send_call_function_ipi_mask: mips 2009-09-24 09:34:45 +09:30
mm MIPS: Cleanup forgotten label_module_alloc in tlbex.c 2010-04-01 15:58:04 -07:00
mti-malta MIPS: Make local arrays with CL_SIZE static __initdata 2009-11-13 18:10:37 +01:00
nxp MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
oprofile MIPS: Oprofile: Rename cpu_type from godson2 to loongson2 2009-11-02 12:00:08 +01:00
pci MIPS: MSP71xx: request_irq() failure ignored in msp_pcibios_config_access() 2009-09-30 21:47:01 +02:00
pmc-sierra cpumask: arch_send_call_function_ipi_mask: mips 2009-09-24 09:34:45 +09:30
power MIPS: Use PAGE_SIZE in assembly instead of _PAGE_SIZE. 2009-09-17 20:07:48 +02:00
rb532 MIPS: RB532: Fix devices.c compilation. 2009-12-02 18:09:51 +00:00
sgi-ip22 MIPS: IP22, IP28: Build with -Werror 2009-09-17 20:07:44 +02:00
sgi-ip27 MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
sgi-ip32 MIPS: IP32: Remove unnecessary if not even harmful volatile keywords. 2009-05-22 13:52:06 +01:00
sibyte MIPS: Sibyte: Apply M3 workaround only on affected chip types and versions. 2010-05-12 14:57:17 -07:00
sni MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
txx9 MIPS: Make local arrays with CL_SIZE static __initdata 2009-11-13 18:10:37 +01:00
vr41xx Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
Kconfig MIPS: Loongson: Switch from flatmem to sparsemem 2009-12-01 16:21:26 +00:00
Kconfig.debug MIPS: Kconfig: Fix the arch-specific header path 2008-12-12 18:12:23 +00:00
Makefile arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0 2009-09-20 12:28:22 +02:00