From: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
To: systemtap@sources.redhat.com
Cc: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>,
Yumiko Sugita <sugita@sdl.hitachi.co.jp>,
Satoshi Oshima <soshima@redhat.com>,
Hideo Aoki <haoki@redhat.com>
Subject: [RFC][Patch 1/2][take2]kprobe: kprobe-booster against 2.6.14-mm1 for i386
Date: Mon, 28 Nov 2005 14:30:00 -0000 [thread overview]
Message-ID: <438B148F.9000004@sdl.hitachi.co.jp> (raw)
In-Reply-To: <438B142B.5080407@sdl.hitachi.co.jp>
Hi,
This patch cleans kprobe's resume_execute() for i386 arch.
Before applying kprobe-booster, I'd like to cleanup codes.
It is useful for simplify booster patch.
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp
Signed-off-by: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
kprobes.c | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
diff -Narup a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
--- a/arch/i386/kernel/kprobes.c 2005-11-08 11:50:46.000000000 +0900
+++ b/arch/i386/kernel/kprobes.c 2005-11-28 11:43:10.000000000 +0900
@@ -345,10 +345,10 @@ static void __kprobes resume_execution(s
struct pt_regs *regs, struct kprobe_ctlblk *kcb)
{
unsigned long *tos = (unsigned long *)®s->esp;
- unsigned long next_eip = 0;
unsigned long copy_eip = (unsigned long)&p->ainsn.insn;
unsigned long orig_eip = (unsigned long)p->addr;
+ regs->eflags &= ~TF_MASK;
switch (p->ainsn.insn[0]) {
case 0x9c: /* pushfl */
*tos &= ~(TF_MASK | IF_MASK);
@@ -358,9 +358,9 @@ static void __kprobes resume_execution(s
case 0xcb:
case 0xc2:
case 0xca:
- regs->eflags &= ~TF_MASK;
- /* eip is already adjusted, no more changes required*/
- return;
+ case 0xea: /* jmp absolute -- eip is correct */
+ /* eip is already adjusted, no more changes required */
+ goto no_change;
case 0xe8: /* call relative - Fix return addr */
*tos = orig_eip + (*tos - copy_eip);
break;
@@ -368,27 +368,21 @@ static void __kprobes resume_execution(s
if ((p->ainsn.insn[1] & 0x30) == 0x10) {
/* call absolute, indirect */
/* Fix return addr; eip is correct. */
- next_eip = regs->eip;
*tos = orig_eip + (*tos - copy_eip);
+ goto no_change;
} else if (((p->ainsn.insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */
((p->ainsn.insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */
/* eip is correct. */
- next_eip = regs->eip;
+ goto no_change;
}
- break;
- case 0xea: /* jmp absolute -- eip is correct */
- next_eip = regs->eip;
- break;
default:
break;
}
- regs->eflags &= ~TF_MASK;
- if (next_eip) {
- regs->eip = next_eip;
- } else {
- regs->eip = orig_eip + (regs->eip - copy_eip);
- }
+ regs->eip = orig_eip + (regs->eip - copy_eip);
+
+ no_change:
+ return ;
}
/*
next prev parent reply other threads:[~2005-11-28 14:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-25 13:13 [RFC][Patch 0/2]kprobe: " Masami Hiramatsu
2005-11-25 13:16 ` [RFC][Patch 1/2]kprobe: " Masami Hiramatsu
2005-11-25 13:19 ` [RFC][Patch 2/2]kprobe: " Masami Hiramatsu
2005-11-25 18:39 ` [RFC][Patch 0/2]kprobe: " Frank Ch. Eigler
2005-11-28 14:33 ` Masami Hiramatsu
2005-11-28 15:41 ` Frank Ch. Eigler
2005-11-29 14:14 ` Masami Hiramatsu
2005-11-28 14:29 ` [RFC][Patch 0/2][take2]kprobe: " Masami Hiramatsu
2005-11-28 14:30 ` Masami Hiramatsu [this message]
2005-11-28 14:32 ` [RFC][Patch 2/2][take2]kprobe: " Masami Hiramatsu
2005-12-06 5:27 ` Masami Hiramatsu
2005-12-12 19:49 ` Keshavamurthy Anil S
2005-12-14 14:19 ` Masami Hiramatsu
2005-12-20 13:45 ` Masami Hiramatsu
2005-12-20 17:27 ` Satoshi Oshima
2005-12-20 19:38 ` Keshavamurthy Anil S
2005-12-21 8:30 ` Ananth N Mavinakayanahalli
2005-12-21 17:39 ` Masami Hiramatsu
2005-11-28 22:10 ` [RFC][Patch 0/2]kprobe: " Keshavamurthy Anil S
2005-11-29 14:14 ` Masami Hiramatsu
2005-11-30 2:25 ` SMP race [was: kprobe: kprobe-booster against 2.6.14-mm1 for i386] Jim Keniston
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=438B148F.9000004@sdl.hitachi.co.jp \
--to=hiramatu@sdl.hitachi.co.jp \
--cc=haoki@redhat.com \
--cc=soshima@redhat.com \
--cc=sugita@sdl.hitachi.co.jp \
--cc=systemtap@sources.redhat.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).