Re: [PATCH] save parameter registers and restore them for jprobe handling

From: Keshavamurthy Anil S <anil.s.keshavamurthy_at_intel.com>
Date: 2005-12-02 07:06:36
On Wed, Nov 30, 2005 at 09:19:02PM -0800, Zhang, Yanmin wrote:

> How about the new patch? I add a new function in arch/ia64/kernel/entry.S.
> 
I agree with Ken, move the assembly function to arch/ia64/kernel/jprobe.S file.
Also, please see my comments.

>  int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
>  {
[...]
>  	/* save architectural state */
Wrong comment above, we are not saving architectural state. 
I guess the comment should be
"Callee owns the argument space and could overwrite it, eg
tail call optimization. So to be absolutely safe
we save the argument space before transfering the control
to instrumented jprobe function which runs in 
the process context"

> @@ -785,8 +821,19 @@ int __kprobes setjmp_pre_handler(struct 
>  int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
>  {
[....]
> +	unw_init_running(ia64_get_bsp_cfm, &pa);
Just an optimization, avoid calling unw_init_running()
and just save bsp and cfm in the previous call and
reuse it. I think you can save in the kcb
structure.

> +	bytes = (char *)ia64_rse_skip_regs(pa.bsp, pa.cfm & 0x3f)
> +				- (char *)pa.bsp;
Again Comment please.. like
	/* restoring the original argument space */
> +	memcpy( pa.bsp,
> +		kcb->jprobes_saved_stacked_regs,
> +		bytes );

-Anil Keshavamurthy
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Dec 02 07:07:35 2005

This archive was generated by hypermail 2.1.8 : 2005-12-02 07:07:45 EST