MicrOS
|
#include "headers/cpuid_defines.h"
#include "headers/cpuid_0x00h.h"
#include "headers/cpuid_0x01h.h"
#include "headers/cpuid_0x04h.h"
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | cpuid_cache_struct |
Struct to represent cache. More... | |
Enumerations | |
enum | cpuid_cache_type { DATA_CACHE = 0x01, INSTRUCTION_CACHE = 0x02, UNIFIED_CACHE = 0x03 } |
Enum to represent cache type. More... | |
Functions | |
uint8_t | cpuid_init () |
Initialization of CPUID. More... | |
uint32_t | cpuid_get_highest_function_parameter () |
Get highest function parameter. More... | |
char * | cpuid_get_vendor_string (char *buffer) |
Get vendor string. More... | |
uint8_t | cpuid_get_stepping_id () |
Get stepping id. More... | |
uint8_t | cpuid_get_model_id () |
Get model id. More... | |
uint8_t | cpuid_get_family_id () |
Get family id. More... | |
uint8_t | cpuid_get_processor_type () |
Get processor type. More... | |
uint8_t | cpuid_is_hyperthreading_available () |
Check if Hyper-Threading is available. More... | |
uint8_t | cpuid_number_of_logical_processors () |
Get number of logical processors. More... | |
uint8_t | cpuid_number_of_physical_processors_cores () |
Get number of physical processors cores. More... | |
uint8_t | cpuid_get_valid_number_cache_entries () |
Get number of valid cache entries. More... | |
uint32_t | cpuid_get_cache_size_in_bytes (uint8_t cache_index) |
Get cache size in bytes. More... | |
cpuid_cache_struct | cpuid_get_cache_data (uint8_t cache_index) |
Get cache data. More... | |
const cpuid_0x00h * | cpuid_get_0x00h_fields () |
Get 0x00h fields. More... | |
const cpuid_0x01h * | cpuid_get_0x01h_fields () |
Get 0x01h fields. More... | |
const cpuid_0x04h * | cpuid_get_0x04h_fields (uint8_t index) |
Get 0x04h fields. More... | |
static void | __cpuid_features (int code, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) |
Perform CPUID instruction. More... | |
static void | __cpuid (unsigned int code, uint32_t where[4]) |
static void | __cpuid_features_count (int code, int count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) |
Perform CPUID instruction. More... | |
static void | __cpuid_count (unsigned int code, int count, uint32_t where[4]) |
void | __cpuid_get_manufacturer_string () |
Helper function to get manufacturer id. More... | |
char * | __cpuid_get_processor_brand (char *buffer) |
Get prcessor brand. More... | |
enum cpuid_cache_type |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Perform CPUID instruction.
Returns processor identification and feature information to the EAX, EBX, ECX, and EDX registers, as determined by input entered in EAX (in some cases, ECX as well).
code | Initial EAX value. Code for EAX variant. |
eax | Result from EAX. |
ebx | Result from EAX. |
ecx | Result from EAX. |
edx | Result from EAX. |
|
inlinestatic |
Perform CPUID instruction.
Returns processor identification and feature information to the EAX, EBX, ECX, and EDX registers, as determined by input entered in EAX (in some cases, ECX as well).
code | Initial EAX value. Code for EAX variant. |
count | Number to put in ECX.. |
eax | Result from EAX. |
ebx | Result from EAX. |
ecx | Result from EAX. |
edx | Result from EAX. |
void __cpuid_get_manufacturer_string | ( | ) |
Helper function to get manufacturer id.
Put vendor string in __cpuid_vendor_string variable.
char* __cpuid_get_processor_brand | ( | char * | buffer | ) |
Get prcessor brand.
Function copy procesor brand to buffer and terminate string with /0.
buffer | Buffer for vendor string with size at least 48. |
const cpuid_0x00h* cpuid_get_0x00h_fields | ( | ) |
Get 0x00h fields.
const cpuid_0x01h* cpuid_get_0x01h_fields | ( | ) |
Get 0x01h fields.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
const cpuid_0x04h* cpuid_get_0x04h_fields | ( | uint8_t | index | ) |
Get 0x04h fields.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 4 or higher.
index | Index of struct to return. |
cpuid_cache_struct cpuid_get_cache_data | ( | uint8_t | cache_index | ) |
Get cache data.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 4 or higher.
cache_index | Index of cache to return. To get max number use cpuid_get_valid_number_cache_entries(). If invalid 0 will be returned. |
uint32_t cpuid_get_cache_size_in_bytes | ( | uint8_t | cache_index | ) |
Get cache size in bytes.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 4 or higher.
cache_index | Index of cache to return. To get max number use cpuid_get_valid_number_cache_entries(). If invalid 0 will be returned. |
uint8_t cpuid_get_family_id | ( | ) |
Get family id.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
uint32_t cpuid_get_highest_function_parameter | ( | ) |
Get highest function parameter.
Indicates how many function parameters CPUID supports. You should use it to determine how much data you can aquire from CPUID functions.
uint8_t cpuid_get_model_id | ( | ) |
Get model id.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
uint8_t cpuid_get_processor_type | ( | ) |
Get processor type.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
uint8_t cpuid_get_stepping_id | ( | ) |
Get stepping id.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
uint8_t cpuid_get_valid_number_cache_entries | ( | ) |
Get number of valid cache entries.
Number that determines how much cache entries are stored. Used in function cpuid_get_cache_size_in_bytes(uint8_t cache_index), cpuid_get_cache_data(uint8_t cache_index).
Result will be valid only if cpuid_get_highest_function_parameter() returns value 4 or higher.
char* cpuid_get_vendor_string | ( | char * | buffer | ) |
Get vendor string.
Function copy vendor string to buffer and terminate string with /0.
buffer | Buffer for vendor string with size at least 13. |
uint8_t cpuid_init | ( | ) |
Initialization of CPUID.
Sets internal variables.
uint8_t cpuid_is_hyperthreading_available | ( | ) |
Check if Hyper-Threading is available.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
uint8_t cpuid_number_of_logical_processors | ( | ) |
Get number of logical processors.
Addressable IDs for logical processors in the same Package. Valid if Hyper-Threading is enabled.
Result will be valid only if cpuid_get_highest_function_parameter() returns value 1 or higher.
uint8_t cpuid_number_of_physical_processors_cores | ( | ) |
Get number of physical processors cores.
Addressable IDs for physical processors cores in a physical package. Result will be valid only if cpuid_get_highest_function_parameter() returns value 4 or higher.