Loading...
iokit/Kernel/IOTimerEventSource.cpp xnu-12377.101.15 xnu-6153.41.3
--- xnu/xnu-12377.101.15/iokit/Kernel/IOTimerEventSource.cpp
+++ xnu/xnu-6153.41.3/iokit/Kernel/IOTimerEventSource.cpp
@@ -26,7 +26,6 @@
  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 
-#include <ptrauth.h>
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
@@ -47,14 +46,13 @@
 #endif
 
 #include <libkern/Block.h>
-#include <libkern/Block_private.h>
 
 
 #define super IOEventSource
 OSDefineMetaClassAndStructors(IOTimerEventSource, IOEventSource)
-OSMetaClassDefineReservedUsedX86(IOTimerEventSource, 0);
-OSMetaClassDefineReservedUsedX86(IOTimerEventSource, 1);
-OSMetaClassDefineReservedUsedX86(IOTimerEventSource, 2);
+OSMetaClassDefineReservedUsed(IOTimerEventSource, 0);
+OSMetaClassDefineReservedUsed(IOTimerEventSource, 1);
+OSMetaClassDefineReservedUsed(IOTimerEventSource, 2);
 OSMetaClassDefineReservedUnused(IOTimerEventSource, 3);
 OSMetaClassDefineReservedUnused(IOTimerEventSource, 4);
 OSMetaClassDefineReservedUnused(IOTimerEventSource, 5);
@@ -102,38 +100,29 @@
 //
 
 __inline__ void
-IOTimerEventSource::invokeAction(IOEventSource::Action _action, IOTimerEventSource * ts,
+IOTimerEventSource::invokeAction(IOTimerEventSource::Action _action, IOTimerEventSource * ts,
     OSObject * _owner, IOWorkLoop * _workLoop)
 {
 	bool    trace = (gIOKitTrace & kIOTraceTimers) ? true : false;
-	void  * address;
-
-	if (kActionBlock & flags) {
-		address = ptrauth_nop_cast(void *, _Block_get_invoke_fn((struct Block_layout *) actionBlock));
-	} else {
-		address = ptrauth_nop_cast(void *, _action);
-	}
 
 	if (trace) {
 		IOTimeStampStartConstant(IODBG_TIMES(IOTIMES_ACTION),
-		    VM_KERNEL_ADDRHIDE(address),
-		    VM_KERNEL_ADDRHIDE(_owner));
+		    VM_KERNEL_ADDRHIDE(_action), VM_KERNEL_ADDRHIDE(_owner));
 	}
 
 	if (kActionBlock & flags) {
 		((IOTimerEventSource::ActionBlock) actionBlock)(ts);
 	} else {
-		((IOTimerEventSource::Action)_action)(_owner, ts);
+		(*_action)(_owner, ts);
 	}
 
 #if CONFIG_DTRACE
-	DTRACE_TMR3(iotescallout__expire, Action, address, OSObject, _owner, void, _workLoop);
+	DTRACE_TMR3(iotescallout__expire, Action, _action, OSObject, _owner, void, _workLoop);
 #endif
 
 	if (trace) {
 		IOTimeStampEndConstant(IODBG_TIMES(IOTIMES_ACTION),
-		    VM_KERNEL_UNSLIDE(address),
-		    VM_KERNEL_ADDRHIDE(_owner));
+		    VM_KERNEL_UNSLIDE(_action), VM_KERNEL_ADDRHIDE(_owner));
 	}
 }
 
@@ -148,10 +137,10 @@
 		IOWorkLoop *
 		    wl = me->workLoop;
 		if (wl) {
-			IOEventSource::Action doit;
+			Action doit;
 			wl->closeGate();
 			IOStatisticsCloseGate();
-			doit = me->action;
+			doit = (Action) me->action;
 			if (doit && me->enabled && AbsoluteTime_to_scalar(&me->abstime)) {
 				me->invokeAction(doit, me, me->owner, me->workLoop);
 			}
@@ -175,21 +164,19 @@
 		IOWorkLoop *
 		    wl = me->reserved->workLoop;
 		if (wl) {
-			IOEventSource::Action doit;
+			Action doit;
 			wl->closeGate();
 			IOStatisticsCloseGate();
-			doit = me->action;
+			doit = (Action) me->action;
 			if (doit && (me->reserved->calloutGeneration == count)) {
-				thread_call_start_iotes_invocation((thread_call_t)me->calloutEntry);
 				me->invokeAction(doit, me, me->owner, me->workLoop);
 			}
 			IOStatisticsOpenGate();
 			wl->openGate();
 		}
 	}
-	if (me->reserved->workLoop) {
-		me->reserved->workLoop->release();
-	}
+
+	me->reserved->workLoop->release();
 	me->release();
 }
 
@@ -198,11 +185,11 @@
 bool
 IOTimerEventSource::checkForWork()
 {
-	IOEventSource::Action doit;
+	Action doit;
 
 	if (reserved
 	    && (reserved->calloutGenerationSignaled == reserved->calloutGeneration)
-	    && enabled && (doit = action)) {
+	    && enabled && (doit = (Action) action)) {
 		reserved->calloutGenerationSignaled = ~reserved->calloutGeneration;
 		invokeAction(doit, this, owner, workLoop);
 	}
@@ -235,11 +222,9 @@
 
 	// reserved != 0 means IOTimerEventSource::timeoutAndRelease is being used,
 	// not a subclassed implementation
-	reserved = IOMallocType(ExpansionData);
-
+	reserved = IONew(ExpansionData, 1);
 	reserved->calloutGenerationSignaled = ~reserved->calloutGeneration;
-	// make use of an existing ivar for parameter passing
-	options = (uint32_t) abstime;
+	options = abstime;
 	abstime = 0;
 
 	thread_call_options_t tcoptions = 0;
@@ -323,7 +308,6 @@
 bool
 IOTimerEventSource::init(uint32_t options, OSObject *inOwner, Action inAction)
 {
-	// make use of an existing ivar for parameter passing
 	abstime = options;
 	return init(inOwner, inAction);
 }
@@ -376,7 +360,7 @@
 	}
 
 	if (reserved) {
-		IOFreeType(reserved, ExpansionData);
+		IODelete(reserved, ExpansionData, 1);
 	}
 
 	super::free();