@@ -120,6 +120,7 @@
#define OP_ADDIS 15
#define OP_BC 16
#define OP_RLWIMI 20
+#define OP_RLWINM 21
#define OP_ORI 24
#define OP_ORIS 25
#define OP_ANDI 28
@@ -601,7 +601,7 @@ int kvmppc_emulate_rld(struct kvm_vcpu *vcpu, u32 inst)
return EMULATE_DONE;
}
-int kvmppc_emulate_rlwimi(struct kvm_vcpu *vcpu, u32 inst)
+int kvmppc_emulate_rlwi(struct kvm_vcpu *vcpu, u32 inst)
{
int sh = (inst >> 11) & 0x1f;
int mb = (inst >> 6) & 0x1f;
@@ -623,7 +623,8 @@ int kvmppc_emulate_rlwimi(struct kvm_vcpu *vcpu, u32 inst)
mask = ~mask;
}
dest &= mask;
- dest |= kvmppc_get_gpr(vcpu, get_ra(inst)) & ~mask;
+ if (get_op(inst) == OP_RLWIMI)
+ dest |= kvmppc_get_gpr(vcpu, get_ra(inst)) & ~mask;
kvmppc_set_gpr(vcpu, get_ra(inst), dest);
if (get_rc(inst))
@@ -707,7 +708,10 @@ int kvmppc_emulate_any_instruction(struct kvm_vcpu *vcpu)
emulated = kvmppc_emulate_rld(vcpu, inst);
break;
case OP_RLWIMI:
- emulated = kvmppc_emulate_rlwimi(vcpu, inst);
+ emulated = kvmppc_emulate_rlwi(vcpu, inst);
+ break;
+ case OP_RLWINM:
+ emulated = kvmppc_emulate_rlwi(vcpu, inst);
break;
case 31:
switch (get_xop(inst)) {
This patch adds emulation support for the rlwinm instruction. Signed-off-by: Alexander Graf <agraf@suse.de> --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/kvm/emulate.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)