Loading...
--- xnu/xnu-12377.101.15/iokit/Kernel/IOStateReporter.cpp
+++ xnu/xnu-7195.141.2/iokit/Kernel/IOStateReporter.cpp
@@ -99,11 +99,11 @@
{
if (_currentStates) {
PREFL_MEMOP_PANIC(_nChannels, int);
- IOFreeData(_currentStates, (size_t)_nChannels * sizeof(int));
+ IOFree(_currentStates, (size_t)_nChannels * sizeof(int));
}
if (_lastUpdateTimes) {
PREFL_MEMOP_PANIC(_nChannels, uint64_t);
- IOFreeData(_lastUpdateTimes, (size_t)_nChannels * sizeof(uint64_t));
+ IOFree(_lastUpdateTimes, (size_t)_nChannels * sizeof(uint64_t));
}
super::free();
@@ -127,7 +127,7 @@
// new currentStates buffer
PREFL_MEMOP_FAIL(newNChannels, int);
newCurStatesSize = (size_t)newNChannels * sizeof(int);
- _swapCurrentStates = (int*)IOMallocData(newCurStatesSize);
+ _swapCurrentStates = (int*)IOMalloc(newCurStatesSize);
if (_swapCurrentStates == NULL) {
res = kIOReturnNoMemory; goto finish;
}
@@ -136,21 +136,22 @@
// new timestamps buffer
PREFL_MEMOP_FAIL(newNChannels, uint64_t);
newTSSize = (size_t)newNChannels * sizeof(uint64_t);
- _swapLastUpdateTimes = (uint64_t *)IOMallocZeroData(newTSSize);
+ _swapLastUpdateTimes = (uint64_t *)IOMalloc(newTSSize);
if (_swapLastUpdateTimes == NULL) {
res = kIOReturnNoMemory; goto finish;
}
+ memset(_swapLastUpdateTimes, 0, newTSSize);
res = super::handleSwapPrepare(newNChannels);
finish:
if (res) {
if (_swapCurrentStates) {
- IOFreeData(_swapCurrentStates, newCurStatesSize);
+ IOFree(_swapCurrentStates, newCurStatesSize);
_swapCurrentStates = NULL;
}
if (_swapLastUpdateTimes) {
- IOFreeData(_swapLastUpdateTimes, newTSSize);
+ IOFree(_swapLastUpdateTimes, newTSSize);
_swapLastUpdateTimes = NULL;
}
}
@@ -242,12 +243,12 @@
if (_swapCurrentStates) {
PREFL_MEMOP_PANIC(swapNChannels, int);
- IOFreeData(_swapCurrentStates, (size_t)swapNChannels * sizeof(int));
+ IOFree(_swapCurrentStates, (size_t)swapNChannels * sizeof(int));
_swapCurrentStates = NULL;
}
if (_swapLastUpdateTimes) {
PREFL_MEMOP_PANIC(swapNChannels, uint64_t);
- IOFreeData(_swapLastUpdateTimes, (size_t)swapNChannels * sizeof(uint64_t));
+ IOFree(_swapLastUpdateTimes, (size_t)swapNChannels * sizeof(uint64_t));
_swapLastUpdateTimes = NULL;
}
}
@@ -344,7 +345,7 @@
if (_getStateIndices(channel_id, state_id, &channel_index, &state_index) == kIOReturnSuccess) {
if (_lastUpdateTimes[channel_index]) {
- panic("overrideChannelState() cannot be used after setChannelState()!");
+ panic("overrideChannelState() cannot be used after setChannelState()!\n");
}
res = handleOverrideChannelStateByIndices(channel_index, state_index,
@@ -420,7 +421,7 @@
if (_getStateIndices(channel_id, state_id, &channel_index, &state_index) == kIOReturnSuccess) {
if (_lastUpdateTimes[channel_index]) {
- panic("incrementChannelState() cannot be used after setChannelState()!");
+ panic("incrementChannelState() cannot be used after setChannelState()!\n");
}
res = handleIncrementChannelStateByIndices(channel_index, state_index,
@@ -871,21 +872,3 @@
finish:
return result;
}
-
-/* static */ OSPtr<IOReportLegendEntry>
-IOStateReporter::createLegend(const uint64_t *channelIDs,
- const char **channelNames,
- int channelCount,
- int nstates,
- IOReportCategories categories,
- IOReportUnit unit)
-{
- IOReportChannelType channelType = {
- .categories = categories,
- .report_format = kIOReportFormatState,
- .nelements = static_cast<uint16_t>(nstates),
- .element_idx = 0
- };
-
- return IOReporter::legendWith(channelIDs, channelNames, channelCount, channelType, unit);
-}