From: Zachary Amsden <zach@vmware.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: akpm@osdl.org, chrisl@vmware.com, davej@codemonkey.org.uk,
linux-kernel@vger.kernel.org, pratap@vmware.com,
Riley@Williams.Name
Subject: Re: [PATCH] 1/5 more-asm-cleanup
Date: Wed, 03 Aug 2005 20:06:32 -0700 [thread overview]
Message-ID: <42F18638.5070108@vmware.com> (raw)
In-Reply-To: <42F165BC.9030504@zytor.com>
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
>
next prev parent reply other threads:[~2005-08-04 3:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-04 0:43 [PATCH] 1/5 more-asm-cleanup zach
2005-08-04 0:47 ` H. Peter Anvin
2005-08-04 3:06 ` Zachary Amsden [this message]
2005-08-04 6:01 ` H. Peter Anvin
2005-08-04 3:33 ` Zachary Amsden
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42F18638.5070108@vmware.com \
--to=zach@vmware.com \
--cc=Riley@Williams.Name \
--cc=akpm@osdl.org \
--cc=chrisl@vmware.com \
--cc=davej@codemonkey.org.uk \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pratap@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox