Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Aug 1998 01:43:33 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        bde@zeta.org.au, cracauer@cons.org, current@FreeBSD.ORG, luoqi@watermarkgroup.com, shocking@prth.pgs.com
Subject:   Re: Floating Point Exceptions, signal handlers & subsequent ops
Message-ID:  <199808290143.SAA29643@usr01.primenet.com>
In-Reply-To: <199808271224.WAA25445@godzilla.zeta.org.au> from "Bruce Evans" at Aug 27, 98 10:24:58 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >> I wrote the assembler code.  Run it under gdb and look at the FP
> >> state using `info float'.  Homework: explain why this generates
> >> only 6 SIGFPE's although it divides by 0.0 by 0.0 8 times.
> >       ^
> >Don't you mean 7?
> 
> Oops.  I miscounted 6 and thought that it was missing 1 for both the
> first and the last division.

A general 5,000 foot view onto the "Homework" problem:

FP exceptions are signalled on the FP instruction following the
exception.  That is, you have to try to use the thing again to
generate an exception.

This is a rather bogus hardware implementation, unless you are ignoring
exceptions entirely, in which case, it saves an instruction restart
for each exception.

FreeBSD does lazy task switching; that it, FreeBSD does not do
FP register saves on task switches, unless necessary, and does not
do implict saves via TSS, since it does not use TSS for the switch
(ie: it doesn't go through a task gate, except to get in and out
of VM86 mode).

Non-lazy task switching would cause context switch to be much higher
overhead (as in Linux), but would cause the exception to be raised
in the context of the process that caused it.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808290143.SAA29643>