1.1 --- a/libipc/lib/src/message.c Sun Jan 14 00:45:39 2024 +0100
1.2 +++ b/libipc/lib/src/message.c Sun Jan 14 23:17:58 2024 +0100
1.3 @@ -50,7 +50,9 @@
1.4 ipc_cap_free_um(msg->to_discard[i]);
1.5 }
1.6
1.7 -/* Initialise a message structure with the given number of expected items. */
1.8 +/* Initialise a message structure with the given number of expected items. This
1.9 + function is primarily for the use of servers needing to reserve items that
1.10 + might be sent in messages from clients. */
1.11
1.12 long ipc_message_expect(ipc_message_t *msg, unsigned int expected_items)
1.13 {
1.14 @@ -271,6 +273,15 @@
1.15 ipc_message_export_fpage(msg, msg->items++, fpage);
1.16 }
1.17
1.18 +/* Add the expectation of a capability. Note that a capability is accepted as a
1.19 + parameter but ignored, this being for the convenience of code generation. */
1.20 +
1.21 +void ipc_message_add_receive_capability(ipc_message_t *msg, l4_cap_idx_t cap)
1.22 +{
1.23 + (void) cap;
1.24 + return _expect_capability(&msg->bregs, msg->receive_items++);
1.25 +}
1.26 +
1.27 /* Add a receive window flexpage item to the message. */
1.28
1.29 void ipc_message_add_receive_fpage(ipc_message_t *msg, l4_snd_fpage_t fpage)
1.30 @@ -486,7 +497,7 @@
1.31 /* Import from the message the capability at the given item position, updating
1.32 the buffer registers for future capabilities. */
1.33
1.34 -long ipc_message_import_capability(ipc_message_t *msg, int item, l4_cap_idx_t *ref)
1.35 +long ipc_message_import_and_expect_capability(ipc_message_t *msg, int item, l4_cap_idx_t *ref)
1.36 {
1.37 long err;
1.38 int local;
1.39 @@ -504,7 +515,7 @@
1.40 /* Import from the message a dataspace, mapping it to an address, updating the
1.41 buffer registers for future capabilities. */
1.42
1.43 -long ipc_message_import_dataspace(ipc_message_t *msg, int item, l4re_ds_t *mem, l4_addr_t *addr)
1.44 +long ipc_message_import_and_expect_dataspace(ipc_message_t *msg, int item, l4re_ds_t *mem, l4_addr_t *addr)
1.45 {
1.46 long err;
1.47 int local;
1.48 @@ -519,6 +530,24 @@
1.49 return ipc_message_expect_capability(msg, item);
1.50 }
1.51
1.52 +/* Import from the message the capability at the given item position. */
1.53 +
1.54 +long ipc_message_import_capability(ipc_message_t *msg, int item, l4_cap_idx_t *ref)
1.55 +{
1.56 + int local;
1.57 +
1.58 + return _import_capability(msg->tag, &msg->bregs, &msg->mregs, item, ref, &local);
1.59 +}
1.60 +
1.61 +/* Import from the message a dataspace, mapping it to an address. */
1.62 +
1.63 +long ipc_message_import_dataspace(ipc_message_t *msg, int item, l4re_ds_t *mem, l4_addr_t *addr)
1.64 +{
1.65 + int local;
1.66 +
1.67 + return _import_dataspace(msg->tag, &msg->bregs, &msg->mregs, item, mem, addr, &local);
1.68 +}
1.69 +
1.70 /* Import from the message the flexpage at the given item position. */
1.71
1.72 long ipc_message_import_fpage(ipc_message_t *msg, int item, l4_snd_fpage_t *fpage)