Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba0593bf authored by H. Peter Anvin's avatar H. Peter Anvin
Browse files

x86: completely disable NOPL on 32 bits



Completely disable NOPL on 32 bits.  It turns out that Microsoft
Virtual PC is so broken it can't even reliably *fail* in the presence
of NOPL.

This leaves the infrastructure in place but disables it
unconditionally.

Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent 5132895f
Loading
Loading
Loading
Loading
+4 −20
Original line number Original line Diff line number Diff line
@@ -344,31 +344,15 @@ static void __init early_cpu_detect(void)


/*
/*
 * The NOPL instruction is supposed to exist on all CPUs with
 * The NOPL instruction is supposed to exist on all CPUs with
 * family >= 6, unfortunately, that's not true in practice because
 * family >= 6; unfortunately, that's not true in practice because
 * of early VIA chips and (more importantly) broken virtualizers that
 * of early VIA chips and (more importantly) broken virtualizers that
 * are not easy to detect.  Hence, probe for it based on first
 * are not easy to detect.  In the latter case it doesn't even *fail*
 * principles.
 * reliably, so probing for it doesn't even work.  Disable it completely
 * unless we can find a reliable way to detect all the broken cases.
 */
 */
static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
{
{
	const u32 nopl_signature = 0x888c53b1; /* Random number */
	u32 has_nopl = nopl_signature;

	clear_cpu_cap(c, X86_FEATURE_NOPL);
	clear_cpu_cap(c, X86_FEATURE_NOPL);
	if (c->x86 >= 6) {
		asm volatile("\n"
			     "1:      .byte 0x0f,0x1f,0xc0\n" /* nopl %eax */
			     "2:\n"
			     "        .section .fixup,\"ax\"\n"
			     "3:      xor %0,%0\n"
			     "        jmp 2b\n"
			     "        .previous\n"
			     _ASM_EXTABLE(1b,3b)
			     : "+a" (has_nopl));

		if (has_nopl == nopl_signature)
			set_cpu_cap(c, X86_FEATURE_NOPL);
	}
}
}


static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
static void __cpuinit generic_identify(struct cpuinfo_x86 *c)