Experimental Physics and
This is a interesting topic.
I searched thru the vxWorks kernel programmer manual from 5.3.1, 5.5, 6.0, 6.x all the way to 6.8.
Nowhere sprintf is mentioned to be illegal in ISR.
Clearly, printf, malloc ... are not allowed.
But I think all agree that sprintf is fat and heavy, so try use as little as possible.
And if any floating point involved, fppSave/fppRestore are needed.
When I dig into source code, more fun there.
In vxWorks, before AltiVec support, sprintf seems safe, no any funny call there, and the implementation is much lighter than regular GNU implementation.
After AltiVec, when sprintf try to line-up vector, malloc could be invoked!!!
So Steve is definitely right, this sprintf is no good.
When look into GNU implementation, malloc is in many places, so no good.
General speaking, no sprintf in ISR, is not because of floating point, but malloc, and heavy/fat anyway.
I have to say one of the major reason the sprintf gets into ISR is because people try to make code OSI compatible.
But epicsInterruptContextMessage is too simple to use. It takes only a string, no any other parameter.
This is the major reason people use sprintf to prepare that string.
epicsInterruptContextMessage should be really written to use logMsg/printk and support a few parameters.
BTW, according to QNX manual, in QNX, strcpy, strxxx ... except strdup are ISR safe, so does memcpy ...
|ANJ, 02 Sep 2010||
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·