X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..cb3231590a3c94ab4375e2228bd5e86b0cf1ad7e:/iokit/Kernel/IOMultiMemoryDescriptor.cpp diff --git a/iokit/Kernel/IOMultiMemoryDescriptor.cpp b/iokit/Kernel/IOMultiMemoryDescriptor.cpp index 3418e41a8..d70531265 100644 --- a/iokit/Kernel/IOMultiMemoryDescriptor.cpp +++ b/iokit/Kernel/IOMultiMemoryDescriptor.cpp @@ -54,7 +54,7 @@ IOMultiMemoryDescriptor * IOMultiMemoryDescriptor::withDescriptors( /* withDirection */ withDirection, /* asReference */ asReference ) == false) { me->release(); - me = 0; + me = NULL; } return me; @@ -97,7 +97,7 @@ IOMultiMemoryDescriptor::initWithDescriptors( // Initialize our minimal state. - _descriptors = 0; + _descriptors = NULL; _descriptorsCount = withCount; _descriptorsIsAllocated = asReference ? false : true; _flags = withDirection; @@ -105,14 +105,14 @@ IOMultiMemoryDescriptor::initWithDescriptors( _direction = (IODirection) (_flags & kIOMemoryDirectionMask); #endif /* !__LP64__ */ _length = 0; - _mappings = 0; + _mappings = NULL; _tag = 0; if (asReference) { _descriptors = descriptors; } else { _descriptors = IONew(IOMemoryDescriptor *, withCount); - if (_descriptors == 0) { + if (_descriptors == NULL) { return false; } @@ -396,6 +396,28 @@ IOMultiMemoryDescriptor::setPurgeable( IOOptionBits newState, return err; } +IOReturn +IOMultiMemoryDescriptor::setOwnership( task_t newOwner, + int newLedgerTag, + IOOptionBits newLedgerOptions ) +{ + IOReturn err; + + if (iokit_iomd_setownership_enabled == FALSE) { + return kIOReturnUnsupported; + } + + err = kIOReturnSuccess; + for (unsigned index = 0; index < _descriptorsCount; index++) { + err = _descriptors[index]->setOwnership(newOwner, newLedgerTag, newLedgerOptions); + if (kIOReturnSuccess != err) { + break; + } + } + + return err; +} + IOReturn IOMultiMemoryDescriptor::getPageCounts(IOByteCount * pResidentPageCount, IOByteCount * pDirtyPageCount)