| To: | ralf@linux-mips.org |
|---|---|
| Subject: | Re: [PATCH] rewrite restore_fp_context/save_fp_context |
| From: | Atsushi Nemoto <anemo@mba.ocn.ne.jp> |
| Date: | Sun, 19 Nov 2006 22:54:03 +0900 (JST) |
| Cc: | linux-mips@linux-mips.org |
| In-reply-to: | <20061118.232717.07456069.anemo@mba.ocn.ne.jp> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <20061114174608.GA5740@linux-mips.org> <20061116.001725.75185058.anemo@mba.ocn.ne.jp> <20061118.232717.07456069.anemo@mba.ocn.ne.jp> |
| Sender: | linux-mips-bounce@linux-mips.org |
On Sat, 18 Nov 2006 23:27:17 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp>
wrote:
> So, we still should very careful to using fp instruction in kernel
> even if the instruction did not change the fpu state. The last part
> of setup_sigcontext() should become something like this:
>
> err |= __put_user(!!used_math(), &sc->sc_used_math);
>
> /*
> * Save FPU state to signal context. Signal handler will "inherit"
> * current FPU state.
> */
> if (used_math()) {
> preempt_disable();
> if (!is_fpu_owner()) {
> own_fpu();
> restore_fp(current);
> }
> preempt_enable();
> err |= save_fp_context(sc);
> }
> return err;
Unfortunately, still this is not safe. preempt_enable() might call
local_irq_enable() so it might lose fpu ownership without clearing CU1
bit...
So something like this ugly check should be needed.
preempt_disable();
if (!is_fpu_owner()) {
own_fpu();
restore_fp(current);
}
preempt_enable();
/* make sure CU1 and FPU ownership are consistent */
if (!__is_fpu_owner() && (read_c0_status() & ST0_CU1))
__disable_fpu();
err |= save_fp_context(sc);
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] rewrite restore_fp_context/save_fp_context, Atsushi Nemoto |
|---|---|
| Next by Date: | Fix long IDE detection delay by not scanning non-existent channels, Martin Michlmayr |
| Previous by Thread: | Re: [PATCH] rewrite restore_fp_context/save_fp_context, Atsushi Nemoto |
| Next by Thread: | A promble about driver, WhiteFox |
| Indexes: | [Date] [Thread] [Top] [All Lists] |