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: 23109 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4E350216DB for ; Fri, 10 Jan 2014 17:58:44 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id g10sf11018415pdj.9 for ; Fri, 10 Jan 2014 09:58:43 -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=OwpYPsyRcGgY3zMvwJM3qyyeJ4fKjGFw4bDYIlgZ2E4=; b=BE428ZtqmKk7nyCe3YpWtgH4c6FLhNkjxLmPm8oWfQF5qOxS+Lukmx0YuZwJNaSEsV JPsDCHzcEcqwTrB3zyf/itDgvI7+BvgJVPhTQVNXmoJAiaeNS1Et4DhN06ouKLTSl7Bt pGJLGxgFY74MrzRVMpxwJea8F996g3E6Bo0BKM8Q1tnyMDUVk4lzQEHWtvrF94my2Exc uIVHDcaMYe/2w7CYOrfDoyKV1b7uVcoQw914AnJ5w6pFlKlnovPgFX3gprl+3QT8C1gK jQdiF8zL40mhWlXZ1dr8/bdUQVpLkNdmeYpVHcYxVn3bvfhii1H29J72mfuRn1DhvXZq /01A== X-Gm-Message-State: ALoCoQkfYznzDqRB0bf7B3suPAcyqzCrJHex55zI8EPbxScDWo6wfFWBEAvrp524u5RZT+sU3Vxc X-Received: by 10.66.153.137 with SMTP id vg9mr1259388pab.43.1389376723478; Fri, 10 Jan 2014 09:58:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.26.72 with SMTP id j8ls1474053qeg.62.gmail; Fri, 10 Jan 2014 09:58:43 -0800 (PST) X-Received: by 10.52.64.140 with SMTP id o12mr7227376vds.40.1389376723246; Fri, 10 Jan 2014 09:58:43 -0800 (PST) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id x5si5386223veb.35.2014.01.10.09.58.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 09:58:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.48; Received: by mail-vb0-f48.google.com with SMTP id q16so1608334vbe.7 for ; Fri, 10 Jan 2014 09:58:43 -0800 (PST) X-Received: by 10.52.227.233 with SMTP id sd9mr2610952vdc.53.1389376723137; Fri, 10 Jan 2014 09:58:43 -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 ey3csp106510ved; Fri, 10 Jan 2014 09:58:42 -0800 (PST) X-Received: by 10.194.22.129 with SMTP id d1mr10080994wjf.22.1389376721959; Fri, 10 Jan 2014 09:58:41 -0800 (PST) Received: from mail-ea0-f178.google.com (mail-ea0-f178.google.com [209.85.215.178]) by mx.google.com with ESMTPS id a9si11424681eew.180.2014.01.10.09.58.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 09:58:41 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.178 is neither permitted nor denied by best guess record for domain of taras.kondratiuk@linaro.org) client-ip=209.85.215.178; Received: by mail-ea0-f178.google.com with SMTP id d10so2208807eaj.23 for ; Fri, 10 Jan 2014 09:58:41 -0800 (PST) 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 Cc: patches@linaro.org, linaro-networking@linaro.org, linaro-kernel@lists.linaro.org, Taras Kondratiuk , linux-kernel@vger.kernel.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-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.212.48 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. 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] == '.')