Introduction   User API Reference   DSMlib Reference   IDL Interface   File List   Index  

Open/Close/Copy Dataspaces
[Dataspace Manager Client API]

Functions to open / close dataspaces and to create copies of dataspaces. More...

Defines

#define L4DM_RESIZE   0x00000080
#define L4DM_CONTIGUOUS   0x00000100
#define L4DM_PINNED   0x00000200
#define L4DM_COW   0x00000400
#define L4DM_SAME_TASK   0x00002000
#define L4DM_WHOLE_DS   (-1)
#define L4DM_DEFAULT_DSM   L4_INVALID_ID
#define L4DM_MEMPHYS_DEFAULT   0
#define L4DM_MEMPHYS_ISA_DMA   7
#define L4DM_MEMPHYS_ANY_ADDR   -1
#define L4DM_MEMPHYS_SUPERPAGES   0x00010000
#define L4DM_MEMPHYS_SAME_POOL   0x00020000

Functions

L4_CV int l4dm_mem_open (l4_threadid_t dsm_id, l4_size_t size, l4_addr_t align, l4_uint32_t flags, const char *name, l4dm_dataspace_t *ds)
 Create new dataspace.
L4_CV int l4dm_mem_resize (const l4dm_dataspace_t *ds, l4_size_t new_size)
 Resize dataspace.
L4_CV int l4dm_mem_info (const l4dm_dataspace_t *ds, l4_size_t *size, l4_threadid_t *owner, char *name, l4_uint32_t *next_id)
 Get debugging information.
L4_CV int l4dm_close (const l4dm_dataspace_t *ds)
 Close dataspace.
int l4dm_close_all (l4_threadid_t dsm_id, l4_threadid_t client, l4_uint32_t flags)
 Close all dataspaces of a client.
L4_CV int l4dm_copy (const l4dm_dataspace_t *ds, l4_uint32_t flags, const char *name, l4dm_dataspace_t *copy)
 Create dataspace copy, short form.
int l4dm_copy_long (const l4dm_dataspace_t *ds, l4_offs_t src_offs, l4_offs_t dst_offs, l4_size_t num, l4_uint32_t flags, const char *name, l4dm_dataspace_t *copy)
 Create dataspace copy, long form.
L4_CV int l4dm_memphys_open (int pool, l4_addr_t addr, l4_size_t size, l4_addr_t align, l4_uint32_t flags, const char *name, l4dm_dataspace_t *ds)
 Create new dataspace (extended version for DMphys).
L4_CV int l4dm_memphys_copy (const l4dm_dataspace_t *ds, l4_offs_t src_offs, l4_offs_t dst_offs, l4_size_t num, int dst_pool, l4_addr_t dst_addr, l4_size_t dst_size, l4_addr_t dst_align, l4_uint32_t flags, const char *name, l4dm_dataspace_t *copy)
 Create dataspace copy (extended DMphys version).
L4_CV l4_threadid_t l4dm_memphys_find_dmphys (void)
 Find DMphys.

Detailed Description

Functions to open / close dataspaces and to create copies of dataspaces.


Define Documentation

#define L4DM_RESIZE   0x00000080

Allow resize

Definition at line 45 of file dm_generic/include/consts.h.

#define L4DM_CONTIGUOUS   0x00000100

Allocate phys. contiguous memory

Definition at line 60 of file dm_generic/include/consts.h.

#define L4DM_PINNED   0x00000200

Allocated pinned memory

Definition at line 64 of file dm_generic/include/consts.h.

#define L4DM_COW   0x00000400

Create copy-on-write dataspace copy

Definition at line 67 of file dm_generic/include/consts.h.

#define L4DM_SAME_TASK   0x00002000

Close dataspace owned by threads of the same task

Definition at line 82 of file dm_generic/include/consts.h.

#define L4DM_WHOLE_DS   (-1)

Copy: create copy of the whole dataspace, phys_addr: return the phys. addresses of the whole dataspace

Definition at line 95 of file dm_generic/include/consts.h.

#define L4DM_DEFAULT_DSM   L4_INVALID_ID

Open: use default dataspcae manager

