public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
Cc: maneesh@in.ibm.com, anil.s.keshavamurthy@intel.com,
	        systemtap@sources.redhat.com,
	Satoshi Oshima <soshima@redhat.com>,
	        Hideo Aoki <haoki@redhat.com>,
	        Yumiko Sugita <sugita@sdl.hitachi.co.jp>
Subject: Re: [RFC][Patch 1/2][take3]kprobe: kprobe-booster against 2.6.15-rc5-mm3 for i386
Date: Tue, 24 Jan 2006 07:04:00 -0000	[thread overview]
Message-ID: <20060124070433.GA3607@in.ibm.com> (raw)
In-Reply-To: <43AAA8EC.9070303@sdl.hitachi.co.jp>

On Thu, Dec 22, 2005 at 10:23:56PM +0900, Masami Hiramatsu wrote:
> Hi,
> 
> Here is a patch to clean up kprobe's resume_execute() for i386 arch.
> Before applying kprobe-booster, I'd like to cleanup codes.
> It is useful for simplify booster patch.

Hi Masami,

This patch looks fine except for some coding-style issues (^^^ below).

Ananth

> 
> -- 
> Masami HIRAMATSU
> 2nd Research Dept.
> Hitachi, Ltd., Systems Development Laboratory
> E-mail: 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-12-20 19:55:42.000000000 +0900
> +++ b/arch/i386/kernel/kprobes.c	2005-12-20 19:57:56.000000000 +0900
> @@ -337,10 +337,10 @@ static void __kprobes resume_execution(s
>  		struct pt_regs *regs, struct kprobe_ctlblk *kcb)
>  {
>  	unsigned long *tos = (unsigned long *)&regs->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);
> @@ -350,9 +350,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;
> @@ -360,27 +360,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:
   ^^^^ no spaces for goto labels.
   
> +	return ;
	     ^^^ spurious whitespace
	     
>  }
> 
>  /*
> 
> 

  reply	other threads:[~2006-01-24  7:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22 13:24 Masami Hiramatsu
2006-01-24  7:04 ` Ananth N Mavinakayanahalli [this message]
2006-01-24 13:22   ` Masami Hiramatsu
2006-01-24 14:16     ` Masami Hiramatsu
2006-01-25  4:51     ` Ananth N Mavinakayanahalli

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=20060124070433.GA3607@in.ibm.com \
    --to=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=haoki@redhat.com \
    --cc=hiramatu@sdl.hitachi.co.jp \
    --cc=maneesh@in.ibm.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).