Re: i486 emu in mainline?

From: Maciej W. Rozycki
Date: Mon May 24 2004 - 07:29:07 EST


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@xxxxxxxxxxxxx, PGP key available +
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/