26 #include <l4/cxx/list>
27 #include <l4/cxx/minmax>
30 #include <l4/sys/cxx/ipc_legacy>
32 namespace L4Re {
namespace Util {
51 : _ds_start(0), _ds_size(0), _map_flags(Snd_fpage::Map),
52 _cache_flags(Snd_fpage::Cached)
70 int map(Dataspace::Offset offset,
71 Dataspace::Map_addr local_addr,
72 Dataspace::Flags flags,
73 Dataspace::Map_addr min_addr,
74 Dataspace::Map_addr max_addr,
90 Dataspace::Flags flags,
91 Dataspace::Map_addr
min,
92 Dataspace::Map_addr
max)
94 (void)offs; (void)flags; (void)
min; (void)
max;
129 l4_addr_t src_offs,
unsigned long size) noexcept
131 (void)dst_offs; (void)src_id; (void)src_offs; (void)size;
144 virtual long clear(
unsigned long offs,
unsigned long size)
const noexcept;
158 { (void)offset; (void)size; (void)access;
return -
L4_ENODEV; }
177 long op_map(L4Re::Dataspace::Rights rights,
178 L4Re::Dataspace::Offset offset,
179 L4Re::Dataspace::Map_addr spot,
180 L4Re::Dataspace::Flags flags,
183 auto rf = map_flags(rights);
185 if (!rf.w() && flags.w())
188 return map(offset, spot, flags & rf, 0, ~0, fp);
191 long op_allocate(L4Re::Dataspace::Rights rights,
192 L4Re::Dataspace::Offset offset,
193 L4Re::Dataspace::Size size)
194 {
return allocate(offset, size, rights & 3); }
196 long op_copy_in(L4Re::Dataspace::Rights rights,
197 L4Re::Dataspace::Offset dst_offs,
199 L4Re::Dataspace::Offset src_offs,
200 L4Re::Dataspace::Size sz)
211 return copy(dst_offs, src_cap.
data(), src_offs, sz);
218 s.
flags = Dataspace::Flags(0);
219 if (map_flags(rights).w())
224 long op_clear(L4Re::Dataspace::Rights rights,
225 L4Re::Dataspace::Offset offset,
226 L4Re::Dataspace::Size size)
228 if (!map_flags(rights).w())
231 return clear(offset, size);
236 unsigned long size() const noexcept
238 unsigned long map_flags() const noexcept
239 {
return _map_flags; }
240 unsigned long page_size() const noexcept
242 unsigned long round_size() const noexcept
244 bool check_limit(
l4_addr_t offset)
const noexcept
245 {
return offset < round_size(); }
247 L4Re::Dataspace::Flags
248 map_flags(L4Re::Dataspace::Rights rights =
L4_CAP_FPAGE_W)
const noexcept
258 void size(
unsigned long size) noexcept { _ds_size = size; }
263 Cache_type _cache_flags;
264 L4Re::Dataspace::Flags _rw_flags;
unsigned int l4_size_t
Unsigned size type.
Interface for memory-like objects.
virtual unsigned long page_shift() const noexcept
Define the size of the flexpage to map.
virtual void take() noexcept
Take a reference to this dataspace.
int map(Dataspace::Offset offset, Dataspace::Map_addr local_addr, Dataspace::Flags flags, Dataspace::Map_addr min_addr, Dataspace::Map_addr max_addr, L4::Ipc::Snd_fpage &memory)
Map a region of the dataspace.
virtual long allocate(l4_addr_t offset, l4_size_t size, unsigned access) noexcept
Allocate a region within a dataspace.
virtual long clear(unsigned long offs, unsigned long size) const noexcept
Clear a region in the dataspace.
virtual int map_hook(Dataspace::Offset offs, Dataspace::Flags flags, Dataspace::Map_addr min, Dataspace::Map_addr max)
A hook that is called as the first operation in each map request.
virtual unsigned long release() noexcept
Release a reference to this dataspace.
virtual long copy(l4_addr_t dst_offs, l4_umword_t src_id, l4_addr_t src_offs, unsigned long size) noexcept
Copy from src dataspace to this destination dataspace.
virtual bool is_static() const noexcept
Return whether the dataspace is static.
Generic RPC wrapper for L4 flex-pages.
Cacheopt
Caching options, see l4_fpage_cacheability_opt_t.
bool id_received() const noexcept
Check if a label was received instead of a mapping.
l4_umword_t data() const noexcept
Return the raw flex page descriptor.
Dataspace protocol defintion.
T1 min(T1 a, T1 b)
Get the minimum of a and b.
T1 max(T1 a, T1 b)
Get the maximum of a and b.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_addr_t
Address type.
@ L4_EACCESS
Permission denied.
@ L4_EINVAL
Invalid argument.
@ L4_ENODEV
No such thing.
@ L4_CAP_FPAGE_W
Interface specific 'W' right for capability flex-pages.
#define L4_LOG2_PAGESIZE
Number of bits used for page offset.
l4_addr_t l4_round_size(l4_addr_t value, unsigned char bits) L4_NOTHROW
Round value up to the next alignment with bits size.
Common L4 ABI Data Types.
@ Caching_mask
mask for caching flags
@ W
Request write-only memory.
Information about the dataspace.