lkml.org 
[lkml]   [2005]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] 1/5 more-asm-cleanup
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:

> zach@vmware.com 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-04 05:11    [W:0.035 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site