From: dave.long@linaro.org (David Long)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/6] arm64: Add more test functions to insn.c
Date: Fri, 16 Jan 2015 16:27:48 -0500 [thread overview]
Message-ID: <54B98254.1000204@linaro.org> (raw)
In-Reply-To: <CAHM4w1=nJVr8P-us8+E42kY9jpcWoRKWyd1ASzfsUpb-_DNPYw@mail.gmail.com>
On 01/14/15 04:32, Pratyush Anand wrote:
> On Sun, Jan 11, 2015 at 9:33 AM, David Long <dave.long@linaro.org> wrote:
>> From: "David A. Long" <dave.long@linaro.org>
>>
>> Certain instructions are hard to execute correctly out-of-line (as in
>> kprobes). Test functions are added to insn.[hc] to identify these. The
>> instructions include any that use PC-relative addressing, change the PC,
>> or change interrupt masking. For efficiency and simplicity test
>> functions are also added for small collections of related instructions.
>>
>> Signed-off-by: David A. Long <dave.long@linaro.org>
>> ---
>> arch/arm64/include/asm/insn.h | 21 +++++++++++++++++++--
>> arch/arm64/kernel/insn.c | 18 ++++++++++++++++++
>> 2 files changed, 37 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
>> index e2ff32a..466afd4 100644
>> --- a/arch/arm64/include/asm/insn.h
>> +++ b/arch/arm64/include/asm/insn.h
>> @@ -223,8 +223,13 @@ static __always_inline bool aarch64_insn_is_##abbr(u32 code) \
>> static __always_inline u32 aarch64_insn_get_##abbr##_value(void) \
>> { return (val); }
>>
>> +__AARCH64_INSN_FUNCS(adr, 0x9F000000, 0x10000000)
>
> Should n't it be
> __AARCH64_INSN_FUNCS(adr_adrp, 0x1F000000, 0x10000000)
>
> So, that it also take care about adrp
Yes, that does look like a mistake.
>> +__AARCH64_INSN_FUNCS(prfm_lit, 0xFF000000, 0xD8000000)
>
> [...]
>
>>
>> +bool aarch64_insn_uses_literal(u32 insn)
>> +{
>> + /* ldr/ldrsw (literal), prfm */
>> +
>> + return aarch64_insn_is_ldr_lit(insn) ||
>> + aarch64_insn_is_ldrsw_lit(insn) ||
>
> also aarch64_insn_is_adr_adrp(insn) ||
>
Yup.
>> + aarch64_insn_is_prfm_lit(insn);
>> +}
>> +
>> +bool aarch64_insn_is_branch(u32 insn)
>> +{
>> + /* b, bl, cb*, tb*, b.cond, br, blr */
>> +
>> + return aarch64_insn_is_b_bl_cb_tb(insn) ||
>> + aarch64_insn_is_br_blr(insn) ||
>
> also aarch64_insn_is_ret(insn) ||
The goal was to catch intructions that use a PC-relative branch, since
the PC will not be what is expected. Of course any instruction that
changes the PC will have a problem too because the PC will be rewritten
after the probe is completed. So, yeah, this needs to be fixed.
>> + aarch64_insn_is_bcond(insn);
>> +}
>> +
>> /*
-dl
next prev parent reply other threads:[~2015-01-16 21:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-11 4:03 [PATCH v4 0/6] arm64: Add kernel probes (kprobes) support David Long
2015-01-11 4:03 ` [PATCH v4 1/6] arm64: Add HAVE_REGS_AND_STACK_ACCESS_API feature David Long
2015-01-12 12:51 ` Steve Capper
2015-01-15 7:07 ` Masami Hiramatsu
2015-01-11 4:03 ` [PATCH v4 2/6] arm64: Add more test functions to insn.c David Long
2015-01-14 9:32 ` Pratyush Anand
2015-01-16 21:27 ` David Long [this message]
2015-01-11 4:03 ` [PATCH v4 3/6] arm64: Kprobes with single stepping support David Long
2015-01-12 13:31 ` Steve Capper
2015-01-14 9:30 ` Pratyush Anand
2015-01-16 19:28 ` David Long
2015-01-19 9:03 ` Pratyush Anand
2015-01-21 18:02 ` David Long
2015-01-11 4:03 ` [PATCH v4 4/6] arm64: Kprobes instruction simulation support David Long
2015-01-14 9:32 ` Pratyush Anand
2015-01-16 21:34 ` David Long
2015-01-11 4:03 ` [PATCH v4 5/6] arm64: Add kernel return probes support(kretprobes) David Long
2015-01-12 14:01 ` Steve Capper
2015-01-11 4:03 ` [PATCH v4 6/6] kprobes: Add arm64 case in kprobe example module David Long
2015-01-12 14:09 ` [PATCH v4 0/6] arm64: Add kernel probes (kprobes) support Steve Capper
2015-01-14 11:55 ` Pratyush Anand
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=54B98254.1000204@linaro.org \
--to=dave.long@linaro.org \
--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).