2006-03-21 Gwenole Beauchesne <gbeauchesne@mandriva.com> * Add cpuid_count() function that accepts ECX input. --- x86info-1.17/cpuid.c.cpuid-with-ecx-input 2005-11-05 01:05:52.000000000 +0100 +++ x86info-1.17/cpuid.c 2006-03-21 23:35:06.000000000 +0100 @@ -58,3 +58,22 @@ void cpuid (int CPU_number, unsigned int return; } } + +/* XXX does the cpuid driver support count inputs? Stick to UP variant for now */ +void cpuid_count (int CPU_number, unsigned int idx, unsigned int count, + unsigned long *eax, + unsigned long *ebx, + unsigned long *ecx, + unsigned long *edx) +{ + unsigned long r_eax, r_ebx, r_ecx, r_edx; + + __asm__ __volatile__ ("cpuid" + : "=a" (r_eax), "=b" (r_ebx), "=c" (r_ecx), "=d" (r_edx) + : "0" (idx), "2" (count)); + + if (eax) *eax = r_eax; + if (ebx) *ebx = r_ebx; + if (ecx) *ecx = r_ecx; + if (edx) *edx = r_edx; +} --- x86info-1.17/x86info.h.cpuid-with-ecx-input 2005-11-05 01:05:52.000000000 +0100 +++ x86info-1.17/x86info.h 2006-03-21 23:35:01.000000000 +0100 @@ -76,6 +76,7 @@ struct cpudata { #define CONN_SOCKET_940 28 void cpuid (int, unsigned int, unsigned long *, unsigned long *, unsigned long *, unsigned long *); +void cpuid_count (int, unsigned int, unsigned int, unsigned long *, unsigned long *, unsigned long *, unsigned long *); void cpuid_UP (int, unsigned long *, unsigned long *, unsigned long *, unsigned long *); void Identify_AMD (struct cpudata *cpu);