From: junxiao.bi@windriver.com (Bi Junxiao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] ARM: ftrace: use canonical Thumb-2 wide instruction format
Date: Thu, 24 Nov 2011 15:22:34 +0800 [thread overview]
Message-ID: <4ECDF0BA.1050707@windriver.com> (raw)
In-Reply-To: <20111123144238.GB2050@localhost.localdomain>
on 11/23/2011 10:42 PM Dave Martin wrote:
> On Tue, Nov 22, 2011 at 11:30:11PM +0530, Rabin Vincent wrote:
>
>> On Tue, Nov 22, 2011 at 17:32, Dave Martin<dave.martin@linaro.org> wrote:
>>
>>> On Mon, Nov 21, 2011 at 08:43:46PM +0530, Rabin Vincent wrote:
>>>
>>>> +#ifndef __ARMEB__
>>>> + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
>>>> + old = (old>> 16) | (old<< 16);
>>>> + new = (new>> 16) | (new<< 16);
>>>>
>>> I think swahw32() in<linux/swab.h> can be used for this operation.
>>>
>> Yes.
>>
>>
>>> Really though, we need a common set of "load and store instruction"
>>> macros, rather than duplicating this knowledge everywhere.
>>>
>> Yes, though this ftrace code may not be able to use them directly since
>> it uses probe_kernel_read()/write().
>>
> In that case what we would want are macros to convert instructions between
> integer and in-memory representation, rather than conflating all that
> together in some memory accessor macros.
>
> How about:
>
> #include<linux/swab.h>
>
> #ifdef __ARMEB__
> #define insn_to_mem_arm(insn) swab32(insn)
> #define insn_to_mem_thumb16(insn) swab16(insn)
> #define insn_to_mem_thumb32(insn) swab16(insn)
> #else
> #define insn_to_mem_arm(insn) (insn)
> #define insn_to_mem_thumb16(insn) (insn)
> #define insn_to_mem_thumb32(insn) shahw32(insn)
> #endif
>
> #define mem_to_insn_arm(insn) insn_to_mem_asm(insn)
> #define mem_to_insn_thumb16(insn) insn_to_mem_thumb16(insn)
> #define mem_to_insn_thumb32(insn) insn_to_mem_thumb32(insn)
>
> Because these are all straightforward swap operations, we don't really
> need separate forwards and backwards operations, but having the separate
> names may make calling code easier to read.
>
> I'm still not sure exactly which header this belongs in, but it's a core
> ARM thing; not local to kprobes or ftrace, etc.
>
>
Yes, these macros are useful for be8 support. Do they deserve a
separated header file as there is no appropriate one for them now?
> If this looks sensible, it would also make sense for Junxiao Bi to build
> his big-endian fixes on it.
>
> Cheers
> ---Dave
>
>
next prev parent reply other threads:[~2011-11-24 7:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 15:13 [PATCH 1/4] ARM: ftrace: use canonical Thumb-2 wide instruction format Rabin Vincent
2011-11-21 15:13 ` [PATCH 2/4] ARM: extract out insn generation code from ftrace Rabin Vincent
2011-11-22 12:02 ` Dave Martin
2011-11-22 13:32 ` Rabin Vincent
2011-11-22 13:56 ` Dave Martin
2011-11-22 18:25 ` Rabin Vincent
2011-11-23 11:50 ` Dave Martin
2011-11-24 16:10 ` Rabin Vincent
2011-11-21 15:13 ` [PATCH 3/4] ARM: extract out code patch function from kprobes Rabin Vincent
2011-11-22 8:48 ` Tixy
2011-11-22 18:03 ` Rabin Vincent
2011-11-21 15:13 ` [PATCH 4/4] ARM: add jump label support Rabin Vincent
2011-11-22 19:42 ` Russell King - ARM Linux
2011-11-22 23:02 ` Stephen Boyd
2011-11-22 23:39 ` Jason Baron
2011-11-22 23:50 ` Jason Baron
2011-11-23 14:55 ` Rabin Vincent
2011-11-23 17:53 ` Russell King - ARM Linux
2011-11-28 17:04 ` Rabin Vincent
2012-01-24 15:43 ` Rabin Vincent
2012-01-24 16:05 ` Russell King - ARM Linux
2012-01-24 16:57 ` Rabin Vincent
2011-11-22 12:02 ` [PATCH 1/4] ARM: ftrace: use canonical Thumb-2 wide instruction format Dave Martin
2011-11-22 18:00 ` Rabin Vincent
2011-11-23 14:42 ` Dave Martin
2011-11-24 7:22 ` Bi Junxiao [this message]
2011-11-25 10:10 ` Dave Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ECDF0BA.1050707@windriver.com \
--to=junxiao.bi@windriver.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).