diff mbox

[27/33] KVM: PPC: Add xor instruction emulation

Message ID 1403472217-22263-28-git-send-email-agraf@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Graf June 22, 2014, 9:23 p.m. UTC
This patch adds emulation for the xor instruction.

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

Patch

diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 86c510e..f2da847 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -101,6 +101,7 @@ 
 #define OP_31_XOP_STBUX     247
 #define OP_31_XOP_LHZX      279
 #define OP_31_XOP_LHZUX     311
+#define OP_31_XOP_XOR       316
 #define OP_31_XOP_MFSPR     339
 #define OP_31_XOP_LHAX      343
 #define OP_31_XOP_LHAUX     375
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index d6e0e4b..8c2db76 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -633,6 +633,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_XOR:
+			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;