From patchwork Fri Oct 18 19:40:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 284708 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 6E3622C0392 for ; Sat, 19 Oct 2013 06:41:07 +1100 (EST) Received: from mail-oa0-x231.google.com (mail-oa0-x231.google.com [IPv6:2607:f8b0:4003:c02::231]) (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 5AB102C00BC for ; Sat, 19 Oct 2013 06:40:41 +1100 (EST) Received: by mail-oa0-f49.google.com with SMTP id j10so3045311oah.8 for ; Fri, 18 Oct 2013 12:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:content-type:content-transfer-encoding:mime-version; bh=v+dZ25L4B39oLPz3uvfd8wkBTCLhJPnIWezFRBIuvZo=; b=VcoYejs/71rRqAMg9/ujAUvsWC5h4qejgHzcXajMd6fMpo3anWQPy93fkIz8nj9aRM rxkoOggU4cLuFPoEq6akiRaJlHV/xOM9m7owQO6qJwXXzE9Rxp16PkTWJ2YuVRW8q8cY 9hKCHTIQy3IRlx6lsFPEY1DXmKrKL9a8M/TdOQk/LswUBeEz1r2wS9PWgo0GKi6BUTbc rlKoc9zDQZKKs7AGphDaz9iMohNyKh4BjNx5i0e9PL9tUjS7EB3aCOxYl2/ZtVDp4bvg DI5HADyBgZD7riBVnOoZmjuG7SOJVi+4gflchl7UafI54RKZxAWNnX2vJ4QiwHdfRrCS sjHg== X-Received: by 10.182.84.132 with SMTP id z4mr5299492oby.49.1382125237886; Fri, 18 Oct 2013 12:40:37 -0700 (PDT) Received: from [9.10.80.32] (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id s9sm6749241obu.4.2013.10.18.12.40.36 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 12:40:37 -0700 (PDT) Message-ID: <1382125235.2206.24.camel@tmusta-sc.rchland.ibm.com> Subject: [PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode From: Tom Musta To: linuxppc-dev Date: Fri, 18 Oct 2013 14:40:35 -0500 In-Reply-To: <1382125125.2206.22.camel@tmusta-sc.rchland.ibm.com> References: <1382125125.2206.22.camel@tmusta-sc.rchland.ibm.com> Organization: X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Cc: tmusta@gmail.com 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: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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). Signed-off-by: Tom Musta --- arch/powerpc/lib/sstep.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) * and the access faults. diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index b1faa15..5e0d0e9 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