From ca6a6ec74c7db2849068f819951dd8b3375582f0 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 10 Mar 2024 15:30:24 +0000 Subject: [PATCH] base/dispatch-x86ish.S (dispatch_x86ish_cpuid): Skip `EFLAGS_ID' dance on AMD64. The 64-bit instruction set postdates the `cpuid' instruction. --- base/dispatch-x86ish.S | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/dispatch-x86ish.S b/base/dispatch-x86ish.S index 8a4c7b2e..3a14c396 100644 --- a/base/dispatch-x86ish.S +++ b/base/dispatch-x86ish.S @@ -67,7 +67,9 @@ FUNC(dispatch_x86ish_cpuid) endprologue // First, check that this is even a thing, using the complicated - // dance with the flags register. + // dance with the flags register. This is unnecessary on AMD64, + // which postdates the introduction of `cpuid'. +#if CPUFAM_X86 pushf pop DX // current flags in d @@ -86,6 +88,7 @@ FUNC(dispatch_x86ish_cpuid) pop DX test edx, EFLAGS_ID jnz 8f +#endif // OK, that seemed to work. cpuid @@ -108,6 +111,7 @@ FUNC(dispatch_x86ish_cpuid) ret // Failed. +#if CPUFAM_X86 8: xor eax, eax mov [OUT + 0], eax mov [OUT + 4], eax @@ -115,6 +119,7 @@ FUNC(dispatch_x86ish_cpuid) mov [OUT + 12], eax mov eax, -1 jmp 9b +#endif ENDFUNC ///-------------------------------------------------------------------------- -- 2.11.0