Definition at line 104 of file dm_generic/include/consts.h.

#define L4DM_MEMPHYS_DEFAULT   0

Use default memory pool

Definition at line 25 of file dm_phys/include/consts.h.

#define L4DM_MEMPHYS_ISA_DMA   7

Use ISA DMA capable memory (below 16MB)

Definition at line 28 of file dm_phys/include/consts.h.

#define L4DM_MEMPHYS_ANY_ADDR   -1

find an appropriate memory area

Definition at line 34 of file dm_phys/include/consts.h.

#define L4DM_MEMPHYS_SUPERPAGES   0x00010000

Open/map: force super-pages

Definition at line 41 of file dm_phys/include/consts.h.

#define L4DM_MEMPHYS_SAME_POOL   0x00020000

Copy: use same pool like source to allocate memory

Definition at line 44 of file dm_phys/include/consts.h.


Function Documentation

L4_CV int l4dm_mem_open ( l4_threadid_t  dsm_id,
l4_size_t  size,
l4_addr_t  align,
l4_uint32_t  flags,
const char *  name,
l4dm_dataspace_t ds 
)

Create new dataspace.

Parameters:
dsm_id Dataspace manager id, set to L4DM_DEFAULT_DSM to use default dataspace manager provided by the L4 environment
size Dataspace size
align Alignment
flags Flags:
  • L4DM_CONTIGUOUS allocate dataspace on phys. contiguous memory
  • L4DM_PINNED allocate "pinned" memory, there will be no pagefaults once the dataspace is mapped
name Dataspace name
Return values:
ds Dataspace id
Returns:
0 on success, error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_ENOMEM out of memory
  • -L4_ENODM no dataspace manager found
Call dataspace manager dsm_id to create a new memory dataspace.

L4_CV int l4dm_mem_resize ( const l4dm_dataspace_t ds,
l4_size_t  new_size 
)

Resize dataspace.

Parameters:
ds Dataspace id
new_size New dataspace size
Returns:
0 on success (resized dataspace), error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL invalid dataspace id
  • -L4_EPERM caller is not the owner of the dataspace
  • -L4_ENOMEM out of memory
Resize the dataspace. If new_size is smaller than the current dataspace size, the remaining area at the end of the dataspace will be freed, if the new size is 0 the dataspace will be closed. If the new size is larger than the current size, more memory is added to the dataspace. If the dataspace was allocated on contiguous memory, enlarge the used contiguous memory area.

L4_CV int l4dm_mem_info ( const l4dm_dataspace_t ds,
l4_size_t *  size,
l4_threadid_t *  owner,
char *  name,
l4_uint32_t *  next_id 
)

Get debugging information.

Parameters:
ds Dataspace id
Return values:
size Dataspace size
owner Dataspace owner
name Dataspace name
next_id Next dataspace id to iterate
Returns:
0 on success (resized dataspace), error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL invalid dataspace id
  • -L4_EPERM caller is not the owner of the dataspace
  • -L4_ENOMEM out of memory
Retrieve information about a dataspace for debugging purposes.

L4_CV int l4dm_close ( const l4dm_dataspace_t ds  ) 

Close dataspace.

Parameters:
ds Dataspace id
Returns:
0 on success, error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL invalid dataspace id
  • -L4_EPERM operation not permitted, only the owner can close a dataspace

int l4dm_close_all ( l4_threadid_t  dsm_id,
l4_threadid_t  client,
l4_uint32_t  flags 
)

Close all dataspaces of a client.

Parameters:
dsm_id Dataspace manager thread id
client Client thread id
flags Flags:
  • L4DM_SAME_TASK close all dataspaces owned by threads of the task specified by client.
Returns:
0 on success, error code otherwise:
  • -L4_EINVAL invalid client thread id
  • -L4_EPERM permission denied
  • -L4_EIPC IPC error calling dataspace manager
This function can be called by everyone. It's up to the dataspace manager to decide who is allowed to close that dataspaces.

L4_CV int l4dm_copy ( const l4dm_dataspace_t ds,
l4_uint32_t  flags,
const char *  name,
l4dm_dataspace_t copy 
)

Create dataspace copy, short form.

