Skip to content

Commit c022f7a

Browse files
authored
Merge pull request #434 from nealsid/client-build-and-topology-structure-mismatch
Add IOUserClient class to CMake builds, and add fields in kernel
2 parents 3aa0827 + eee1719 commit c022f7a

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

src/MacMSRDriver/PcmMsr/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ add_executable(
44
PcmMsrDriver
55
MACOSX_BUNDLE
66
PcmMsr.cpp
7+
PcmMSrClient.cpp
78
PcmMsrDriver_info.c
89
PcmMsr-Info.plist
910
)

src/MacMSRDriver/PcmMsr/PcmMsr.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void cpuWriteMSR(void* pIDatas){
5757
}
5858

5959
void cpuGetTopoData(void* pTopos){
60-
kTopologyEntry* entries = (kTopologyEntry*)pTopos;
60+
topologyEntry* entries = (topologyEntry*)pTopos;
6161
volatile uint cpu = cpu_number();
6262
int info[4];
6363
entries[cpu].os_id = cpu;
@@ -119,15 +119,17 @@ bool PcmMsrDriverClassName::init(OSDictionary *dict)
119119
topologies = 0;
120120
if(result && num_cores != 0)
121121
{
122-
topologies = (kTopologyEntry*)IOMallocAligned(sizeof(kTopologyEntry)*num_cores, 128);
122+
topologies = (topologyEntry*)IOMallocAligned(sizeof(topologyEntry)*num_cores, 32);
123123
}
124124
return (result && topologies && num_cores != 0);
125125
}
126126

127127
void PcmMsrDriverClassName::free()
128128
{
129-
if(topologies)
130-
IOFreeAligned(topologies, sizeof(kTopologyEntry)*num_cores);
129+
if (topologies)
130+
{
131+
IOFreeAligned(topologies, sizeof(topologyEntry)*num_cores);
132+
}
131133
super::free();
132134
}
133135

src/MacMSRDriver/PcmMsr/PcmMsr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PcmMsrDriverClassName : public IOService
3737
// number of providers currently using the driver
3838
uint32_t num_clients = 0;
3939
uint32_t num_cores;
40-
kTopologyEntry *topologies;
40+
topologyEntry *topologies;
4141
};
4242

4343
#ifdef DEBUG

src/MacMSRDriver/PcmMsr/UserKernelShared.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,18 @@ typedef struct {
2121
} k_pcm_msr_data_t;
2222

2323
// The topologyEntry struct that is used by PCM
24-
typedef struct{
24+
typedef struct
25+
{
2526
uint32_t os_id;
2627
uint32_t thread_id;
2728
uint32_t core_id;
2829
uint32_t tile_id;
2930
uint32_t socket;
31+
uint32_t native_cpu_model;
32+
uint32_t core_type; // This is an enum in the userland structure.
33+
uint32_t padding;
3034
} topologyEntry;
3135

32-
// A kernel version of the topology entry structure. It has
33-
// an extra unused int to explicitly align the struct on a 64bit
34-
// boundary, preventing the compiler from adding extra padding.
35-
typedef struct{
36-
uint32_t os_id;
37-
uint32_t thread_id;
38-
uint32_t core_id;
39-
uint32_t tile_id;
40-
uint32_t socket;
41-
char padding[108];
42-
} kTopologyEntry;
43-
4436
enum {
4537
kOpenDriver,
4638
kCloseDriver,

0 commit comments

Comments
 (0)