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: 22730 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A67BD20540 for ; Mon, 23 Dec 2013 16:19:57 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf23775945obc.9 for ; Mon, 23 Dec 2013 08:19:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=vUiCpfnlgr9QSLH3KlUMhhx2REBIGIxk3aJBfS/n5CE=; b=PQlOZzofYxikX4VLEBK4yeFOAIEkxO9G0L5/Op9YCFVWgacCJEisWDNnpb1L8O4UmO AYBvVzQVLCrkQAIc1RbyItq6Mss1Fn1qboF7HEbFX1pLV/tl/U9q+tVc7ogROgAh3Ppb 1ZB11hW7YzplnmTwigZr0GXO2+DBJ1/6RvIYt2urK9/wVGZ8RiBO7yPQARyf0EmZDs8n qAhPUpqmbimL+VIYvi98JYZwhJcs7p/nAkbLy/0zJ76speyf9Lf73GwxRhKcMHs5+POG R0xet7avO8q1x7owHJ3Fg0k5zGijBJ8qhaluzoHKtxwUZYCx0KEtiRTGpDzWHFY1aJME Ik7Q== X-Gm-Message-State: ALoCoQn9SKfrvHynR/VTN/iXp3mbHH9nL25V7sVZFknjJT/ayn3CuKJQ7eSkS8cultccRlnUJATR X-Received: by 10.182.236.74 with SMTP id us10mr10648083obc.36.1387815596464; Mon, 23 Dec 2013 08:19:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.162 with SMTP id on2ls1618183qeb.73.gmail; Mon, 23 Dec 2013 08:19:56 -0800 (PST) X-Received: by 10.53.7.193 with SMTP id de1mr76049vdd.91.1387815596312; Mon, 23 Dec 2013 08:19:56 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id gs2si4974166vdc.109.2013.12.23.08.19.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 08:19:56 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so2911587veb.5 for ; Mon, 23 Dec 2013 08:19:56 -0800 (PST) X-Received: by 10.220.248.202 with SMTP id mh10mr102881vcb.70.1387815596228; Mon, 23 Dec 2013 08:19:56 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp238382ved; Mon, 23 Dec 2013 08:19:55 -0800 (PST) X-Received: by 10.14.5.194 with SMTP id 42mr271728eel.100.1387815595198; Mon, 23 Dec 2013 08:19:55 -0800 (PST) Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com [209.85.215.174]) by mx.google.com with ESMTPS id l2si20720815een.104.2013.12.23.08.19.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 08:19:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.174 is neither permitted nor denied by best guess record for domain of taras.kondratiuk@linaro.org) client-ip=209.85.215.174; Received: by mail-ea0-f174.google.com with SMTP id b10so2436192eae.33 for ; Mon, 23 Dec 2013 08:19:54 -0800 (PST) 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 Cc: patches@linaro.org, linaro-networking@linaro.org, linaro-kernel@lists.linaro.org, Taras Kondratiuk , linux-kernel@vger.kernel.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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;