[comp.sys.mac.programmer] "Spurious Interrupt..." Problem

sean@eleazar.dartmouth.edu (Sean P. Nolan) (07/27/90)

Hi there...

I'm working on a project that uses a VBL task. The task is locked in the 
System Heap and VInstall'ed at INIT time. It is pretty benign, doing some 
floating-point calculations and then dropping out. It restores all its 
registers, and doesn't use any nasty memory-moving calls. (The Floating-
Point calls are via the _FP68K trap).

The task runs without a hitch on my SE running 6.0.5 system software. 
However, when I tried it on my girlfriend's SE/30 running 6.0.5, I ran into
trouble. It works ok (and calculates its values appropriately) for a short
while, usually about 4-5 minutes. Then, I drop into the debugger with a
"Spurious Interrupt or Unimplemented Interrupt Vector" message (equivalent
to System Error 11). This does NOT happen within my code, it happens always
within Dequeue or Date2Secs, and always during an FMOVE op. 

It's definitely something my task is doing, since the problem disappears
when the task is removed. But I can't figure it out for the life of me.
The only thing I can find anywhere is a note in IM II saying that the
Floating Point package does not preserve the state of the status register.
Should this matter? The register is saved and restored around my task, so it
should be ok, at least I think it should be.

Help! If anyone has run into a similar problem, please let me know. Thanks
for any help.

--- Sean

+----------------------------------------------------------------------------+
| Sean P. Nolan     |   Net: Sean_Nolan@Dartmouth.EDU   | "That's not a      |
| Dartmouth College |                                   |  baby, that's a    |
| Hinman Box 2658   |            SCALP 'EM!             |  Mr. Potatohead!"  |
| Hanover, NH 03755 |                                   |     --- A.W.O.T.M. |
+----------------------------------------------------------------------------+

beard@ux5.lbl.gov (Patrick C Beard) (07/27/90)

In article <23389@dartvax.Dartmouth.EDU> sean@eleazar.dartmouth.edu (Sean P. Nolan) writes:
#Hi there...
#
#I'm working on a project that uses a VBL task. The task is locked in the 
#System Heap and VInstall'ed at INIT time. It is pretty benign, doing some 
#floating-point calculations and then dropping out. It restores all its 
#registers, and doesn't use any nasty memory-moving calls. (The Floating-
#Point calls are via the _FP68K trap).
#
#The task runs without a hitch on my SE running 6.0.5 system software. 
#However, when I tried it on my girlfriend's SE/30 running 6.0.5, I ran into
#trouble. It works ok (and calculates its values appropriately) for a short
#while, usually about 4-5 minutes. Then, I drop into the debugger with a
#"Spurious Interrupt or Unimplemented Interrupt Vector" message (equivalent
#to System Error 11). This does NOT happen within my code, it happens always
#within Dequeue or Date2Secs, and always during an FMOVE op. 

Here is the problem:  SE's have no FPU, SE/30's have an FPU.  The problem
is that SANE (FP68k) doesn't save the FPU's state and so you have to do
it before using SANE at interrupt time.  The Sound Manager uses SANE at
interrupt time when processing bufferCmd's, and it as well gets these types
of crashes.  I have seen these many times before.

The solution to your problem is to do an FSAVE -(SP) on entry to your
routine, and FRESTORE (SP)+ before you exit, on machines that have FPU's.

--
-------------------------------------------------------------------------------
-  Patrick Beard, Macintosh Programmer                        (beard@lbl.gov) -
-  Berkeley Systems, Inc.  ".......<dead air>.......Good day!" - Paul Harvey  -
-------------------------------------------------------------------------------