iPXE
Data Structures | Defines | Functions | Variables
cpuid.h File Reference

x86 CPU feature detection More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  x86_feature_registers
 An x86 CPU feature register set. More...
struct  x86_features
 x86 CPU features More...

Defines

#define CPUID_FLAG   0x00200000UL
 CPUID support flag.
#define CPUID_EXTENDED   0x80000000UL
 CPUID extended function.
#define CPUID_VENDOR_ID   0x00000000UL
 Get vendor ID and largest standard function.
#define CPUID_FEATURES   0x00000001UL
 Get standard features.
#define CPUID_FEATURES_INTEL_ECX_HYPERVISOR   0x80000000UL
 Hypervisor is present.
#define CPUID_AMD_MAX_FN   0x80000000UL
 Get largest extended function.
#define CPUID_AMD_CHECK   0x80000000UL
 Extended function existence check.
#define CPUID_AMD_CHECK_MASK   0xffff0000UL
 Extended function existence check mask.
#define CPUID_AMD_FEATURES   0x80000001UL
 Get extended features.
#define CPUID_MODEL   0x80000002UL
 Get CPU model.
#define CPUID_APM   0x80000007UL
 Get APM information.
#define CPUID_APM_EDX_TSC_INVARIANT   0x00000100UL
 Invariant TSC.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static __attribute__ ((always_inline)) void cpuid(uint32_t function
 Issue CPUID instruction.
void x86_features (struct x86_features *features)
 Get x86 CPU features.

Variables

struct x86_feature_registers __attribute__
static uint32_t subfunction
static uint32_t uint32_teax
static uint32_t uint32_t uint32_tebx
static uint32_t uint32_t
uint32_t uint32_t
ecx

Detailed Description

x86 CPU feature detection

Definition in file cpuid.h.


Define Documentation

#define CPUID_FLAG   0x00200000UL

CPUID support flag.

Definition at line 31 of file cpuid.h.

Referenced by cpuid_instruction_supported().

#define CPUID_EXTENDED   0x80000000UL

CPUID extended function.

Definition at line 34 of file cpuid.h.

Referenced by cpuid_supported().

#define CPUID_VENDOR_ID   0x00000000UL

Get vendor ID and largest standard function.

Definition at line 37 of file cpuid.h.

#define CPUID_FEATURES   0x00000001UL

Get standard features.

Definition at line 40 of file cpuid.h.

Referenced by x86_intel_features().

#define CPUID_FEATURES_INTEL_ECX_HYPERVISOR   0x80000000UL

Hypervisor is present.

Definition at line 43 of file cpuid.h.

Referenced by hv_check_hv().

#define CPUID_AMD_MAX_FN   0x80000000UL

Get largest extended function.

Definition at line 46 of file cpuid.h.

#define CPUID_AMD_CHECK   0x80000000UL

Extended function existence check.

Definition at line 49 of file cpuid.h.

#define CPUID_AMD_CHECK_MASK   0xffff0000UL

Extended function existence check mask.

Definition at line 52 of file cpuid.h.

Referenced by cpuid_supported().

#define CPUID_AMD_FEATURES   0x80000001UL

Get extended features.

Definition at line 55 of file cpuid.h.

Referenced by x86_amd_features().

#define CPUID_MODEL   0x80000002UL

Get CPU model.

Definition at line 58 of file cpuid.h.

#define CPUID_APM   0x80000007UL

Get APM information.

Definition at line 61 of file cpuid.h.

Referenced by rdtsc_probe().

#define CPUID_APM_EDX_TSC_INVARIANT   0x00000100UL

Invariant TSC.

Definition at line 64 of file cpuid.h.

Referenced by rdtsc_probe().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static __attribute__ ( (always_inline)  ) [inline, static]

Issue CPUID instruction.

Parameters:
functionCPUID function (input via eax)
subfunctionCPUID subfunction (input via ecx)
eaxOutput via eax
ebxOutput via ebx
ecxOutput via ecx
edxOutput via edx
void x86_features ( struct x86_features features)

Get x86 CPU features.

Parameters:
featuresx86 CPU features to fill in

Definition at line 163 of file cpuid.c.

References memset(), x86_amd_features(), and x86_intel_features().

Referenced by cpuid_exec(), and hv_check_hv().

                                                    {

        /* Clear all features */
        memset ( features, 0, sizeof ( *features ) );

        /* Get Intel-defined features */
        x86_intel_features ( features );

        /* Get AMD-defined features */
        x86_amd_features ( features );
}

Variable Documentation

Definition at line 77 of file cpuid.h.

Referenced by cpuid_settings_fetch().

Definition at line 77 of file cpuid.h.

Referenced by com32_cfarcall().

Definition at line 77 of file cpuid.h.

Referenced by hv_map_hypercall(), and hvm_cpuid_base().

Definition at line 77 of file cpuid.h.

Referenced by hv_map_hypercall(), and hvm_cpuid_base().