L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
dataspace
Go to the documentation of this file.
1// -*- Mode: C++ -*-
2// vim:ft=cpp
7/*
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>,
10 * Björn Döbel <doebel@os.inf.tu-dresden.de>,
11 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
12 * economic rights: Technische Universität Dresden (Germany)
13 *
14 * License: see LICENSE.spdx (in this directory or the directories above)
15 */
16
17#pragma once
18
19#include <l4/bid_config.h>
20#include <l4/sys/types.h>
21#include <l4/sys/l4int.h>
22#include <l4/sys/capability>
23#include <l4/re/protocols.h>
24#include <l4/sys/cxx/ipc_types>
25#include <l4/sys/cxx/ipc_iface>
26#include <l4/sys/cxx/types>
27
28namespace L4Re
29{
30
31 // MISSING:
32 // * size support in map, mapped size in reply
33
51 public L4::Kobject_t<Dataspace, L4::Kobject, L4RE_PROTO_DATASPACE,
52 L4::Type_info::Demand_t<1> >
53{
54public:
55
57 struct F
58 {
59 enum
60 {
61 Caching_shift = 4,
62 };
63
70 enum Flags
71 {
87 Rights_mask = 0x0f,
88
90 Normal = 0x00,
92 Cacheable = Normal,
94 Bufferable = 0x10,
96 Uncacheable = 0x20,
98 Caching_mask = 0x30,
99 };
100
102 };
103
104 struct Flags : L4::Types::Flags_ops_t<Flags>
105 {
106 unsigned long raw;
107 Flags() = default;
108 explicit constexpr Flags(unsigned long f) : raw(f) {}
109 constexpr Flags(F::Flags f) : raw(f) {}
110 constexpr bool r() const { return raw & L4_FPAGE_RO; }
111 constexpr bool w() const { return raw & L4_FPAGE_W; }
112 constexpr bool x() const { return raw & L4_FPAGE_X; }
113
114 constexpr unsigned long fpage_rights() const
115 { return raw & 0xf; }
116 };
117
118 typedef l4_uint64_t Size;
119 typedef l4_uint64_t Offset;
120 typedef l4_uint64_t Map_addr;
121
125 struct Stats
126 {
127 Size size;
128 Flags flags;
129 };
130
131
156 long map(Offset offset, Flags flags, Map_addr local_addr,
157 Map_addr min_addr, Map_addr max_addr,
158 L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
159
187 long map_region(Offset offset, Flags flags,
188 Map_addr min_addr, Map_addr max_addr,
189 L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
190
208 L4_RPC(long, clear, (Offset offset, Size size));
209
229 L4_RPC(long, allocate, (Offset offset, Size size));
230
249 L4_RPC(long, copy_in, (Offset dst_offs, L4::Ipc::Cap<Dataspace> src,
250 Offset src_offs, Size size));
251
257 Size size() const noexcept;
258
267 Flags flags() const noexcept;
268
277 L4_RPC(long, info, (Stats *stats));
278
279 L4_RPC_NF(long, map, (Offset offset, Map_addr spot,
280 Flags flags, L4::Ipc::Rcv_fpage r,
281 L4::Ipc::Snd_fpage &fp));
282
302#ifdef CONFIG_MMU
303 L4_RPC_NF(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
304 inline long map_info([[maybe_unused]] l4_addr_t *start_addr,
305 [[maybe_unused]] l4_addr_t *end_addr)
306 { return 0; }
307#else
308 L4_RPC(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
309#endif
310
311private:
312
313 long __map(Offset offset, unsigned char *order, Flags flags,
314 Map_addr local_addr, L4::Cap<L4::Task> dst) const noexcept;
315
316public:
317 typedef L4::Typeid::Rpcs<map_t, clear_t, info_t, copy_in_t,
318 allocate_t, map_info_t> Rpcs;
319
320};
321
322}
323
L4::Cap related definitions.
Interface for memory-like objects.
Definition dataspace:53
long map_info(l4_addr_t *start_addr, l4_addr_t *end_addr)
Get mapping range of dataspace.
Definition dataspace:304
C++ interface for capabilities.
Definition capability.h:219
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:699
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:750
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
@ L4_FPAGE_X
Executable flexpage.
Definition __l4_fpage.h:120
@ L4_FPAGE_RWX
Read-write-execute flexpage.
Definition __l4_fpage.h:125
@ L4_FPAGE_RX
Read-execute flexpage.
Definition __l4_fpage.h:124
@ L4_FPAGE_RO
Read-only flexpage
Definition __l4_fpage.h:122
@ L4_FPAGE_RW
Read-write flexpage.
Definition __l4_fpage.h:123
@ L4_FPAGE_W
Writable flexpage.
Definition __l4_fpage.h:121
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:210
Interface Definition Language.
#define L4_RPC(res, name, args, attr...)
Define an RPC call (type and callable).
Definition ipc_iface:535
#define L4_RPC_NF(res, name, args...)
Define an RPC call type (the type only, no callable).
Definition ipc_iface:504
Common L4 ABI Data Types.
L4Re C++ Interfaces.
Definition cmd_control:14
L4 low-level kernel interface.
L4Re Protocol Constants (C version)
Dataspace flags definitions.
Definition dataspace:58
Flags
Flags for map operations.
Definition dataspace:71
Information about the dataspace.
Definition dataspace:126
Standard list of RPCs of an interface.
Definition __typeinfo.h:428
Mixin class to define a set of friend bitwise operators on DT.
Definition types:221
#define L4_TYPES_FLAGS_OPS_DEF(T)
Helper macro to define a set of bitwise operators on an enum type.
Definition types:195