From patchwork Mon Dec 23 16:19:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 3397111 Return-Path: X-Original-To: patchwork-linux-arm@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 E0C459F169 for ; Mon, 23 Dec 2013 16:21:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49E822057D for ; Mon, 23 Dec 2013 16:21:02 +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 1046E20579 for ; Mon, 23 Dec 2013 16:21:01 +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 1Vv8FF-0005JI-1D; Mon, 23 Dec 2013 16:20:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vv8F8-0002Qd-UP; Mon, 23 Dec 2013 16:20:34 +0000 Received: from mail-ea0-f177.google.com ([209.85.215.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vv8Eq-0002MV-DA for linux-arm-kernel@lists.infradead.org; Mon, 23 Dec 2013 16:20:17 +0000 Received: by mail-ea0-f177.google.com with SMTP id n15so2453523ead.36 for ; Mon, 23 Dec 2013 08:19:54 -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=vUiCpfnlgr9QSLH3KlUMhhx2REBIGIxk3aJBfS/n5CE=; b=cqPV0+VeUSDlqwp2u6stVDCWpin2GEBqvl2tQTdiDArO0F6XDI9st1ifVqptloN3QE N98ZAzmUMawFQcutUuJ86xqNyKG6woK9rhyDB5qmUPDWMtBia2R5eI/rYnl8/OE+RFBo U3Xv4Uya9kPmx3YXuoIUDOe534MVlaOoCRmhY3tr2j85W9uOz+Ro8gpVv5U1jdA5qwr+ onSecgg73Bor6G74JlWuCTZNCRsu4WTejNQ4wvcJZ0vQeVWP4YdImTAehCT0UNFUiext cyiF6uIzSL0Yq58d6mPuv9dJ3DPm1IVkP5rMbzecfFF16gdiXnkxVuc8cyXqPIQQVlpk ZvoQ== X-Gm-Message-State: ALoCoQk0ulPPvA2SR1J+FQLE7e92Ub1l6QzGAUlVF5xMACrt58GEcJtNS+j7oQ85d/pX7X0bDJi8 X-Received: by 10.15.26.6 with SMTP id m6mr1167037eeu.80.1387815594498; Mon, 23 Dec 2013 08:19:54 -0800 (PST) Received: from condor-x220.synapse.com ([195.238.93.36]) by mx.google.com with ESMTPSA id 1sm46940687eeg.4.2013.12.23.08.19.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 08:19:54 -0800 (PST) From: Taras Kondratiuk To: Jon Medhurst , Russell King , Ben Dooks , linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/5] ARM: kprobes-test: use for instruction accesses Date: Mon, 23 Dec 2013 18:19:36 +0200 Message-Id: <1387815579-15677-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1387815579-15677-1-git-send-email-taras.kondratiuk@linaro.org> References: <1387815579-15677-1-git-send-email-taras.kondratiuk@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131223_112016_573186_2BA8A0B6 X-CRM114-Status: GOOD ( 12.82 ) 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.7 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. Signed-off-by: Ben Dooks [taras.kondratiuk@linaro.org: fix next_instruction() function] Signed-off-by: Taras Kondratiuk Acked-by: Jon Medhurst --- arch/arm/kernel/kprobes-test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 0cd63d0..96e3dbc 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] == '.') @@ -1593,7 +1594,6 @@ static int run_test_cases(void (*tests)(void), const union decode_item *table) return 0; } - static int __init run_all_tests(void) { int ret = 0;