MCPcopy Create free account
hub / github.com/acidanthera/VirtualSMC / staticThreadEntry

Method staticThreadEntry

Sensors/SMCProcessor/SMCProcessor.cpp:107–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void SMCProcessor::staticThreadEntry(thread_call_param_t param0, thread_call_param_t param1)
108{
109 auto *that = OSDynamicCast(SMCProcessor, reinterpret_cast<OSObject*>(param0));
110 if (!that) {
111 SYSLOG("scpu", "Failed to get pointer to SMIMonitor");
112 return;
113 }
114
115 uint32_t cpu = static_cast<uint32_t>(reinterpret_cast<uint64_t>(param1));
116 // This should not happen
117 if (cpu >= CPUInfo::MaxCpus) {
118 SYSLOG("scpu", "CPU number cannot exceed %zu", CPUInfo::MaxCpus);
119 return;
120 }
121
122 DBGLOG("scpu", "staticThreadEntry for CPU number %u is started", cpu);
123
124 if (!that->bindCurrentThreadToCpu(cpu))
125 return;
126#ifdef DEBUG
127 auto enable = ml_set_interrupts_enabled(FALSE);
128 assert(cpu_number() == cpu);
129 ml_set_interrupts_enabled(enable);
130#endif
131
132 while (true) {
133 IOSleep(TimerTimeoutMs);
134 that->updateCounters(cpu);
135 }
136}
137
138void SMCProcessor::updateCounters(uint32_t cpu) {
139 // This should not happen

Callers

nothing calls this directly

Calls 2

updateCountersMethod · 0.80

Tested by

no test coverage detected