• Paul Burton's avatar
    MIPS: math-emu: Fix jalr emulation when rd == $0 · ab4a92e6
    Paul Burton authored
    When emulating a jalr instruction with rd == $0, the code in
    isBranchInstr was incorrectly writing to GPR $0 which should actually
    always remain zeroed. This would lead to any further instructions
    emulated which use $0 operating on a bogus value until the task is next
    context switched, at which point the value of $0 in the task context
    would be restored to the correct zero by a store in SAVE_SOME. Fix this
    by not writing to rd if it is $0.
    
    Fixes: 102cedc3 ("MIPS: microMIPS: Floating point support.")
    Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
    Cc: Maciej W. Rozycki <macro@imgtec.com>
    Cc: James Hogan <james.hogan@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Cc: stable <stable@vger.kernel.org> # v3.10
    Patchwork: https://patchwork.linux-mips.org/patch/13160/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    ab4a92e6
cp1emu.c 62 KB