Re: [PATCH] 1/5 more-asm-cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please explain why this is a reject after looking at the cpuid macro. It changed recently. Note 0 -> %ecx.

Would you prefer that I call cpuid_count and pass an explicit zero parameter for ecx?


/*
* Generic CPUID function
* clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
* resulting in stale register contents being returned.
*/
static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
{
       __asm__("cpuid"
               : "=a" (*eax),
                 "=b" (*ebx),
                 "=c" (*ecx),
                 "=d" (*edx)
               : "0" (op), "c"(0));
}


H. Peter Anvin wrote:

[email protected] wrote:

Some more assembler cleanups I noticed along the way.


Index: linux-2.6.13/arch/i386/kernel/cpu/intel.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/cpu/intel.c 2005-08-03 15:18:18.000000000 -0700 +++ linux-2.6.13/arch/i386/kernel/cpu/intel.c 2005-08-03 15:19:39.000000000 -0700
@@ -82,16 +82,12 @@
  */
 static int __devinit num_cpu_cores(struct cpuinfo_x86 *c)
 {
-    unsigned int eax;
+    unsigned int eax, ebx, ecx, edx;
if (c->cpuid_level < 4)
         return 1;
- __asm__("cpuid"
-        : "=a" (eax)
-        : "0" (4), "c" (0)
-        : "bx", "dx");
-
+    cpuid(4, &eax, &ebx, &ecx, &edx);
     if (eax & 0x1f)
         return ((eax >> 26) + 1);


Reject! This is a bogus patch; Intel's CPUID level 4 has a nonstandard dependency on ECX (idiots...) and therefore this needs special handling.

    -hpa


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux