lkml.org 
[lkml]   [1997]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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.

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.043 / U:0.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site