This applies to 32 bit and 64 bit discover_x86_cpu_type()
implementations. In both cases %ebx was not being preserved as is
required by the ABI.
---
 i386/i386/locore.S | 2 ++
 x86_64/locore.S    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index dc761991..9d2c702c 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1234,7 +1234,9 @@ ENTRY(discover_x86_cpu_type)
        /* We are a modern enough processor to have the CPUID instruction;
           use it to find out what we are. */
 0:     movl    $1,%eax                 /* Fetch CPU type info ... */
+       pushl   %ebx                    /* Preserve to comply with ABI */
        cpuid                           /*  ... into eax */
+       popl    %ebx
        movl    %ecx,cpu_features_ecx   /* Keep a copy */
        movl    %edx,cpu_features_edx   /* Keep a copy */
        shrl    $8,%eax                 /* Slide family bits down */
diff --git a/x86_64/locore.S b/x86_64/locore.S
index dd35d2f8..31a57688 100644
--- a/x86_64/locore.S
+++ b/x86_64/locore.S
@@ -1563,7 +1563,9 @@ ENTRY(discover_x86_cpu_type)
        /* We are a modern enough processor to have the CPUID instruction;
           use it to find out what we are. */
        movl    $1,%eax                 /* Fetch CPU type info ... */
+       pushq   %rbx                    /* Preserve to comply with ABI */
        cpuid                           /*  ... into eax */
+       popq    %rbx
        movl    %ecx,cpu_features_ecx   /* Keep a copy */
        movl    %edx,cpu_features_edx   /* Keep a copy */
        shrl    $8,%eax                 /* Slide family bits down */
-- 
2.47.3


Reply via email to