On Thu, 2009-05-14 at 19:15 +0530, K.Prasad wrote:
> plain text document attachment (ppc64_modify_process_handling_04)

> Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c
> ===================================================================
> --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c
> +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c
> @@ -50,6 +50,7 @@
>  #include <asm/syscalls.h>
>  #ifdef CONFIG_PPC64
>  #include <asm/firmware.h>
> +#include <asm/hw_breakpoint.h>
>  #endif
>  #include <linux/kprobes.h>
>  #include <linux/kdebug.h>
> @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig
>                       11, SIGSEGV) == NOTIFY_STOP)
>               return;
>  
> +#ifndef CONFIG_PPC64
>       if (debugger_dabr_match(regs))
>               return;
> +#endif
>  
>       /* Clear the DAC and struct entries.  One shot trigger */
>  #if defined(CONFIG_BOOKE)
> @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t
>  
>  #endif /* CONFIG_SMP */
>  
> +#ifdef CONFIG_PPC64
> +             if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG)))
> +                     switch_to_thread_hw_breakpoint(new);
> +#else

To avoid all these ifdefs in the code we need something like this in a
header:

static inline int task_uses_debug_regs(struct task_struct *tsk)
{
#ifdef CONFIG_PPC64
        return test_tsk_thread_flag(tsk, TIF_DEBUG);
#else
        return 0;
#endif
}

> @@ -605,6 +617,9 @@ int copy_thread(unsigned long clone_flag
>       struct pt_regs *childregs, *kregs;
>       extern void ret_from_fork(void);
>       unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
> +#ifdef CONFIG_PPC64
> +     struct task_struct *tsk = current;
> +#endif
>  
>       CHECK_FULL_REGS(regs);
>       /* Copy registers */
> @@ -672,6 +687,9 @@ int copy_thread(unsigned long clone_flag
>        * function.
>        */
>       kregs->nip = *((unsigned long *)ret_from_fork);
> +
> +     if (unlikely(test_tsk_thread_flag(tsk, TIF_DEBUG)))
> +             copy_thread_hw_breakpoint(tsk, p, clone_flags);

If you just use current here you don't need to define tsk above.

cheers

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to