Messages in this thread | | | Date | Wed, 29 Oct 1997 23:46:58 +0100 (MET) | From | Gabriel Paubert <> | Subject | Re: Kernels 2.1 with 386DX/387 IRQ13 PC boxes |
| |
On Wed, 29 Oct 1997, C. Scott Ananian wrote:
> On Tue, 28 Oct 1997 root <root@mangue.ibm.net> wrote: > > > Now my question : How to test it? How to generate an IRQ13 interrupt? > > Perhaps try creating illegal floating-point numbers by type-casting to > (float *)? I'd have to read up more on the Intel FPU architecture to > suggest specifics, but it's a direction that might be worth a try. > --Scott
The simplest way is to generate an invalid stack exception. Init the coprocessor, load a new value into the control word to enable invalid exceptions. Then any instruction which uses a FP register will fault. The following should work (I've just tested it on a P5-133):
unsigned short cw=0x340; asm volatile("fninit; fldcw %0; fld %%st; wait": : "m" (cw));
The wait is necessary because floating point exceptions are delayed on Intel coprocessors.
You see that you do not need to try to create a divide by zero or whatever, stack faults are so easy to produce, you always end up with one when trying to program more than a few FP instructions in assembly ;)
Gabriel.
| |