This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/83401] New: cpuid function for leaf 7 may not be accessed when sub-leaf (%ecx) is undefined
- From: "warnerme at ptd dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Dec 2017 20:23:59 +0000
- Subject: [Bug target/83401] New: cpuid function for leaf 7 may not be accessed when sub-leaf (%ecx) is undefined
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83401
Bug ID: 83401
Summary: cpuid function for leaf 7 may not be accessed when
sub-leaf (%ecx) is undefined
Product: gcc
Version: 5.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: warnerme at ptd dot net
Target Milestone: ---
In the file cpuid.h, there is a problem with the definition:
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level))
With the ecx undefined, the leaf 7 (Extended Features %eax == 7) can not be
accessed. Leaf 7 (%eax) can only be accessed when sub-leaf (%ecx) is 0
I suggest instead:
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level), "2" (0))