Barrelfish
|
Capability system user code. More...
Macros | |
#define | ROOT_CNODE_INIT |
Root CNode. | |
Functions | |
errval_t | cap_retype (struct capref dest_start, struct capref src, gensize_t offset, enum objtype new_type, gensize_t objsize, size_t count) |
Retype (part of) a capability into one or more new capabilities. More... | |
errval_t | cap_create (struct capref dest, enum objtype type, size_t size) |
Create a capability. More... | |
errval_t | cap_delete (struct capref cap) |
Delete the given capability. More... | |
errval_t | cap_revoke (struct capref cap) |
Revoke (delete all copies and descendants of) the given capability. More... | |
errval_t | cap_destroy (struct capref cap) |
Destroy a capability, i.e. delete it and free the slot. More... | |
errval_t | root_cnode_resize (struct capref new, struct capref ret) |
Replace own L1 CNode. More... | |
errval_t | cnode_create_from_mem (struct capref dest, struct capref src, enum objtype cntype, struct cnoderef *cnoderef, size_t slots) |
Create a CNode from a given RAM capability in a specific slot. More... | |
errval_t | cnode_create (struct capref *ret_dest, struct cnoderef *cnoderef, cslot_t slots, cslot_t *retslots) |
Create a CNode from newly-allocated RAM in a newly-allocated slot. More... | |
errval_t | cnode_create_l2 (struct capref *ret_dest, struct cnoderef *cnoderef) |
Create a L2 CNode from newly-allocated RAM in a newly-allocated slot. More... | |
errval_t | cnode_create_foreign_l2 (struct capref dest_l1, cslot_t dest_slot, struct cnoderef *cnoderef) |
Create a CNode for another cspace from newly-allocated RAM in a newly-allocated slot. More... | |
errval_t | cnode_create_raw (struct capref dest, struct cnoderef *cnoderef, enum objtype cntype, cslot_t slots, cslot_t *retslots) |
Create a CNode from newly-allocated RAM in the given slot. More... | |
errval_t | cnode_create_with_guard (struct capref dest, struct cnoderef *cnoderef, cslot_t slots, cslot_t *retslots, uint64_t guard, uint8_t guard_size) |
Create CNode with a given guard. More... | |
errval_t | vnode_create (struct capref dest, enum objtype type) |
Create a VNode in newly-allocated memory. More... | |
errval_t | frame_create (struct capref dest, size_t bytes, size_t *retbytes) |
Create a Frame cap referring to newly-allocated RAM in a given slot. More... | |
errval_t | dispatcher_create (struct capref dest) |
Create a Dispatcher in newly-allocated memory. More... | |
errval_t | endpoint_create (size_t buflen, struct capref *retcap, struct lmp_endpoint **retep) |
Create endpoint to caller on current dispatcher. More... | |
errval_t | frame_alloc (struct capref *dest, size_t bytes, size_t *retbytes) |
Create a Frame cap referring to newly-allocated RAM in an allocated slot. More... | |
errval_t | devframe_type (struct capref *dest, struct capref src, uint8_t bits) |
Create a DevFrame cap by retyping out of given source PhysAddr cap. More... | |
errval_t | idcap_alloc (struct capref *dest) |
Create an ID cap in a newly allocated slot. More... | |
errval_t | idcap_create (struct capref dest) |
Create an ID cap in the specified slot. More... | |
errval_t | cnode_build_cnoderef (struct cnoderef *cnoder, struct capref capr) |
Builds a cnoderef struct from a capref struct using cap identification. More... | |
Variables | |
struct cnoderef | cnode_task = TASK_CNODE_INIT |
Task CNode. | |
struct cnoderef | cnode_base |
Base CNode. | |
struct cnoderef | cnode_super |
Super CNode. | |
struct cnoderef | cnode_page = PAGE_CNODE_INIT |
Page CNode. | |
struct cnoderef | cnode_module |
Module CNode. | |
struct capref | cap_root |
Capability to Root CNode. | |
struct capref | cap_irq |
Capability for IRQ table. | |
struct capref | cap_io |
Capability for legacy IO. | |
struct capref | cap_selfep |
Capability for endpoint to self. | |
struct capref | cap_dispatcher |
Capability for dispatcher. | |
struct capref | cap_dispframe |
Capability for dispatcher. | |
struct capref | cap_argcn |
Capability for ArgSpace. | |
struct capref | cap_monitorep |
Capability for monitor endpoint. | |
struct capref | cap_kernel |
Capability for kernel (only in monitor) | |
struct capref | cap_ipi |
Capability for IPI sending (only in monitor) | |
struct capref | cap_perfmon |
PerfMon CNode. | |
struct capref | cap_initep |
Capability for endpoint to init (only in monitor/mem_serv) | |
struct capref | cap_sessionid |
Session ID. | |
struct capref | cap_vroot |
Root PML4 VNode. | |
Capability system user code.
errval_t cap_create | ( | struct capref | dest, |
enum objtype | type, | ||
size_t | size | ||
) |
Create a capability.
dest | Location where to create the cap, which must be empty. |
type | Kernel object type to create. |
size | Size of the created capability in bytes. (ignored for fixed-size objects) |
Only certain types of capabilities can be created this way. If invoked on a capability type, that is not creatable at runtime the error SYS_ERR_TYPE_NOT_CREATABLE is returned. Most capabilities have to be retyped from other capabilities with cap_retype().
errval_t cap_delete | ( | struct capref | cap | ) |
Delete the given capability.
cap | Capability to be deleted |
Deletes (but does not revoke) the given capability, allowing the CNode slot to be reused.
errval_t cap_destroy | ( | struct capref | cap | ) |
Destroy a capability, i.e. delete it and free the slot.
cap | Capability to be destroyed |
errval_t cap_retype | ( | struct capref | dest_start, |
struct capref | src, | ||
gensize_t | offset, | ||
enum objtype | new_type, | ||
gensize_t | objsize, | ||
size_t | count | ||
) |
Retype (part of) a capability into one or more new capabilities.
dest_start | Location of first destination slot, which must be empty |
src | Source capability to retype |
offset | Offset into source capability |
new_type | Kernel object type to retype to. |
objsize | Size of created objects in bytes (ignored for fixed-size objects) |
count | The number of new objects to create |
When retyping IRQSrc capabilities, offset and objsize represent the start and end of the to be created interrupt range. Count must be 1 for IRQSrc.
Retypes (part of) the given source capability into a number of new capabilities, which may be of the same or of different type. The new capabilities are created in the slots starting from dest_start, which must all be empty and lie in the same CNode. The number of objects created is determined by the argument count
.
errval_t cap_revoke | ( | struct capref | cap | ) |
Revoke (delete all copies and descendants of) the given capability.
cap | Capability to be revoked |
Deletes all copies and descendants of the given capability, but not the capability itself. If this succeeds, the capability is guaranteed to be the only copy in the system.
errval_t cnode_create | ( | struct capref * | ret_dest, |
struct cnoderef * | cnoderef, | ||
cslot_t | slots, | ||
cslot_t * | retslots | ||
) |
Create a CNode from newly-allocated RAM in a newly-allocated slot.
ret_dest | capref struct to be filled-in with location of CNode |
cnoderef | cnoderef struct, filled-in if non-NULL with relevant info |
slots | Minimum number of slots in created CNode |
retslots | If non-NULL, filled in with the number of slots in created CNode |
errval_t cnode_create_foreign_l2 | ( | struct capref | dest_l1, |
cslot_t | dest_slot, | ||
struct cnoderef * | cnoderef | ||
) |
Create a CNode for another cspace from newly-allocated RAM in a newly-allocated slot.
dest_l1 | capref to L1 (root) cnode of destination cspace |
dest_slot | slot to fill with new cnode in destination L1 cnode |
cnoderef | cnoderef struct, filled-in if non-NULL with relevant info |
This function creates a CNode which contains 256 capabilities initially and puts it in a slot in our cspace.
errval_t cnode_create_from_mem | ( | struct capref | dest, |
struct capref | src, | ||
enum objtype | cntype, | ||
struct cnoderef * | cnoderef, | ||
size_t | slots | ||
) |
Create a CNode from a given RAM capability in a specific slot.
dest | location in which to place newly-created CNode cap |
src | location of RAM capability to be retyped to new CNode |
cnoderef | cnoderef struct, filled-in if non-NULL with relevant info |
slots | number of slots in created CNode must match size of RAM capability. |
This function requires that dest refer to an existing but empty slot. It retypes the given memory to a new CNode.
Create a L2 CNode from newly-allocated RAM in a newly-allocated slot.
ret_dest | capref struct to be filled-in with location of CNode |
cnoderef | cnoderef struct, filled-in if non-NULL with relevant info |
This function always creates a L2 CNode which contains 256 capabilities
errval_t cnode_create_raw | ( | struct capref | dest, |
struct cnoderef * | cnoderef, | ||
enum objtype | cntype, | ||
cslot_t | slots, | ||
cslot_t * | retslots | ||
) |
Create a CNode from newly-allocated RAM in the given slot.
dest | location in which to place CNode cap |
cnoderef | cnoderef struct, filled-in if non-NULL with relevant info |
cntype,type | of new cnode |
slots | Minimum number of slots in created CNode |
retslots | If non-NULL, filled in with the number of slots in created CNode |
This function requires that dest refer to an existing but empty slot. It allocates memory (using ram_alloc), and retypes that memory to a new CNode. The intermediate ram cap is destroyed.
errval_t cnode_create_with_guard | ( | struct capref | dest, |
struct cnoderef * | cnoderef, | ||
cslot_t | slots, | ||
cslot_t * | retslots, | ||
uint64_t | guard, | ||
uint8_t | guard_size | ||
) |
Create CNode with a given guard.
dest | Location where to place the cnode |
cnoderef | Filled in cnoderef struct if non-NULL |
slots | Minimum number of slots in created CNode |
retslots | If non-NULL, filled in with the number of slots in created CNode |
guard | The guard value to set |
guard_size | The length of the guard in bits |
This function requires that dest refer to an existing but empty slot. It allocates memory (using ram_alloc), and retypes that memory to a new CNode with the given guard value and size. An intermediate slot is used in order to set the guard value.
Create a DevFrame cap by retyping out of given source PhysAddr cap.
dest | Pointer to capref struct, filled-in with location of new cap |
src | Cap_info struct for the source PhysAddr cap |
size_bits | Size of created objects as a power of two (ignored for fixed-size objects) |
errval_t dispatcher_create | ( | struct capref | dest | ) |
Create a Dispatcher in newly-allocated memory.
dest | location to place new dispatcher cap |
This function requires that dest refer to an existing but empty slot. It does not map in nor initialise the Dispatcher. The intermediate ram cap is destroyed.
errval_t endpoint_create | ( | size_t | buflen, |
struct capref * | retcap, | ||
struct lmp_endpoint ** | retep | ||
) |
Create endpoint to caller on current dispatcher.
buflen | Length of incoming LMP buffer, in words |
retcap | Pointer to capref struct, filled-in with location of cap |
retep | Double pointer to LMP endpoint, filled-in with allocated EP |
errval_t frame_alloc | ( | struct capref * | dest, |
size_t | bytes, | ||
size_t * | retbytes | ||
) |
Create a Frame cap referring to newly-allocated RAM in an allocated slot.
dest | Pointer to capref struct, filled-in with location of new cap |
bytes | Minimum size of frame to create |
retbytes | If non-NULL, filled in with size of created frame |
errval_t frame_create | ( | struct capref | dest, |
size_t | bytes, | ||
size_t * | retbytes | ||
) |
Create a Frame cap referring to newly-allocated RAM in a given slot.
dest | Location to place new frame cap |
bytes | Minimum size of frame to create |
retbytes | If non-NULL, filled in with size of created frame |
This function requires that dest refer to an existing but empty slot. ram_alloc is used to allocate memory. After retyping the intermediate ram cap is destroyed.
This function will returns a special error code if ram_alloc fails due to the constrains on the memory server (size of cap or region of memory). This is to facilitate retrying with different constraints.
errval_t idcap_alloc | ( | struct capref * | dest | ) |
Create an ID cap in a newly allocated slot.
dest | Pointer to capref struct, filld-in with location of new cap. |
The caller is responsible for revoking the cap after using it.
errval_t idcap_create | ( | struct capref | dest | ) |
Create an ID cap in the specified slot.
dest | Capref, where ID cap should be created. |
The caller is responsible for revoking the cap after using it.
Replace own L1 CNode.
new | the replacement L1 CNode |
ret | the slot to put the old L1 CNode |
errval_t vnode_create | ( | struct capref | dest, |
enum objtype | type | ||
) |
Create a VNode in newly-allocated memory.
dest | location to place new VNode cap |
type | VNode type to create |
This function requires that dest refer to an existing but empty slot. The intermidiate ram cap is destroyed.