mirror of
https://github.com/anrieff/libcpuid
synced 2024-11-10 22:59:13 +00:00
Implement cpu_msr_driver_open_core() on Mac OS X and Windows (dummies).
On Windows, we don't have the API that Linux provides, which can be used to query MSRs of particular CPU cores. However, the same behaviour can be emulated. Say that the driver handle object also stores 'dedicated thread index'. When you call 'cpu_msr_driver_open()', this index is set to -1, so further API functions do not force which core should be executing RDMSR code. I.e. "I don't care on which core I run". However, if this is non-negative number, the subsequent functions like cpu_rdmsr() are forced to pass through this core by using temporary affinity mask.
This commit is contained in:
parent
3b713ff7a2
commit
6b09bceb66
1 changed files with 12 additions and 0 deletions
|
@ -42,6 +42,12 @@ struct msr_driver_t* cpu_msr_driver_open(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct msr_driver_t* cpu_msr_driver_open_core(int core_num)
|
||||||
|
{
|
||||||
|
set_error(ERR_NOT_IMP);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int cpu_rdmsr(struct msr_driver_t* driver, int msr_index, uint64_t* result)
|
int cpu_rdmsr(struct msr_driver_t* driver, int msr_index, uint64_t* result)
|
||||||
{
|
{
|
||||||
return set_error(ERR_NOT_IMP);
|
return set_error(ERR_NOT_IMP);
|
||||||
|
@ -176,6 +182,12 @@ struct msr_driver_t* cpu_msr_driver_open(void)
|
||||||
return drv;
|
return drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct msr_driver_t* cpu_msr_driver_open_core(int core_num)
|
||||||
|
{
|
||||||
|
warnf(1, "cpu_msr_driver_open_core(): parameter ignored (function is the same as cpu_msr_driver_open)\n");
|
||||||
|
return cpu_msr_driver_open();
|
||||||
|
}
|
||||||
|
|
||||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||||
static BOOL is_running_x64(void)
|
static BOOL is_running_x64(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue