Back to Darwin Xnu

Device Map

osfmk/man/device_map.html

latest2.3 KB
Original Source

device_map


Function - Establish the specified device's memory manager.

SYNOPSIS

**#include&lt device/device.h&gt**** kern\_return\_t device\_map****(mach\_port\_t**device, **vm\_prot\_t** prot, **vm\_offset\_t** offset, **vm\_size\_t** size, **mach\_port\_t** mem\_obj\_t, **boolean\_t** unmap**);**

PARAMETERS

device[in device send right] A device port to the device to be mapped.

prot[in scalar] Protection for the device memory.

offset[in scalar] 15~Offset in memory object.

size[in scalar] The size of the device memory object.

pager[out memory-object send right] The returned memory object representative port to a memory manager that represents the device.

unmapUnused.

DESCRIPTION

The device_map function establishes a memory manager that presents a memory object representing a device. The resulting port is suitable for use as the memory manager port in a vm_map call. This call is device dependent.

NOTES

Port rights are maintained as follows:

  • Memory object port: the device memory manager has all rights.
  • Memory cache control port: the device memory manager has only send rights.

Regardless of how the object is created, the control port is created by the kernel and passed through the memory management interface.

If the device port used is restricted to use by a single identity, the generated representative port will be likewise restricted.

CAUTIONS

The device memory manager assumes that access to its memory objects will not be propagated to more that one host, and therefore provides no consistency guarantees beyond those made by the kernel.

In the event that more than one host attempts to use a device memory object, the device memory manager will only record the last set of port names. Currently, the device memory manager assumes that its clients adhere to the initialization and termination protocols in the memory management interface; otherwise, port rights or out-of-line memory from erroneous messages may be allowed to accumulate.

RETURN VALUES

D_DEVICE_DOWN Device has been shut down

D_NO_SUCH_DEVICE No device with that name, or the device is not operational.

D_READ_ONLY Data cannot be written to this device.

Functions: vm_map.