Experimental Physics and Industrial Control System
Subject: |
devVXStats.c corrupts Intel floating point unit |
From: |
[email protected] (Jeff Hill) |
To: |
"EPICS-tech-talk (E-mail)" <[email protected]> |
Date: |
Fri, 12 Mar 1999 17:56:08 -0700 |
All,
This message is in reference to "devVXStats" which is not a part of
EPICS base but may nevertheless be in use at a number of EPICS
sites. This code is EPICS device support which is used to monitor an
IOC's state of health.
Symptom:
Mysterious floating point value corruption in an analog input record
which initially defies any rational explanation.
Cause:
After some considerable effort I have discovered that a floating point
value corruption occurring in our Intel-based IOCs was caused by a
missing function prototype for the function "sqrt()" in devVXStats.c.
It appears the Intel floating point unit became corrupted in a task
spawned off by devVXStats.c for the purpose of calculating the IOC's
CPU consumption. The "sqrt()" call was used by devVXStats.c to
consume CPU and thereby estimate CPU consumption in a low priority
task, and so the code was not interested in the result from "sqrt()".
The compiler assumed that the function returned type "int" when in fact
a double precision floating point number was returned, and this
appears to have corrupted the floating point unit. The result was that
another task in the system produced a not-a-number IEEE floating point
value in the ESLO field of an analog input record during EPICS
initialization. When the record processed the NaN value was propagated
to the VAL field of the ai record.
Resolution:
Here is the patch we applied which eliminated the problem:
D:\hill\leda\share\rp\src>cvs diff -r 1.2 -r 1.1 devVXStats.c
Index: devVXStats.c
===================================================================
RCS file: /usr/local/cvsroot/share/rp/src/devVXStats.c,v
retrieving revision 1.2
retrieving revision 1.1
diff -r1.2 -r1.1
24d23
< #include <math.h>
Jeff
______________________________________________________
Jeffrey O. Hill Internet [email protected]
LANL MS H820 Voice 505 665 1831
Los Alamos NM 87545 USA FAX 505 665 5107
- Navigate by Date:
- Prev:
EPICS on x86 john sinclair
- Next:
Re: EPICS on x86 Ralph Lange
- Index:
1994
1995
1996
1997
1998
<1999>
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: EPICS on x86 Brian McAllister
- Next:
pcompress->alg == compressALG_N_to_1_Median William Lupton
- Index:
1994
1995
1996
1997
1998
<1999>
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024