lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Detecting use of floating point


From: Sandro Magi
Subject: Re: [Lightning] Detecting use of floating point
Date: Sat, 23 Feb 2008 00:57:45 -0500

On Sat, Feb 23, 2008 at 12:35 AM, tim <address@hidden> wrote:
> For X86, the TS bit of CR0 (X86), if on ,forces a fault if FP is used.
>  It is set by a hardware context switch and reset by a privileged
>  instruction.
>
>  The EM bit may also be useful.
>
>  The OS formally does this for you. If you are writing the OS, you woudl
>  have the authority to MOV into CR0.
>
>  Some CPUs have this facility and others do not.

Thanks for the pointers. I knew it could be done with ring-0
privilege, as I've studied OSes that use this optimization. I was just
wondering whether it could be done at user level. I suspect that most
operating systems don't expose an API to access this state. The C99
fenv.h header [1] exposes an interface to some floating point state,
but it's mainly limited to exceptional conditions and rounding modes.

Sandro

[1] http://www.opengroup.org/onlinepubs/009695399/basedefs/fenv.h.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]