I am running code on a 5509A, and I am not using DSP/BIOS.
I have a periodic interrupt triggered on the nINT0 pin (external interrupt) that occurs every 256us. The code in that interrupt runs for about 40us.
I am processing data in between that interrupt. Part of that processing calls for my code to accumulate a 64-bit value (stored in a struct). I use an assembly code function to add two 64-bit numbers. Inevitably, the interrupt eventually fires while I am in this assembly function. Usually this causes no problem, but it apparently destroys one, or some, of the registers on occasion.
The result seems to be a return of the same number that was passed (this is an accumulation function) so that that call does not accumulate. The end result is that if I am accumulating 14 results, my final accumulation includes only 13 of them.
This accum function is called in a for loop to sum up an array for averaging. I have verified that it has looped in the for loop the correct number of times when it fails, but it is as if one of the 14 values was not accumulated.
It seems that when the C coded interrupt hits, the context save is not quite complete. I am experimenting with pushing and popping all registers at entrance and exit of the interrupt, but that is an ugly solution. My understanding of SPRU281f Section 6.6.3 is that a properly declared C interrupt should take care of context saving.
Is there something different when C code interrupts assembly code?