]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re_c/lib/src/dataspace.cc
update
[l4.git] / l4 / pkg / l4re_c / lib / src / dataspace.cc
1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *               Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  *
10  * As a special exception, you may use this file as part of a free software
11  * library without restriction.  Specifically, if other files instantiate
12  * templates or use macros or inline functions from this file, or you compile
13  * this file and link it with other files to produce an executable, this
14  * file does not by itself cause the resulting executable to be covered by
15  * the GNU General Public License.  This exception does not however
16  * invalidate any other reasons why the executable file might be covered by
17  * the GNU General Public License.
18  */
19
20 #include <l4/re/c/dataspace.h>
21
22 #include <l4/re/mem_alloc>
23 #include <l4/re/dataspace>
24 #include <l4/re/env>
25 #include <l4/sys/err.h>
26
27
28 int
29 l4re_ds_map(const l4re_ds_t ds, l4_addr_t offset, unsigned long flags,
30             l4_addr_t local_addr, l4_addr_t min_addr, l4_addr_t max_addr) L4_NOTHROW
31 {
32   L4::Cap<L4Re::Dataspace> x(ds);
33   return x->map(offset, flags, local_addr, min_addr, max_addr);
34 }
35
36 int
37 l4re_ds_map_region(const l4re_ds_t ds, l4_addr_t offset, unsigned long flags,
38                    l4_addr_t min_addr, l4_addr_t max_addr) L4_NOTHROW
39 {
40   L4::Cap<L4Re::Dataspace> x(ds);
41   return x->map_region(offset, flags, min_addr, max_addr);
42 }
43
44 long
45 l4re_ds_clear(const l4re_ds_t ds, l4_addr_t offset, unsigned long size) L4_NOTHROW
46 {
47   L4::Cap<L4Re::Dataspace> x(ds);
48   return x->clear(offset, size);
49 }
50
51 long
52 l4re_ds_allocate(const l4re_ds_t ds,
53                  l4_addr_t offset, l4_size_t size) L4_NOTHROW
54 {
55   L4::Cap<L4Re::Dataspace> x(ds);
56   return x->allocate(offset, size);
57 }
58
59 int
60 l4re_ds_copy_in(const l4re_ds_t ds, l4_addr_t dst_offs, const l4re_ds_t src,
61                 l4_addr_t src_offs, unsigned long size) L4_NOTHROW
62 {
63   L4::Cap<L4Re::Dataspace> x(ds);
64   L4::Cap<L4Re::Dataspace> srcds(src);
65   return x->copy_in(dst_offs, srcds, src_offs, size);
66 }
67
68
69 int
70 l4re_ds_phys(const l4re_ds_t ds, l4_addr_t offset,
71              l4_addr_t *phys_addr, l4_size_t *phys_size) L4_NOTHROW
72 {
73   L4::Cap<L4Re::Dataspace> x(ds);
74   return x->phys(offset, *phys_addr, *phys_size);
75 }
76
77 long
78 l4re_ds_size(const l4re_ds_t ds) L4_NOTHROW
79 {
80   L4::Cap<L4Re::Dataspace> x(ds);
81   return x->size();
82 }
83
84 int
85 l4re_ds_info(const l4re_ds_t ds, l4re_ds_stats_t *stats) L4_NOTHROW
86 {
87   L4::Cap<L4Re::Dataspace> x(ds);
88   return x->info((L4Re::Dataspace::Stats *)stats);
89 }
90
91 long
92 l4re_ds_flags(const l4re_ds_t ds) L4_NOTHROW
93 {
94   L4::Cap<L4Re::Dataspace> x(ds);
95   return x->flags();
96 }