This patch adds emulation support for the or and or. instruction.

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

diff --git a/arch/powerpc/include/asm/ppc-opcode.h 
b/arch/powerpc/include/asm/ppc-opcode.h
index 35296d0..8a155dd 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -105,6 +105,7 @@
 #define OP_31_XOP_LHAUX     375
 #define OP_31_XOP_STHX      407
 #define OP_31_XOP_STHUX     439
+#define OP_31_XOP_OR        444
 #define OP_31_XOP_MTSPR     467
 #define OP_31_XOP_DCBI      470
 #define OP_31_XOP_LWBRX     534
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index e156d31..bde4c1e 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -544,6 +544,14 @@ int kvmppc_emulate_any_instruction(struct kvm_vcpu *vcpu)
                                kvmppc_emulate_cmp(vcpu, value, 0, true, 0,
                                                   is_32bit);
                        break;
+               case OP_31_XOP_OR:
+                       value = kvmppc_get_gpr(vcpu, get_rs(inst));
+                       value |= kvmppc_get_gpr(vcpu, get_rb(inst));
+                       kvmppc_set_gpr(vcpu, get_ra(inst), value);
+                       if (get_rc(inst))
+                               kvmppc_emulate_cmp(vcpu, value, 0, true, 0,
+                                                  is_32bit);
+                       break;
                default:
                        emulated = EMULATE_FAIL;
                        break;
-- 
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