25#include <l4/sys/cxx/consts>
37Dataspace::__map(Dataspace::Offset offset,
unsigned char *size,
38 Dataspace::Flags flags,
39 Dataspace::Map_addr local_addr,
42 Map_addr spot = local_addr & ~(~0ULL <<
l4_umword_t(*size));
43 Map_addr base = local_addr & (~0ULL <<
l4_umword_t(*size));
47 long err = map_t::call(c(), offset, spot, flags, r, fp,
l4_utcb());
51 *size = fp.rcv_order();
57 Dataspace::Map_addr min_addr,
58 Dataspace::Map_addr max_addr,
61 min_addr = L4::trunc_page(min_addr);
62 max_addr = L4::round_page(max_addr);
67 while (min_addr < max_addr)
69 unsigned char order_mapped;
71 = L4::max_order(order, min_addr, min_addr, max_addr, min_addr);
73 err = __map(offset, &order_mapped, flags, min_addr, dst);
77 if (order > order_mapped)
80 min_addr += Map_addr(1) << order;
81 offset += Map_addr(1) << order;
83 if (min_addr >= max_addr)
97 Dataspace::Map_addr local_addr,
98 Dataspace::Map_addr min_addr,
99 Dataspace::Map_addr max_addr,
102 min_addr = L4::trunc_page(min_addr);
103 max_addr = L4::round_page(max_addr);
104 local_addr = L4::trunc_page(local_addr);
106 = L4::max_order(
L4_LOG2_PAGESIZE, local_addr, min_addr, max_addr, local_addr);
108 return __map(offset, &order, flags, local_addr, dst);
115 int err =
info(&stats);
125 int err =
info(&stats);
long copy_in(Offset dst_offs, L4::Ipc::Cap< Dataspace > src, Offset src_offs, Size size)
Copy contents from another dataspace.
Size size() const noexcept
Get size of a dataspace.
Flags flags() const noexcept
Get flags of the dataspace.
long map_region(Offset offset, Flags flags, Map_addr min_addr, Map_addr max_addr, L4::Cap< L4::Task > dst=L4::Cap< L4::Task >::Invalid) const noexcept
Map a part of a dataspace into a local memory area.
long map_info(l4_addr_t *, l4_addr_t *)
Get mapping range of dataspace.
long info(Stats *stats)
Get information on the dataspace.
long clear(Offset offset, Size size)
Clear parts of a dataspace.
long allocate(Offset offset, Size size)
Allocate a range in the dataspace.
long map(Offset offset, Flags flags, Map_addr local_addr, Map_addr min_addr, Map_addr max_addr, L4::Cap< L4::Task > dst=L4::Cap< L4::Task >::Invalid) const noexcept
Request a flex-page mapping from the dataspace.
C++ interface for capabilities.
unsigned long l4_umword_t
Unsigned machine word.
#define L4_LOG2_PAGESIZE
Number of bits used for page offset.
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
#define L4_UNLIKELY(x)
Expression is unlikely to execute.
#define L4_RPC_DEF(name)
Generate the definition of an RPC stub.
constexpr T round_order(T val, unsigned char order)
Round a value up so the given number of lsb is zero.
constexpr T trunc_order(T val, unsigned char order)
Round a value down so the given number of lsb is zero.
Information about the dataspace.