MIPS: KVM: Factor writing of translated guest instructions
authorJames Hogan <james.hogan@imgtec.com>
Wed, 15 Jun 2016 18:29:46 +0000 (19:29 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Jun 2016 21:58:17 +0000 (23:58 +0200)
commitd5cd26bcfc881f5443d510e3acd40b30d7b7d0df
tree471d3e50f148156e827c267c704692e4d8255759
parent66ffc50c480e7ab6ad5642f47276435a8873c31a
MIPS: KVM: Factor writing of translated guest instructions

The code in kvm_mips_dyntrans.c to write a translated guest instruction
to guest memory depending on the segment is duplicated between each of
the functions. Additionally the cache op translation functions assume
the instruction is in the KSEG0/1 segment rather than KSEG2/3, which is
generally true but isn't guaranteed.

Factor that code into a new kvm_mips_trans_replace() which handles both
KSEG0/1 and KSEG2/3.

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