Re: PATCH - assembler glitches

Richard B. Johnson (root@chaos.analogic.com)
Tue, 12 Oct 1999 17:40:39 -0400 (EDT)


On Tue, 12 Oct 1999, Martin Dalecki wrote:

> The attached patch is sweepping out obvious errors in IA32 assembler
> code.
> Just apply it.
>
> --Marcin Dalecki

Does the new gas 'know' when you are not yet in 32-bit protected mode
and/or when you are? If not, you will end up with a bunch of 0x66
prefixes which are not correct.

For instance, movl %edx, %eax in 32-bit mode is exactly the same
code as movw %dx, %ax in 16-bit mode. If gas thinks it's in
32-bit mode, and you do movw %dx, %ax it will put 0x66 as a prefix.

By the same token, if you truly are in 32-bit mode, and you want
to do movw %dx, %ax, the resulting code must have a 0x66 prefix.

I see in the patch, a number of instances where a movw will be
made to a segment register. This forces an extra 0x66 prefix which
is not necessary as longword moves to segment registers is allowed.

You need to look through the binary produced in the boot code
before the machine enters protected mode and look for 0x66. If
these exist as a prefix, something is wrong and, although you
can be lucky most of the time, the result may be an unbootable
machine.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/