CPUID: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Added PCIDE bit to CPUID's possible return values
Line 150: Line 150:


== Using CPUID from GCC ==
== Using CPUID from GCC ==

Alternatively, one can use the __get_cpuid function that comes with GCC. To use this function, include <cpuid.h>.

<source>
#include <cpuid.h>

/* Example: Get CPU's model number */
static int get_model(void)
{
int ebx, unused;
__cpuid(0, unused, ebx, unused, unused);
return ebx;
}

/* Example: Check for builtin local APIC. */
static int check_apic(void)
{
unsigned int eax, unused, edx;
__get_cpuid(1, &eax, &unused, &unused, %edx);
return edx & CPUID_FEAT_EDX_APIC;
}

</source>


{{Disputed}}
{{Disputed}}
Line 156: Line 179:


<source lang="c">
<source lang="c">
/* TODO: You should use the <cpuid.h> header that comes with GCC instead. */
/* DEPRECATED: You should use the <cpuid.h> header that comes with GCC instead. */


enum cpuid_requests {
enum cpuid_requests {