Recently, I have had problems with FPU stack overflow. I managed to track it back to the buggy library function, which pops the garbage value onto the FPU stack every time it is called and never clears it.
Fortunately, this is easy to reproduce, and I know exactly what conditions cause it. I can drop the embedded ASM block into a routine that calls this procedure to pop the top value from the FPU stack ... except that I don’t quite know what to write. My ASM-fu is fair for middlin ', but not so strong.
So, what is the easiest way to get rid of the top value on the FPU stack in the x86 assembly, assuming it's junk data, and I don't care about the value?
assembly x86 x87
Mason wheeler
source share