Re: [PATCH] x86: Don't use NOPL on 32-bit cpu's because not all systems support it.

H. Peter Anvin
2008-09-16T18:03:59Z

>
> I think you still want the nopl enabled for 64-bits.
>

Yes. Accordingly, I didn't change 64 bits.

> int main()
> {
> signal(SIGILL, except);
> asm("\n"
> "mov $0x01, %eax\n" /* function number */
> ".byte 0x0f, 0x3f, 0x07, 0x0b\n" /* call VPC */
> );
> printf("Inside Virtual PC\n");
> return 0;
> }

Well, isn't that "interesting". 0F 3F is in the range expected
(although not documented) to be used for 3-byte opcode prefixes in the
future. It's also the Centaur ALTINST instruction (which I believe have
to be enabled via an MSR, so in that way it's not a bad choice.)

It's definitely less broken than the official way to detect VMWare, but
still pretty daft. (CPUID, MSR or PCI IDs make a lot more sense.)

The "official" way to detect Virtual PC is apparently to look for
"Microsoft Corportation" as the DMI motherboard manufacturer. This is
downright dangerously stupid, since Microsoft likes to make false starts
in the hardware business on a regular basis, and doesn't work with old
Connectix VPC anyway. However, there is supposedly "Virtual Machine" as
the model, which can be used to disambiguate.

-hpa