ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference
|
IOMemoryMap |
Inherits from: | |
Declared In: |
An abstract base class defining common methods for describing a memory mapping.
The IOMemoryMap object represents a mapped range of memory, described by an IOMemoryDescriptor. The mapping may be in the kernel or a non-kernel task and has processor cache mode attributes. IOMemoryMap instances are created by IOMemoryDescriptor when it creates mappings in its map
method, and returned to the caller.
Accessor to the task of the mapping.
Accessor to the length of the mapping.
Accessor to the options the mapping was created with.
Accessor to the IOMemoryDescriptor the mapping was created from.
Return the physical address of the first byte in the mapping.
Break a mapping into its physically contiguous segments.
Replace the memory mapped in a process with new backing memory.
Force the IOMemoryMap to unmap, without destroying the object.
getAddressTask |
Accessor to the task of the mapping.
public
virtual task_t getAddressTask() = 0;
A Mach task_t
.
This method returns the Mach task the mapping exists in. Note that in Mac OS X, each process is based on a Mach task and one or more Mach threads. For more information on the composition of a Mach task and its relationship with Mach threads, see "Tasks and Threads".
getLength |
Accessor to the length of the mapping.
public
virtual IOByteCount getLength() = 0;
A byte count.
This method returns the length of the mapping.
getMapOptions |
Accessor to the options the mapping was created with.
public
virtual IOOptionBits getMapOptions() = 0;
Options for the mapping, including cache settings.
This method returns the options to IOMemoryDescriptor::map the mapping was created with.
getMemoryDescriptor |
Accessor to the IOMemoryDescriptor the mapping was created from.
public
virtual IOMemoryDescriptor * getMemoryDescriptor() = 0;
An IOMemoryDescriptor reference, which is valid while the IOMemoryMap object is retained. It should not be released by the caller.
This method returns the IOMemoryDescriptor the mapping was created from.
getPhysicalAddress |
Return the physical address of the first byte in the mapping.
public
IOPhysicalAddress getPhysicalAddress();
A physical address.
This method returns the physical address of the first byte in the mapping. It is most useful on mappings known to be physically contiguous.
getPhysicalSegment |
Break a mapping into its physically contiguous segments.
public
virtual IOPhysicalAddress getPhysicalSegment( IOByteCount offset, IOByteCount *length) = 0;
offset
A byte offset into the mapping whose physical address to return.
length
If non-zero, getPhysicalSegment
will store here the length of the physically contiguous segement at the given offset.
A physical address, or zero if the offset is beyond the length of the mapping.
This method returns the physical address of the byte at the given offset into the mapping, and optionally the length of the physically contiguous segment from that offset. It functions similarly to IOMemoryDescriptor::getPhysicalSegment.
redirect |
Replace the memory mapped in a process with new backing memory.
public
virtual IOReturn redirect( IOMemoryDescriptor *newBackingMemory, IOOptionBits options, IOByteCount offset = 0) = 0;
newBackingMemory
The IOMemoryDescriptor that represents the physical memory that is to be now mapped in the virtual range the IOMemoryMap represents. If newBackingMemory
is NULL, any access to the mapping will hang (in vm_fault()
) until access has been restored by a new call to redirect
with non-NULL newBackingMemory
argument.
options
Mapping options are defined in IOTypes.h
, and are documented in IOMemoryDescriptor::map()
.
offset
As with IOMemoryDescriptor::map()
, a beginning offset into the IOMemoryDescriptor's memory where the mapping starts. Zero is the default.
An IOReturn code.
An IOMemoryMap created with the kIOMapUnique
option to IOMemoryDescriptor::map can remapped to a new IOMemoryDescriptor backing object. If the new IOMemoryDescriptor is specified as NULL, client access to the memory map is blocked until a new backing object has been set. By blocking access and copying data, the caller can create atomic copies of the memory while the client is potentially reading or writing the memory.
unmap |
Force the IOMemoryMap to unmap, without destroying the object.
public
virtual IOReturn unmap() = 0;
An IOReturn code.
IOMemoryMap instances will unmap themselves upon free, ie. when the last client with a reference calls release. This method forces the IOMemoryMap to destroy the mapping it represents, regardless of the number of clients. It is not generally used.
|
Last Updated: 2008-12-19