mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
MIPS: KVM: Fix 64-bit big endian dynamic translation
The MFC0 and MTC0 instructions in the guest which cause traps can be replaced with 32-bit loads and stores to the commpage, however on big endian 64-bit builds the offset needs to have 4 added so as to load/store the least significant half of the long instead of the most significant half. Signed-off-by: James Hogan <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: "Radim Krčmář" <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
This commit is contained in:
parent
2a06dab877
commit
5808844f03
1 changed files with 8 additions and 0 deletions
|
|
@ -103,6 +103,10 @@ int kvm_mips_trans_mfc0(union mips_instruction inst, u32 *opc,
|
|||
mfc0_inst.i_format.rt = inst.c0r_format.rt;
|
||||
mfc0_inst.i_format.simmediate = KVM_GUEST_COMMPAGE_ADDR |
|
||||
offsetof(struct kvm_mips_commpage, cop0.reg[rd][sel]);
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
if (sizeof(vcpu->arch.cop0->reg[0][0]) == 8)
|
||||
mfc0_inst.i_format.simmediate |= 4;
|
||||
#endif
|
||||
}
|
||||
|
||||
return kvm_mips_trans_replace(vcpu, opc, mfc0_inst);
|
||||
|
|
@ -121,6 +125,10 @@ int kvm_mips_trans_mtc0(union mips_instruction inst, u32 *opc,
|
|||
mtc0_inst.i_format.rt = inst.c0r_format.rt;
|
||||
mtc0_inst.i_format.simmediate = KVM_GUEST_COMMPAGE_ADDR |
|
||||
offsetof(struct kvm_mips_commpage, cop0.reg[rd][sel]);
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
if (sizeof(vcpu->arch.cop0->reg[0][0]) == 8)
|
||||
mtc0_inst.i_format.simmediate |= 4;
|
||||
#endif
|
||||
|
||||
return kvm_mips_trans_replace(vcpu, opc, mtc0_inst);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue