]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Fix MFC1 & MFHC1 emulation for 64-bit MIPS systems
authorPaul Burton <paul.burton@imgtec.com>
Wed, 24 Sep 2014 09:45:37 +0000 (10:45 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 26 Sep 2014 09:33:11 +0000 (11:33 +0200)
commitda7be87c0076aac90333f6178f22d453372d9676
treef90e0aaa79c1337055460cb7c7bd8a4575ffcae9
parent8ec11e1c58a2c22a1393a1f3aa2c09dc37cb74b2
MIPS: Fix MFC1 & MFHC1 emulation for 64-bit MIPS systems

Commit d59d1a1e5af4 "MIPS: Simplify FP context access" modified the
SIFROMREG & SIFROMHREG macros such that they return unsigned rather
than signed 32b integers. I had believed that to be fine, but
inadvertently missed the MFC1 & MFHC1 cases which write to a struct
pt_regs regs element. On MIPS32 this is fine, but on 64 bit those
saved regs' fields are 64 bit wide. Using unsigned values caused the
32 bit value from the FP register to be zero rather than sign extended
as the architecture specifies, causing incorrect emulation of the
MFC1 & MFHc1 instructions. Fix by reintroducing the casts to signed
integers, and therefore the sign extension.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: stable@vger.kernel.org # v3.15+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7848/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/math-emu/cp1emu.c