From patchwork Sun Jun 22 21:23:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 4396771 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8CDF09F383 for ; Sun, 22 Jun 2014 21:25:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4BE02021A for ; Sun, 22 Jun 2014 21:25:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0647B2021B for ; Sun, 22 Jun 2014 21:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbaFVVY5 (ORCPT ); Sun, 22 Jun 2014 17:24:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33361 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbaFVVXo (ORCPT ); Sun, 22 Jun 2014 17:23:44 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 562E1AD71; Sun, 22 Jun 2014 21:23:38 +0000 (UTC) From: Alexander Graf To: kvm-ppc@vger.kernel.org Cc: kvm@vger.kernel.org Subject: [PATCH 24/33] KVM: PPC: Add cmpwi/cmpdi instruction emulation Date: Sun, 22 Jun 2014 23:23:28 +0200 Message-Id: <1403472217-22263-25-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1403472217-22263-1-git-send-email-agraf@suse.de> References: <1403472217-22263-1-git-send-email-agraf@suse.de> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds emulation for the cmpwi and cmpdi instructions. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/kvm/emulate.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 8a155dd..5160af9 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -114,6 +114,7 @@ #define OP_31_XOP_LHBRX 790 #define OP_31_XOP_STHBRX 918 +#define OP_CMPI 11 #define OP_ADDIS 15 #define OP_ORI 24 #define OP_ANDI 28 diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index bde4c1e..7b8acb0 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -531,6 +531,11 @@ int kvmppc_emulate_any_instruction(struct kvm_vcpu *vcpu) kvmppc_set_gpr(vcpu, get_ra(inst), value); kvmppc_emulate_cmp(vcpu, value, 0, true, 0, is_32bit); break; + case OP_CMPI: + value = kvmppc_get_gpr(vcpu, get_ra(inst)); + kvmppc_emulate_cmp(vcpu, value, (s16)get_d(inst), true, + get_rt(inst) >> 2, !(get_rt(inst) & 1)); + break; case 31: switch (get_xop(inst)) { case OP_31_XOP_MFCR: