mirror of
https://github.com/anrieff/libcpuid
synced 2025-10-13 11:10:39 +00:00
Reorganize library a bit.
- Expose intel_code_t and amd_code_t enums - they are no longer limited to just recog_{intel,amd}.c. - Add libcpuid_internal.h lists those enums and provides the, cpu_ident_internal() function, which is the same as cpu_identify(), but also has a third parameter - a internal_id_info_t structure, which holds detection internals. All of this is intended to be used in rdmsr, which needs to know specifics on what CPU it is running.
This commit is contained in:
parent
86cf1df62c
commit
a2550463a9
10 changed files with 98 additions and 39 deletions
|
@ -24,6 +24,7 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "libcpuid.h"
|
||||
#include "libcpuid_internal.h"
|
||||
#include "recog_intel.h"
|
||||
#include "recog_amd.h"
|
||||
#include "asm-bits.h"
|
||||
|
@ -478,7 +479,7 @@ int cpuid_deserialize_raw_data(struct cpu_raw_data_t* data, const char* filename
|
|||
return set_error(ERR_OK);
|
||||
}
|
||||
|
||||
int cpu_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
|
||||
int cpu_ident_internal(struct cpu_raw_data_t* raw, struct cpu_id_t* data, struct internal_id_info_t* internal)
|
||||
{
|
||||
int r;
|
||||
struct cpu_raw_data_t myraw;
|
||||
|
@ -492,10 +493,10 @@ int cpu_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
|
|||
return set_error(r);
|
||||
switch (data->vendor) {
|
||||
case VENDOR_INTEL:
|
||||
r = cpuid_identify_intel(raw, data);
|
||||
r = cpuid_identify_intel(raw, data, internal);
|
||||
break;
|
||||
case VENDOR_AMD:
|
||||
r = cpuid_identify_amd(raw, data);
|
||||
r = cpuid_identify_amd(raw, data, internal);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -503,6 +504,12 @@ int cpu_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
|
|||
return set_error(r);
|
||||
}
|
||||
|
||||
int cpu_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
|
||||
{
|
||||
struct internal_id_info_t throwaway;
|
||||
return cpu_ident_internal(raw, data, &throwaway);
|
||||
}
|
||||
|
||||
const char* cpu_feature_str(cpu_feature_t feature)
|
||||
{
|
||||
const struct { cpu_feature_t feature; const char* name; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue