]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOMemoryDescriptor.cpp
xnu-6153.121.1.tar.gz
[apple/xnu.git] / iokit / Kernel / IOMemoryDescriptor.cpp
index d73a4343b5961696c3ef3dfda5bd4d0f53bd570a..a4e7d0536eb23a0a6c5a44619579f2b0fbe2dfc9 100644 (file)
@@ -3440,6 +3440,7 @@ IOGeneralMemoryDescriptor::wireVirtual(IODirection forDirection)
                                                upl_abort(iopl.fIOPL, 0);
                                                upl_deallocate(iopl.fIOPL);
                                        }
+                                       error = kIOReturnNoMemory;
                                        goto abortExit;
                                }
                                dataP = NULL;
@@ -3740,6 +3741,10 @@ IOGeneralMemoryDescriptor::prepare(IODirection forDirection)
        }
 
        if (kIOMemoryTypeVirtual == type || kIOMemoryTypeVirtual64 == type || kIOMemoryTypeUIO == type) {
+               if ((forDirection & kIODirectionPrepareAvoidThrottling) && NEED_TO_HARD_THROTTLE_THIS_TASK()) {
+                       error = kIOReturnNotReady;
+                       goto finish;
+               }
                error = wireVirtual(forDirection);
        }
 
@@ -3751,6 +3756,8 @@ IOGeneralMemoryDescriptor::prepare(IODirection forDirection)
                }
        }
 
+finish:
+
        if (_prepareLock) {
                IOLockUnlock(_prepareLock);
        }