Re: i486 emu in mainline?

Maciej W. Rozycki
2004-05-24T12:28:22Z

On Sun, 23 May 2004, Christoph Hellwig wrote:

> + /* we'll verify if this is a BSWAP opcode, main source of SIGILL on 386's */
> + if ((*eip & 0xF8) == 0xC8) { /* BSWAP */
> + u8 reg;
> +
> + reg = *eip++ & 0x07;
> + src = reg_address(regs, 1, reg);
> +
> + __asm__ __volatile__ (
> + "xchgb %%al, %%ah\n\t"
> + "roll $16, %%eax\n\t"
> + "xchgb %%al, %%ah\n\t"
> + : "=a" (*(u32*)src)
> + : "a" (*(u32*)src));
> + regs->eip = (u32)eip;
> + goto out;
> + }

You've forgotten about the 16-bit variant here -- the emulation is wrong
with PREFIX_D32. This may not matter much in practice, though.

--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +