mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
MIPS: R2-on-R6 MULTU/MADDU/MSUBU emulation bugfix
commitd65e5677adupstream. MIPS instructions MULTU, MADDU and MSUBU emulation requires registers HI/LO to be converted to signed 32bits before 64bit sign extension on MIPS64. Bug was found on running MIPS32 R2 test application on MIPS64 R6 kernel. Fixes:b0a668fb20("MIPS: kernel: mips-r2-to-r6-emul: Add R2 emulator for MIPS R6") Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com> Reported-by: Nikola.Veljkovic@imgtec.com Cc: paul.burton@imgtec.com Cc: yamada.masahiro@socionext.com Cc: akpm@linux-foundation.org Cc: andrea.gelmini@gelma.net Cc: macro@imgtec.com Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14043/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
304b69247e
commit
0112db0b9a
@@ -434,8 +434,8 @@ static int multu_func(struct pt_regs *regs, u32 ir)
|
||||
rs = regs->regs[MIPSInst_RS(ir)];
|
||||
res = (u64)rt * (u64)rs;
|
||||
rt = res;
|
||||
regs->lo = (s64)rt;
|
||||
regs->hi = (s64)(res >> 32);
|
||||
regs->lo = (s64)(s32)rt;
|
||||
regs->hi = (s64)(s32)(res >> 32);
|
||||
|
||||
MIPS_R2_STATS(muls);
|
||||
|
||||
@@ -671,9 +671,9 @@ static int maddu_func(struct pt_regs *regs, u32 ir)
|
||||
res += ((((s64)rt) << 32) | (u32)rs);
|
||||
|
||||
rt = res;
|
||||
regs->lo = (s64)rt;
|
||||
regs->lo = (s64)(s32)rt;
|
||||
rs = res >> 32;
|
||||
regs->hi = (s64)rs;
|
||||
regs->hi = (s64)(s32)rs;
|
||||
|
||||
MIPS_R2_STATS(dsps);
|
||||
|
||||
@@ -729,9 +729,9 @@ static int msubu_func(struct pt_regs *regs, u32 ir)
|
||||
res = ((((s64)rt) << 32) | (u32)rs) - res;
|
||||
|
||||
rt = res;
|
||||
regs->lo = (s64)rt;
|
||||
regs->lo = (s64)(s32)rt;
|
||||
rs = res >> 32;
|
||||
regs->hi = (s64)rs;
|
||||
regs->hi = (s64)(s32)rs;
|
||||
|
||||
MIPS_R2_STATS(dsps);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user