L4Re - L4 Runtime Environment
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 
37 namespace L4Re
38 {
39 
40  // MISSING:
41  // * size support in map, mapped size in reply
42 
59 class L4_EXPORT Dataspace :
60  public L4::Kobject_t<Dataspace, L4::Kobject, L4RE_PROTO_DATASPACE,
61  L4::Type_info::Demand_t<1> >
62 {
63 public:
64 
68  enum Map_flags
69  {
70  Map_ro = 0,
71  Map_rw = 1,
72 
73  Map_normal = 0x00,
74  Map_cacheable = Map_normal,
75  Map_bufferable = 0x10,
76  Map_uncacheable = 0x20,
77 
78  Map_caching_mask = 0x30,
79  Map_caching_shift = 4,
80  };
81 
85  struct Stats {
86  unsigned long size;
87  unsigned long flags;
88  };
89 
90 
113  long map(l4_addr_t offset, unsigned long flags, l4_addr_t local_addr,
114  l4_addr_t min_addr, l4_addr_t max_addr) const throw();
115 
131  long map_region(l4_addr_t offset, unsigned long flags,
132  l4_addr_t min_addr, l4_addr_t max_addr) const throw();
133 
151  L4_RPC(long, clear, (l4_addr_t offset, unsigned long size));
152 
172  L4_RPC(long, allocate, (l4_addr_t offset, l4_size_t size));
173 
191  L4_RPC(long, copy_in, (l4_addr_t dst_offs, L4::Ipc::Cap<Dataspace> src,
192  l4_addr_t src_offs, unsigned long size));
193 
194 
212  L4_RPC(long, phys, (l4_addr_t offset, l4_addr_t &phys_addr, l4_size_t &phys_size));
213 
219  unsigned long size() const throw();
220 
229  long flags() const throw();
230 
239  L4_RPC(long, info, (Stats *stats));
240 
250  L4_RPC(long, take, ());
251 
261  L4_RPC(long, release, ());
262 
263  L4_RPC_NF(long, map, (unsigned long offset, l4_addr_t spot,
264  unsigned long flags, L4::Ipc::Rcv_fpage r,
265  L4::Ipc::Snd_fpage &fp));
266 private:
267 
268  long __map(l4_addr_t offset, unsigned char *size, unsigned long flags,
269  l4_addr_t local_addr) const throw();
270 
271 public:
272  typedef L4::Typeid::Rpcs<map_t, clear_t, info_t, copy_in_t, take_t,
273  release_t, phys_t, allocate_t> Rpcs;
274 
275 };
276 
277 
278 }
279 
unsigned int l4_size_t
Unsigned size type.
Definition: l4int.h:35
Capability type for RPC interfaces (see L4::Cap<T>).
Definition: ipc_types:541
unsigned long size
size
Definition: dataspace:86
Standard list of RPCs of an interface.
Definition: __typeinfo.h:438
Common L4 ABI Data Types.
L4 low-level kernel interface.
Information about the dataspace.
Definition: dataspace:85
L4Re C++ Interfaces.
Definition: cmd_control:15
L4::Cap related definitions.
Interface for memory-like objects.
Definition: dataspace:59
unsigned long flags
flags
Definition: dataspace:87
Interface Definition Language.
Map_flags
Flags for map operations.
Definition: dataspace:68
Gen_fpage< Snd_item > Snd_fpage
Send flex-page.
Definition: ipc_types:477
Gen_fpage< Buf_item > Rcv_fpage
Rcv flex-page.
Definition: ipc_types:479
Helper class to create an L4Re interface class that is derived from a single base class...
Definition: __typeinfo.h:759
L4Re Protocol Constants (C version)
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
#define L4_RPC(res, name, args, attr...)
Define an RPC call (type and callable).
Definition: ipc_iface:517
#define L4_RPC_NF(res, name, args...)
Define an RPC call type (the type only, no callable).
Definition: ipc_iface:486