On Wed, 19 Aug 2015 01:22:03 -0400, Peter Cheung <
mche...@gmail.com> wrote:
> my way to handle exception 0x7 is too simple and naive, but it just
> works for me, basically i dont know much about the fpu
You probably need to look at setting or clearing bits
CR0.NE and CR0.EM in CR0, perhaps calling a few FPU
instructions, and writing to a couple of ports.
CR0.EM (bit 2) - selects external (0) math coprocessor
(for 386 or earlier) to trap Int 0x07, or internal (1)
math coprocessor for 486 or newer
CR0.NE (bit 5) - selects hardware (0) IRQ 13h (Int 0x75)
or software (1) Int 0x10 (1) for numerical exceptions
At a minimum, you may want to clear FPU exceptions with
FNCLEX instruction (DB E2) during exceptions. You might
want to also initialize the FPU with the FNINIT instruction
(DB E3) when your OS starts.
You can use an out port instruction to port 0xF0 with value
0x00 to clear the coprocessor busy latch, and out port
instruction to 0xF1 with value 0x00 to reset the coprocessor.
286 or 386 generate Int 09h for coprocessor exceptions.
486 or newer generates Int 0Dh for coprocessor exceptions.
Rod Pemberton
--
Scientists now say we'll experience a mini-ice in 2030.
So, I guess we need more global warming today ...