From: David Gibson <david@gibson•dropbear.id.au>
To: linuxppc-embedded@lists•linuxppc.org
Subject: Re: applications in HHL 2.0, 405GP
Date: Wed, 19 Sep 2001 12:07:09 +1000 [thread overview]
Message-ID: <20010919120709.B13693@zax> (raw)
In-Reply-To: <01091812073101.04299@minotaur.mvista.com>
On Tue, Sep 18, 2001 at 12:05:09PM -0700, Joe Green wrote:
>
> David Updegraff wrote:
> > Anyway, I thought it was the "theory" that the kernel was trapping the
> > float instructions and emulating them...???
>
> Remember that it's not just a matter of configuring math emulation into
> the kernel. The function call ABI is different for soft vs. hard
> float, so library calls will go kerflooey if you mix the two. If you
> stick to all hard float user space, you can use kernel math emulation.
Except of course that the 4xx port as it stands doesn't support kernel
math emulation. The patch below adds support (and also lets 4xx do
the other emulated instructions that most of the ppc ports support).
Anyone care to merge it?
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/traps.c linux-bungo/arch/ppc/kernel/traps.c
--- /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/traps.c Tue Sep 4 19:13:42 2001
+++ linux-bungo/arch/ppc/kernel/traps.c Wed Sep 12 13:16:43 2001
@@ -267,6 +267,7 @@
{
#if defined(CONFIG_4xx)
unsigned int esr = mfspr(SPRN_ESR);
+ extern int do_mathemu(struct pt_regs *regs);
if (esr & ESR_PTR) {
#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
@@ -275,9 +276,19 @@
#endif
_exception(SIGTRAP, regs);
} else {
- _exception(SIGILL, regs);
+ int errcode;
+#ifdef CONFIG_MATH_EMULATION
+ if (do_mathemu(regs) == 0)
+ return;
+#endif /* CONFIG_MATH_EMULATION */
+ if ((errcode = emulate_instruction(regs))) {
+ if (errcode == -EFAULT)
+ _exception(SIGBUS, regs);
+ else
+ _exception(SIGILL, regs);
+ }
}
-#else
+#else /* ! CONFIG_4xx */
if (regs->msr & 0x100000) {
/* IEEE FP exception */
_exception(SIGFPE, regs);
@@ -286,7 +297,7 @@
#if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
if (debugger_bpt(regs))
return;
-#endif
+#endif /* defined(CONFIG_XMON) || defined(CONFIG_KGDB) */
_exception(SIGTRAP, regs);
} else {
/* Try to emulate it if we should. */
--
David Gibson | For every complex problem there is a
david@gibson•dropbear.id.au | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2001-09-19 2:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-07 11:18 swapspace in HHL 2.0 James F Dougherty
2001-09-07 18:27 ` Mark Hatle
2001-09-18 16:49 ` applications in HHL 2.0, 405GP David Updegraff
2001-09-18 19:05 ` Joe Green
2001-09-19 2:07 ` David Gibson [this message]
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=20010919120709.B13693@zax \
--to=david@gibson$(echo .)dropbear.id.au \
--cc=linuxppc-embedded@lists$(echo .)linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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