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/bid_config.h>
31#include <l4/sys/types.h>
32#include <l4/sys/l4int.h>
33#include <l4/sys/capability>
34#include <l4/re/protocols.h>
35#include <l4/sys/cxx/ipc_types>
36#include <l4/sys/cxx/ipc_iface>
37#include <l4/sys/cxx/types>
38
39namespace L4Re
40{
41
42 // MISSING:
43 // * size support in map, mapped size in reply
44
62 public L4::Kobject_t<Dataspace, L4::Kobject, L4RE_PROTO_DATASPACE,
63 L4::Type_info::Demand_t<1> >
64{
65public:
66
68 struct F
69 {
70 enum
71 {
72 Caching_shift = 4,
73 };
74
81 enum Flags
82 {
98 Rights_mask = 0x0f,
99
101 Normal = 0x00,
103 Cacheable = Normal,
105 Bufferable = 0x10,
107 Uncacheable = 0x20,
109 Caching_mask = 0x30,
110 };
111
113 };
114
115 struct Flags : L4::Types::Flags_ops_t<Flags>
116 {
117 unsigned long raw;
118 Flags() = default;
119 explicit constexpr Flags(unsigned long f) : raw(f) {}
120 constexpr Flags(F::Flags f) : raw(f) {}
121 constexpr bool r() const { return raw & L4_FPAGE_RO; }
122 constexpr bool w() const { return raw & L4_FPAGE_W; }
123 constexpr bool x() const { return raw & L4_FPAGE_X; }
124
125 constexpr unsigned long fpage_rights() const
126 { return raw & 0xf; }
127 };
128
129 typedef l4_uint64_t Size;
130 typedef l4_uint64_t Offset;
131 typedef l4_uint64_t Map_addr;
132
136 struct Stats
137 {
138 Size size;
139 Flags flags;
140 };
141
142
167 long map(Offset offset, Flags flags, Map_addr local_addr,
168 Map_addr min_addr, Map_addr max_addr,
169 L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
170
198 long map_region(Offset offset, Flags flags,
199 Map_addr min_addr, Map_addr max_addr,
200 L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
201
219 L4_RPC(long, clear, (Offset offset, Size size));
220
240 L4_RPC(long, allocate, (Offset offset, Size size));
241
260 L4_RPC(long, copy_in, (Offset dst_offs, L4::Ipc::Cap<Dataspace> src,
261 Offset src_offs, Size size));
262
268 Size size() const noexcept;
269
278 Flags flags() const noexcept;
279
288 L4_RPC(long, info, (Stats *stats));
289
290 L4_RPC_NF(long, map, (Offset offset, Map_addr spot,
291 Flags flags, L4::Ipc::Rcv_fpage r,
292 L4::Ipc::Snd_fpage &fp));
293
313#ifdef CONFIG_MMU
314 L4_RPC_NF(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
315 inline long map_info(l4_addr_t *, l4_addr_t *)
316 { return 0; }
317#else
318 L4_RPC(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
319#endif
320
321private:
322
323 long __map(Offset offset, unsigned char *order, Flags flags,
324 Map_addr local_addr, L4::Cap<L4::Task> dst) const noexcept;
325
326public:
327 typedef L4::Typeid::Rpcs<map_t, clear_t, info_t, copy_in_t,
328 allocate_t, map_info_t> Rpcs;
329
330};
331
332}
333
L4::Cap related definitions.
Interface for memory-like objects.
Definition dataspace:64
long map_info(l4_addr_t *, l4_addr_t *)
Get mapping range of dataspace.
Definition dataspace:315
C++ interface for capabilities.
Definition capability.h:219
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:563
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:761
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
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:231
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 l4re.dox:17
L4 low-level kernel interface.
Definition io_regblock.h:19
L4Re Protocol Constants (C version)
Dataspace flags definitions.
Definition dataspace:69
Flags
Flags for map operations.
Definition dataspace:82
Information about the dataspace.
Definition dataspace:137
Standard list of RPCs of an interface.
Definition __typeinfo.h:439
Mixin class to define a set of friend bitwise operators on DT.
Definition types:232
#define L4_TYPES_FLAGS_OPS_DEF(T)
Helper macro to define a set of bitwise operators on an enum type.
Definition types:206