aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2015-11-11 09:21:19 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2015-11-18 06:25:36 -0500
commitc5c2a3b998f1ff5a586f9d37e154070b8d550d17 (patch)
tree5b6edaece6469ae15b8d32f95fa54bd21090960b
parent002374f371bd02df864cce1fe85d90dc5b292837 (diff)
MIPS: KVM: Fix CACHE immediate offset sign extension
The immediate field of the CACHE instruction is signed, so ensure that it gets sign extended by casting it to an int16_t rather than just masking the low 16 bits. Fixes: e685c689f3a8 ("KVM/MIPS32: Privileged instruction/target branch emulation.") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gleb Natapov <gleb@kernel.org> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Cc: <stable@vger.kernel.org> # 3.10.x- Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/mips/kvm/emulate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index d5fa3eaf39a1..41b1b090f56f 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -1581,7 +1581,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc,
1581 1581
1582 base = (inst >> 21) & 0x1f; 1582 base = (inst >> 21) & 0x1f;
1583 op_inst = (inst >> 16) & 0x1f; 1583 op_inst = (inst >> 16) & 0x1f;
1584 offset = inst & 0xffff; 1584 offset = (int16_t)inst;
1585 cache = (inst >> 16) & 0x3; 1585 cache = (inst >> 16) & 0x3;
1586 op = (inst >> 18) & 0x7; 1586 op = (inst >> 18) & 0x7;
1587 1587