From: wangnan0@huawei.com (Wang Nan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v18 10/11] ARM: kprobes: check register usage for probed instruction.
Date: Sun, 4 Jan 2015 13:16:02 +0800 [thread overview]
Message-ID: <54A8CC92.1080002@huawei.com> (raw)
In-Reply-To: <54A8CA21.1060009@hitachi.com>
On 2015/1/4 13:05, Masami Hiramatsu wrote:
> Hi Wang,
>
> (2014/12/29 13:07), Wang Nan wrote:
>> This patch utilizes previous introduced checker to check register usage
>> for probed ARM instruction and saves it in a mask. Futher patch will
>> use such information to avoid simuation or emulation.
>>
>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
>> ---
>> arch/arm/include/asm/probes.h | 12 ++++
>> arch/arm/probes/decode.c | 7 ++
>> arch/arm/probes/kprobes/actions-arm.c | 2 +-
>> arch/arm/probes/kprobes/checkers-arm.c | 124 +++++++++++++++++++++++++++++++++
>> arch/arm/probes/kprobes/checkers.h | 1 +
>> 5 files changed, 145 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/include/asm/probes.h b/arch/arm/include/asm/probes.h
>> index f0a1ee8..ee04067 100644
>> --- a/arch/arm/include/asm/probes.h
>> +++ b/arch/arm/include/asm/probes.h
>> @@ -41,6 +41,18 @@ struct arch_probes_insn {
>> probes_insn_singlestep_t *insn_singlestep;
>> probes_insn_fn_t *insn_fn;
>> int stack_space;
>> +
>> + /* Use 2 bits for a register. One more bit for extension */
>
> Would you have any concrete idea for the extend bits? If not, we don't need
> it at this point. I think we don't need to care about future binary compatibility :)
> (moreover, if you need another bitflag, you can add another flag)
>
2 bits can describe the read/write direction of a register. With such information,
futher code is possible to utilize unused register to do some optimization. However,
as you pointed, it is not a very concrete idea.
>> +#define REG_NO_USE (0)
>> +#define REG_USE (1)
>> +#define REG_MASK (3)
>> +#define __register_usage_flag(n, f) ((f) << ((n) * 2))
>> +#define __register_usage_mask(n) (REG_MASK << ((n) * 2))
>> +#define __clean_register_flag(m, n) ((m) & (~(__register_usage_mask(n))))
>> +#define __set_register_flag(m, n, f) (__clean_register_flag(m, n) | __register_usage_flag(n, f))
>> +#define set_register_nouse(m, n) do {(m) = __set_register_flag(m, n, REG_NO_USE);} while(0)
>> +#define set_register_use(m, n) do {(m) = __set_register_flag(m, n, REG_USE);} while(0)
>> + int register_usage_mask;
>
> Is this a mask or flag? It seems a bit flag, if so, it should be "register_usage_flag".
>
> Thank you,
>
OK, I'll rename it.
Thanks to your comment.
next prev parent reply other threads:[~2015-01-04 5:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-27 7:33 [PATCH v17 00/11] ARM: kprobes: OPTPROBES and other improvements Wang Nan
2014-12-27 7:34 ` [PATCH v17 01/11] ARM: probes: move all probe code to dedicate directory Wang Nan
2014-12-27 7:34 ` [PATCH v17 02/11] ARM: kprobes: remove unused ARM decoder actions Wang Nan
2014-12-27 7:35 ` [PATCH v17 03/11] ARM: kprobes: introduces checker Wang Nan
2014-12-27 7:35 ` [PATCH v17 04/11] ARM: kprobes: collects stack consumption for store instructions Wang Nan
2014-12-27 7:35 ` [PATCH v17 05/11] ARM: kprobes: disallow probing stack consuming instructions Wang Nan
2014-12-27 7:35 ` [PATCH v17 06/11] ARM: kprobes: Add test cases for " Wang Nan
2014-12-27 7:35 ` [PATCH v17 07/11] kprobes: Pass the original kprobe for preparing optimized kprobe Wang Nan
2014-12-27 7:35 ` [PATCH v17 08/11] ARM: kprobes: enable OPTPROBES for ARM 32 Wang Nan
2014-12-27 7:35 ` [PATCH v17 09/11] ARM: kprobes: Fix unreliable MRS instruction tests Wang Nan
2014-12-27 7:35 ` [PATCH v17 10/11] ARM: kprobes: check register usage for probed instruction Wang Nan
2014-12-27 7:36 ` [PATCH v17 11/11] ARM: optprobes: execute instruction during restoring if possible Wang Nan
2014-12-28 22:10 ` Masami Hiramatsu
2014-12-29 4:07 ` [PATCH v18 10/11] ARM: kprobes: check register usage for probed instruction Wang Nan
2015-01-04 5:05 ` Masami Hiramatsu
2015-01-04 5:16 ` Wang Nan [this message]
2014-12-29 4:07 ` [PATCH v18 11/11] ARM: optprobes: execute instruction during restoring if possible Wang Nan
2015-01-04 5:25 ` Masami Hiramatsu
2014-12-29 4:10 ` [PATCH v17 " Wang Nan
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=54A8CC92.1080002@huawei.com \
--to=wangnan0@huawei.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).