From patchwork Thu Oct 31 18:38:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 287583 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id B7A4E2C037D for ; Fri, 1 Nov 2013 05:40:29 +1100 (EST) Received: from mail-ob0-x232.google.com (mail-ob0-x232.google.com [IPv6:2607:f8b0:4003:c01::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id ABA532C0421 for ; Fri, 1 Nov 2013 05:39:45 +1100 (EST) Received: by mail-ob0-f178.google.com with SMTP id wm4so3524687obc.9 for ; Thu, 31 Oct 2013 11:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r20c2a1YoWn+pMAGqM4RzE2Zjzbdx7ZaLcViqV5mMvo=; b=H5QynnPweyxYImJOBTTWd4H/wNQczUH8MvZyJmnkJ7qlPSjh8sse62s3VbANCw9sxo 06rmWPs6QetToVtGdkXQ3r1j/4RElCvzuPxXdPrinR5Hsd9a/veMyI9FUCL0QDBET9e/ QmBzWNuLV08aMk4yomZwG/lwW6mI+PSRQM+esIVi27ixU3oB90wMgoFLIDkquuu5ynGF rnb8sxeqmPr8eKRKnfaAfC2CsWWJLFv36LCs1C9zWwEg/XR5HR2gygegReimZ9+8hhj6 mq3KxZB/PP8UvoYlLaD+O7cY+aQtgHGwg+XMjMCSYc+Ru5Fg8swqgx7iXBBwVU0VZ8JR FTUA== X-Received: by 10.182.18.9 with SMTP id s9mr3780068obd.15.1383244782469; Thu, 31 Oct 2013 11:39:42 -0700 (PDT) Received: from tmusta-sc.rchland.ibm.com (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id ru3sm7619068obc.2.2013.10.31.11.39.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Oct 2013 11:39:41 -0700 (PDT) From: Tom To: linuxppc-dev@lists.ozlabs.org Subject: [V2 PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode Date: Thu, 31 Oct 2013 13:38:56 -0500 Message-Id: <1383244738-5986-2-git-send-email-tommusta@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1383244738-5986-1-git-send-email-tommusta@gmail.com> References: <1383244738-5986-1-git-send-email-tommusta@gmail.com> Cc: Tom Musta X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16rc2 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Tom Musta This patch modifies the endian chicken switch in the single step emulation code (emulate_step()). The old (big endian) code bailed early if a load or store instruction was to be emulated in little endian mode. The new code modifies the check and only bails in a cross-endian situation (LE mode in a kernel compiled for BE and vice verse). V2: fixed bug in MSR[LE] check identified by Andreas Schwab and Geert Uytterhoeven. Signed-off-by: Tom Musta --- arch/powerpc/lib/sstep.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index b1faa15..7bfaa9d 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -1222,12 +1222,18 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) } /* - * Following cases are for loads and stores, so bail out - * if we're in little-endian mode. + * Following cases are for loads and stores and this + * implementation does not support cross-endian. So + * bail out if this is the case. */ +#ifdef __BIG_ENDIAN__ if (regs->msr & MSR_LE) return 0; - +#endif +#ifdef __LITTLE_ENDIAN__ + if (!(regs->msr & MSR_LE)) + return 0; +#endif /* * Save register RA in case it's an update form load or store * and the access faults.