]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOInterruptEventSource.cpp
xnu-4903.231.4.tar.gz
[apple/xnu.git] / iokit / Kernel / IOInterruptEventSource.cpp
index 1636405f6a78c162db718a597956a16929304285..0d96bbb8649202557dfcf85df55c03682644a1a0 100644 (file)
@@ -220,6 +220,19 @@ IOInterruptEventSource::interruptEventSource(OSObject *inOwner,
     return me;
 }
 
     return me;
 }
 
+IOInterruptEventSource *
+IOInterruptEventSource::interruptEventSource(OSObject *inOwner,
+                                            IOService *inProvider,
+                                            int inIntIndex,
+                                            ActionBlock inAction)
+{
+    IOInterruptEventSource * ies;
+    ies = IOInterruptEventSource::interruptEventSource(inOwner, (Action) NULL, inProvider, inIntIndex);
+    if (ies) ies->setActionBlock((IOEventSource::ActionBlock) inAction);
+
+    return ies;
+}
+
 void IOInterruptEventSource::free()
 {
     if (provider && intIndex >= 0)
 void IOInterruptEventSource::free()
 {
     if (provider && intIndex >= 0)
@@ -300,6 +313,7 @@ bool IOInterruptEventSource::checkForWork()
     unsigned int cacheProdCount = producerCount;
     int numInts = cacheProdCount - consumerCount;
     IOInterruptEventAction intAction = (IOInterruptEventAction) action;
     unsigned int cacheProdCount = producerCount;
     int numInts = cacheProdCount - consumerCount;
     IOInterruptEventAction intAction = (IOInterruptEventAction) action;
+    ActionBlock intActionBlock = (ActionBlock) actionBlock;
        bool trace = (gIOKitTrace & kIOTraceIntEventSource) ? true : false;
        
     IOStatisticsCheckForWork();
        bool trace = (gIOKitTrace & kIOTraceIntEventSource) ? true : false;
        
     IOStatisticsCheckForWork();
@@ -308,7 +322,8 @@ bool IOInterruptEventSource::checkForWork()
        {
                if (trace)
                        IOTimeStampStartConstant(IODBG_INTES(IOINTES_ACTION),
        {
                if (trace)
                        IOTimeStampStartConstant(IODBG_INTES(IOINTES_ACTION),
-                                                VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+                                                VM_KERNEL_ADDRHIDE(intAction), VM_KERNEL_ADDRHIDE(owner),
+                                                VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(workLoop));
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelSystemTimeIndex)) {
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelSystemTimeIndex)) {
@@ -321,7 +336,8 @@ bool IOInterruptEventSource::checkForWork()
                }
 
                // Call the handler
                }
 
                // Call the handler
-               (*intAction)(owner, this, numInts);
+               if (kActionBlock & flags) (intActionBlock)(this, numInts);
+               else                      (*intAction)(owner, this, numInts);
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelCountIndex)) {
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelCountIndex)) {
@@ -341,7 +357,8 @@ bool IOInterruptEventSource::checkForWork()
                
                if (trace)
                        IOTimeStampEndConstant(IODBG_INTES(IOINTES_ACTION),
                
                if (trace)
                        IOTimeStampEndConstant(IODBG_INTES(IOINTES_ACTION),
-                                              VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+                                               VM_KERNEL_ADDRHIDE(intAction), VM_KERNEL_ADDRHIDE(owner),
+                                               VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(workLoop));
                
                consumerCount = cacheProdCount;
                if (autoDisable && !explicitDisable)
                
                consumerCount = cacheProdCount;
                if (autoDisable && !explicitDisable)
@@ -352,7 +369,8 @@ bool IOInterruptEventSource::checkForWork()
        {
                if (trace)
                        IOTimeStampStartConstant(IODBG_INTES(IOINTES_ACTION),
        {
                if (trace)
                        IOTimeStampStartConstant(IODBG_INTES(IOINTES_ACTION),
-                                                VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+                                               VM_KERNEL_ADDRHIDE(intAction), VM_KERNEL_ADDRHIDE(owner),
+                                               VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(workLoop));
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelSystemTimeIndex)) {
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelSystemTimeIndex)) {
@@ -365,7 +383,8 @@ bool IOInterruptEventSource::checkForWork()
                }
                
                // Call the handler
                }
                
                // Call the handler
-               (*intAction)(owner, this, -numInts);
+               if (kActionBlock & flags) (intActionBlock)(this, numInts);
+               else                      (*intAction)(owner, this, numInts);
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelCountIndex)) {
 
                if (reserved->statistics) {
                        if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingSecondLevelCountIndex)) {
@@ -385,7 +404,8 @@ bool IOInterruptEventSource::checkForWork()
                
                if (trace)
                        IOTimeStampEndConstant(IODBG_INTES(IOINTES_ACTION),
                
                if (trace)
                        IOTimeStampEndConstant(IODBG_INTES(IOINTES_ACTION),
-                                              VM_KERNEL_UNSLIDE(intAction), (uintptr_t) owner, (uintptr_t) this, (uintptr_t) workLoop);
+                                                       VM_KERNEL_ADDRHIDE(intAction), VM_KERNEL_ADDRHIDE(owner),
+                                                       VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(workLoop));
                
                consumerCount = cacheProdCount;
                if (autoDisable && !explicitDisable)
                
                consumerCount = cacheProdCount;
                if (autoDisable && !explicitDisable)
@@ -404,7 +424,7 @@ void IOInterruptEventSource::normalInterruptOccurred
     producerCount++;
        
        if (trace)
     producerCount++;
        
        if (trace)
-           IOTimeStampStartConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
+           IOTimeStampStartConstant(IODBG_INTES(IOINTES_SEMA), VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(owner));
 
     if (reserved->statistics) {
         if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingFirstLevelCountIndex)) {
 
     if (reserved->statistics) {
         if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingFirstLevelCountIndex)) {
@@ -415,7 +435,7 @@ void IOInterruptEventSource::normalInterruptOccurred
     signalWorkAvailable();
        
        if (trace)
     signalWorkAvailable();
        
        if (trace)
-           IOTimeStampEndConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
+           IOTimeStampEndConstant(IODBG_INTES(IOINTES_SEMA), VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(owner));
 }
 
 void IOInterruptEventSource::disableInterruptOccurred
 }
 
 void IOInterruptEventSource::disableInterruptOccurred
@@ -429,7 +449,7 @@ void IOInterruptEventSource::disableInterruptOccurred
     producerCount++;
        
        if (trace)
     producerCount++;
        
        if (trace)
-           IOTimeStampStartConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
+           IOTimeStampStartConstant(IODBG_INTES(IOINTES_SEMA), VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(owner));
 
     if (reserved->statistics) {
         if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingFirstLevelCountIndex)) {
 
     if (reserved->statistics) {
         if (IA_GET_STATISTIC_ENABLED(kInterruptAccountingFirstLevelCountIndex)) {
@@ -440,7 +460,7 @@ void IOInterruptEventSource::disableInterruptOccurred
     signalWorkAvailable();
        
        if (trace)
     signalWorkAvailable();
        
        if (trace)
-           IOTimeStampEndConstant(IODBG_INTES(IOINTES_SEMA), (uintptr_t) this, (uintptr_t) owner);
+           IOTimeStampEndConstant(IODBG_INTES(IOINTES_SEMA), VM_KERNEL_ADDRHIDE(this), VM_KERNEL_ADDRHIDE(owner));
 }
 
 void IOInterruptEventSource::interruptOccurred
 }
 
 void IOInterruptEventSource::interruptOccurred