OSAPI  0.29
Open System API
machine_type_cpu.h
1 // *****************************************************************************************
2 //
3 // File description:
4 //
5 // Author: Joao Costa
6 // Purpose: Type declarations for CPU
7 //
8 // *****************************************************************************************
9 
10 #ifndef OSAPI_MACHINE_TYPE_CPU_H_
11 #define OSAPI_MACHINE_TYPE_CPU_H_
12 
13 // *****************************************************************************************
14 //
15 // Section: Import headers
16 //
17 // *****************************************************************************************
18 
19 // Standard C headers
20 #include <stdint.h>
21 
22 // General OSAPI headers
23 #include "common/types/common_type_cpu.h"
24 
25 // Import own elements
26 #include "machine/machine_platform.h"
27 #include "machine/cpu/type/machine_type_features.h"
28 #include "machine/cpu/type/machine_type_endian.h"
29 #include "machine/cpu/type/machine_type_arch.h"
30 #include "machine/cpu/type/machine_type_vendor.h"
31 #include "machine/cpu/type/machine_type_vm.h"
32 
33 
34 // *****************************************************************************************
35 //
36 // Section: Sanity checks
37 //
38 // *****************************************************************************************
39 
40 osapi_static_assert( OSAPI_MACHINE_CPU_FEATURE_MAX > osapi_machine_cpu_feature_max, " CPU error: Number of features exceeds maximum" );
41 
42 
43 // *****************************************************************************************
44 //
45 // Section: Declarations
46 //
47 // *****************************************************************************************
48 
49 
50 
53 {
54  char oem [ OSAPI_MACHINE_CPU_SIZE_VENDORID ];
55  char family [ OSAPI_MACHINE_CPU_SIZE_FAMILY ];
56  char model_id [ OSAPI_MACHINE_CPU_SIZE_MODEL ];
57  char model_name [ OSAPI_MACHINE_CPU_SIZE_MODELNAME ];
58  char level [ OSAPI_MACHINE_CPU_SIZE_REVISION ];
59  char virt [ OSAPI_MACHINE_CPU_SIZE_VIRTUAL ];
60 };
61 
63 
64 
67 {
68  uint8_t canary;
71 };
72 
73 typedef struct osapi_machine_cpu_S t_cpu;
74 
75 
76 
79 {
81  t_cpu_nthreads nthreads;
82  t_cpu_ncores ncores;
83  t_cpu_nlogical ncpus_present;
84  t_cpu_nlogical ncpus_available;
85  t_cpu_nsocket sockets;
86  t_cpu_endian endianess;
87 };
88 
90 
91 
92 #endif /* OSAPI_MACHINE_TYPE_CPU_H_ */
osapi_machine_cpu_info_S::family
char family[OSAPI_MACHINE_CPU_SIZE_FAMILY]
NAme of CPU family.
Definition: machine_type_cpu.h:55
osapi_machine_cpu_S::canary
uint8_t canary
Sanity checks.
Definition: machine_type_cpu.h:68
osapi_machine_cpu_S
A generic CPU type.
Definition: machine_type_cpu.h:66
osapi_machine_cpu_info_S::model_name
char model_name[OSAPI_MACHINE_CPU_SIZE_MODELNAME]
CPU Model Name.
Definition: machine_type_cpu.h:57
osapi_machine_cpu_info_S
CPU ID information (For CPUs that support it)
Definition: machine_type_cpu.h:52
osapi_machine_cpu_feature_S
Define a type for CPU features.
Definition: machine_type_features.h:42
osapi_machine_cpu_summary_S::ncores
t_cpu_ncores ncores
Number of cores per CPU.
Definition: machine_type_cpu.h:82
osapi_machine_cpu_info_S::model_id
char model_id[OSAPI_MACHINE_CPU_SIZE_MODEL]
CPU Model ID.
Definition: machine_type_cpu.h:56
osapi_machine_cpu_summary_S
Machine CPU summary information.
Definition: machine_type_cpu.h:78
osapi_machine_cpu_S::features
t_cpu_feature_list features
The CPU supported features.
Definition: machine_type_cpu.h:70
osapi_machine_cpu_info_S::oem
char oem[OSAPI_MACHINE_CPU_SIZE_VENDORID]
Name of OEM company.
Definition: machine_type_cpu.h:54
osapi_machine_cpu_info_S::virt
char virt[OSAPI_MACHINE_CPU_SIZE_VIRTUAL]
CPU virtualization name/type.
Definition: machine_type_cpu.h:59
osapi_machine_cpu_summary_S::info
t_cpu_info info
CPU information (assumes all CPUs with the same info)
Definition: machine_type_cpu.h:80
osapi_machine_cpu_summary_S::ncpus_present
t_cpu_nlogical ncpus_present
Present Logical CPUs in the system.
Definition: machine_type_cpu.h:83
osapi_machine_cpu_summary_S::ncpus_available
t_cpu_nlogical ncpus_available
Available Logical CPUs in the system.
Definition: machine_type_cpu.h:84
osapi_machine_cpu_summary_S::sockets
t_cpu_nsocket sockets
Number of sockets in the system.
Definition: machine_type_cpu.h:85
osapi_machine_cpu_S::info
t_cpu_info info
The CPU generic information.
Definition: machine_type_cpu.h:69
osapi_machine_cpu_summary_S::endianess
t_cpu_endian endianess
CPU architecture endianness.
Definition: machine_type_cpu.h:86
osapi_machine_cpu_info_S::level
char level[OSAPI_MACHINE_CPU_SIZE_REVISION]
CPU revision level (stepping)
Definition: machine_type_cpu.h:58
osapi_machine_cpu_summary_S::nthreads
t_cpu_nthreads nthreads
Number of threads per core.
Definition: machine_type_cpu.h:81