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(
44 PcmMsrDriver
55 MACOSX_BUNDLE
66 PcmMsr.cpp
7+ PcmMSrClient.cpp
78 PcmMsrDriver_info.c
89 PcmMsr-Info.plist
910)
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ void cpuWriteMSR(void* pIDatas){
5757}
5858
5959void 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
127127void 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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-
4436enum {
4537 kOpenDriver ,
4638 kCloseDriver ,
You can’t perform that action at this time.
0 commit comments