Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Carsten Langgaard <carstenl@mips.com>
To: Daniel Jacobowitz <dan@debian.org>
Cc: linux-mips@oss.sgi.com
Subject: Re: FP emulator patch
Date: Thu, 16 Aug 2001 09:07:48 +0200	[thread overview]
Message-ID: <3B7B7143.AFAF1ABF@mips.com> (raw)
In-Reply-To: 20010815110634.A19305@nevyn.them.org

Daniel Jacobowitz wrote:

> On Wed, Aug 15, 2001 at 02:53:12PM +0200, Carsten Langgaard wrote:
> > There has been some reports regarding FP emulator failures, which the
> > attached patch should solve.
> > The patch include a fix for emulation of instructions in a COP1
> > delay-slot, a fix for FP context switching and some additional stuff ,
> > which was needed to pass our torture test.
> >
> > Ralf could you please apply this patch.
>
> Two comments, especially since parts of this seem to be the patch I
> posted here over a month ago.

You are absolutely right, it's your old patch.

>
> > Index: linux/arch/mips/kernel/signal.c
>
> > @@ -353,12 +355,11 @@
> >       owned_fp = (current == last_task_used_math);
> >       err |= __put_user(owned_fp, &sc->sc_ownedfp);
> >
> > -     if (current->used_math) {       /* fp is active.  */
> > +     if (owned_fp) { /* fp is active.  */
> >               set_cp0_status(ST0_CU1);
> >               err |= save_fp_context(sc);
> >               last_task_used_math = NULL;
> >               regs->cp0_status &= ~ST0_CU1;
> > -             current->used_math = 0;
> >       }
> >
> >       return err;
>
> This is absolutely not right.  It's righter than the status quo.  If we
> don't own the FP, you don't save the FP.  Then we can use FP in the
> signal handler, corrupting the process's original floating point
> context.

You are probably right, this is not a proper fix, but at least it solves the problems people
has been seeing.
So until we come up with a better fix, this is still better than the current sources.

>
> > Index: linux/include/asm-mips/processor.h
>
> > @@ -235,8 +215,8 @@
> >   * Do necessary setup to start up a newly executed thread.
> >   */
> >  #define start_thread(regs, new_pc, new_sp) do {                              \
> > -     /* New thread looses kernel privileges. */                      \
> > -     regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|ST0_KSU)) | KU_USER;\
> > +     /* New thread loses kernel and FPU privileges. */               \
> > +        regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|ST0_KSU|ST0_CU1)) | KU_USER;\
> >       regs->cp0_epc = new_pc;                                         \
> >       regs->regs[29] = new_sp;                                        \
> >       current->thread.current_ds = USER_DS;                           \
>
> I could be misremembering, but I believe that Ralf said this should be
> unnecessary and the problem was somewhere else.  On the other hand, I
> still think it's a good idea.
>
> --
> Daniel Jacobowitz                           Carnegie Mellon University
> MontaVista Software                         Debian GNU/Linux Developer

--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com

  parent reply	other threads:[~2001-08-16  7:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-15 12:53 FP emulator patch Carsten Langgaard
2001-08-15 18:06 ` Daniel Jacobowitz
2001-08-16  0:05   ` Kevin D. Kissell
2001-08-16  0:05     ` Kevin D. Kissell
2001-08-16  4:20   ` Atsushi Nemoto
2001-08-16 12:35     ` Kevin D. Kissell
2001-08-16 12:35       ` Kevin D. Kissell
2001-08-16  7:07   ` Carsten Langgaard [this message]
2001-08-16  4:35 ` Atsushi Nemoto
  -- strict thread matches above, loose matches on Subject: below --
2001-08-16 18:23 Kevin D. Kissell
2001-08-16 18:23 ` Kevin D. Kissell
2001-08-16 18:49 ` Pete Popov
2001-08-16 18:53 ` Daniel Jacobowitz
2001-08-16 19:15   ` Jun Sun
2001-08-16 20:40     ` Kevin D. Kissell
2001-08-16 20:40       ` Kevin D. Kissell
2001-08-16 21:34       ` Jun Sun
2001-08-16 22:33         ` Kevin D. Kissell
2001-08-16 22:33           ` Kevin D. Kissell
2001-08-16 22:38           ` Pete Popov
2001-08-16 22:37         ` Daniel Jacobowitz
2001-08-16 23:12           ` Jun Sun
2001-08-16 23:38           ` Kevin D. Kissell
2001-08-16 23:38             ` Kevin D. Kissell
2001-08-16 19:20 ` Kevin D. Kissell
2001-08-16 19:20   ` Kevin D. Kissell
2001-08-16 20:20   ` Jun Sun
2001-08-16 22:58 Kevin D. Kissell
2001-08-16 22:58 ` Kevin D. Kissell
2001-08-16 23:14 ` Jun Sun
2001-08-16 23:46   ` Kevin D. Kissell
2001-08-16 23:46     ` Kevin D. Kissell
2002-09-10 11:55 Carsten Langgaard

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=3B7B7143.AFAF1ABF@mips.com \
    --to=carstenl@mips.com \
    --cc=dan@debian.org \
    --cc=linux-mips@oss.sgi.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