This patch adds emulation support for the andi. instruction.

Signed-off-by: Alexander Graf <ag...@suse.de>
---
 arch/powerpc/include/asm/ppc-opcode.h | 1 +
 arch/powerpc/kvm/emulate.c            | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/arch/powerpc/include/asm/ppc-opcode.h 
b/arch/powerpc/include/asm/ppc-opcode.h
index d3ff899..35296d0 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -115,6 +115,7 @@
 
 #define OP_ADDIS 15
 #define OP_ORI  24
+#define OP_ANDI 28
 #define OP_LWZ  32
 #define OP_LD   58
 #define OP_LWZU 33
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index cfe0bf6..e156d31 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -525,6 +525,12 @@ int kvmppc_emulate_any_instruction(struct kvm_vcpu *vcpu)
                value |= get_d(inst);
                kvmppc_set_gpr(vcpu, get_ra(inst), value);
                break;
+       case OP_ANDI:
+               value = kvmppc_get_gpr(vcpu, get_rs(inst));
+               value &= get_d(inst);
+               kvmppc_set_gpr(vcpu, get_ra(inst), value);
+               kvmppc_emulate_cmp(vcpu, value, 0, true, 0, is_32bit);
+               break;
        case 31:
                switch (get_xop(inst)) {
                case OP_31_XOP_MFCR:
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to