Parameters:
ds Source dataspace id
flags Flags:
name Copy name
Return values:
copy Copy dataspace id
Returns:
0 on success (copy contains the id of the created copy), error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL Invalid source dataspace id
  • -L4_EPERM Permission denied
  • -L4_ENOHANDLE Could not create dataspace descriptor
  • -L4_ENOMEM Out of memory creating copy
Create a copy of the whole dataspace.

int l4dm_copy_long ( const l4dm_dataspace_t ds,
l4_offs_t  src_offs,
l4_offs_t  dst_offs,
l4_size_t  num,
l4_uint32_t  flags,
const char *  name,
l4dm_dataspace_t copy 
)

Create dataspace copy, long form.

Parameters:
ds Source dataspace id
src_offs Offset in source dataspace
dst_offs Offset in destination dataspace
num Number of bytes to copy, set to L4DM_WHOLE_DS to copy the whole dataspace starting at src_offs
flags Flags
name Copy name
Return values:
copy Dataspace id of copy
Returns:
0 on success, error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL Invalid source dataspace id
  • -L4_EPERM Permission denied
  • -L4_ENOHANDLE Could not create dataspace descriptor
  • -L4_ENOMEM Out of memory creating copy
Create a copy of the dataspace, src_offs and num specify the area of the source dataspace which should be copied to the destination dataspace at offset dst_offs. There are no restrictions to the offsets, in particular they do not need to be aligned to pagesizes.

L4_CV int l4dm_memphys_open ( int  pool,
l4_addr_t  addr,
l4_size_t  size,
l4_addr_t  align,
l4_uint32_t  flags,
const char *  name,
l4dm_dataspace_t ds 
)

Create new dataspace (extended version for DMphys).

Parameters:
pool Memory pool (0-7), predefined pools are:
addr Start address of memory area, set to L4DM_MEMPHYS_ANY_ADDR to find a suitable memory area, otherwise the contiguous area at addr is allocated.
size Dataspace size
align Memory area alignment, it is only used if addr is set to L4DM_MEMPHYS_ANY_ADDR and the flag L4DM_CONTIGUOUS ist set
flags Flags:
name Dataspace name
Return values:
ds Dataspace id
Returns:
0 on success (created dataspace, ds contains a valid dataspace id), error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_ENOMEM out of memory
Call DMphys to create a new dataspace.

L4_CV int l4dm_memphys_copy ( const l4dm_dataspace_t ds,
l4_offs_t  src_offs,
l4_offs_t  dst_offs,
l4_size_t  num,
int  dst_pool,
l4_addr_t  dst_addr,
l4_size_t  dst_size,
l4_addr_t  dst_align,
l4_uint32_t  flags,
const char *  name,
l4dm_dataspace_t copy 
)

Create dataspace copy (extended DMphys version).

Parameters:
ds Source dataspace id
src_offs Offset in source dataspace
dst_offs Offset in destination dataspace
num Number of bytes to copy, set to L4DM_WHOLE_DS to copy the whole dataspace starting at src_offs
dst_pool Memory pool to use to allocate destination dataspace
dst_addr Phys. address of destination dataspace, set to L4DM_MEMPHYS_ANY_ADDR to find an appropriate address
dst_size Size of destination dataspace, if larger than dst_offs + num it is used as the size of the destination dataspace
dst_align Alignment of destination dataspace
flags Flags:
name Destination dataspace name
Return values:
copy Copy dataspace id
Returns:
0 on success (copy contains the id of the created copy), error code otherwise:
  • -L4_EIPC IPC error calling dataspace manager
  • -L4_EINVAL Invalid source dataspace id
  • -L4_EPERM Permission denied
  • -L4_ENOHANDLE Could not create dataspace descriptor
  • -L4_ENOMEM Out of memory creating copy
Note:
DMphys does not support copy-on-write dataspace copies, the flag L4DM_COW is ignored.

L4_CV l4_threadid_t l4dm_memphys_find_dmphys ( void   ) 

Find DMphys.

Returns:
DMphys id, L4_INVALID_ID if not found.


DMphys Reference Manual, written by Lars Reuther  © 2000-2003