#include <IOKit/IOMemoryDescriptor.h>
IOKit/IOMemoryDescriptor.h
enum(anonymous)
Direction of transfer, with respect to the described memory.
| kIODirectionNone | 0 | same as VM_PROT_NONE |
| kIODirectionIn | 1 | User land 'read', same as VM_PROT_READ |
| kIODirectionOut | 2 | User land 'write', same as VM_PROT_WRITE |
| kIODirectionOutIn | 3 | |
| kIODirectionInOut | 3 | |
| kIODirectionPrepareToPhys32 | 4 | these flags are valid for the prepare() method only |
| kIODirectionPrepareNoFault | 8 | |
| kIODirectionPrepareReserved1 | 16 | |
| kIODirectionPrepareNonCoherent | 32 | |
| kIODirectionCompleteWithError | 64 | |
| kIODirectionCompleteWithDataValid | 128 |
macroIODIRECTIONPREPARENONCOHERENTDEFINED
#define IODIRECTIONPREPARENONCOHERENTDEFINED 1
macroIODIRECTIONCOMPLETEWITHERRORDEFINED
these flags are valid for the complete() method only
#define IODIRECTIONCOMPLETEWITHERRORDEFINED 1
macroIODIRECTIONCOMPLETEWITHDATAVALIDDEFINED
#define IODIRECTIONCOMPLETEWITHDATAVALIDDEFINED 1
typedefIODirection
typedef IOOptionBits IODirection
enum(anonymous)
IOOptionBits used in the withOptions variant
| kIOMemoryDirectionMask | 7 | |
| kIOMemoryTypeVirtual | 16 | |
| kIOMemoryTypePhysical | 32 | |
| kIOMemoryTypeUPL | 48 | |
| kIOMemoryTypePersistentMD | 64 | Persistent Memory Descriptor |
| kIOMemoryTypeUIO | 80 | |
| kIOMemoryTypeVirtual64 | 16 | |
| kIOMemoryTypePhysical64 | 32 | |
| kIOMemoryTypeVnode | 96 | |
| kIOMemoryTypeMask | 240 | |
| kIOMemoryAsReference | 256 | |
| kIOMemoryBufferPageable | 1024 | |
| kIOMemoryMapperNone | 2048 | Shared with Buffer MD |
| kIOMemoryHostOnly | 4096 | Never DMA accessible |
| kIOMemoryPersistent | 65536 | |
| kIOMemoryMapCopyOnWrite | 131072 | |
| kIOMemoryRemote | 262144 | |
| kIOMemoryThreadSafe | 1048576 | Shared with Buffer MD |
| kIOMemoryClearEncrypt | 2097152 | Shared with Buffer MD |
| kIOMemoryUseReserve | 8388608 | Shared with Buffer MD |
macroIOMEMORYUSERESERVEDEFINED
#define IOMEMORYUSERESERVEDEFINED 1
macrokIOMapperSystem
#define kIOMapperSystem ((IOMapper *) NULL)
enum(anonymous)
| kIOMemoryLedgerTagDefault | 1 | |
| kIOmemoryLedgerTagNetwork | 2 | |
| kIOMemoryLedgerTagMedia | 3 | |
| kIOMemoryLedgerTagGraphics | 4 | |
| kIOMemoryLedgerTagNeural | 5 |
enum(anonymous)
| kIOMemoryLedgerFlagNoFootprint | 1 |
enum(anonymous)
| kIOMemoryPurgeableKeepCurrent | 1 | |
| kIOMemoryPurgeableNonVolatile | 2 | |
| kIOMemoryPurgeableVolatile | 3 | |
| kIOMemoryPurgeableEmpty | 4 | |
| kIOMemoryPurgeableVolatileGroup0 | 0 | modifiers for kIOMemoryPurgeableVolatile behavior |
| kIOMemoryPurgeableVolatileGroup1 | 256 | |
| kIOMemoryPurgeableVolatileGroup2 | 512 | |
| kIOMemoryPurgeableVolatileGroup3 | 768 | |
| kIOMemoryPurgeableVolatileGroup4 | 1024 | |
| kIOMemoryPurgeableVolatileGroup5 | 1280 | |
| kIOMemoryPurgeableVolatileGroup6 | 1536 | |
| kIOMemoryPurgeableVolatileGroup7 | 1792 | |
| kIOMemoryPurgeableVolatileBehaviorFifo | 0 | |
| kIOMemoryPurgeableVolatileBehaviorLifo | 64 | |
| kIOMemoryPurgeableVolatileOrderingObsolete | 32 | |
| kIOMemoryPurgeableVolatileOrderingNormal | 0 | |
| kIOMemoryPurgeableFaultOnAccess | 8192 |
enum(anonymous)
| kIOMemoryIncoherentIOFlush | 1 | |
| kIOMemoryIncoherentIOStore | 2 | |
| kIOMemoryClearEncrypted | 50 | |
| kIOMemorySetEncrypted | 51 |
macroIOMEMORYDESCRIPTOR_SUPPORTS_DMACOMMAND
#define IOMEMORYDESCRIPTOR_SUPPORTS_DMACOMMAND 1
structIODMAMapSpecification
| uint64_t | alignment | |
| IOService * | device | |
| uint32_t | options | |
| uint8_t | numAddressBits | |
| uint8_t[3] | resvA | |
| uint32_t[4] | resvB |
structIODMAMapPageList
| uint32_t | pageOffset | |
| uint32_t | pageListCount | |
| const upl_page_info_t * | pageList |
enum(anonymous)
mapOptions for iovmMapMemory
| kIODMAMapReadAccess | 1 | |
| kIODMAMapWriteAccess | 2 | |
| kIODMAMapPhysicallyContiguous | 16 | |
| kIODMAMapDeviceMemory | 32 | |
| kIODMAMapPagingPath | 64 | |
| kIODMAMapIdentityMap | 128 | |
| kIODMAMapPageListFullyOccupied | 256 | |
| kIODMAMapFixedAddress | 512 |
enum(anonymous)
| kIOPreparationIDUnprepared | 0 | |
| kIOPreparationIDUnsupported | 1 | |
| kIOPreparationIDAlwaysPrepared | 2 |
classIOMemoryDescriptor
: public OSObject
| struct IOMemoryDescriptorReserved * | reserved | |
| OSPtr<OSSet> | _mappings | |
| IOOptionBits | _flags | |
| void * | __iomd_reserved5 | |
| uint16_t[4] | __iomd_reserved1 | |
| uintptr_t | __iomd_reserved2 | |
| uint16_t | _iomapperOptions | |
| uint16_t[3] | __iomd_reserved3 | |
| uintptr_t | __iomd_reserved4 | |
| IOByteCount | _length | length of all ranges |
| IOOptionBits | _tag |
OSDeclareDefaultStructorsWithDispatch(IOMemoryDescriptor)static protected
OSDeclareDefaultStructorsWithDispatch(IOMemoryDescriptor)static protected
virtual bool initWithOptions( void * buffers, UInt32 count, UInt32 offset, task_t task, IOOptionBits options, IOMapper * mapper = kIOMapperSystem )virtual
@function initWithOptions
@abstract Master initialiser for all variants of memory descriptors. For a more complete description see IOMemoryDescriptor::withOptions.
@discussion Note this function can be used to re-init a previously created memory descriptor.
@result true on success, false on failure.
virtual IOReturn setPurgeable(IOOptionBits newState, IOOptionBits * oldState)virtual
IOReturn setOwnership(task_t newOwner, int newLedgerTag, IOOptionBits newLedgerOptions)
IOReturn getPageCounts(IOByteCount * residentPageCount, IOByteCount * dirtyPageCount)
IOReturn getPageCounts( IOByteCount * residentPageCount, IOByteCount * dirtyPageCount, IOByteCount * swappedPageCount )
virtual IOReturn performOperation( IOOptionBits options, IOByteCount offset, IOByteCount length )virtual
virtual IOReturn dmaCommandOperation(DMACommandOps op, void *vData, UInt dataSize) constvirtual
Used for dedicated communications for IODMACommand
virtual addr64_t getPhysicalSegment( IOByteCount offset, IOByteCount * length, IOOptionBits options = 0 ) = 0pure virtual
virtual uint64_t getPreparationID(void)virtual
void setPreparationID(void)
void setVMTags(uint32_t kernelTag, uint32_t userTag)
uint32_t getVMTag(vm_map_t map)
APPLE_KEXT_OVERRIDE
virtual void free(void)virtual protectedstatic void initialize(void)static
static OSPtr<IOMemoryDescriptor> withAddress( void * address, IOByteCount withLength, IODirection withDirection )static
static OSPtr<IOMemoryDescriptor> withPhysicalAddress( IOPhysicalAddress address, IOByteCount withLength, IODirection withDirection )static
static OSPtr<IOMemoryDescriptor> withAddressRange( mach_vm_address_t address, mach_vm_size_t length, IOOptionBits options, task_t task )static
static OSPtr<IOMemoryDescriptor> withAddressRanges( IOAddressRange * ranges, UInt32 rangeCount, IOOptionBits options, task_t task )static
static OSPtr<IOMemoryDescriptor> withOptions( void * buffers, UInt32 count, UInt32 offset, task_t task, IOOptionBits options, IOMapper * mapper = kIOMapperSystem )static
static OSPtr<IOMemoryDescriptor> withPersistentMemoryDescriptor( IOMemoryDescriptor *originalMD )static
@function withPersistentMemoryDescriptor
@abstract Copy constructor that generates a new memory descriptor if the backing memory for the same task's virtual address and length has changed.
@discussion If the original memory descriptor's address and length is still backed by the same real memory, i.e. the user hasn't deallocated and the reallocated memory at the same address then the original memory descriptor is returned with a additional reference. Otherwise we build a totally new memory descriptor with the same characteristics as the previous one but with a new view of the vm. Note not legal to call this function with anything except an IOGeneralMemoryDescriptor that was created with the kIOMemoryPersistent option.
@param originalMD The memory descriptor to be duplicated.
@result Either the original memory descriptor with an additional retain or a new memory descriptor, 0 for a bad original memory descriptor or some other resource shortage.
virtual IODirection getDirection() constvirtual
virtual IOByteCount getLength() constvirtual
uint64_t getDMAMapLength(uint64_t * offset = NULL)
virtual void setTag(IOOptionBits tag)virtual
virtual IOOptionBits getTag(void)virtual
uint64_t getFlags(void)
virtual IOByteCount readBytes(IOByteCount offset, void * bytes, IOByteCount withLength)virtual
virtual IOByteCount writeBytes( IOByteCount offset, const void * bytes, IOByteCount withLength )virtual
IOPhysicalAddress getPhysicalAddress()
virtual IOReturn prepare(IODirection forDirection = kIODirectionNone) = 0pure virtual
virtual IOReturn complete(IODirection forDirection = kIODirectionNone) = 0pure virtual
OSPtr<IOMemoryMap> createMappingInTask( task_t intoTask, mach_vm_address_t atAddress, IOOptionBits options, mach_vm_size_t offset = 0, mach_vm_size_t length = 0 )
virtual OSPtr<IOMemoryMap> map(IOOptionBits options = 0)virtual
virtual OSPtr<IOMemoryMap> setMapping( task_t task, IOVirtualAddress mapAddress, IOOptionBits options = 0 )virtual
void setMapperOptions(uint16_t options)
uint16_t getMapperOptions(void)
IOReturn handleFault(void * _pager, mach_vm_size_t sourceOffset, mach_vm_size_t length)
IOReturn populateDevicePager( void * pager, vm_map_t addressMap, mach_vm_address_t address, mach_vm_size_t sourceOffset, mach_vm_size_t length, IOOptionBits options )
virtual LIBKERN_RETURNS_NOT_RETAINED IOMemoryMap * makeMapping( IOMemoryDescriptor * owner, task_t intoTask, IOVirtualAddress atAddress, IOOptionBits options, IOByteCount offset, IOByteCount length )virtual
virtual void addMapping(IOMemoryMap * mapping)virtual protected
virtual void removeMapping(IOMemoryMap * mapping)virtual protected
virtual IOReturn doMap( vm_map_t addressMap, IOVirtualAddress * atAddress, IOOptionBits options, IOByteCount sourceOffset = 0, IOByteCount length = 0 )virtual protected
virtual IOReturn doUnmap( vm_map_t addressMap, IOVirtualAddress logical, IOByteCount length )virtual protected
macroIOMEMORYDESCRIPTOR_SUPPORTS_GETDMAMAPLENGTH
#define IOMEMORYDESCRIPTOR_SUPPORTS_GETDMAMAPLENGTH
classIOMemoryMap
: public OSObject
APPLE_KEXT_OVERRIDE virtual void taggedRelease(const void *tag = NULL) constvirtual protected
APPLE_KEXT_OVERRIDE
virtual void free(void)virtual protectedvirtual IOVirtualAddress getVirtualAddress(void)virtual
virtual IOPhysicalAddress getPhysicalSegment( IOByteCount offset, IOByteCount * length, IOOptionBits options = 0 )virtual
IOPhysicalAddress getPhysicalAddress(void)
virtual IOByteCount getLength(void)virtual
virtual task_t getAddressTask()virtual
virtual IOMemoryDescriptor * getMemoryDescriptor()virtual
virtual IOOptionBits getMapOptions()virtual
virtual IOReturn unmap()virtual
virtual void taskDied()virtual
virtual IOReturn redirect( IOMemoryDescriptor * newBackingMemory, IOOptionBits options, mach_vm_size_t offset = 0 )virtual
__attribute__((always_inline)) inline mach_vm_address_t getAddress()
@function getAddress
@abstract Accessor to the virtual address of the first byte in the mapping.
@discussion This method returns the virtual address of the first byte in the mapping.
@result A virtual address.
__attribute__((always_inline)) inline mach_vm_size_t getSize()
@function getSize
@abstract Accessor to the length of the mapping.
@discussion This method returns the length of the mapping.
@result A byte count.
IOReturn wireRange(uint32_t options, mach_vm_size_t offset, mach_vm_size_t length)
classIOGeneralMemoryDescriptor
: public IOMemoryDescriptor
| Ranges | _ranges | |
| unsigned int | _rangesCount | number of address ranges in list |
| task_t | _task | task where all ranges are mapped to |
| unnamed union at Kernel/IOKit/IOMemoryDescriptor.h:928:2 | _singleRange | storage space for a single range |
| unsigned int | _wireCount | number of outstanding wires |
| bool | _initialized | has superclass been initialized? |
APPLE_KEXT_OVERRIDE
virtual void free()virtualAPPLE_KEXT_OVERRIDE virtual IOReturn dmaCommandOperation(DMACommandOps op, void *vData, UInt dataSize) constvirtual
APPLE_KEXT_OVERRIDE
virtual uint64_t getPreparationID(void)virtualAPPLE_KEXT_OVERRIDE virtual bool initWithOptions( void * buffers, UInt32 count, UInt32 offset, task_t task, IOOptionBits options, IOMapper * mapper = kIOMapperSystem )virtual
Master initaliser
APPLE_KEXT_OVERRIDE virtual IOReturn setPurgeable(IOOptionBits newState, IOOptionBits * oldState)virtual
IOReturn setOwnership(task_t newOwner, int newLedgerTag, IOOptionBits newLedgerOptions)
APPLE_KEXT_OVERRIDE virtual addr64_t getPhysicalSegment( IOByteCount offset, IOByteCount * length, IOOptionBits options = 0 )virtual
APPLE_KEXT_OVERRIDE virtual IOReturn prepare(IODirection forDirection = kIODirectionNone)virtual
APPLE_KEXT_OVERRIDE virtual IOReturn complete(IODirection forDirection = kIODirectionNone)virtual
APPLE_KEXT_OVERRIDE virtual LIBKERN_RETURNS_NOT_RETAINED IOMemoryMap * makeMapping( IOMemoryDescriptor * owner, task_t intoTask, IOVirtualAddress atAddress, IOOptionBits options, IOByteCount offset, IOByteCount length )virtual
APPLE_KEXT_OVERRIDE virtual IOReturn doMap( vm_map_t addressMap, IOVirtualAddress * atAddress, IOOptionBits options, IOByteCount sourceOffset = 0, IOByteCount length = 0 )virtual
APPLE_KEXT_OVERRIDE virtual IOReturn doUnmap( vm_map_t addressMap, IOVirtualAddress logical, IOByteCount length )virtual
APPLE_KEXT_OVERRIDE virtual bool serialize(OSSerialize *s) constvirtual
static OSPtr<IOMemoryDescriptor> withPersistentMemoryDescriptor( IOGeneralMemoryDescriptor *originalMD )static
Factory method for cloning a persistent IOMD, see IOMemoryDescriptor
IOOptionBits memoryReferenceCreateOptions(IOOptionBits options, IOMemoryMap * map)
variableiokit_iomd_setownership_enabled
extern bool iokit_iomd_setownership_enabled