1.1 --- a/libipc/lib/src/mem_ipc.c Sun Jun 12 17:11:18 2022 +0200
1.2 +++ b/libipc/lib/src/mem_ipc.c Sun Jun 12 17:38:30 2022 +0200
1.3 @@ -46,16 +46,9 @@
1.4 long ipc_allocate_align(unsigned long size, l4re_rm_flags_t flags,
1.5 unsigned char align, void **addr, l4re_ds_t *ds)
1.6 {
1.7 - /* Allocate a capability for the dataspace. */
1.8 -
1.9 - *ds = ipc_cap_alloc();
1.10 -
1.11 - if (l4_is_invalid_cap(*ds))
1.12 - return -L4_ENOENT;
1.13 -
1.14 /* Allocate and attach the memory for the dataspace. */
1.15
1.16 - if (ipc_new_dataspace(*ds, size, 0, align))
1.17 + if (ipc_new_dataspace(size, 0, align, ds))
1.18 {
1.19 ipc_cap_free_um(*ds);
1.20 return -L4_ENOMEM;
1.21 @@ -72,9 +65,17 @@
1.22
1.23 /* Create a dataspace. Equivalent to l4re_ma_alloc_align. */
1.24
1.25 -long ipc_new_dataspace(l4_cap_idx_t cap, l4_mword_t size, l4_umword_t flags, l4_umword_t align)
1.26 +long ipc_new_dataspace(l4_mword_t size, l4_umword_t flags, l4_umword_t align,
1.27 + l4re_ds_t *ds)
1.28 {
1.29 - return l4re_ma_alloc_align(size, cap, flags, align);
1.30 + /* Allocate a capability for the dataspace. */
1.31 +
1.32 + *ds = ipc_cap_alloc();
1.33 +
1.34 + if (l4_is_invalid_cap(*ds))
1.35 + return -L4_ENOENT;
1.36 +
1.37 + return l4re_ma_alloc_align(size, *ds, flags, align);
1.38 }
1.39
1.40 /* Attach a dataspace region. Similar to l4re_rm_attach. */