Skip to content

Commit

Permalink
KVM: PPC: Mask ea's high 32-bits in 32/64 instr emulation
Browse files Browse the repository at this point in the history
Mask high 32 bits of effective address in emulation layer for guests running
in 32-bit mode.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
[agraf: fix indent]
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
Mihai Caraman authored and Alexander Graf committed Dec 6, 2012
1 parent 7cdd7a9 commit 8823a8f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/powerpc/include/asm/kvm_ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,21 @@ static inline void kvmppc_lazy_ee_enable(void)
static inline ulong kvmppc_get_ea_indexed(struct kvm_vcpu *vcpu, int ra, int rb)
{
ulong ea;
ulong msr_64bit = 0;

ea = kvmppc_get_gpr(vcpu, rb);
if (ra)
ea += kvmppc_get_gpr(vcpu, ra);

#if defined(CONFIG_PPC_BOOK3E_64)
msr_64bit = MSR_CM;
#elif defined(CONFIG_PPC_BOOK3S_64)
msr_64bit = MSR_SF;
#endif

if (!(vcpu->arch.shared->msr & msr_64bit))
ea = (uint32_t)ea;

return ea;
}

Expand Down

0 comments on commit 8823a8f

Please sign in to comment.