FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
cpuid2.h File Reference

The CPUID instructions. More...

#include <basics.h>
#include <graphics.h>
Include dependency graph for cpuid2.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int cpuid_string (int code, int where[4])
 Executes the CPUID instruction with the given code and stores the results.
cstring cpu_string ()
 Returns a string representing the CPU type.
void cpuid (int32 reg, int32 *eax, int32 *ebx, int32 *ecx, int32 *edx)
 Executes the CPUID instruction and retrieves values of the specified registers.
cstring get_cpu_vendor ()
 Retrieve the CPU vendor string.
cstring get_cpu_name ()
 Retrieve the CPU name.
void print_cpu_info ()
 Print CPU information, including the vendor and CPU string.
void print_L1_cache_info ()
 Retrieve and print L1 cache information.
void print_L2_cache_info ()
 Retrieve and print L2 cache information.
void print_L3_cache_info ()
 Retrieve and print L3 cache information.

Detailed Description

The CPUID instructions.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2023-11-10

Definition in file cpuid2.h.

Function Documentation

◆ cpu_string()

cstring cpu_string ( )

Returns a string representing the CPU type.

This function queries the CPU type using the cpuid instruction and returns a string representation of the CPU type.

Returns
A constant string representing the CPU type.

◆ cpuid()

void cpuid ( int32 reg,
int32 * eax,
int32 * ebx,
int32 * ecx,
int32 * edx )
inline

Executes the CPUID instruction and retrieves values of the specified registers.

This function executes the CPUID instruction with the given register and stores the values in the provided pointers for EAX, EBX, ECX, and EDX registers.

Parameters
regThe register to query with CPUID.
eaxPointer to store the value of EAX register.
ebxPointer to store the value of EBX register.
ecxPointer to store the value of ECX register.
edxPointer to store the value of EDX register.

◆ cpuid_string()

int cpuid_string ( int code,
int where[4] )
inlinestatic

Executes the CPUID instruction with the given code and stores the results.

This function executes the CPUID instruction with the specified code and stores the results in the provided array where.

Parameters
codeThe CPUID code to query.
whereAn integer array to store the result, with at least 4 elements.
Returns
The value of the EAX register after executing CPUID.

◆ get_cpu_name()

cstring get_cpu_name ( )

Retrieve the CPU name.

Returns
The CPU name.

◆ get_cpu_vendor()

cstring get_cpu_vendor ( )

Retrieve the CPU vendor string.

Returns
The CPU vendor string.