1.1 --- a/libexec/lib/src/internal_pager.cc Thu Apr 18 17:14:13 2024 +0200
1.2 +++ b/libexec/lib/src/internal_pager.cc Mon May 06 01:25:22 2024 +0200
1.3 @@ -22,6 +22,7 @@
1.4 #include <l4/re/env.h>
1.5 #include <l4/re/c/dataspace.h>
1.6 #include <l4/re/c/rm.h>
1.7 +#include <l4/sys/err.h>
1.8 #include <l4/util/util.h>
1.9
1.10 #include <ipc/cap_alloc.h>
1.11 @@ -125,6 +126,9 @@
1.12
1.13 *region = {0, l4_fpage_invalid()};
1.14
1.15 + if (err)
1.16 + printf("InternalPager: mapping error: %s\n", l4sys_errtostr(err));
1.17 +
1.18 return err;
1.19 }
1.20
2.1 --- a/libipc/lib/src/message.c Thu Apr 18 17:14:13 2024 +0200
2.2 +++ b/libipc/lib/src/message.c Mon May 06 01:25:22 2024 +0200
2.3 @@ -213,7 +213,12 @@
2.4 msg->discarded_items = 0;
2.5 msg->words = 0;
2.6 msg->items = 0;
2.7 +
2.8 + /* Initialise items to be received.
2.9 + NOTE: This does not support item type mixing. */
2.10 +
2.11 msg->import_item = 0;
2.12 + msg->bregs.bdr = 0;
2.13
2.14 /* Message label overriding. */
2.15
2.16 @@ -510,8 +515,16 @@
2.17 if (local)
2.18 return L4_EOK;
2.19
2.20 - err = ipc_message_expect_capability(msg, msg->import_item);
2.21 - msg->import_item += 1;
2.22 + /* Only if the specified item yielded a valid capability, will an allocated
2.23 + have been consumed. Otherwise, the next allocated capability will still be
2.24 + available. */
2.25 +
2.26 + if (l4_is_valid_cap(*ref))
2.27 + {
2.28 + err = ipc_message_expect_capability(msg, msg->import_item);
2.29 + msg->import_item += 1;
2.30 + }
2.31 +
2.32 return err;
2.33 }
2.34
3.1 --- a/libipc/lib/src/util_ipc.c Thu Apr 18 17:14:13 2024 +0200
3.2 +++ b/libipc/lib/src/util_ipc.c Mon May 06 01:25:22 2024 +0200
3.3 @@ -60,7 +60,6 @@
3.4
3.5 /* Indicate the expectation of a capability in return. */
3.6
3.7 - bregs->bdr = 0;
3.8 bregs->br[item] = L4_RCV_ITEM_SINGLE_CAP | future | L4_RCV_ITEM_LOCAL_ID;
3.9
3.10 return L4_EOK;
3.11 @@ -70,7 +69,6 @@
3.12
3.13 long _expect_fpage(l4_buf_regs_t *bregs, int item, l4_umword_t map_control, l4_fpage_t fpage)
3.14 {
3.15 - bregs->bdr = 0;
3.16 bregs->br[item] = map_control;
3.17 bregs->br[item + 1] = fpage.raw;
3.18