This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Re: libm use in kernel


> From: Christophe Coutand [mailto:ccoutand@stmi.com] 
> 
> Thanks for the explanation.
> 
> You are correct, eCos is making use of this mechanism in the i386 HAL:
> 
> 	cdl_option CYGHWR_HAL_I386_FPU_SWITCH_LAZY {
> 	    display       "Use lazy FPU state switching"
> 	    flavor        bool
> 	    default_value 1
> 
> 	    description "
> 	                This option enables lazy FPU state switching.
>                       The default behaviour for eCos is to save and
>                       restore FPU state on every thread 
> switch, interrupt
> 	                and exception. While simple and 
> deterministic, this
> 	                approach can be expensive if the FPU is 
> not used by
> 	                all threads. The alternative, enabled 
> by this option,
> 	                is to use hardware features that allow 
> the FPU state
> 	                of a thread to be left in the FPU after 
> it has been
> 	                descheduled, and to allow the state to 
> be switched to
> 	                a new thread only if it actually uses 
> the FPU. Where
> 	                only one or two threads use the FPU 
> this can avoid a
> 	                lot of unnecessary state switching."
> 	}

Hmmm. It refers to thread switches, interrupts and exceptions. But what
about DSRs? A DSR isn't a thread, with a state that persists from one
invocation to another.

A cursory examination of the kernel DSR code leads me to believe that when
the kernel runs DSRs, it hasn't saved the FP state and provided a clean one.
This would mean that on the i386 platform one couldn't use FP instructions
in a DSR without explicitly saving the FP state and initing the FP unit
first, and restoring the state after. Furthermore, this would be true
regardless of the setting of that CDL option. I could be wrong about this,
but that's the way it looks to me.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com 


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]