MentOS  0.8.0
The Mentoring Operating System
Classes | Macros | Typedefs | Functions | Variables
cpuid.h File Reference

Structures and functions to handle the CPUID. More...

Go to the source code of this file.

Classes

struct  cpuinfo_t
 Contains the information concerning the CPU. More...
 

Macros

#define ECX_FLAGS_SIZE   24
 Dimension of the exc flags.
 
#define EDX_FLAGS_SIZE   32
 Dimension of the edx flags.
 

Typedefs

typedef struct cpuinfo_t cpuinfo_t
 Contains the information concerning the CPU.
 

Functions

void get_cpuid (cpuinfo_t *cpuinfo)
 Main CPUID procedure. More...
 
void call_cpuid (pt_regs *registers)
 Actual CPUID call. More...
 
void cpuid_write_vendor (cpuinfo_t *cpuinfo, pt_regs *registers)
 Extract vendor string. More...
 
void cpuid_write_proctype (cpuinfo_t *cpuinfo, pt_regs *registers)
 
void cpuid_feature_ecx (cpuinfo_t *cpuinfo, uint32_t ecx)
 EAX=1, ECX contains a list of supported features. More...
 
void cpuid_feature_edx (cpuinfo_t *cpuinfo, uint32_t edx)
 EAX=1, EDX contains a list of supported features. More...
 
uint32_t cpuid_get_byte (uint32_t reg, uint32_t position, uint32_t value)
 Extract single byte from a register. More...
 
char * cpuid_brand_index (pt_regs *f)
 Index of brand strings. TODO: Document. More...
 
char * cpuid_brand_string (pt_regs *f)
 Brand string is contained in EAX, EBX, ECX and EDX. More...
 

Variables

cpuinfo_t sinfo
 This will be populated with the information concerning the CPU.
 

Detailed Description

Structures and functions to handle the CPUID.

CPUID instruction (identified by a CPUID opcode) is a processor supplementary instruction (its name derived from CPU IDentification) allowing software to discover details of the processor.

Function Documentation

◆ call_cpuid()

void call_cpuid ( pt_regs registers)

Actual CPUID call.

Parameters
registersThe registers to fill with the result of the call.

◆ cpuid_brand_index()

char* cpuid_brand_index ( pt_regs f)

Index of brand strings. TODO: Document.

Parameters
fStack frame.
Returns
The brand string.

◆ cpuid_brand_string()

char* cpuid_brand_string ( pt_regs f)

Brand string is contained in EAX, EBX, ECX and EDX.

Parameters
fStack frame.
Returns
The brand string.

◆ cpuid_feature_ecx()

void cpuid_feature_ecx ( cpuinfo_t cpuinfo,
uint32_t  ecx 
)

EAX=1, ECX contains a list of supported features.

Parameters
cpuinfo
ecx

◆ cpuid_feature_edx()

void cpuid_feature_edx ( cpuinfo_t cpuinfo,
uint32_t  edx 
)

EAX=1, EDX contains a list of supported features.

Parameters
cpuinfo
edx

◆ cpuid_get_byte()

uint32_t cpuid_get_byte ( uint32_t  reg,
uint32_t  position,
uint32_t  value 
)
inline

Extract single byte from a register.

Parameters
reg
position
value
Returns

◆ cpuid_write_proctype()

void cpuid_write_proctype ( cpuinfo_t cpuinfo,
pt_regs registers 
)
Parameters
cpuinfo
registers

CPUID is called with EAX=1 EAX contains Type, Family, Model and Stepping ID EBX contains the Brand Index if supported, and the APIC ID ECX/EDX contains feature information

◆ cpuid_write_vendor()

void cpuid_write_vendor ( cpuinfo_t cpuinfo,
pt_regs registers 
)

Extract vendor string.

Parameters
cpuinfoThe struct containing the CPUID infos.
registersThe registers.

◆ get_cpuid()

void get_cpuid ( cpuinfo_t cpuinfo)

Main CPUID procedure.

Parameters
cpuinfoStructure to fill with CPUID information.