Barrelfish
Functions
capabilities.c File Reference

Kernel capability management implementation. More...

Functions

 STATIC_ASSERT (48==ObjType_Num,"Knowledge of all cap types")
 Determine how many objects can be created in a specified region. More...
 
errval_t caps_lookup_slot (struct capability *rootcn, capaddr_t cptr, uint8_t level, struct cte **ret, CapRights rights)
 
errval_t caps_lookup_cap (struct capability *cnode_cap, capaddr_t cptr, uint8_t level, struct capability **ret, CapRights rights)
 
errval_t caps_create_from_existing (struct capability *root, capaddr_t cnode_cptr, int cnode_level, cslot_t dest_slot, coreid_t owner, struct capability *src)
 Create a capability from an existing capability metadata. More...
 
errval_t caps_create_new (enum objtype type, lpaddr_t addr, size_t bytes, size_t objsize, coreid_t owner, struct cte *caps)
 
errval_t caps_retype (enum objtype type, gensize_t objsize, size_t count, struct capability *dest_cnode, cslot_t dest_slot, struct cte *src_cte, gensize_t offset, bool from_monitor)
 
errval_t is_retypeable (struct cte *src_cte, enum objtype src_type, enum objtype dest_type, bool from_monitor)
 Check the validity of a retype operation.
 
errval_t caps_copy_to_cnode (struct cte *dest_cnode_cte, cslot_t dest_slot, struct cte *src_cte, bool mint, uintptr_t param1, uintptr_t param2)
 Create copies to a slot within a cnode.
 

Detailed Description

Kernel capability management implementation.

Function Documentation

errval_t caps_create_from_existing ( struct capability *  root,
capaddr_t  cnode_cptr,
int  cnode_level,
cslot_t  dest_slot,
coreid_t  owner,
struct capability *  src 
)

Create a capability from an existing capability metadata.

Used when sending capabilities across cores. The metadata is sent across cores and the receiving monitor can create the new capability on its core.

errval_t caps_create_new ( enum objtype  type,
lpaddr_t  addr,
size_t  bytes,
size_t  objsize,
coreid_t  owner,
struct cte caps 
)

Create caps to new kernel objects. This takes the size of the memory region in bytes, and the size of individual objects in bytes. The following needs to hold: bytes % objbytes == 0

errval_t caps_lookup_cap ( struct capability *  cnode_cap,
capaddr_t  cptr,
uint8_t  level,
struct capability **  ret,
CapRights  rights 
)

Wrapper for caps_lookup_slot returning capability instead of cte.

errval_t caps_lookup_slot ( struct capability *  rootcn,
capaddr_t  cptr,
uint8_t  level,
struct cte **  ret,
CapRights  rights 
)

Look up a capability in two-level cspace rooted at rootcn.

errval_t caps_retype ( enum objtype  type,
gensize_t  objsize,
size_t  count,
struct capability *  dest_cnode,
cslot_t  dest_slot,
struct cte src_cte,
gensize_t  offset,
bool  from_monitor 
)

Retype caps Create count new caps of type from offset in src, and put them in dest_cnode starting at dest_slot.

STATIC_ASSERT ( 48  = =ObjType_Num,
"Knowledge of all cap types"   
)

Determine how many objects can be created in a specified region.

Create copies to a cte.

check arguments, return true iff ok

Create capabilities to kernel objects.

Initialize the objects for which local caps are about to be created.

This function computes the number of objects that can be created by a call to caps_create().

Parameters
typeType of objects to create.
srcsizeSize of memory area in bytes
objsizeFor variable-sized objects, size multiplier
Returns
Number of objects to be created, or zero on error

For the meaning of the parameters, see the 'caps_create' function.

This function creates 'count' kernel objects of 'type' into the memory area, based at 'addr' and of size 'objsize'. For each created kernel object, a capability is created to it and put consecutively into the array of CTEs pointed to by 'caps'. The array needs to have the appropriate size to hold all created caps. Some kernel objects can have a variable size. In that case, 'objsize' should be non-zero. and give the size multiplier. *

Parameters
typeType of objects to create.
lpaddrBase address in the local address space.
sizeSize of memory area as bytes.
objsizeFor variable-sized objects, size in bytes.
countNumber of objects to be created (count <= caps_max_numobjs(type, size, objsize))
dest_capsPointer to array of CTEs to hold created caps.
Returns
Error code