L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
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 * This file is part of TUD:OS and distributed under the terms of the
15 * GNU General Public License 2.
16 * Please see the COPYING-GPL-2 file for details.
17 *
18 * As a special exception, you may use this file as part of a free software
19 * library without restriction. Specifically, if other files instantiate
20 * templates or use macros or inline functions from this file, or you compile
21 * this file and link it with other files to produce an executable, this
22 * file does not by itself cause the resulting executable to be covered by
23 * the GNU General Public License. This exception does not however
24 * invalidate any other reasons why the executable file might be covered by
25 * the GNU General Public License.
26 */
27
28#pragma once
29
30#include <l4/sys/types.h>
31#include <l4/sys/l4int.h>
32#include <l4/sys/capability>
33#include <l4/re/protocols.h>
34#include <l4/sys/cxx/ipc_types>
35#include <l4/sys/cxx/ipc_iface>
36#include <l4/sys/cxx/types>
37
38namespace L4Re
39{
40
41 // MISSING:
42 // * size support in map, mapped size in reply
43
61 public L4::Kobject_t<Dataspace, L4::Kobject, L4RE_PROTO_DATASPACE,
62 L4::Type_info::Demand_t<1> >
63{
64public:
65
67 struct F
68 {
69 enum
70 {
71 Caching_shift = 4,
72 };
73
80 enum Flags
81 {
97 Rights_mask = 0x0f,
98
100 Normal = 0x00,
102 Cacheable = Normal,
104 Bufferable = 0x10,
106 Uncacheable = 0x20,
108 Caching_mask = 0x30,
109 };
110
112 };
113
114 struct Flags : L4::Types::Flags_ops_t<Flags>
115 {
116 unsigned long raw;
117 Flags() = default;
118 explicit constexpr Flags(unsigned long f) : raw(f) {}
119 constexpr Flags(F::Flags f) : raw(f) {}
120 constexpr bool r() const { return raw & L4_FPAGE_RO; }
121 constexpr bool w() const { return raw & L4_FPAGE_W; }
122 constexpr bool x() const { return raw & L4_FPAGE_X; }
123
124 constexpr unsigned long fpage_rights() const
125 { return raw & 0xf; }
126 };
127
128 typedef l4_uint64_t Size;
129 typedef l4_uint64_t Offset;
130 typedef l4_uint64_t Map_addr;
131
135 struct Stats
136 {
137 Size size;
138 Flags flags;
139 };
140
141
164 long map(Offset offset, Flags flags, Map_addr local_addr,
165 Map_addr min_addr, Map_addr max_addr) const noexcept;
166
192 long map_region(Offset offset, Flags flags,
193 Map_addr min_addr, Map_addr max_addr) const noexcept;
194
212 L4_RPC(long, clear, (Offset offset, Size size));
213
233 L4_RPC(long, allocate, (Offset offset, Size size));
234
253 L4_RPC(long, copy_in, (Offset dst_offs, L4::Ipc::Cap<Dataspace> src,
254 Offset src_offs, Size size));
255
261 Size size() const noexcept;
262
271 Flags flags() const noexcept;
272
281 L4_RPC(long, info, (Stats *stats));
282
283 L4_RPC_NF(long, map, (Offset offset, Map_addr spot,
284 Flags flags, L4::Ipc::Rcv_fpage r,
285 L4::Ipc::Snd_fpage &fp));
286
287private:
288
289 long __map(Offset offset, unsigned char *order, Flags flags,
290 Map_addr local_addr) const noexcept;
291
292public:
293 typedef L4::Typeid::Rpcs<map_t, clear_t, info_t, copy_in_t,
294 allocate_t> Rpcs;
295
296};
297
298}
299
L4::Cap related definitions.
Interface for memory-like objects.
Definition dataspace:63
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:546
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:760
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:42
@ L4_FPAGE_X
Executable flex page.
Definition __l4_fpage.h:126
@ L4_FPAGE_RWX
Read-write-execute flex page.
Definition __l4_fpage.h:131
@ L4_FPAGE_RX
Read-execute flex page.
Definition __l4_fpage.h:130
@ L4_FPAGE_RO
Read-only flex page
Definition __l4_fpage.h:128
@ L4_FPAGE_RW
Read-write flex page.
Definition __l4_fpage.h:129
@ L4_FPAGE_W
Writable flex page.
Definition __l4_fpage.h:127
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:221
Interface Definition Language.
#define L4_RPC(res, name, args, attr...)
Define an RPC call (type and callable).
Definition ipc_iface:528
#define L4_RPC_NF(res, name, args...)
Define an RPC call type (the type only, no callable).
Definition ipc_iface:497
Common L4 ABI Data Types.
L4Re C++ Interfaces.
Definition cmd_control:15
L4 low-level kernel interface.
L4Re Protocol Constants (C version)
Dataspace flags definitions.
Definition dataspace:68
Flags
Flags for map operations.
Definition dataspace:81
Information about the dataspace.
Definition dataspace:136
Standard list of RPCs of an interface.
Definition __typeinfo.h:438
Mixin class to define a set of friend bitwise operators on DT.
Definition types:233
#define L4_TYPES_FLAGS_OPS_DEF(T)
Helper macro to define a set of bitwise operators on an enum type.
Definition types:207