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
91 Normal = 0x00,
93 Cacheable = Normal,
95 Bufferable = 0x10,
97 Uncacheable = 0x20,
99 Caching_mask = 0x30,
100 };
101
103 };
104
105 struct Flags : L4::Types::Flags_ops_t<Flags>
106 {
107 unsigned long raw;
108 Flags() = default;
109 explicit constexpr Flags(unsigned long f) : raw(f) {}
110 constexpr Flags(F::Flags f) : raw(f) {}
111 constexpr bool r() const { return raw & L4_FPAGE_RO; }
112 constexpr bool w() const { return raw & L4_FPAGE_W; }
113 constexpr bool x() const { return raw & L4_FPAGE_X; }
114
115 constexpr unsigned long fpage_rights() const
116 { return raw & 0xf; }
117 };
118
119 typedef l4_uint64_t Size;
120 typedef l4_uint64_t Offset;
121 typedef l4_uint64_t Map_addr;
122
126 struct Stats
127 {
128 Size size;
129 Flags flags;
130 };
131
132
157 long map(Offset offset, Flags flags, Map_addr local_addr,
158 Map_addr min_addr, Map_addr max_addr,
159 L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
160
188 long map_region(Offset offset, Flags flags,
189 Map_addr min_addr, Map_addr max_addr,
190 L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
191
209 L4_RPC(long, clear, (Offset offset, Size size));
210
230 L4_RPC(long, allocate, (Offset offset, Size size));
231
250 L4_RPC(long, copy_in, (Offset dst_offs, L4::Ipc::Cap<Dataspace> src,
251 Offset src_offs, Size size));
252
258 Size size() const noexcept;
259
268 Flags flags() const noexcept;
269
278 L4_RPC(long, info, (Stats *stats));
279
280 L4_RPC_NF(long, map, (Offset offset, Map_addr spot,
281 Flags flags, L4::Ipc::Rcv_fpage r,
282 L4::Ipc::Snd_fpage &fp));
283
303#ifdef CONFIG_MMU
304 L4_RPC_NF(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
305 inline long map_info([[maybe_unused]] l4_addr_t *start_addr,
306 [[maybe_unused]] l4_addr_t *end_addr)
307 { return 0; }
308#else
309 L4_RPC(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
310#endif
311
312private:
313
314 long __map(Offset offset, unsigned char *order, Flags flags,
315 Map_addr local_addr, L4::Cap<L4::Task> dst) const noexcept;
316
317public:
318 typedef L4::Typeid::Rpcs<map_t, clear_t, info_t, copy_in_t,
319 allocate_t, map_info_t> Rpcs;
320
321};
322
323}
324
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:305
C++ interface for capabilities.
Definition capability.h:224
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:541
#define L4_RPC_NF(res, name, args...)
Define an RPC call type (the type only, no callable).
Definition ipc_iface:510
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:127
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