]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: KVM: Fix translation of MFC0 ErrCtl
authorJames Hogan <james.hogan@imgtec.com>
Wed, 15 Jun 2016 18:29:45 +0000 (19:29 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Jun 2016 21:58:16 +0000 (23:58 +0200)
commitd20d79d41a7b475c5ba6e68b5262f7b017409f1a
tree17c963c673cf7be348562758e546963bbd7555f4
parent2d541450cfdae312bec4a200fa44d65c3fc515e9
MIPS: KVM: Fix translation of MFC0 ErrCtl

The MIPS KVM dynamic translation is meant to translate "MFC0 rt, ErrCtl"
instructions into "ADD rt, zero, zero" to zero the destination register,
however the rt register number was copied into rt of the ADD instruction
encoding, which is the 2nd source operand. This results in "ADD zero,
zero, rt" which is a no-op, so only the first execution of each such
MFC0 from ErrCtl will actually read 0.

Fix the shift to put the rt from the MFC0 encoding into the rd field of
the ADD.

Fixes: e9e62190294a ("KVM/MIPS32: Binary patching of select privileged instructions.")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/dyntrans.c