Defines | |
| #define | L4_IPC_IS_ERROR(x) |
| Test if IPC error occurred. | |
| #define | L4_IPC_MSG_DECEITED(x) |
| Test if received message was deceited by a chief task. | |
| #define | L4_IPC_MSG_REDIRECTED(x) |
| Test if the message was redirected to a chief task. | |
| #define | L4_IPC_SRC_INSIDE(x) |
| Test if the message comes from outside or inside the clan. | |
| #define | L4_IPC_SND_ERROR(x) |
| Test if send operation failed. | |
| #define | L4_IPC_ERROR(x) |
| Get IPC error from IPC result message dope. | |
| #define | L4_IPC_ENOT_EXISTENT 0x10 |
| Non-existing destination or source. | |
| #define | L4_IPC_RETIMEOUT 0x20 |
| Timeout during receive operation. | |
| #define | L4_IPC_SETIMEOUT 0x30 |
| Timeout during send operation. | |
| #define | L4_IPC_RECANCELED 0x40 |
| Receive operation canceled. | |
| #define | L4_IPC_SECANCELED 0x50 |
| Send operation canceled. | |
| #define | L4_IPC_REMAPFAILED 0x60 |
| Map flexpage failed in receive operation. | |
| #define | L4_IPC_SEMAPFAILED 0x70 |
| Map flexpage failed in send operation. | |
| #define | L4_IPC_RESNDPFTO 0x80 |
| Send-pagefault timeout in receive operation. | |
| #define | L4_IPC_SESNDPFTO 0x90 |
| Send-pagefault timeout in send operation. | |
| #define | L4_IPC_RERCVPFTO 0xA0 |
| Receive-pagefault timeout in receive operation. | |
| #define | L4_IPC_SERCVPFTO 0xB0 |
| Receive-pagefault timeout in send operation. | |
| #define | L4_IPC_REABORTED 0xC0 |
| Receive operation aborted. | |
| #define | L4_IPC_SEABORTED 0xD0 |
| Send operation aborted. | |
| #define | L4_IPC_REMSGCUT 0xE0 |
| Cut receive message (due to (a) message buffer is too small, (b) not enough strings are accepted, (c) at least one string buffer is too small). | |
| #define | L4_IPC_SEMSGCUT 0xF0 |
| Cut send message (due to (a) message buffer is too small, (b) not enough strings are accepted, (c) at least one string buffer is too small). | |
Functions | |
| l4_timeout_t | l4_ipc_timeout (unsigned snd_man, unsigned snd_exp, unsigned rcv_man, unsigned rcv_exp) |
| Convert explicit timeout values to L4 type. | |
| int | l4_ipc_call_tag (l4_threadid_t dest, const void *snd_msg, l4_umword_t snd_dword0, l4_umword_t snd_dword1, l4_msgtag_t tag, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result, l4_msgtag_t *rtag) |
| IPC Call, usual blocking RPC, tagged version. | |
| int | l4_ipc_call (l4_threadid_t dest, const void *snd_msg, l4_umword_t snd_dword0, l4_umword_t snd_dword1, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result) |
| IPC Call, usual blocking RPC. | |
| int | l4_ipc_reply_and_wait_tag (l4_threadid_t dest, const void *snd_msg, l4_umword_t snd_dword0, l4_umword_t snd_dword1, l4_msgtag_t tag, l4_threadid_t *src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result, l4_msgtag_t *rtag) |
| IPC reply and wait, send a reply to a client and wait for next message, tagged version. | |
| int | l4_ipc_reply_and_wait (l4_threadid_t dest, const void *snd_msg, l4_umword_t snd_dword0, l4_umword_t snd_dword1, l4_threadid_t *src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result) |
| IPC reply and wait, send a reply to a client and wait for next message. | |
| int | l4_ipc_wait_next_period (l4_threadid_t *src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result) |
| Wait for next period. | |
| int | l4_ipc_send_tag (l4_threadid_t dest, const void *snd_msg, l4_umword_t snd_dword0, l4_umword_t snd_dword1, l4_msgtag_t tag, l4_timeout_t timeout, l4_msgdope_t *result) |
| IPC send, send a message to a thread, tagged version. | |
| int | l4_ipc_send (l4_threadid_t dest, const void *snd_msg, l4_umword_t snd_dword0, l4_umword_t snd_dword1, l4_timeout_t timeout, l4_msgdope_t *result) |
| IPC send, send a message to a thread. | |
| int | l4_ipc_wait_tag (l4_threadid_t *src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result, l4_msgtag_t *tag) |
| IPC wait, wait for message from any source, tagged version. | |
| int | l4_ipc_wait (l4_threadid_t *src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result) |
| IPC wait, wait for message from any source. | |
| int | l4_ipc_receive_tag (l4_threadid_t src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result, l4_msgtag_t *tag) |
| IPC receive, wait for a message from a specified thread, tagged version. | |
| int | l4_ipc_receive (l4_threadid_t src, void *rcv_msg, l4_umword_t *rcv_dword0, l4_umword_t *rcv_dword1, l4_timeout_t timeout, l4_msgdope_t *result) |
| IPC receive, wait for a message from a specified thread. | |
| int | l4_ipc_sleep (l4_timeout_t timeout) |
| Sleep for an amount of time. | |
| int | l4_ipc_fpage_received (l4_msgdope_t msgdope) |
| Check if received message contains flexpage. | |
| int | l4_ipc_is_fpage_granted (l4_fpage_t fp) |
| Check if flexpage was granted. | |
| int | l4_ipc_is_fpage_writable (l4_fpage_t fp) |
| Check if flexpage is writable. | |
| long | l4_is_rcv_map_descr (const void *msg) |
| Return if message is fpage message. | |
| long | l4_is_long_rcv_descr (const void *msg) |
| Return if receive message descriptor is a long IPC message descriptor. | |
| long | l4_is_long_snd_descr (const void *msg) |
| Return if source message descriptor is a long IPC message descriptor. | |
| const l4_msg_t * | l4_get_snd_msg_from_descr (const void *msg) |
| Return message descriptor address from send message descriptor. | |
| l4_msg_t * | l4_get_rcv_msg_from_descr (void *msg) |
| Return message descriptor address from receive message descriptor. | |
IPC in L4 is always synchronous and unbuffered: a message is transferred from the sender to the recipient if and only if the recipient has invoked a corresponding IPC operation. The sender blocks until this happens or a timeout specified by the sender elapsed without the destination becoming ready to receive.
IPC can be used to copy data as well as to map or grant flexpages from the sender to the recipient. There are two major flavors of IPC messages:
With short IPC only two dwords or a single flexpage can be transfered. The data is transfered using CPU registers, no memory reference is necessary.
With long IPC up to 524288 (2^19) dwords and 32 memory buffers ("indirect strings") can be transfered. A valid message buffer looks as follows:
struct msg_buffer { l4_fpage_t rcv_fpage; // flexpage receive window l4_msgdope_t size; // message size dope l4_msgdope_t send; // message send dope // message send flexpages (optional) l4_snd_fpage_t snd_fpage0; ... // message dwords (optional) l4_umword_t dword0; ... // message send/receive string descriptors (optional) l4_strdope_t str0; ... }
The same message buffer can be used for both send and receive operations. Note that the first two dwords of the message (either the first send flexpage or the first two message dwords) are still transfered using CPU registers.
| #define L4_IPC_IS_ERROR | ( | x | ) |
Test if IPC error occurred.
| x | IPC result message dope |
Definition at line 104 of file L4API-l4v2/ipc.h.
| #define L4_IPC_MSG_DECEITED | ( | x | ) |
Test if received message was deceited by a chief task.
| x | IPC result message dope |
Definition at line 114 of file L4API-l4v2/ipc.h.
| #define L4_IPC_MSG_REDIRECTED | ( | x | ) |
Test if the message was redirected to a chief task.
| x | IPC result message dope |
Definition at line 124 of file L4API-l4v2/ipc.h.
| #define L4_IPC_SRC_INSIDE | ( | x | ) |
Test if the message comes from outside or inside the clan.
| x | IPC result message dope |
Definition at line 135 of file L4API-l4v2/ipc.h.
| #define L4_IPC_SND_ERROR | ( | x | ) |
Test if send operation failed.
| x | IPC result message dope |
Definition at line 145 of file L4API-l4v2/ipc.h.
| #define L4_IPC_ERROR | ( | x | ) |
Get IPC error from IPC result message dope.
| x | IPC result message dope |
Definition at line 159 of file L4API-l4v2/ipc.h.
| l4_timeout_t l4_ipc_timeout | ( | unsigned | snd_man, | |
| unsigned | snd_exp, | |||
| unsigned | rcv_man, | |||
| unsigned | rcv_exp | |||
| ) | [inline] |
Convert explicit timeout values to L4 type.
| snd_man | Mantissa of send timeout. | |
| snd_exp | Exponent of send timeout. | |
| rcv_man | Mantissa of receive timeout. | |
| rcv_exp | Exponent of receive timeout. |
Definition at line 206 of file __timeout.h.
References l4_timeout_t::p, l4_timeout_t::rcv, l4_timeout_t::snd, and l4_timeout_s::t.
| int l4_ipc_call_tag | ( | l4_threadid_t | dest, | |
| const void * | snd_msg, | |||
| l4_umword_t | snd_dword0, | |||
| l4_umword_t | snd_dword1, | |||
| l4_msgtag_t | tag, | |||
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result, | |||
| l4_msgtag_t * | rtag | |||
| ) | [inline] |
IPC Call, usual blocking RPC, tagged version.
| dest | Thread id of the call destination | |
| snd_msg | Pointer to the send message descriptor. It can contain the following values:
| |
| snd_dword0 | The first dword to be transmitted. | |
| snd_dword1 | The second dword to be transmitted. | |
| tag | Message tag of the sending IPC | |
| rcv_msg | Pointer to the receive message descriptor. It can contain the following values:
|
| rcv_dword0 | The first dword of the received message, undefined if no message was received. | |
| rcv_dword1 | The second dword of the received message, undefined if no message was received. |
| timeout | IPC timeout (see l4_ipc_timeout). |
| result | Result message dope | |
| rtag | Message tag of the receiving IPC |
This operation can also be used for a server with one dedicated client. It sends the reply to the client and waits for the client's next order.
Referenced by l4_ipc_call().
| int l4_ipc_call | ( | l4_threadid_t | dest, | |
| const void * | snd_msg, | |||
| l4_umword_t | snd_dword0, | |||
| l4_umword_t | snd_dword1, | |||
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result | |||
| ) | [inline] |
IPC Call, usual blocking RPC.
Definition at line 9 of file ipc-impl.h.
References l4_ipc_call_tag(), and l4_msgtag().
| int l4_ipc_reply_and_wait_tag | ( | l4_threadid_t | dest, | |
| const void * | snd_msg, | |||
| l4_umword_t | snd_dword0, | |||
| l4_umword_t | snd_dword1, | |||
| l4_msgtag_t | tag, | |||
| l4_threadid_t * | src, | |||
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result, | |||
| l4_msgtag_t * | rtag | |||
| ) | [inline] |
IPC reply and wait, send a reply to a client and wait for next message, tagged version.
| dest | Thread id of the send destination | |
| snd_msg | Pointer to the send message descriptor. It can contain the following values:
| |
| snd_dword0 | The first dword to be transmitted. | |
| snd_dword1 | The second dword to be transmitted. | |
| tag | Message tag of the sending IPC |
| src | Source thread id of the received message |
| rcv_msg | Pointer to the receive message descriptor. It can contain the following values:
|
| rcv_dword0 | The first dword of the received message, undefined if no message was received. | |
| rcv_dword1 | The second dword of the received message, undefined if no message was received. |
| timeout | IPC timeout (see l4_ipc_timeout). |
| result | Result message dope | |
| rtag | Message tag of the receiving IPC |
Referenced by l4_ipc_reply_and_wait().
| int l4_ipc_reply_and_wait | ( | l4_threadid_t | dest, | |
| const void * | snd_msg, | |||
| l4_umword_t | snd_dword0, | |||
| l4_umword_t | snd_dword1, | |||
| l4_threadid_t * | src, | |||
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result | |||
| ) | [inline] |
IPC reply and wait, send a reply to a client and wait for next message.
Definition at line 26 of file ipc-impl.h.
References l4_ipc_reply_and_wait_tag(), and l4_msgtag().
| int l4_ipc_send_tag | ( | l4_threadid_t | dest, | |
| const void * | snd_msg, | |||
| l4_umword_t | snd_dword0, | |||
| l4_umword_t | snd_dword1, | |||
| l4_msgtag_t | tag, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result | |||
| ) | [inline] |
IPC send, send a message to a thread, tagged version.
| dest | Thread id of the send destination | |
| snd_msg | Pointer to the send message descriptor. It can contain the following values:
| |
| snd_dword0 | The first dword to be transmitted. | |
| snd_dword1 | The second dword to be transmitted. | |
| tag | Message tag | |
| timeout | IPC timeout (see l4_ipc_timeout). |
| result | Result message dope |
Referenced by l4_ipc_send().
| int l4_ipc_send | ( | l4_threadid_t | dest, | |
| const void * | snd_msg, | |||
| l4_umword_t | snd_dword0, | |||
| l4_umword_t | snd_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result | |||
| ) | [inline] |
IPC send, send a message to a thread.
Definition at line 58 of file ipc-impl.h.
References l4_ipc_send_tag(), and l4_msgtag().
| int l4_ipc_wait_tag | ( | l4_threadid_t * | src, | |
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result, | |||
| l4_msgtag_t * | tag | |||
| ) | [inline] |
IPC wait, wait for message from any source, tagged version.
| src | Source thread id of the received message |
| rcv_msg | Pointer to the receive message descriptor. It can contain the following values:
|
| rcv_dword0 | The first dword of the received message. | |
| rcv_dword1 | The second dword of the received message. |
| timeout | IPC timeout (see l4_ipc_timeout). |
| result | Result message dope | |
| tag | Message tag |
Referenced by l4_ipc_wait().
| int l4_ipc_wait | ( | l4_threadid_t * | src, | |
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result | |||
| ) | [inline] |
IPC wait, wait for message from any source.
Definition at line 45 of file ipc-impl.h.
References l4_ipc_wait_tag().
| int l4_ipc_receive_tag | ( | l4_threadid_t | src, | |
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result, | |||
| l4_msgtag_t * | tag | |||
| ) | [inline] |
IPC receive, wait for a message from a specified thread, tagged version.
| src | Thread to receive message from | |
| rcv_msg | Pointer to the receive message descriptor. It can contain the following values:
|
| rcv_dword0 | The first dword of the received message. | |
| rcv_dword1 | The second dword of the received message. |
| timeout | IPC timeout (see l4_ipc_timeout). |
| result | Result message dope | |
| tag | Message tag |
Referenced by l4_ipc_receive().
| int l4_ipc_receive | ( | l4_threadid_t | src, | |
| void * | rcv_msg, | |||
| l4_umword_t * | rcv_dword0, | |||
| l4_umword_t * | rcv_dword1, | |||
| l4_timeout_t | timeout, | |||
| l4_msgdope_t * | result | |||
| ) | [inline] |
IPC receive, wait for a message from a specified thread.
Definition at line 70 of file ipc-impl.h.
References l4_ipc_receive_tag().
Referenced by l4_ipc_sleep().
| int l4_ipc_sleep | ( | l4_timeout_t | timeout | ) | [inline] |
Sleep for an amount of time.
| timeout | IPC timeout (see l4_ipc_timeout). |
Definition at line 83 of file ipc-impl.h.
References l4_ipc_receive(), L4_IPC_SHORT_MSG, and L4_NIL_ID.
| int l4_ipc_fpage_received | ( | l4_msgdope_t | msgdope | ) | [inline] |
Check if received message contains flexpage.
| msgdope | IPC result message dope |
Definition at line 92 of file ipc-impl.h.
References l4_msgdope_struct_t::fpage_received, and l4_msgdope_t::md.
| int l4_ipc_is_fpage_granted | ( | l4_fpage_t | fp | ) | [inline] |
Check if flexpage was granted.
| fp | Flexpage descriptor |
Definition at line 98 of file ipc-impl.h.
References l4_fpage_t::fp, and l4_fpage_struct_t::grant.
| int l4_ipc_is_fpage_writable | ( | l4_fpage_t | fp | ) | [inline] |
Check if flexpage is writable.
| fp | Flexpage descriptor |
Definition at line 104 of file ipc-impl.h.
References l4_fpage_t::fp, and l4_fpage_struct_t::write.
| long l4_is_rcv_map_descr | ( | const void * | msg | ) | [inline] |
Return if message is fpage message.
| msg | Message descriptor |
Definition at line 119 of file ipc-impl.h.
Referenced by l4_is_long_rcv_descr().
| long l4_is_long_rcv_descr | ( | const void * | msg | ) | [inline] |
Return if receive message descriptor is a long IPC message descriptor.
| msg | Message descriptor |
Definition at line 110 of file ipc-impl.h.
References l4_is_rcv_map_descr().
| long l4_is_long_snd_descr | ( | const void * | msg | ) | [inline] |
Return if source message descriptor is a long IPC message descriptor.
| msg | Message descriptor |
Definition at line 125 of file ipc-impl.h.
| const l4_msg_t* l4_get_snd_msg_from_descr | ( | const void * | msg | ) | [inline] |
Return message descriptor address from send message descriptor.
| msg | Message descriptor |
Definition at line 131 of file ipc-impl.h.
| l4_msg_t* l4_get_rcv_msg_from_descr | ( | void * | msg | ) | [inline] |
Return message descriptor address from receive message descriptor.
| msg | Message descriptor |
Definition at line 137 of file ipc-impl.h.