Re: MMX emulator ?

Horst von Brand (vonbrand@sleipnir.valparaiso.cl)
Sun, 28 Jun 1998 20:38:31 -0500


Sylvain Pion <Sylvain.Pion@sophia.inria.fr> said:
> On Sun, Jun 28, 1998 at 06:51:00PM +0200, Andrea Arcangeli wrote:
> > >I wondered whether there has been some thoughts about implementing an MMX
> > >emulator in the kernel, something like the FPU emulator. It sounds like a
> >
> > Intel say that it' s impossible. From 24319201.pdf section 10.1:
> >
> > 10.1. EMULATION OF THE MMX™ INSTRUCTION SET
> >
> > The Intel Architecture does not support emulation of the MMX
> > technology, as it does for floating-point instructions. The EM
> > flag in control register CR0 (provided to invoke emulation of
> > floating-point instructions) cannot be used for MMX instruction
> > emulation. If an MMX instruction is executed when the EM flag is
> > set, an invalid opcode (UD#) exception is generated.

> Well, I already have a prototype (very very very alpha/dirty) that begins to
> work. Cf http://www.inria.fr/prisme/personnel/pion/progs/linux if you're
> interested. The emulation is actually done via the invalid opcode exception,
> caught by the kernel, which in turn sends SIGILL to the process. What Intel
> says is that they do not support hardware help for the emulation (and I don't
> know what's the benefit of that anyway), but we don't need it.

Just add up the cost of the exception handling, plus the SIGILL handling,
plus the context switches involved... and consider if that cost *for each
instruction* is worth it to "speed up" the bit fiddling.

-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile                               +56 32 672616

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu