base/dispatch-x86ish.S (dispatch_x86ish_cpuid): Skip `EFLAGS_ID' dance on AMD64.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 Mar 2024 15:30:24 +0000 (15:30 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 10 Mar 2024 16:04:50 +0000 (16:04 +0000)
The 64-bit instruction set postdates the `cpuid' instruction.

base/dispatch-x86ish.S

index 8a4c7b2..3a14c39 100644 (file)
@@ -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
 
 ///--------------------------------------------------------------------------