From patchwork Fri Jan 10 17:58:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 3467501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CB660C02DC for ; Fri, 10 Jan 2014 18:01:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C202520142 for ; Fri, 10 Jan 2014 18:01:18 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8656A2013A for ; Fri, 10 Jan 2014 18:01:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1gNG-0004tZ-Sv; Fri, 10 Jan 2014 18:00:03 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1gMx-0007g0-HV; Fri, 10 Jan 2014 17:59:43 +0000 Received: from mail-ee0-f49.google.com ([74.125.83.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1gMK-0007ZY-28 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jan 2014 17:59:07 +0000 Received: by mail-ee0-f49.google.com with SMTP id c41so2050562eek.36 for ; Fri, 10 Jan 2014 09:58:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OwpYPsyRcGgY3zMvwJM3qyyeJ4fKjGFw4bDYIlgZ2E4=; b=RH6BVlRs5SpIhe9EnJUiCTg66eyPegJLrDOlO/YaKOMcNwYW2mc1fhhWX88+8ROiOQ hKJ4xXnpXbCg/1bj8vnQEf+IDgd9bDmtOwMxEPlFWOAGxlZ/fN/zaBukb1U8UC+6X4M6 QDamYN281bH4cdtk03cUodCvrPU/WgUAsBPE0pdxJQssdaIlf8F8f+T5vk6mQlZojpyR 7SHjJBk5HKXRuHtPckR/Z/MVoDiGitLy2mmeBm8cNiXKtvQFCsUqlG1TFCkI40rTZVPM nwzXbcZIokRm8H/HY+NxPxZiq524OOrHqfM2GwUz2GUkS851OdX5XSL5NWdbZJ1sDFo6 x8fQ== X-Gm-Message-State: ALoCoQmFhG0wJI1SDaEnnxfp7KnfC+O8hZGpR0bgKzHDG0sGYJR4j8kSErNYDH0nv6jeTciKaZPz X-Received: by 10.14.221.193 with SMTP id r41mr11448804eep.92.1389376719518; Fri, 10 Jan 2014 09:58:39 -0800 (PST) Received: from condor-x220.synapse.com ([195.238.93.36]) by mx.google.com with ESMTPSA id p45sm16407719eeg.1.2014.01.10.09.58.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 09:58:39 -0800 (PST) From: Taras Kondratiuk To: Russell King , Ben Dooks , Jon Medhurst , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/5] ARM: kprobes-test: use for instruction accesses Date: Fri, 10 Jan 2014 19:58:23 +0200 Message-Id: <1389376706-30051-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389376706-30051-1-git-send-email-taras.kondratiuk@linaro.org> References: <1389376706-30051-1-git-send-email-taras.kondratiuk@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140110_125904_250727_F8FB1043 X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: -2.6 (--) Cc: Taras Kondratiuk , linaro-networking@linaro.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Ben Dooks Ensure we read instructions in the correct endian-ness by using the helper to transform them as necessary. Acked-by: Jon Medhurst Signed-off-by: Ben Dooks [taras.kondratiuk@linaro.org: fix next_instruction() function] Signed-off-by: Taras Kondratiuk --- arch/arm/kernel/kprobes-test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 0cd63d0..0850c72 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/kernel/kprobes-test.c @@ -1329,7 +1329,8 @@ static void test_case_failed(const char *message) static unsigned long next_instruction(unsigned long pc) { #ifdef CONFIG_THUMB2_KERNEL - if ((pc & 1) && !is_wide_instruction(*(u16 *)(pc - 1))) + if ((pc & 1) && + !is_wide_instruction(__mem_to_opcode_thumb16(*(u16 *)(pc - 1)))) return pc + 2; else #endif @@ -1374,13 +1375,13 @@ static uintptr_t __used kprobes_test_case_start(const char *title, void *stack) if (test_case_is_thumb) { u16 *p = (u16 *)(test_code & ~1); - current_instruction = p[0]; + current_instruction = __mem_to_opcode_thumb16(p[0]); if (is_wide_instruction(current_instruction)) { - current_instruction <<= 16; - current_instruction |= p[1]; + u16 instr2 = __mem_to_opcode_thumb16(p[1]); + current_instruction = __opcode_thumb32_compose(current_instruction, instr2); } } else { - current_instruction = *(u32 *)test_code; + current_instruction = __mem_to_opcode_arm(*(u32 *)test_code); } if (current_title[0] == '.')