File tree Expand file tree Collapse file tree 4 files changed +13
-18
lines changed Expand file tree Collapse file tree 4 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ add_executable(
4
4
PcmMsrDriver
5
5
MACOSX_BUNDLE
6
6
PcmMsr.cpp
7
+ PcmMSrClient.cpp
7
8
PcmMsrDriver_info.c
8
9
PcmMsr-Info.plist
9
10
)
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ void cpuWriteMSR(void* pIDatas){
57
57
}
58
58
59
59
void cpuGetTopoData (void * pTopos){
60
- kTopologyEntry * entries = (kTopologyEntry *)pTopos;
60
+ topologyEntry * entries = (topologyEntry *)pTopos;
61
61
volatile uint cpu = cpu_number ();
62
62
int info[4 ];
63
63
entries[cpu].os_id = cpu;
@@ -119,15 +119,17 @@ bool PcmMsrDriverClassName::init(OSDictionary *dict)
119
119
topologies = 0 ;
120
120
if (result && num_cores != 0 )
121
121
{
122
- topologies = (kTopologyEntry *)IOMallocAligned (sizeof (kTopologyEntry )*num_cores, 128 );
122
+ topologies = (topologyEntry *)IOMallocAligned (sizeof (topologyEntry )*num_cores, 32 );
123
123
}
124
124
return (result && topologies && num_cores != 0 );
125
125
}
126
126
127
127
void PcmMsrDriverClassName::free ()
128
128
{
129
- if (topologies)
130
- IOFreeAligned (topologies, sizeof (kTopologyEntry )*num_cores);
129
+ if (topologies)
130
+ {
131
+ IOFreeAligned (topologies, sizeof (topologyEntry)*num_cores);
132
+ }
131
133
super::free ();
132
134
}
133
135
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class PcmMsrDriverClassName : public IOService
37
37
// number of providers currently using the driver
38
38
uint32_t num_clients = 0 ;
39
39
uint32_t num_cores;
40
- kTopologyEntry *topologies;
40
+ topologyEntry *topologies;
41
41
};
42
42
43
43
#ifdef DEBUG
Original file line number Diff line number Diff line change @@ -21,26 +21,18 @@ typedef struct {
21
21
} k_pcm_msr_data_t ;
22
22
23
23
// The topologyEntry struct that is used by PCM
24
- typedef struct {
24
+ typedef struct
25
+ {
25
26
uint32_t os_id ;
26
27
uint32_t thread_id ;
27
28
uint32_t core_id ;
28
29
uint32_t tile_id ;
29
30
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 ;
30
34
} topologyEntry ;
31
35
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
-
44
36
enum {
45
37
kOpenDriver ,
46
38
kCloseDriver ,
You can’t perform that action at this time.
0 commit comments