Miscellaneous Memory Functions
[Dataspace Manager Client API]

Lock/unlock dataspace regions, get memory size, ... More...

Data Structures

struct  l4dm_mem_addr

Typedefs

typedef struct l4dm_mem_addr l4dm_mem_addr_t

Functions

L4_CV int l4dm_mem_size (const l4dm_dataspace_t *ds, l4_size_t *size)
 Return dataspace size.
L4_CV int l4dm_mem_ds_phys_addr (const l4dm_dataspace_t *ds, l4_offs_t offset, l4_size_t size, l4_addr_t *paddr, l4_size_t *psize)
 Get phys. address of dataspace region.
L4_CV int l4dm_mem_phys_addr (const void *ptr, l4_size_t size, l4dm_mem_addr_t addrs[], int num, l4_size_t *psize)
 Get phys. address of a of VM region.
L4_CV int l4dm_mem_ds_is_contiguous (const l4dm_dataspace_t *ds)
 Test if dataspace is allocated on contiguous memory.
L4_CV int l4dm_mem_ds_lock (const l4dm_dataspace_t *ds, l4_offs_t offset, l4_size_t size)
 Lock dataspace region.
L4_CV int l4dm_mem_ds_unlock (const l4dm_dataspace_t *ds, l4_offs_t offset, l4_size_t size)
 Unlock dataspace region.
L4_CV int l4dm_mem_lock (const void *ptr, l4_size_t size)
 Lock virtual memory region.
L4_CV int l4dm_mem_unlock (const void *ptr, l4_size_t size)
 Unlock virtual memory region.

Detailed Description

Lock/unlock dataspace regions, get memory size, ...


Typedef Documentation

Address region


Function Documentation

L4_CV int l4dm_mem_size ( const l4dm_dataspace_t ds,
l4_size_t *  size 
)

Return dataspace size.

Parameters:
ds Dataspace descriptor
Return values:
size Dataspace size
Returns:
0 on success (size contains the dataspace size), error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL invalid dataspace id
  • -L4_EPERM Caller is not a client of the dataspace

L4_CV int l4dm_mem_ds_phys_addr ( const l4dm_dataspace_t ds,
l4_offs_t  offset,
l4_size_t  size,
l4_addr_t *  paddr,
l4_size_t *  psize 
)

Get phys. address of dataspace region.

Parameters:
ds Dataspace id
offset Offset in dataspace
size Region size, L4DM_WHOLE_DS to get the size of the contiguous area at offset
Return values:
paddr Phys. address
psize Size of phys. contiguous dataspace region at offset
Returns:
0 on success, error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL invalid dataspace id
  • -L4_EPERM caller is not a client of the dataspace
  • -L4_EINVAL_OFFS offset points beyond end of dataspace
Return the phys. address of the dataspace memory at offset. The dataspace manager will return the size of the contiguous memory starting at offset in psize (psize is set to size if the area is larger than size).
Note:
The dataspace region must be pinned in physical memory, otherwise it is not safe to use the returned phys. address (the dataspace region might get paged in the meantime).

L4_CV int l4dm_mem_phys_addr ( const void *  ptr,
l4_size_t  size,
l4dm_mem_addr_t  addrs[],
int  num,
l4_size_t *  psize 
)

Get phys. address of a of VM region.

Parameters:
ptr VM region address
size VM region size
addrs Phys. address regions destination buffer
num Number of elements in addrs.
Return values:
psize Total size of the address regions in addrs
Returns:
On success number of found phys. address regions, error code otherwise:
  • -L4_ENOTFOUND dataspace not found for a VM address
  • -L4_EINVAL Invalid vm region (i.e. no dataspace attached to that region, but external pager etc.)
  • -L4_EPERM caller is not a client of the dataspace
  • -L4_EIPC error calling region mapper / dataspace manager
Lookup the phys. addresses for the specified virtual memory region. If several dataspaces are attached to the VM region or the dataspaces are not phys. contiguous, the different addresses are returned in addrs (up to num entries). psize will contain the total size of the areas described in addrs. Like in l4dm_mem_ds_phys_addr(), the VM area must be pinned.

L4_CV int l4dm_mem_ds_is_contiguous ( const l4dm_dataspace_t ds  ) 

Test if dataspace is allocated on contiguous memory.

Parameters:
ds Dataspace id
Returns:
1 if dataspace is allocated on contiguous memory, 0 if not.

L4_CV int l4dm_mem_ds_lock ( const l4dm_dataspace_t ds,
l4_offs_t  offset,
l4_size_t  size 
)

Lock dataspace region.

Parameters:
ds Dataspace id
offset Offset in dataspace
size Region size, L4DM_WHOLE_DS to lock the whole dataspace starting at offset
Returns:
0 on success, error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EPERM caller is not a client of the dataspace
  • -L4_EINVAL invalid dataspace id
  • -L4_EINVAL_OFFS offset points beyond end of dataspace
Lock ("pin") the dataspace region. This ensures that the dataspace region will not be unmapped by the dataspace manager.

L4_CV int l4dm_mem_ds_unlock ( const l4dm_dataspace_t ds,
l4_offs_t  offset,
l4_size_t  size 
)

Unlock dataspace region.

Parameters:
ds Dataspace id
offset Offset in dataspace
size Region size, L4DM_WHOLE_DS to unlock the whole dataspace starting at offset
Returns:
0 on success, error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EPERM caller is not a client of the dataspace
  • -L4_EINVAL invalid dataspace id
  • -L4_EINVAL_OFFS offset points beyond end of dataspace

L4_CV int l4dm_mem_lock ( const void *  ptr,
l4_size_t  size 
)

Lock virtual memory region.

Parameters:
ptr VM region start address
size VM region size
Returns:
0 on success (locked VM region), error code otherwise:
  • -L4_ENOTFOUND dataspace not found for a VM address
  • -L4_EINVAL Invalid vm region (i.e. no dataspace attached to that region, but external pager etc.)
  • -L4_EIPC error calling region mapper / dataspace manager
  • -L4_EPERM caller is not a client of a dataspace attached to the VM region
Lock ("pin") the VM region. This ensures that the dataspaces attached to this region will not be unmapped by the dataspace managers.

L4_CV int l4dm_mem_unlock ( const void *  ptr,
l4_size_t  size 
)

Unlock virtual memory region.

Parameters:
ptr VM region start address
size VM region size
Returns:
0 on success (unlocked VM region), error code otherwise:
  • -L4_ENOTFOUND dataspace not found for a VM address
  • -L4_EINVAL Invalid vm region (i.e. no dataspace attached to that region, but external pager etc.)
  • -L4_EIPC error calling region mapper / dataspace manager
  • -L4_EPERM caller is not a client of a dataspace attached to the VM region


Generated on Wed Apr 11 06:37:12 2012 for L4Env Memory Dataspace Manager Interface by  doxygen 1.5.6