The relevant sections from the header file IOMemoryDescriptor.h are as follows:
Description of various IOOptionBits used by the IOBufferMemoryDescriptor::withOptions(...) function:
Description of various individual flags
Description of various IOOptionBits used by the IOBufferMemoryDescriptor::withOptions(...) function:
C:
@param options
* kIOMemoryDirectionMask (options:direction) This nibble indicates the I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
* kIOMemoryTypeMask (options:type) kIOMemoryTypeVirtual64, kIOMemoryTypeVirtual, kIOMemoryTypePhysical64, kIOMemoryTypePhysical, kIOMemoryTypeUPL Indicates that what type of memory basic memory descriptor to use. This sub-field also controls the interpretation of the buffers, count, offset & task parameters.
* kIOMemoryAsReference For options:type = Virtual or Physical this indicate that the memory descriptor need not copy the ranges array into local memory. This is an optimisation to try to minimise unnecessary allocations.
* kIOMemoryBufferPageable Only used by the IOBufferMemoryDescriptor as an indication that the kernel virtual memory is in fact pageable and we need to use the kernel pageable submap rather than the default map.
Description of various individual flags
C:
enum IODirection
#endif /* !__LP64__ */
{
kIODirectionNone = 0x0,// same as VM_PROT_NONE
kIODirectionIn = 0x1,// User land 'read', same as VM_PROT_READ
kIODirectionOut = 0x2,// User land 'write', same as VM_PROT_WRITE
kIODirectionOutIn = kIODirectionOut | kIODirectionIn,
kIODirectionInOut = kIODirectionIn | kIODirectionOut,
// these flags are valid for the prepare() method only
kIODirectionPrepareToPhys32 = 0x00000004,
kIODirectionPrepareNoFault = 0x00000008,
kIODirectionPrepareReserved1 = 0x00000010,
#define IODIRECTIONPREPARENONCOHERENTDEFINED 1
kIODirectionPrepareNonCoherent = 0x00000020,
#define IODIRECTIONPREPAREAVOIDTHROTTLING 1
kIODirectionPrepareAvoidThrottling = 0x00000100,
// these flags are valid for the complete() method only
#define IODIRECTIONCOMPLETEWITHERRORDEFINED 1
kIODirectionCompleteWithError = 0x00000040,
#define IODIRECTIONCOMPLETEWITHDATAVALIDDEFINED 1
kIODirectionCompleteWithDataValid = 0x00000080,
};
#ifdef __LP64__
typedef IOOptionBits IODirection;
#endif /* __LP64__ */
/*
* IOOptionBits used in the withOptions variant
*/
enum {
kIOMemoryDirectionMask = 0x00000007,
kIOMemoryTypeVirtual = 0x00000010,
kIOMemoryTypePhysical = 0x00000020,
kIOMemoryTypeUPL = 0x00000030,
kIOMemoryTypePersistentMD = 0x00000040,// Persistent Memory Descriptor
kIOMemoryTypeUIO = 0x00000050,
#ifdef __LP64__
kIOMemoryTypeVirtual64 = kIOMemoryTypeVirtual,
kIOMemoryTypePhysical64 = kIOMemoryTypePhysical,
#else /* !__LP64__ */
kIOMemoryTypeVirtual64 = 0x00000060,
kIOMemoryTypePhysical64 = 0x00000070,
#endif /* !__LP64__ */
kIOMemoryTypeMask = 0x000000f0,
kIOMemoryAsReference = 0x00000100,
kIOMemoryBufferPageable = 0x00000400,
kIOMemoryMapperNone = 0x00000800,// Shared with Buffer MD
kIOMemoryHostOnly = 0x00001000,// Never DMA accessible
kIOMemoryPersistent = 0x00010000,
kIOMemoryMapCopyOnWrite = 0x00020000,
kIOMemoryRemote = 0x00040000,
kIOMemoryThreadSafe = 0x00100000,// Shared with Buffer MD
kIOMemoryClearEncrypt = 0x00200000,// Shared with Buffer MD
kIOMemoryUseReserve = 0x00800000,// Shared with Buffer MD
#define IOMEMORYUSERESERVEDEFINED 1
};
Last edited: