X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Farm%2Fvfp%2Fvfpmodule.c;h=03486be04193e0497f8258d45d4be1ef02656258;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=4178f6cc3d3714deec92f88f4480838b0450c447;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 4178f6cc3..03486be04 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -9,13 +9,12 @@ * published by the Free Software Foundation. */ #include +#include #include #include #include #include #include - -#include #include #include "vfpinstr.h" @@ -37,54 +36,37 @@ union vfp_state *last_VFP_context; */ unsigned int VFP_arch; -static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) +/* + * Per-thread VFP initialisation. + */ +void vfp_flush_thread(union vfp_state *vfp) { - struct thread_info *thread = v; - union vfp_state *vfp = &thread->vfpstate; - - switch (cmd) { - case THREAD_NOTIFY_FLUSH: - /* - * Per-thread VFP initialisation. - */ - memset(vfp, 0, sizeof(union vfp_state)); - - vfp->hard.fpexc = FPEXC_ENABLE; - vfp->hard.fpscr = FPSCR_ROUND_NEAREST; + memset(vfp, 0, sizeof(union vfp_state)); - /* - * Disable VFP to ensure we initialise it first. - */ - fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE); + vfp->hard.fpexc = FPEXC_ENABLE; + vfp->hard.fpscr = FPSCR_ROUND_NEAREST; - /* - * FALLTHROUGH: Ensure we don't try to overwrite our newly - * initialised state information on the first fault. - */ - - case THREAD_NOTIFY_RELEASE: - /* - * Per-thread VFP cleanup. - */ - if (last_VFP_context == vfp) - last_VFP_context = NULL; - break; - - case THREAD_NOTIFY_SWITCH: - /* - * Always disable VFP so we can lazily save/restore the - * old state. - */ - fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE); - break; - } + /* + * Disable VFP to ensure we initialise it first. + */ + fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE); - return NOTIFY_DONE; + /* + * Ensure we don't try to overwrite our newly initialised + * state information on the first fault. + */ + if (last_VFP_context == vfp) + last_VFP_context = NULL; } -static struct notifier_block vfp_notifier_block = { - .notifier_call = vfp_notifier, -}; +/* + * Per-thread VFP cleanup. + */ +void vfp_release_thread(union vfp_state *vfp) +{ + if (last_VFP_context == vfp) + last_VFP_context = NULL; +} /* * Raise a SIGFPE for the current process. @@ -131,7 +113,7 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_ pr_debug("VFP: raising exceptions %08x\n", exceptions); - if (exceptions == VFP_EXCEPTION_ERROR) { + if (exceptions == (u32)-1) { vfp_panic("unhandled bounce"); vfp_raise_sigfpe(0, regs); return; @@ -170,7 +152,7 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_ */ static u32 vfp_emulate_instruction(u32 inst, u32 fpscr, struct pt_regs *regs) { - u32 exceptions = VFP_EXCEPTION_ERROR; + u32 exceptions = (u32)-1; pr_debug("VFP: emulate: INST=0x%08x SCR=0x%08x\n", inst, fpscr); @@ -299,8 +281,6 @@ static int __init vfp_init(void) (vfpsid & FPSID_VARIANT_MASK) >> FPSID_VARIANT_BIT, (vfpsid & FPSID_REV_MASK) >> FPSID_REV_BIT); vfp_vector = vfp_support_entry; - - thread_register_notifier(&vfp_notifier_block); } return 0; }