Subject: Re: Lazy FPU context switch
To: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
From: Matt Thomas <matt@3am-software.com>
List: port-mips
Date: 04/16/2000 19:04:14
At 06:48 PM 4/16/00 , Toru Nishimura wrote:
>If a process inhibited to use FPU is about to execute a FP insn,
>CPU posts 'unavailable' exception.  Global variable fpcurproc points
>which process has the ownership of FPU.  At the moment upon
>'unvailable' exception, FPU hardware should contain the snapshot
>of 'runtime image' for the owner process, which is different from
>curproc that has posted the exception.  Unavailable handler saves
>the FPU hardware context made with a large number of FP registers
>for the sake of fpcurproc, and load the curproc's FPU hardware
>context into FPU registers.  The initial load of process FPU context
>clears entire FPU.  In this way, FPU context switch is deferred
>until another process is found requesting to use FPU.  Because the
>vast majority of programs run no FP insn during process life time,
>deferred lazy FPU context switch works handsomely avoiding rather
>burdensome tasks of FPU save/load operations.

You need to be careful to properly cleanup the lazy fp context with
the fpcurproc exits.
-- 
Matt Thomas               Internet:   matt@3am-software.com
3am Software Foundry      WWW URL:    http://www.3am-software.com/bio/matt/
Cupertino, CA             Disclaimer: I avow all knowledge of this message