* [PATCH] fix PPC floating point debug
@ 2009-11-27 8:59 Stefani Seibold
2009-11-27 11:01 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Stefani Seibold @ 2009-11-27 8:59 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev
The PPC architecture is unable to debug applications using hardware
floating point, because it would not save the floating point registers.
After returning from the debugger, the contents of register was
modified. This patch fix this bug.
Signed-off-by: Stefani Seibold <stefani@seibold.net>
---
traps.c | 6 ++++++
1 file changed, 6 insertions(+)
--- linux-2.6.32-rc5/arch/powerpc/kernel/traps.c.orig 2009-11-27 09:47:37.989943124 +0100
+++ linux-2.6.32-rc5/arch/powerpc/kernel/traps.c 2009-11-27 09:47:41.088330825 +0100
@@ -559,6 +559,8 @@ void instruction_breakpoint_exception(st
return;
if (debugger_iabr_match(regs))
return;
+ if (regs->msr & MSR_FP)
+ giveup_fpu(current);
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
}
@@ -577,6 +579,8 @@ void __kprobes single_step_exception(str
if (debugger_sstep(regs))
return;
+ if (regs->msr & MSR_FP)
+ giveup_fpu(current);
_exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
}
@@ -834,6 +838,8 @@ void __kprobes program_check_exception(s
regs->nip += 4;
return;
}
+ if (regs->msr & MSR_FP)
+ giveup_fpu(current);
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
return;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix PPC floating point debug
2009-11-27 8:59 [PATCH] fix PPC floating point debug Stefani Seibold
@ 2009-11-27 11:01 ` Benjamin Herrenschmidt
2009-11-27 12:44 ` Stefani Seibold
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-27 11:01 UTC (permalink / raw)
To: Stefani Seibold; +Cc: linuxppc-dev, linux-kernel
On Fri, 2009-11-27 at 09:59 +0100, Stefani Seibold wrote:
> The PPC architecture is unable to debug applications using hardware
> floating point, because it would not save the floating point registers.
>
> After returning from the debugger, the contents of register was
> modified. This patch fix this bug.
I'm not sure what problem you are trying to fix... debugging FP apps
works just fine afaik. You don't need to flush the FP state into the
thread when delivering the SIGTRAP. If you have a signal handler, that
will be done for you by the signal code before laying out the signal
frame. If you are using ptrace, you should be using the appropriate
ptrace calls to retrieve the FP state and they should do the right thing
to.
Do you have a precise example that doesn't work and which is fixed by
your patch ?
Cheers,
Ben.
> Signed-off-by: Stefani Seibold <stefani@seibold.net>
> ---
> traps.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> --- linux-2.6.32-rc5/arch/powerpc/kernel/traps.c.orig 2009-11-27 09:47:37.989943124 +0100
> +++ linux-2.6.32-rc5/arch/powerpc/kernel/traps.c 2009-11-27 09:47:41.088330825 +0100
> @@ -559,6 +559,8 @@ void instruction_breakpoint_exception(st
> return;
> if (debugger_iabr_match(regs))
> return;
> + if (regs->msr & MSR_FP)
> + giveup_fpu(current);
> _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
> }
>
> @@ -577,6 +579,8 @@ void __kprobes single_step_exception(str
> if (debugger_sstep(regs))
> return;
>
> + if (regs->msr & MSR_FP)
> + giveup_fpu(current);
> _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
> }
>
> @@ -834,6 +838,8 @@ void __kprobes program_check_exception(s
> regs->nip += 4;
> return;
> }
> + if (regs->msr & MSR_FP)
> + giveup_fpu(current);
> _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
> return;
> }
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix PPC floating point debug
2009-11-27 11:01 ` Benjamin Herrenschmidt
@ 2009-11-27 12:44 ` Stefani Seibold
0 siblings, 0 replies; 3+ messages in thread
From: Stefani Seibold @ 2009-11-27 12:44 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
Am Freitag, den 27.11.2009, 22:01 +1100 schrieb Benjamin Herrenschmidt:
> On Fri, 2009-11-27 at 09:59 +0100, Stefani Seibold wrote:
> > The PPC architecture is unable to debug applications using hardware
> > floating point, because it would not save the floating point registers.
> >
> > After returning from the debugger, the contents of register was
> > modified. This patch fix this bug.
>
> I'm not sure what problem you are trying to fix... debugging FP apps
> works just fine afaik. You don't need to flush the FP state into the
> thread when delivering the SIGTRAP. If you have a signal handler, that
> will be done for you by the signal code before laying out the signal
> frame. If you are using ptrace, you should be using the appropriate
> ptrace calls to retrieve the FP state and they should do the right thing
> to.
>
Aeh... Forget it! Thank you for the support.
Stefani
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-27 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-27 8:59 [PATCH] fix PPC floating point debug Stefani Seibold
2009-11-27 11:01 ` Benjamin Herrenschmidt
2009-11-27 12:44 ` Stefani Seibold
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).