Barrelfish
Functions
lmp_endpoints.c File Reference

Management of incoming LMP endpoints. More...

Functions

errval_t lmp_endpoint_alloc (size_t buflen, struct lmp_endpoint **retep)
 Allocate an LMP endpoint buffer on the current dispatcher. More...
 
void lmp_endpoint_free (struct lmp_endpoint *ep)
 Free an LMP endpoint buffer on the current dispatcher. More...
 
errval_t lmp_endpoint_create_in_slot (size_t buflen, struct capref dest, struct lmp_endpoint **retep)
 Create endpoint to caller on current dispatcher in a specified slot. More...
 
void lmp_endpoint_set_recv_slot (struct lmp_endpoint *ep, struct capref slot)
 Set the receive capability slot for a given endpoint. More...
 
bool lmp_endpoint_can_recv (struct lmp_endpoint *ep)
 Returns true iff there are messages in the given endpoint buffer. More...
 
void lmp_endpoints_poll_disabled (dispatcher_handle_t handle)
 Check incoming LMP endpoints for messages and notify waitsets. More...
 
errval_t lmp_endpoint_register (struct lmp_endpoint *ep, struct waitset *ws, struct event_closure closure)
 Register an event handler to be notified when messages can be received. More...
 
errval_t lmp_endpoint_deregister (struct lmp_endpoint *ep)
 Cancel an event registration made with lmp_endpoint_register() More...
 
void lmp_endpoint_migrate (struct lmp_endpoint *ep, struct waitset *ws)
 Migrate an event registration made with lmp_endpoint_register() to a new waitset. More...
 
errval_t lmp_endpoint_recv (struct lmp_endpoint *ep, struct lmp_recv_buf *buf, struct capref *cap)
 Retrieve an LMP message from an endpoint, if possible. More...
 
void lmp_endpoint_store_lrpc_disabled (struct lmp_endpoint *ep, uint32_t bufpos, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
 Store a newly-received LRPC message into an endpoint buffer. More...
 
void lmp_endpoint_init (void)
 Initialize LMP endpoint subsystem.
 

Detailed Description

Management of incoming LMP endpoints.

Function Documentation

errval_t lmp_endpoint_alloc ( size_t  buflen,
struct lmp_endpoint **  retep 
)

Allocate an LMP endpoint buffer on the current dispatcher.

In order to accomodate for the in-kernel sentinel word, the allocated size of the buffer will be one larger than buflen.

Parameters
buflenLength of incoming LMP buffer, in words
retepDouble pointer to LMP endpoint, filled-in with allocated EP
bool lmp_endpoint_can_recv ( struct lmp_endpoint ep)
inline

Returns true iff there are messages in the given endpoint buffer.

May be called enabled or disabled. As a result, when enabled, the result may be incorrect as soon as the function returns.

errval_t lmp_endpoint_create_in_slot ( size_t  buflen,
struct capref  dest,
struct lmp_endpoint **  retep 
)

Create endpoint to caller on current dispatcher in a specified slot.

Parameters
buflenLength of incoming LMP buffer, in words
destLocation of empty slot in which to create endpoint
retepDouble pointer to LMP endpoint, filled-in with allocated EP

This function mints into the given slot an endpoint capability to the current dispatcher.

errval_t lmp_endpoint_deregister ( struct lmp_endpoint ep)

Cancel an event registration made with lmp_endpoint_register()

Parameters
epLMP Endpoint
void lmp_endpoint_free ( struct lmp_endpoint ep)

Free an LMP endpoint buffer on the current dispatcher.

Does not delete the endpoint capability nor free any receive slot.

Parameters
epLMP endpoint
void lmp_endpoint_migrate ( struct lmp_endpoint ep,
struct waitset ws 
)

Migrate an event registration made with lmp_endpoint_register() to a new waitset.

Parameters
epLMP Endpoint
wsNew waitset
errval_t lmp_endpoint_recv ( struct lmp_endpoint ep,
struct lmp_recv_buf buf,
struct capref cap 
)

Retrieve an LMP message from an endpoint, if possible.

Parameters
epEndpoint
bufLMP message buffer, to be filled-in
capIf non-NULL, filled-in with location of received capability, if any
Returns
LIB_ERR_NO_LMP_MSG if no message is available
LIB_ERR_LMP_RECV_BUF_OVERFLOW if user-provided receive buffer is too small to store the entire message
errval_t lmp_endpoint_register ( struct lmp_endpoint ep,
struct waitset ws,
struct event_closure  closure 
)

Register an event handler to be notified when messages can be received.

In the future, call the closure on the given waitset when it is likely that a message can be received on the endpoint. An endpoint may only be registered with a single event handler on a single waitset at any one time.

Parameters
epLMP endpoint
wsWaitset
closureEvent handler
void lmp_endpoint_set_recv_slot ( struct lmp_endpoint ep,
struct capref  slot 
)

Set the receive capability slot for a given endpoint.

Parameters
epEndpoint returned from messages_lmp_alloc_endpoint()
slotReceive slot
void lmp_endpoint_store_lrpc_disabled ( struct lmp_endpoint ep,
uint32_t  bufpos,
uintptr_t  arg1,
uintptr_t  arg2,
uintptr_t  arg3,
uintptr_t  arg4 
)

Store a newly-received LRPC message into an endpoint buffer.

Must be called while disabled.

Parameters
epEndpoint
bufposReserved position in endpoint message buffer
arg1Message payload
arg2Message payload
arg3Message payload
arg4Message payload
void lmp_endpoints_poll_disabled ( dispatcher_handle_t  handle)

Check incoming LMP endpoints for messages and notify waitsets.

Parameters
disp_privDispatcher's private data

Must be called while disabled.