April 19th, 2007, 10:42 PM
CPU Flags changed, Divid error is taken place.
I'm checking a bug for my program which is running on a 80186 CPU. I found there was a strange issue:
There is a function which send some parameters to a port.
Before write parameter to the port I save CPU flags to stack and disable the interrupt. Flags is resumed after output operation is done. All routine is below. (Mixed asm and C)
However , when popf is executed. An exception is occurred.
- Divide error. This bug is very hard to reproduce. So, I'm confused. FLAGs changing can result in interrupt#0?
I had checked specification of CPU, nothing I can find there?
So, anybody have been met this kind of problem?