F00F trap

Richard B. Johnson (root@chaos.analogic.com)
Tue, 18 Nov 1997 11:50:12 -0500 (EST)


Linus,
I have an idea about making the F00F trap work without
extensive modifications to existing procedures. I don't really
know how to use the gnu "pseudo assembly" so I have not tried it
on the kernel, however, I have a flat-mode OS that I wrote for
our cat-scanner, with the usual traps, written in Intel assembly,
and this seems to work.

(1) Use the new "bad" IDT alignment to force a page-fault.
(2) If the fault was due to the missing portion of the
IDT, Use LIDT to load the "good" descriptor that
is not missing from memory and execute _software_
interrupts for the 6 routines. Control will return
to the page-fault routine. On my system, reloading
the "context" of the interrupted task is easy. I don't
know how easy or hard it is in linux. Basically, I
force the faulting task to execute the software interrupts
from the kernel's code-segment so control returns to
the kernel's code-segment.
(3) When control returns, LIDT the "bad" descriptor
who's first 6 entries are not in memory.

On my system, this provides the intended behavior without having to
rewrite all the low-number traps.

Cheers,
Dick Johnson

Richard B. Johnson
Project Engineer
Analogic Corporation
Penguin : Linux version 2.1.63 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.