X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6601e61aa18bf4f09af135ff61fc7f4771d23b06..0c530ab8987f0ae6a1a3d9284f40182b88852816:/iokit/Kernel/IOMultiMemoryDescriptor.cpp diff --git a/iokit/Kernel/IOMultiMemoryDescriptor.cpp b/iokit/Kernel/IOMultiMemoryDescriptor.cpp index ea706f33a..257a3aadb 100644 --- a/iokit/Kernel/IOMultiMemoryDescriptor.cpp +++ b/iokit/Kernel/IOMultiMemoryDescriptor.cpp @@ -270,9 +270,35 @@ IOReturn IOMultiMemoryDescriptor::complete(IODirection forDirection) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -IOPhysicalAddress IOMultiMemoryDescriptor::getPhysicalSegment( - IOByteCount offset, - IOByteCount * length ) +addr64_t IOMultiMemoryDescriptor::getPhysicalSegment64( + IOByteCount offset, IOByteCount * length ) +{ + // + // This method returns the physical address of the byte at the given offset + // into the memory, and optionally the length of the physically contiguous + // segment from that offset. + // + + assert(offset <= _length); + + for ( unsigned index = 0; index < _descriptorsCount; index++ ) + { + if ( offset < _descriptors[index]->getLength() ) + { + return _descriptors[index]->getPhysicalSegment64(offset, length); + } + offset -= _descriptors[index]->getLength(); + } + + if ( length ) *length = 0; + + return 0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +IOPhysicalAddress IOMultiMemoryDescriptor::getPhysicalSegment( + IOByteCount offset, IOByteCount * length ) { // // This method returns the physical address of the byte at the given offset