Page 1 of 1
coprocessor error
Posted: Sat Feb 07, 2004 1:29 pm
by beyondsociety
I have been having a problem with my code for some time and I think I have finally found my problem. Does anybody know why my code would generate a coprocessor error.
In the intel manuals it says: [glow=blue,2,300]If the detected exception is not masked by a bit in the control word, the coprocessor communicates the fact that an error occurred to the CPU by a signal at the ERROR# pin. The CPU causes interrupt 16 the next time it checks the ERROR# pin, which is only at the beginning of a subsequent WAIT or certain ESC instructions. If the exception is masked, the numerics coprocessor handles the exception according to on-board logic; it does not assert the ERROR# pin in this case.[/glow]
I understand what this says, but I cant find the problem. Could it be in my re-mapping of the PICs code?
Re:coprocessor error
Posted: Sun Feb 08, 2004 4:40 pm
by Pype.Clicker
it might be the PIC, but i hardly see how you could have remapped things at INT 0x10 by mistake ... you're not trying to call VGA bios interrupt, are you ?
Re:coprocessor error
Posted: Sun Feb 08, 2004 7:36 pm
by beyondsociety
Pype.Clicker wrote:
it might be the PIC, but i hardly see how you could have remapped things at INT 0x10 by mistake ... you're not trying to call VGA bios interrupt, are you ?
No, Im not trying to call the VGA BIOS interrupt. Let me example the problem a little better.
For some reason my fault handler will get called and no matter what I do, it will still come up. But then I'll test it again and the problem will go away. Then a week later, it will re-surface again. Then it goes away. This has been driving me crazy. I had finally gotten around to designing my fault handler better and it drops the coprocessor error. Before, it faulted but wouldnt print anything to the screen as I tested this with adding debug info to be displayed. What could be the problem?
Re:coprocessor error
Posted: Mon Feb 09, 2004 3:36 am
by Pype.Clicker
one thing that could be wrong is that you appear to have no "wait for completion" in the 8259 reprogramming ... depending on your hardware speed, it may work or it may not ...
i had myself problems with things like these and used an "in al,21h" after outs to force the CPU to synchronize with 8259, or just a busy loop of 4096 iterations.
however, if you receive IRQ0 on the expected IRQ, there are chances the initialisation is okay ... Do you know if the problem is bound to a specific machine or can you reproduce it on other systems (including emulators like Bochs or VMware) ?
Maybe it's another exception and your code is messing up between exception nr and error codes ?
Do you know on which instruction the problem arise ? (trace-on option in BOCHS may help figuring out) ...
Sorry for having so much questions and so little hints ...
Re:coprocessor error
Posted: Mon Feb 09, 2004 4:47 pm
by beyondsociety
I disabled all my code except what was needed to test an irq0 and it worked. I then commented it out and ran my code to see if it would trigger a coprocessor error and to my shock it wasnt displayed. Weird huh?
I was previously delaying my code with a basic for loop and I started getting this error. Could the delay have caused this waiting error? because this is all I can figure as the problem besides my PIC code not correct, but it is.
I tested it on the two computers I had and was previously getting that error, now its fine. Both are HP 8240's with pentium 133's. I havent tested it on bochs let as I havent figured out a way to get my kernel to load with it, I currently using cygwin to compile my os. By the way, Im using grub. IF you want to test it on your computer, just say so and I'll give you the necessary files.